diff --git a/.github/policies/pull-request-automation.json b/.github/policies/pull-request-automation.json new file mode 100644 index 0000000000..74003487a9 --- /dev/null +++ b/.github/policies/pull-request-automation.json @@ -0,0 +1,18 @@ +{ + "name": "pull-request-automation", + "enforcement": "active", + "conditions": { + "workflow_path": { + "include": [".github/workflows/pull-request-automation.yml"], + "exclude": [] + } + }, + "rules": [ + { + "type": "restrict_action_events", + "parameters": { + "allowed_events": ["pull_request_target"] + } + } + ] +} diff --git a/.github/workflows/pull-request-automation.yml b/.github/workflows/pull-request-automation.yml new file mode 100644 index 0000000000..8637a0d4be --- /dev/null +++ b/.github/workflows/pull-request-automation.yml @@ -0,0 +1,67 @@ +name: pull-request-automation + +on: + # zizmor: ignore[dangerous-triggers] + pull_request_target: + types: ["opened", "edited", "reopened", "ready_for_review", "synchronize", "closed"] + +permissions: {} + +jobs: + pull-request-size: + runs-on: ubuntu-24.04 + if: ${{ github.event.action != 'closed' }} + continue-on-error: true + permissions: + pull-requests: write + steps: + - uses: codelytv/pr-size-labeler@19c335e7695ba922de938806dd129f0a9b992644 # v1.12.0 + with: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + xs_label: 'size: XS' + xs_max_size: 50 + s_label: 'size: S' + s_max_size: 250 + m_label: 'size: M' + m_max_size: 500 + l_label: 'size: L' + l_max_size: 1000 + xl_label: 'size: XL' + fail_if_xl: false + files_to_ignore: 'composer.lock timezones.json nested_timezones.json' + message_if_xl: '' + + dependabot: + runs-on: ubuntu-24.04 + if: ${{ github.event.action != 'closed' && github.event.pull_request.user.login == 'dependabot[bot]' }} + permissions: + contents: write + pull-requests: write + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Enable auto-merge for Dependabot PRs + if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}} + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + pull-request-caches: + runs-on: ubuntu-24.04 + if: ${{ github.event.action == 'closed' }} + permissions: + actions: write + steps: + - name: "Delete the caches of the closed pull request" + env: + GH_TOKEN: ${{ github.token }} + REPOSITORY: ${{ github.repository }} + CACHE_REF: refs/pull/${{ github.event.pull_request.number }}/merge + run: | + for id in $(gh cache list --repo "$REPOSITORY" --ref "$CACHE_REF" --limit 1000 --json id --jq '.[].id'); do + gh cache delete "$id" --repo "$REPOSITORY" + done diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 3cbf118878..4dec2d7e0a 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -1,9 +1,8 @@ name: pull-request on: - # zizmor: ignore[dangerous-triggers] - pull_request_target: - types: ["opened", "edited", "reopened", "ready_for_review", "synchronize", "closed"] + pull_request: + types: ["opened", "edited", "reopened", "ready_for_review", "synchronize"] permissions: {} @@ -11,7 +10,6 @@ jobs: # Code borrowed from: https://github.com/carthage-software/mago/blob/main/.github/workflows/commit-authorship.yml check-commit-authorship: runs-on: ubuntu-24.04 - if: ${{ github.event.action != 'closed' }} permissions: pull-requests: read # See https://stackoverflow.com/a/72408109 @@ -70,7 +68,6 @@ jobs: pull-request-description: runs-on: ubuntu-24.04 - if: ${{ github.event.action != 'closed' }} permissions: contents: read steps: @@ -81,61 +78,3 @@ jobs: with: entrypoint: "/composer/vendor/bin/automation" args: "pull-request:description:check ${{ github.repository }} ${{ github.event.pull_request.number }} --skip-from=\"dependabot[bot]\"" - - pull-request-size: - runs-on: ubuntu-24.04 - if: ${{ github.event.action != 'closed' }} - continue-on-error: true - permissions: - pull-requests: write - steps: - - uses: codelytv/pr-size-labeler@19c335e7695ba922de938806dd129f0a9b992644 # v1.12.0 - with: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - xs_label: 'size: XS' - xs_max_size: 50 - s_label: 'size: S' - s_max_size: 250 - m_label: 'size: M' - m_max_size: 500 - l_label: 'size: L' - l_max_size: 1000 - xl_label: 'size: XL' - fail_if_xl: false - files_to_ignore: 'composer.lock timezones.json nested_timezones.json' - message_if_xl: '' - - dependabot: - runs-on: ubuntu-24.04 - if: ${{ github.event.action != 'closed' && github.event.pull_request.user.login == 'dependabot[bot]' }} - permissions: - contents: write - pull-requests: write - steps: - - name: Dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3 - with: - github-token: "${{ secrets.GITHUB_TOKEN }}" - - name: Enable auto-merge for Dependabot PRs - if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}} - run: gh pr merge --auto --merge "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - - pull-request-caches: - runs-on: ubuntu-24.04 - if: ${{ github.event.action == 'closed' }} - permissions: - actions: write - steps: - - name: "Delete the caches of the closed pull request" - env: - GH_TOKEN: ${{ github.token }} - REPOSITORY: ${{ github.repository }} - CACHE_REF: refs/pull/${{ github.event.pull_request.number }}/merge - run: | - for id in $(gh cache list --repo "$REPOSITORY" --ref "$CACHE_REF" --limit 1000 --json id --jq '.[].id'); do - gh cache delete "$id" --repo "$REPOSITORY" - done diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5bf54a2365..aa4ad634a4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -279,7 +279,7 @@ jobs: dependencies: - "locked" php-version: - - "8.3" + - "8.5" steps: - name: "Checkout" @@ -370,7 +370,7 @@ jobs: fail-fast: false matrix: php-version: - - "8.3" + - "8.5" steps: - name: "Checkout" @@ -433,7 +433,6 @@ jobs: DOMAIN: flow-php.com PLAYGROUND_API_URL: https://flow-php.com/api/playground/snippets PLAYGROUND_SNIPPETS_URL: https://playground-snippets.flow-php.com - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} FLOW_VERSION: ${{ steps.flow_version.outputs.tag }} working-directory: "web/landing" @@ -516,7 +515,7 @@ jobs: strategy: matrix: php-version: - - "8.3" + - "8.5" operating-system: - "ubuntu-24.04" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2a4f5f4000..ad9c43dc32 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,7 +68,7 @@ jobs: dependencies: - "locked" php-version: - - "8.3" + - "8.5" operating-system: - "ubuntu-24.04" @@ -165,11 +165,11 @@ jobs: strategy: fail-fast: false matrix: - # composer.lock is resolved on PHP 8.3, so only 8.3 installs it; a newer PHP resolves its own set + # composer.lock is resolved on PHP 8.5, so only 8.5 installs it; a newer PHP resolves its own set include: >- ${{ fromJSON(github.event_name == 'pull_request' - && '[{"php-version":"8.3","dependencies":"locked","coverage":true},{"php-version":"8.4","dependencies":"highest"},{"php-version":"8.5","dependencies":"highest"},{"php-version":"8.6","dependencies":"highest"}]' - || '[{"php-version":"8.3","dependencies":"locked","coverage":true},{"php-version":"8.3","dependencies":"lowest"},{"php-version":"8.4","dependencies":"lowest"},{"php-version":"8.5","dependencies":"lowest"},{"php-version":"8.6","dependencies":"lowest"}]') }} + && '[{"php-version":"8.5","dependencies":"locked","coverage":true},{"php-version":"8.6","dependencies":"highest"}]' + || '[{"php-version":"8.5","dependencies":"locked","coverage":true},{"php-version":"8.5","dependencies":"lowest"},{"php-version":"8.6","dependencies":"lowest"}]') }} steps: - name: "Checkout" @@ -320,7 +320,7 @@ jobs: # gRPC-exercising tests, isolated. grpc's EventEngine threads race PHP's extension # dlclose at process shutdown on PHP 8.5/amd64 (upstream grpc#38216, no released fix), - # so this step is allowed to fail ONLY on 8.5. A real grpc test regression on 8.3/8.4 + # so this step is allowed to fail ONLY on 8.5. A real grpc test regression on 8.6 # still fails CI. Remove continue-on-error once grpc ships a fix. - name: "Test (grpc)" timeout-minutes: 10 @@ -356,10 +356,11 @@ jobs: strategy: fail-fast: false matrix: - include: >- - ${{ fromJSON(github.event_name == 'pull_request' - && '[{"php-version":"8.3","dependencies":"locked"},{"php-version":"8.6","dependencies":"highest"}]' - || '[{"php-version":"8.3","dependencies":"locked"},{"php-version":"8.4","dependencies":"highest"},{"php-version":"8.5","dependencies":"highest"},{"php-version":"8.6","dependencies":"highest"}]') }} + include: + - php-version: "8.5" + dependencies: "locked" + - php-version: "8.6" + dependencies: "highest" steps: - name: "Checkout" @@ -375,7 +376,7 @@ jobs: uses: "./.github/actions/setup-php" with: php-version: "${{ matrix.php-version }}" - coverage: ${{ matrix.php-version == '8.3' && 'pcov' || 'none' }} + coverage: ${{ matrix.php-version == '8.5' && 'pcov' || 'none' }} extensions: ':psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib, brotli, lz4, zstd, snappy-https://github.com/kjdev/php-ext-snappy@0.2.1, :redis' ini-values: 'memory_limit=-1' tools: 'composer:v2' @@ -393,19 +394,19 @@ jobs: cache-key-suffix: "-extensions" - name: "Test Brotli" - run: "just test --group brotli-extension ${{ matrix.php-version == '8.3' && '--coverage-clover=./var/phpunit/coverage/clover/brotli.xml' || '' }}" + run: "just test --group brotli-extension ${{ matrix.php-version == '8.5' && '--coverage-clover=./var/phpunit/coverage/clover/brotli.xml' || '' }}" - name: "Test LZ4" - run: "just test --group lz4-extension ${{ matrix.php-version == '8.3' && '--coverage-clover=./var/phpunit/coverage/clover/lz4.xml' || '' }}" + run: "just test --group lz4-extension ${{ matrix.php-version == '8.5' && '--coverage-clover=./var/phpunit/coverage/clover/lz4.xml' || '' }}" - name: "Test ZSTD" - run: "just test --group zstd-extension ${{ matrix.php-version == '8.3' && '--coverage-clover=./var/phpunit/coverage/clover/zstd.xml' || '' }}" + run: "just test --group zstd-extension ${{ matrix.php-version == '8.5' && '--coverage-clover=./var/phpunit/coverage/clover/zstd.xml' || '' }}" - name: "Test Snappy" - run: "just test --group snappy-extension ${{ matrix.php-version == '8.3' && '--coverage-clover=./var/phpunit/coverage/clover/snappy.xml' || '' }}" + run: "just test --group snappy-extension ${{ matrix.php-version == '8.5' && '--coverage-clover=./var/phpunit/coverage/clover/snappy.xml' || '' }}" - name: Upload to Codecov - if: ${{ !cancelled() && matrix.php-version == '8.3' }} + if: ${{ !cancelled() && matrix.php-version == '8.5' }} uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: use_oidc: true @@ -433,10 +434,13 @@ jobs: strategy: fail-fast: false matrix: - include: >- - ${{ fromJSON(github.event_name == 'pull_request' - && '[{"phpunit-version":"11","php-version":"8.3","dependencies":"locked"},{"phpunit-version":"13","php-version":"8.5","dependencies":"highest"},{"phpunit-version":"13","php-version":"8.6","dependencies":"highest"}]' - || '[{"phpunit-version":"11","php-version":"8.3","dependencies":"locked"},{"phpunit-version":"12","php-version":"8.4","dependencies":"highest"},{"phpunit-version":"13","php-version":"8.5","dependencies":"highest"},{"phpunit-version":"13","php-version":"8.6","dependencies":"highest"}]') }} + include: + - phpunit-version: "11" + php-version: "8.5" + dependencies: "locked" + - phpunit-version: "13" + php-version: "8.6" + dependencies: "highest" steps: &telemetry-test-steps - name: "Checkout" @@ -448,7 +452,7 @@ jobs: uses: "./.github/actions/setup-php" with: php-version: "${{ matrix.php-version }}" - coverage: ${{ matrix.php-version == '8.3' && 'pcov' || 'none' }} + coverage: ${{ matrix.php-version == '8.5' && 'pcov' || 'none' }} extensions: ':psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib, curl, pgsql, grpc, protobuf, :redis' ini-values: 'memory_limit=-1' tools: 'composer:v2' @@ -484,12 +488,12 @@ jobs: run: tools/phpunit/vendor/bin/phpunit --version - name: "Test" - run: just test --testsuite bridge-phpunit-postgresql-unit,bridge-phpunit-postgresql-integration,bridge-phpunit-telemetry-unit ${{ matrix.php-version == '8.3' && '--coverage-clover=./var/phpunit/coverage/clover/coverage.xml' || '' }} + run: just test --testsuite bridge-phpunit-postgresql-unit,bridge-phpunit-postgresql-integration,bridge-phpunit-telemetry-unit ${{ matrix.php-version == '8.5' && '--coverage-clover=./var/phpunit/coverage/clover/coverage.xml' || '' }} env: PGSQL_DATABASE_URL: pgsql://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports['5432'] }}/postgres?serverVersion=18&charset=utf8 - name: Upload to Codecov - if: ${{ !cancelled() && matrix.php-version == '8.3' && matrix.phpunit-version == '11' }} + if: ${{ !cancelled() && matrix.php-version == '8.5' && matrix.phpunit-version == '11' }} uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: use_oidc: true @@ -508,20 +512,10 @@ jobs: strategy: fail-fast: false matrix: - # PHPUnit 13 requires PHP >= 8.4.1, so 13 x 8.3 is not in the list include: - - phpunit-version: "11" - php-version: "8.4" - dependencies: "highest" - - phpunit-version: "11" - php-version: "8.5" - dependencies: "highest" - phpunit-version: "11" php-version: "8.6" dependencies: "highest" - - phpunit-version: "12" - php-version: "8.3" - dependencies: "locked" - phpunit-version: "12" php-version: "8.5" dependencies: "highest" @@ -529,7 +523,7 @@ jobs: php-version: "8.6" dependencies: "highest" - phpunit-version: "13" - php-version: "8.4" + php-version: "8.5" dependencies: "highest" steps: *telemetry-test-steps @@ -544,7 +538,7 @@ jobs: dependencies: - "locked" php-version: - - "8.3" + - "8.5" operating-system: - "blacksmith-8vcpu-ubuntu-2404" @@ -609,7 +603,7 @@ jobs: fail-fast: false matrix: include: - - php: '8.3' + - php: '8.5' ts: nts dependencies: locked - php: '8.6' @@ -631,7 +625,7 @@ jobs: extensions: ':psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib, zstd, :redis' ini-values: 'memory_limit=-1' tools: 'composer:v2, php-config' - coverage: ${{ (matrix.php == '8.3' && matrix.ts == 'nts') && 'pcov' || 'none' }} + coverage: ${{ (matrix.php == '8.5' && matrix.ts == 'nts') && 'pcov' || 'none' }} - name: Install just uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4 @@ -716,7 +710,7 @@ jobs: path: src/extension/flow-php-ext/ext/modules/flow_php.so - name: Run ETL Unit Tests with Flow PHP Extension - run: just test --testsuite=etl-unit ${{ (matrix.php == '8.3' && matrix.ts == 'nts') && '--coverage-clover=./var/phpunit/coverage/clover/coverage.xml' || '' }} + run: just test --testsuite=etl-unit ${{ (matrix.php == '8.5' && matrix.ts == 'nts') && '--coverage-clover=./var/phpunit/coverage/clover/coverage.xml' || '' }} - name: Run ETL Integration Tests with Flow PHP Extension run: just test --testsuite=etl-integration @@ -746,7 +740,7 @@ jobs: run: just test --testsuite=adapter-parquet-integration - name: Upload to Codecov - if: ${{ !cancelled() && matrix.php == '8.3' && matrix.ts == 'nts' }} + if: ${{ !cancelled() && matrix.php == '8.5' && matrix.ts == 'nts' }} uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: use_oidc: true @@ -763,20 +757,16 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.3', '8.4', '8.5', '8.6'] + php: ['8.5', '8.6'] ts: ['nts', 'zts'] exclude: - - php: '8.3' + - php: '8.5' ts: nts - php: '8.6' ts: zts include: - - php: '8.3' - dependencies: locked - - php: '8.4' - dependencies: highest - php: '8.5' - dependencies: highest + dependencies: locked - php: '8.6' dependencies: highest @@ -799,7 +789,7 @@ jobs: - name: Setup PHP uses: ./.github/actions/setup-php with: - php-version: '8.3' + php-version: '8.5' extensions: ':psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib, :redis' ini-values: 'memory_limit=-1' tools: 'composer:v2, phpize, php-config' @@ -807,7 +797,7 @@ jobs: - name: Install Composer Dependencies uses: ./.github/actions/composer-install with: - php-version: '8.3' + php-version: '8.5' dependencies: locked - name: Setup Rust extension toolchain @@ -878,7 +868,7 @@ jobs: fail-fast: false matrix: include: - - php: '8.3' + - php: '8.5' ts: nts dependencies: locked - php: '8.6' @@ -900,7 +890,7 @@ jobs: extensions: ':psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib, zstd, :redis' ini-values: 'memory_limit=-1' tools: 'composer:v2, php-config' - coverage: ${{ (matrix.php == '8.3' && matrix.ts == 'nts') && 'pcov' || 'none' }} + coverage: ${{ (matrix.php == '8.5' && matrix.ts == 'nts') && 'pcov' || 'none' }} - name: Install just uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4 @@ -973,7 +963,7 @@ jobs: path: src/extension/arrow-ext/ext/modules/arrow.so - name: Run Parquet Integration Tests with Arrow - run: just test --testsuite=lib-parquet-integration ${{ (matrix.php == '8.3' && matrix.ts == 'nts') && '--coverage-clover=./var/phpunit/coverage/clover/coverage.xml' || '' }} + run: just test --testsuite=lib-parquet-integration ${{ (matrix.php == '8.5' && matrix.ts == 'nts') && '--coverage-clover=./var/phpunit/coverage/clover/coverage.xml' || '' }} - name: Run Parquet Adapter Unit Tests with Arrow run: just test --testsuite=adapter-parquet-unit @@ -982,7 +972,7 @@ jobs: run: just test --testsuite=adapter-parquet-integration - name: Upload to Codecov - if: ${{ !cancelled() && matrix.php == '8.3' && matrix.ts == 'nts' }} + if: ${{ !cancelled() && matrix.php == '8.5' && matrix.ts == 'nts' }} uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: use_oidc: true @@ -999,20 +989,16 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.3', '8.4', '8.5', '8.6'] + php: ['8.5', '8.6'] ts: ['nts', 'zts'] exclude: - - php: '8.3' + - php: '8.5' ts: nts - php: '8.6' ts: zts include: - - php: '8.3' - dependencies: locked - - php: '8.4' - dependencies: highest - php: '8.5' - dependencies: highest + dependencies: locked - php: '8.6' dependencies: highest @@ -1035,7 +1021,7 @@ jobs: - name: Setup PHP uses: ./.github/actions/setup-php with: - php-version: '8.3' + php-version: '8.5' extensions: ':psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib, :redis' ini-values: 'memory_limit=-1' tools: 'composer:v2, phpize, php-config' @@ -1043,7 +1029,7 @@ jobs: - name: Install Composer Dependencies uses: ./.github/actions/composer-install with: - php-version: '8.3' + php-version: '8.5' dependencies: locked - name: Setup Rust extension toolchain @@ -1107,7 +1093,7 @@ jobs: fail-fast: false matrix: include: - - php: '8.3' + - php: '8.5' ts: nts dependencies: locked - php: '8.6' @@ -1176,20 +1162,16 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.3', '8.4', '8.5', '8.6'] + php: ['8.5', '8.6'] ts: ['nts', 'zts'] exclude: - - php: '8.3' + - php: '8.5' ts: nts - php: '8.6' ts: zts include: - - php: '8.3' - dependencies: locked - - php: '8.4' - dependencies: highest - php: '8.5' - dependencies: highest + dependencies: locked - php: '8.6' dependencies: highest @@ -1210,7 +1192,7 @@ jobs: - name: Setup PHP uses: ./.github/actions/setup-php with: - php-version: '8.3' + php-version: '8.5' extensions: ':psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib, :redis' ini-values: 'memory_limit=-1' tools: 'composer:v2, phpize, php-config' @@ -1218,7 +1200,7 @@ jobs: - name: Install Composer Dependencies uses: ./.github/actions/composer-install with: - php-version: '8.3' + php-version: '8.5' dependencies: locked - name: Install build dependencies (Ubuntu) @@ -1285,7 +1267,7 @@ jobs: - name: "Setup PHP" uses: "./.github/actions/setup-php" with: - php-version: "8.3" + php-version: "8.5" coverage: "none" extensions: ':psr, bcmath, dom, hash, json, mbstring, xml, xmlwriter, xmlreader, zlib, :redis' ini-values: 'memory_limit=-1' @@ -1299,7 +1281,7 @@ jobs: - name: "Install Composer dependencies" uses: "./.github/actions/composer-install" with: - php-version: "8.3" + php-version: "8.5" dependencies: "locked" cache-key-suffix: "-locked-phar" @@ -1337,7 +1319,7 @@ jobs: - name: "Setup PHP" uses: "./.github/actions/setup-php" with: - php-version: "8.3" + php-version: "8.5" coverage: "none" extensions: ':psr, bcmath, curl, dom, hash, json, mbstring, pdo_sqlite, xml, xmlwriter, xmlreader, zip, zlib, :redis' ini-values: 'memory_limit=-1' @@ -1351,14 +1333,14 @@ jobs: - name: "Install Composer dependencies" uses: "./.github/actions/composer-install" with: - php-version: "8.3" + php-version: "8.5" dependencies: "locked" cache-key-suffix: "-locked" - name: "Install website Composer dependencies" uses: "./.github/actions/composer-install" with: - php-version: "8.3" + php-version: "8.5" dependencies: "locked" working-directory: "web/landing" cache-key-suffix: "-website" @@ -1386,7 +1368,7 @@ jobs: fail-fast: false matrix: php-version: - - "8.3" + - "8.5" operating-system: - "ubuntu-24.04" @@ -1514,7 +1496,7 @@ jobs: - name: "Setup PHP" uses: "./.github/actions/setup-php" with: - php-version: "8.3" + php-version: "8.5" coverage: "none" extensions: ':psr, bcmath, curl, dom, hash, json, mbstring, pdo_sqlite, xml, xmlwriter, xmlreader, zip, zlib, :redis' ini-values: 'memory_limit=-1' @@ -1528,14 +1510,14 @@ jobs: - name: "Install Composer dependencies" uses: "./.github/actions/composer-install" with: - php-version: "8.3" + php-version: "8.5" dependencies: "locked" cache-key-suffix: "-locked" - name: "Install website Composer dependencies" uses: "./.github/actions/composer-install" with: - php-version: "8.3" + php-version: "8.5" dependencies: "locked" working-directory: "web/landing" cache-key-suffix: "-website" diff --git a/README.md b/README.md index bedec34bc3..d57073b874 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Flow is a PHP-based, strongly typed data processing framework with a low memory - Discord [Discord Server](https://discord.gg/5dNXfQyACW) Supported PHP -versions: [![PHP 8.3](https://img.shields.io/badge/php-~8.3-8892BF.svg)](https://php.net/) [![PHP 8.4](https://img.shields.io/badge/php-~8.4-8892BF.svg)](https://php.net/) [![PHP 8.5](https://img.shields.io/badge/php-~8.5-8892BF.svg)](https://php.net/) [![PHP 8.6](https://img.shields.io/badge/php-~8.6-8892BF.svg)](https://php.net/) +versions: [![PHP 8.5](https://img.shields.io/badge/php-~8.5-8892BF.svg)](https://php.net/) [![PHP 8.6](https://img.shields.io/badge/php-~8.6-8892BF.svg)](https://php.net/) Supported Operating Systems diff --git a/benchmarks/src/Datasets/DigestCache.php b/benchmarks/src/Datasets/DigestCache.php index 9e0ef0d73d..9a95e7671d 100644 --- a/benchmarks/src/Datasets/DigestCache.php +++ b/benchmarks/src/Datasets/DigestCache.php @@ -19,6 +19,6 @@ public static function clear(): void public static function tree(string $relativeTree): string { - return self::$digests[$relativeTree] ??= (new SourceTreeDigest($relativeTree))->value(); + return self::$digests[$relativeTree] ??= new SourceTreeDigest($relativeTree)->value(); } } diff --git a/benchmarks/src/Datasets/FixturePath.php b/benchmarks/src/Datasets/FixturePath.php index d57a6f826c..0b46313f70 100644 --- a/benchmarks/src/Datasets/FixturePath.php +++ b/benchmarks/src/Datasets/FixturePath.php @@ -33,7 +33,7 @@ public function path(): string . '_' . $this->rows . '.' - . (new FixtureFingerprint($this->format))->value() + . new FixtureFingerprint($this->format)->value() . '.' . $this->format->extension() ); diff --git a/benchmarks/src/Datasets/SellersDataset.php b/benchmarks/src/Datasets/SellersDataset.php index 02e46047a2..610ab291e6 100644 --- a/benchmarks/src/Datasets/SellersDataset.php +++ b/benchmarks/src/Datasets/SellersDataset.php @@ -27,7 +27,7 @@ public function parquet(): string $fixture->prune(); - $ordersPath = (new OrdersDataset($this->rows))->parquet(); + $ordersPath = new OrdersDataset($this->rows)->parquet(); $sellerIds = []; foreach (data_frame()->read(from_parquet($ordersPath)->withColumns(['seller_id']))->get() as $batch) { diff --git a/benchmarks/src/Datasets/TextDataset.php b/benchmarks/src/Datasets/TextDataset.php index a6ad0fbb97..2a50284dab 100644 --- a/benchmarks/src/Datasets/TextDataset.php +++ b/benchmarks/src/Datasets/TextDataset.php @@ -27,7 +27,7 @@ public function path(): string $fixture->prune(); - $parquetPath = (new OrdersDataset($this->rows))->parquet(); + $parquetPath = new OrdersDataset($this->rows)->parquet(); $lines = []; foreach (data_frame()->read(from_parquet($parquetPath)->withColumns(['customer', 'notes']))->get() as $batch) { diff --git a/benchmarks/src/Partitioning/PartitionedTree.php b/benchmarks/src/Partitioning/PartitionedTree.php index dda5fab074..5665e6d9c3 100644 --- a/benchmarks/src/Partitioning/PartitionedTree.php +++ b/benchmarks/src/Partitioning/PartitionedTree.php @@ -43,11 +43,10 @@ public static function of(PartitionCardinality $cardinality, int $rows): self return self::$trees[$key]; } - $root = - Paths::datasets() . '/partitioned_' . $key . '.' . (new FixtureFingerprint(FixtureFormat::csv))->value(); + $root = Paths::datasets() . '/partitioned_' . $key . '.' . new FixtureFingerprint(FixtureFormat::csv)->value(); if (!is_dir($root)) { - (new PartitionedOrders($cardinality, $rows))->writeTo($root); + new PartitionedOrders($cardinality, $rows)->writeTo($root); } $directories = glob($root . '/*') ?: []; diff --git a/benchmarks/src/Partitioning/PartitionedWriteScenario.php b/benchmarks/src/Partitioning/PartitionedWriteScenario.php index 197ef7d59e..1627dbb6e6 100644 --- a/benchmarks/src/Partitioning/PartitionedWriteScenario.php +++ b/benchmarks/src/Partitioning/PartitionedWriteScenario.php @@ -19,7 +19,7 @@ public function run(): string { $root = Paths::var() . '/partition_write_' . $this->cardinality->value . '_' . uniqid('', true); - (new PartitionedOrders($this->cardinality, $this->rows))->writeTo($root); + new PartitionedOrders($this->cardinality, $this->rows)->writeTo($root); return $root; } diff --git a/benchmarks/src/Pipeline/ColumnMixScenario.php b/benchmarks/src/Pipeline/ColumnMixScenario.php index 9c5a2932be..0c099917d5 100644 --- a/benchmarks/src/Pipeline/ColumnMixScenario.php +++ b/benchmarks/src/Pipeline/ColumnMixScenario.php @@ -27,7 +27,7 @@ public function columns(): array public function run(): void { data_frame(BenchmarkConfig::builder()) - ->read((new SourceExtractor($this->source, SchemaMode::declared, $this->rows))->extractor()) + ->read(new SourceExtractor($this->source, SchemaMode::declared, $this->rows)->extractor()) ->select(...$this->columns()) ->run(); } diff --git a/benchmarks/src/Pipeline/FetchScenario.php b/benchmarks/src/Pipeline/FetchScenario.php index 3f7ddecacd..8c149ef6eb 100644 --- a/benchmarks/src/Pipeline/FetchScenario.php +++ b/benchmarks/src/Pipeline/FetchScenario.php @@ -19,7 +19,7 @@ public function __construct( public function run(): Rows { return data_frame(BenchmarkConfig::builder()) - ->read((new SourceExtractor($this->source, SchemaMode::declared, $this->rows))->extractor()) + ->read(new SourceExtractor($this->source, SchemaMode::declared, $this->rows)->extractor()) ->select('order_id', 'customer') ->fetch(); } diff --git a/benchmarks/src/Pipeline/LimitPushdownScenario.php b/benchmarks/src/Pipeline/LimitPushdownScenario.php index 5a69632cd3..f181ab32f2 100644 --- a/benchmarks/src/Pipeline/LimitPushdownScenario.php +++ b/benchmarks/src/Pipeline/LimitPushdownScenario.php @@ -27,7 +27,7 @@ public function limit(): ?int public function run(): void { data_frame(BenchmarkConfig::builder()) - ->read((new SourceExtractor($this->source, SchemaMode::declared, $this->rows))->extractor()) + ->read(new SourceExtractor($this->source, SchemaMode::declared, $this->rows)->extractor()) ->select('order_id', 'seller_id', 'created_at', 'customer', 'email') ->limit($this->limit) ->run(); diff --git a/benchmarks/src/Pipeline/PipelineScenario.php b/benchmarks/src/Pipeline/PipelineScenario.php index 222c0bd56a..ee60ee02b8 100644 --- a/benchmarks/src/Pipeline/PipelineScenario.php +++ b/benchmarks/src/Pipeline/PipelineScenario.php @@ -14,9 +14,9 @@ public function __construct( public function run(): void { - (new CanonicalPipeline( - (new SourceExtractor($this->source, $this->mode, $this->rows))->extractor(), + new CanonicalPipeline( + new SourceExtractor($this->source, $this->mode, $this->rows)->extractor(), $this->source->value, - ))->run(); + )->run(); } } diff --git a/benchmarks/src/Pipeline/PipelineWidthScenario.php b/benchmarks/src/Pipeline/PipelineWidthScenario.php index 982c97fb54..96ed8d2812 100644 --- a/benchmarks/src/Pipeline/PipelineWidthScenario.php +++ b/benchmarks/src/Pipeline/PipelineWidthScenario.php @@ -45,7 +45,7 @@ public function columns(): array public function run(): void { data_frame(BenchmarkConfig::builder()) - ->read((new SourceExtractor($this->source, SchemaMode::declared, $this->rows))->extractor()) + ->read(new SourceExtractor($this->source, SchemaMode::declared, $this->rows)->extractor()) ->select(...$this->columns()) ->run(); } diff --git a/benchmarks/src/Pipeline/PlanDepthScenario.php b/benchmarks/src/Pipeline/PlanDepthScenario.php index 3fb231586a..fb89691e12 100644 --- a/benchmarks/src/Pipeline/PlanDepthScenario.php +++ b/benchmarks/src/Pipeline/PlanDepthScenario.php @@ -27,7 +27,7 @@ public function __construct( public function bind(): Schema { $frame = data_frame(BenchmarkConfig::builder()) - ->read((new SourceExtractor($this->source, SchemaMode::declared, $this->rows))->extractor()); + ->read(new SourceExtractor($this->source, SchemaMode::declared, $this->rows)->extractor()); for ($step = 0; $step < $this->depth; $step++) { $frame = $frame->withColumn('c' . $step, ref('customer')->concat(lit((string) $step))); diff --git a/benchmarks/src/Pipeline/ReadScenario.php b/benchmarks/src/Pipeline/ReadScenario.php index 582b4c4629..ffdb6134e4 100644 --- a/benchmarks/src/Pipeline/ReadScenario.php +++ b/benchmarks/src/Pipeline/ReadScenario.php @@ -21,7 +21,7 @@ public function __construct( public function extractor(): Extractor { - return (new SourceExtractor($this->source, SchemaMode::declared, $this->rows))->extractor(); + return new SourceExtractor($this->source, SchemaMode::declared, $this->rows)->extractor(); } public function run(): void diff --git a/benchmarks/src/Pipeline/SourceFixture.php b/benchmarks/src/Pipeline/SourceFixture.php index 0bfe4c0200..17d8ecf4bd 100644 --- a/benchmarks/src/Pipeline/SourceFixture.php +++ b/benchmarks/src/Pipeline/SourceFixture.php @@ -17,6 +17,6 @@ public function __construct( public function warm(): void { - (new SourceExtractor($this->source, SchemaMode::declared, $this->rows))->extractor(); + new SourceExtractor($this->source, SchemaMode::declared, $this->rows)->extractor(); } } diff --git a/benchmarks/src/Pipeline/StageScenario.php b/benchmarks/src/Pipeline/StageScenario.php index 673ae9231e..9365450ca9 100644 --- a/benchmarks/src/Pipeline/StageScenario.php +++ b/benchmarks/src/Pipeline/StageScenario.php @@ -25,7 +25,7 @@ public function __construct( public function run(): void { $frame = data_frame(BenchmarkConfig::builder()) - ->read((new SourceExtractor($this->source, SchemaMode::declared, $this->rows))->extractor()) + ->read(new SourceExtractor($this->source, SchemaMode::declared, $this->rows)->extractor()) ->select('order_id', 'seller_id', 'created_at', 'customer', 'email'); match ($this->stage) { diff --git a/benchmarks/src/Service/Doctrine/DoctrineConnection.php b/benchmarks/src/Service/Doctrine/DoctrineConnection.php index be523853f7..ad7ee078f1 100644 --- a/benchmarks/src/Service/Doctrine/DoctrineConnection.php +++ b/benchmarks/src/Service/Doctrine/DoctrineConnection.php @@ -22,7 +22,7 @@ public static function open(): Connection $dsn = Services::pgsqlDsn(); try { - $connection = DriverManager::getConnection((new DsnParser(['postgresql' => 'pdo_pgsql']))->parse($dsn)); + $connection = DriverManager::getConnection(new DsnParser(['postgresql' => 'pdo_pgsql'])->parse($dsn)); $connection->executeQuery('SELECT 1'); return $connection; @@ -44,7 +44,7 @@ public static function open(): Connection */ public static function createTable(Connection $connection, string $table, bool $keyed = false): void { - $definition = to_dbal_schema_table((new FakeRandomOrdersExtractor())->schema(), $table); + $definition = to_dbal_schema_table(new FakeRandomOrdersExtractor()->schema(), $table); if ($keyed) { $definition = $definition diff --git a/benchmarks/src/Service/Doctrine/DoctrinePipelineScenario.php b/benchmarks/src/Service/Doctrine/DoctrinePipelineScenario.php index 45142c21f8..6083dc407e 100644 --- a/benchmarks/src/Service/Doctrine/DoctrinePipelineScenario.php +++ b/benchmarks/src/Service/Doctrine/DoctrinePipelineScenario.php @@ -49,7 +49,7 @@ public function run(): void { $connection = DoctrineConnection::open(); - (new CanonicalPipeline( + new CanonicalPipeline( from_dbal_key_set_qb( $connection, $connection->createQueryBuilder()->select('*')->from($this->table()), @@ -58,7 +58,7 @@ public function run(): void ->withBatchSize(1000) ->withSchema(OrdersSchema::ofService(ServiceSource::doctrine)), 'doctrine', - ))->run(); + )->run(); $connection->close(); } diff --git a/benchmarks/src/Service/Postgresql/PostgresqlConnection.php b/benchmarks/src/Service/Postgresql/PostgresqlConnection.php index 968d7875e9..5125c35689 100644 --- a/benchmarks/src/Service/Postgresql/PostgresqlConnection.php +++ b/benchmarks/src/Service/Postgresql/PostgresqlConnection.php @@ -49,7 +49,7 @@ public static function open(): Client */ public static function createTable(Client $client, string $table, bool $keyed = false): void { - foreach (to_pgsql_schema_table((new FakeRandomOrdersExtractor())->schema(), $table)->toSql() as $sql) { + foreach (to_pgsql_schema_table(new FakeRandomOrdersExtractor()->schema(), $table)->toSql() as $sql) { $client->execute($sql); } diff --git a/benchmarks/src/Service/Postgresql/PostgresqlPipelineScenario.php b/benchmarks/src/Service/Postgresql/PostgresqlPipelineScenario.php index 155d9d6d64..bb9019ce9b 100644 --- a/benchmarks/src/Service/Postgresql/PostgresqlPipelineScenario.php +++ b/benchmarks/src/Service/Postgresql/PostgresqlPipelineScenario.php @@ -54,7 +54,7 @@ public function run(): void { $client = PostgresqlConnection::open(); - (new CanonicalPipeline( + new CanonicalPipeline( from_pgsql_key_set( $client, select(star())->from(table($this->table()))->orderBy(asc(col('order_id'))), @@ -63,7 +63,7 @@ public function run(): void ->withBatchSize(1000) ->withSchema(OrdersSchema::ofService(ServiceSource::postgresql)), 'postgresql', - ))->run(); + )->run(); $client->close(); } diff --git a/benchmarks/src/Service/Seal/SealWriteScenario.php b/benchmarks/src/Service/Seal/SealWriteScenario.php index 1e48e8f223..e131395a57 100644 --- a/benchmarks/src/Service/Seal/SealWriteScenario.php +++ b/benchmarks/src/Service/Seal/SealWriteScenario.php @@ -49,6 +49,6 @@ public function dropIndex(): void private function schema(): SealSchema { - return to_seal_schema((new FakeRandomOrdersExtractor())->schema(), $this->index(), 'order_id'); + return to_seal_schema(new FakeRandomOrdersExtractor()->schema(), $this->index(), 'order_id'); } } diff --git a/benchmarks/suites/Caching/CacheBench.php b/benchmarks/suites/Caching/CacheBench.php index 2f007ce875..539954383a 100644 --- a/benchmarks/suites/Caching/CacheBench.php +++ b/benchmarks/suites/Caching/CacheBench.php @@ -21,12 +21,12 @@ public function warm(array $params): void #[Bench\Groups(['caching'])] public function bench_cache_write(array $params): void { - (new CacheWriteScenario((int) $params['rows']))->run(); + new CacheWriteScenario((int) $params['rows'])->run(); } public function warmCacheRead(array $params): void { - (new CacheReadScenario((int) $params['rows']))->warm(); + new CacheReadScenario((int) $params['rows'])->warm(); } #[Bench\ParamProviders('rows')] @@ -34,7 +34,7 @@ public function warmCacheRead(array $params): void #[Bench\BeforeMethods('warmCacheRead')] public function bench_cache_read(array $params): void { - (new CacheReadScenario((int) $params['rows']))->run(); + new CacheReadScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Filtering/FilterOrdersBench.php b/benchmarks/suites/Filtering/FilterOrdersBench.php index 5ddaaf9990..e1d284fda2 100644 --- a/benchmarks/suites/Filtering/FilterOrdersBench.php +++ b/benchmarks/suites/Filtering/FilterOrdersBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void #[Bench\Groups(['filtering'])] public function bench_filter_orders(array $params): void { - (new FilterOrdersScenario((int) $params['rows']))->run(); + new FilterOrdersScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Csv/CsvReadBench.php b/benchmarks/suites/Format/Csv/CsvReadBench.php index 9144b6adb1..77e041c3d5 100644 --- a/benchmarks/suites/Format/Csv/CsvReadBench.php +++ b/benchmarks/suites/Format/Csv/CsvReadBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void #[Bench\Groups(['format', 'format-csv'])] public function bench_csv_read(array $params): void { - (new CsvReadScenario((int) $params['rows']))->run(); + new CsvReadScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Csv/CsvWriteBench.php b/benchmarks/suites/Format/Csv/CsvWriteBench.php index 659e857a49..481585751a 100644 --- a/benchmarks/suites/Format/Csv/CsvWriteBench.php +++ b/benchmarks/suites/Format/Csv/CsvWriteBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void #[Bench\Groups(['format', 'format-csv'])] public function bench_csv_write(array $params): void { - (new CsvWriteScenario((int) $params['rows']))->run(); + new CsvWriteScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Excel/ExcelReadBench.php b/benchmarks/suites/Format/Excel/ExcelReadBench.php index 4bf274f4d4..7f46332fb9 100644 --- a/benchmarks/suites/Format/Excel/ExcelReadBench.php +++ b/benchmarks/suites/Format/Excel/ExcelReadBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void #[Bench\Groups(['format', 'format-excel'])] public function bench_excel_read(array $params): void { - (new ExcelReadScenario((int) $params['rows']))->run(); + new ExcelReadScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Excel/ExcelWriteBench.php b/benchmarks/suites/Format/Excel/ExcelWriteBench.php index e64be8603e..caed18a541 100644 --- a/benchmarks/suites/Format/Excel/ExcelWriteBench.php +++ b/benchmarks/suites/Format/Excel/ExcelWriteBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void #[Bench\Groups(['format', 'format-excel'])] public function bench_excel_write(array $params): void { - (new ExcelWriteScenario((int) $params['rows']))->run(); + new ExcelWriteScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Floe/FloeReadBench.php b/benchmarks/suites/Format/Floe/FloeReadBench.php index 2fc3753998..3a9c42f98e 100644 --- a/benchmarks/suites/Format/Floe/FloeReadBench.php +++ b/benchmarks/suites/Format/Floe/FloeReadBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void #[Bench\Groups(['format', 'format-floe'])] public function bench_floe_read(array $params): void { - (new FloeReadScenario((int) $params['rows']))->run(); + new FloeReadScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Floe/FloeWriteBench.php b/benchmarks/suites/Format/Floe/FloeWriteBench.php index aaada5f55b..374d7ffeb2 100644 --- a/benchmarks/suites/Format/Floe/FloeWriteBench.php +++ b/benchmarks/suites/Format/Floe/FloeWriteBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void #[Bench\Groups(['format', 'format-floe'])] public function bench_floe_write(array $params): void { - (new FloeWriteScenario((int) $params['rows']))->run(); + new FloeWriteScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Json/JsonReadBench.php b/benchmarks/suites/Format/Json/JsonReadBench.php index 9b8cae6b52..bbc001b648 100644 --- a/benchmarks/suites/Format/Json/JsonReadBench.php +++ b/benchmarks/suites/Format/Json/JsonReadBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void #[Bench\Groups(['format', 'format-json'])] public function bench_json_read(array $params): void { - (new JsonReadScenario((int) $params['rows']))->run(); + new JsonReadScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Json/JsonWriteBench.php b/benchmarks/suites/Format/Json/JsonWriteBench.php index 0097fea3d9..ad66f7b282 100644 --- a/benchmarks/suites/Format/Json/JsonWriteBench.php +++ b/benchmarks/suites/Format/Json/JsonWriteBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void #[Bench\Groups(['format', 'format-json'])] public function bench_json_write(array $params): void { - (new JsonWriteScenario((int) $params['rows']))->run(); + new JsonWriteScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Parquet/ParquetReadBench.php b/benchmarks/suites/Format/Parquet/ParquetReadBench.php index 366d7fa6ee..acac1180a6 100644 --- a/benchmarks/suites/Format/Parquet/ParquetReadBench.php +++ b/benchmarks/suites/Format/Parquet/ParquetReadBench.php @@ -27,7 +27,7 @@ public function bench_parquet_read(array $params): void { $engine = $params['engine'] === RustParquetEngine::class ? new RustParquetEngine() : new PhpParquetEngine(); - (new ParquetReadScenario((int) $params['rows'], $engine))->run(); + new ParquetReadScenario((int) $params['rows'], $engine)->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Parquet/ParquetWriteBench.php b/benchmarks/suites/Format/Parquet/ParquetWriteBench.php index 0abe5acc71..8895c8cdb8 100644 --- a/benchmarks/suites/Format/Parquet/ParquetWriteBench.php +++ b/benchmarks/suites/Format/Parquet/ParquetWriteBench.php @@ -27,7 +27,7 @@ public function bench_parquet_write(array $params): void { $engine = $params['engine'] === RustParquetEngine::class ? new RustParquetEngine() : new PhpParquetEngine(); - (new ParquetWriteScenario((int) $params['rows'], $engine))->run(); + new ParquetWriteScenario((int) $params['rows'], $engine)->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Text/TextReadBench.php b/benchmarks/suites/Format/Text/TextReadBench.php index dd5bbe9ddc..ee8e958ce5 100644 --- a/benchmarks/suites/Format/Text/TextReadBench.php +++ b/benchmarks/suites/Format/Text/TextReadBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void #[Bench\Groups(['format', 'format-text'])] public function bench_text_read(array $params): void { - (new TextReadScenario((int) $params['rows']))->run(); + new TextReadScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Text/TextWriteBench.php b/benchmarks/suites/Format/Text/TextWriteBench.php index 213cff831f..403dd80e5b 100644 --- a/benchmarks/suites/Format/Text/TextWriteBench.php +++ b/benchmarks/suites/Format/Text/TextWriteBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void #[Bench\Groups(['format', 'format-text'])] public function bench_text_write(array $params): void { - (new TextWriteScenario((int) $params['rows']))->run(); + new TextWriteScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Xml/XmlReadBench.php b/benchmarks/suites/Format/Xml/XmlReadBench.php index 45652dfe40..95ae71b541 100644 --- a/benchmarks/suites/Format/Xml/XmlReadBench.php +++ b/benchmarks/suites/Format/Xml/XmlReadBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void #[Bench\Groups(['format', 'format-xml'])] public function bench_xml_read(array $params): void { - (new XmlReadScenario((int) $params['rows']))->run(); + new XmlReadScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Format/Xml/XmlWriteBench.php b/benchmarks/suites/Format/Xml/XmlWriteBench.php index c5d17ce07c..113546c10a 100644 --- a/benchmarks/suites/Format/Xml/XmlWriteBench.php +++ b/benchmarks/suites/Format/Xml/XmlWriteBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void #[Bench\Groups(['format', 'format-xml'])] public function bench_xml_write(array $params): void { - (new XmlWriteScenario((int) $params['rows']))->run(); + new XmlWriteScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Grouping/GroupBench.php b/benchmarks/suites/Grouping/GroupBench.php index ccd0b41e43..3834f8155e 100644 --- a/benchmarks/suites/Grouping/GroupBench.php +++ b/benchmarks/suites/Grouping/GroupBench.php @@ -21,21 +21,21 @@ public function warm(array $params): void #[Bench\Groups(['grouping'])] public function bench_group_by(array $params): void { - (new GroupByScenario((int) $params['rows']))->run(); + new GroupByScenario((int) $params['rows'])->run(); } #[Bench\ParamProviders('rows')] #[Bench\Groups(['grouping'])] public function bench_group_by_aggregate(array $params): void { - (new GroupByAggregateScenario((int) $params['rows']))->run(); + new GroupByAggregateScenario((int) $params['rows'])->run(); } #[Bench\ParamProviders('rows')] #[Bench\Groups(['grouping'])] public function bench_group_by_spilling(array $params): void { - (new GroupBySpillingScenario((int) $params['rows']))->run(); + new GroupBySpillingScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Joining/JoinBench.php b/benchmarks/suites/Joining/JoinBench.php index 42193b67cb..f660ba123a 100644 --- a/benchmarks/suites/Joining/JoinBench.php +++ b/benchmarks/suites/Joining/JoinBench.php @@ -23,42 +23,42 @@ public function warm(array $params): void #[Bench\Groups(['joining'])] public function bench_join_inner(array $params): void { - (new JoinOrdersWithSellersScenario(JoinType::inner, (int) $params['rows']))->run(); + new JoinOrdersWithSellersScenario(JoinType::inner, (int) $params['rows'])->run(); } #[Bench\ParamProviders('rows')] #[Bench\Groups(['joining'])] public function bench_join_left(array $params): void { - (new JoinOrdersWithSellersScenario(JoinType::left, (int) $params['rows']))->run(); + new JoinOrdersWithSellersScenario(JoinType::left, (int) $params['rows'])->run(); } #[Bench\ParamProviders('rows')] #[Bench\Groups(['joining'])] public function bench_join_left_anti(array $params): void { - (new JoinOrdersWithSellersScenario(JoinType::left_anti, (int) $params['rows']))->run(); + new JoinOrdersWithSellersScenario(JoinType::left_anti, (int) $params['rows'])->run(); } #[Bench\ParamProviders('rows')] #[Bench\Groups(['joining'])] public function bench_join_right(array $params): void { - (new JoinOrdersWithSellersScenario(JoinType::right, (int) $params['rows']))->run(); + new JoinOrdersWithSellersScenario(JoinType::right, (int) $params['rows'])->run(); } #[Bench\ParamProviders('rows')] #[Bench\Groups(['joining'])] public function bench_cross_join(array $params): void { - (new CrossJoinScenario((int) $params['rows']))->run(); + new CrossJoinScenario((int) $params['rows'])->run(); } #[Bench\ParamProviders('rows')] #[Bench\Groups(['joining'])] public function bench_join_each(array $params): void { - (new JoinEachScenario((int) $params['rows']))->run(); + new JoinEachScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Partitioning/PartitioningBench.php b/benchmarks/suites/Partitioning/PartitioningBench.php index 54d8a5f7cd..4a4a44fd20 100644 --- a/benchmarks/suites/Partitioning/PartitioningBench.php +++ b/benchmarks/suites/Partitioning/PartitioningBench.php @@ -22,14 +22,14 @@ public function warmTree(array $params): void #[Bench\Groups(['partitioning'])] public function bench_partitioned_write_low(array $params): void { - (new PartitionedWriteScenario(PartitionCardinality::low, (int) $params['rows']))->run(); + new PartitionedWriteScenario(PartitionCardinality::low, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'high'])] #[Bench\Groups(['partitioning'])] public function bench_partitioned_write_high(array $params): void { - (new PartitionedWriteScenario(PartitionCardinality::high, (int) $params['rows']))->run(); + new PartitionedWriteScenario(PartitionCardinality::high, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'high'])] @@ -37,7 +37,7 @@ public function bench_partitioned_write_high(array $params): void #[Bench\BeforeMethods('warmTree')] public function bench_partitioned_read_all(array $params): void { - (new PartitionedReadScenario(PartitionCardinality::high, false, (int) $params['rows']))->run(); + new PartitionedReadScenario(PartitionCardinality::high, false, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'high'])] @@ -46,7 +46,7 @@ public function bench_partitioned_read_all(array $params): void #[Bench\Revs(10)] public function bench_partitioned_read_pruned(array $params): void { - (new PartitionedReadScenario(PartitionCardinality::high, true, (int) $params['rows']))->run(); + new PartitionedReadScenario(PartitionCardinality::high, true, (int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Pipeline/NodePipelineBench.php b/benchmarks/suites/Pipeline/NodePipelineBench.php index 4bcd608274..3b2d42f7b1 100644 --- a/benchmarks/suites/Pipeline/NodePipelineBench.php +++ b/benchmarks/suites/Pipeline/NodePipelineBench.php @@ -17,21 +17,21 @@ final class NodePipelineBench { public function warm(array $params): void { - (new NodeFixture(NodeSource::from((string) $params['source']), (int) $params['rows']))->warm(); + new NodeFixture(NodeSource::from((string) $params['source']), (int) $params['rows'])->warm(); } #[Bench\ParamProviders(['rows', 'source_xml'])] #[Bench\Groups(['pipeline-node', 'pipeline-xml'])] public function bench_pipeline_xml(array $params): void { - (new NodePipelineScenario(NodeSource::xml, (int) $params['rows']))->run(); + new NodePipelineScenario(NodeSource::xml, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_text'])] #[Bench\Groups(['pipeline-node', 'pipeline-text'])] public function bench_pipeline_text(array $params): void { - (new NodePipelineScenario(NodeSource::text, (int) $params['rows']))->run(); + new NodePipelineScenario(NodeSource::text, (int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Pipeline/OrdersPipelineBench.php b/benchmarks/suites/Pipeline/OrdersPipelineBench.php index 1a8597fed5..16ddd81061 100644 --- a/benchmarks/suites/Pipeline/OrdersPipelineBench.php +++ b/benchmarks/suites/Pipeline/OrdersPipelineBench.php @@ -16,105 +16,105 @@ final class OrdersPipelineBench { public function warm(array $params): void { - (new SourceFixture(Source::from((string) $params['source']), (int) $params['rows']))->warm(); + new SourceFixture(Source::from((string) $params['source']), (int) $params['rows'])->warm(); } #[Bench\ParamProviders(['rows', 'source_csv'])] #[Bench\Groups(['pipeline', 'pipeline-csv'])] public function bench_pipeline_csv_declared(array $params): void { - (new PipelineScenario(Source::csv, SchemaMode::declared, (int) $params['rows']))->run(); + new PipelineScenario(Source::csv, SchemaMode::declared, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_json'])] #[Bench\Groups(['pipeline', 'pipeline-json'])] public function bench_pipeline_json_declared(array $params): void { - (new PipelineScenario(Source::json, SchemaMode::declared, (int) $params['rows']))->run(); + new PipelineScenario(Source::json, SchemaMode::declared, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_json_lines'])] #[Bench\Groups(['pipeline', 'pipeline-json-lines'])] public function bench_pipeline_json_lines_declared(array $params): void { - (new PipelineScenario(Source::json_lines, SchemaMode::declared, (int) $params['rows']))->run(); + new PipelineScenario(Source::json_lines, SchemaMode::declared, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_excel'])] #[Bench\Groups(['pipeline', 'pipeline-excel'])] public function bench_pipeline_excel_declared(array $params): void { - (new PipelineScenario(Source::excel, SchemaMode::declared, (int) $params['rows']))->run(); + new PipelineScenario(Source::excel, SchemaMode::declared, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_parquet'])] #[Bench\Groups(['pipeline', 'pipeline-parquet'])] public function bench_pipeline_parquet_declared(array $params): void { - (new PipelineScenario(Source::parquet, SchemaMode::declared, (int) $params['rows']))->run(); + new PipelineScenario(Source::parquet, SchemaMode::declared, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_floe'])] #[Bench\Groups(['pipeline', 'pipeline-floe'])] public function bench_pipeline_floe_declared(array $params): void { - (new PipelineScenario(Source::floe, SchemaMode::declared, (int) $params['rows']))->run(); + new PipelineScenario(Source::floe, SchemaMode::declared, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_array'])] #[Bench\Groups(['pipeline', 'pipeline-array'])] public function bench_pipeline_array_declared(array $params): void { - (new PipelineScenario(Source::array, SchemaMode::declared, (int) $params['rows']))->run(); + new PipelineScenario(Source::array, SchemaMode::declared, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_memory'])] #[Bench\Groups(['pipeline', 'pipeline-memory'])] public function bench_pipeline_memory_declared(array $params): void { - (new PipelineScenario(Source::memory, SchemaMode::declared, (int) $params['rows']))->run(); + new PipelineScenario(Source::memory, SchemaMode::declared, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_csv'])] #[Bench\Groups(['pipeline', 'pipeline-csv'])] public function bench_pipeline_csv_inferred(array $params): void { - (new PipelineScenario(Source::csv, SchemaMode::inferred, (int) $params['rows']))->run(); + new PipelineScenario(Source::csv, SchemaMode::inferred, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_json'])] #[Bench\Groups(['pipeline', 'pipeline-json'])] public function bench_pipeline_json_inferred(array $params): void { - (new PipelineScenario(Source::json, SchemaMode::inferred, (int) $params['rows']))->run(); + new PipelineScenario(Source::json, SchemaMode::inferred, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_json_lines'])] #[Bench\Groups(['pipeline', 'pipeline-json-lines'])] public function bench_pipeline_json_lines_inferred(array $params): void { - (new PipelineScenario(Source::json_lines, SchemaMode::inferred, (int) $params['rows']))->run(); + new PipelineScenario(Source::json_lines, SchemaMode::inferred, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_excel'])] #[Bench\Groups(['pipeline', 'pipeline-excel'])] public function bench_pipeline_excel_inferred(array $params): void { - (new PipelineScenario(Source::excel, SchemaMode::inferred, (int) $params['rows']))->run(); + new PipelineScenario(Source::excel, SchemaMode::inferred, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_array'])] #[Bench\Groups(['pipeline', 'pipeline-array'])] public function bench_pipeline_array_inferred(array $params): void { - (new PipelineScenario(Source::array, SchemaMode::inferred, (int) $params['rows']))->run(); + new PipelineScenario(Source::array, SchemaMode::inferred, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_memory'])] #[Bench\Groups(['pipeline', 'pipeline-memory'])] public function bench_pipeline_memory_inferred(array $params): void { - (new PipelineScenario(Source::memory, SchemaMode::inferred, (int) $params['rows']))->run(); + new PipelineScenario(Source::memory, SchemaMode::inferred, (int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Pipeline/PipelineCostBench.php b/benchmarks/suites/Pipeline/PipelineCostBench.php index c86e2cbbb0..10bda05298 100644 --- a/benchmarks/suites/Pipeline/PipelineCostBench.php +++ b/benchmarks/suites/Pipeline/PipelineCostBench.php @@ -16,21 +16,21 @@ final class PipelineCostBench { public function warm(array $params): void { - (new SourceFixture(Source::csv, (int) $params['rows']))->warm(); + new SourceFixture(Source::csv, (int) $params['rows'])->warm(); } #[Bench\ParamProviders(['rows', 'mixes'])] #[Bench\Groups(['pipeline-cost'])] public function bench_pipeline_column_mix(array $params): void { - (new ColumnMixScenario(Source::csv, ColumnMix::from((string) $params['mix']), (int) $params['rows']))->run(); + new ColumnMixScenario(Source::csv, ColumnMix::from((string) $params['mix']), (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'widths'])] #[Bench\Groups(['pipeline-cost'])] public function bench_pipeline_width(array $params): void { - (new PipelineWidthScenario(Source::csv, (int) $params['width'], (int) $params['rows']))->run(); + new PipelineWidthScenario(Source::csv, (int) $params['width'], (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'depths'])] @@ -38,14 +38,14 @@ public function bench_pipeline_width(array $params): void #[Bench\Revs(10)] public function bench_plan_bind_depth(array $params): void { - (new PlanDepthScenario(Source::csv, (int) $params['depth'], (int) $params['rows']))->run(); + new PlanDepthScenario(Source::csv, (int) $params['depth'], (int) $params['rows'])->run(); } #[Bench\ParamProviders('rows')] #[Bench\Groups(['pipeline-cost'])] public function bench_fetch_materialisation(array $params): void { - (new FetchScenario(Source::csv, (int) $params['rows']))->run(); + new FetchScenario(Source::csv, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'limits'])] @@ -54,7 +54,7 @@ public function bench_limit_pushdown(array $params): void { $limit = $params['limit'] === null ? null : (int) $params['limit']; - (new LimitPushdownScenario(Source::csv, $limit, (int) $params['rows']))->run(); + new LimitPushdownScenario(Source::csv, $limit, (int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Pipeline/PipelineReadBench.php b/benchmarks/suites/Pipeline/PipelineReadBench.php index 805c3acfaf..9d91dac6c6 100644 --- a/benchmarks/suites/Pipeline/PipelineReadBench.php +++ b/benchmarks/suites/Pipeline/PipelineReadBench.php @@ -13,63 +13,63 @@ final class PipelineReadBench { public function warm(array $params): void { - (new SourceFixture(Source::from((string) $params['source']), (int) $params['rows']))->warm(); + new SourceFixture(Source::from((string) $params['source']), (int) $params['rows'])->warm(); } #[Bench\ParamProviders(['rows', 'source_csv'])] #[Bench\Groups(['pipeline-read', 'pipeline-csv'])] public function bench_read_csv(array $params): void { - (new ReadScenario(Source::csv, (int) $params['rows']))->run(); + new ReadScenario(Source::csv, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_json'])] #[Bench\Groups(['pipeline-read', 'pipeline-json'])] public function bench_read_json(array $params): void { - (new ReadScenario(Source::json, (int) $params['rows']))->run(); + new ReadScenario(Source::json, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_json_lines'])] #[Bench\Groups(['pipeline-read', 'pipeline-json-lines'])] public function bench_read_json_lines(array $params): void { - (new ReadScenario(Source::json_lines, (int) $params['rows']))->run(); + new ReadScenario(Source::json_lines, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_excel'])] #[Bench\Groups(['pipeline-read', 'pipeline-excel'])] public function bench_read_excel(array $params): void { - (new ReadScenario(Source::excel, (int) $params['rows']))->run(); + new ReadScenario(Source::excel, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_parquet'])] #[Bench\Groups(['pipeline-read', 'pipeline-parquet'])] public function bench_read_parquet(array $params): void { - (new ReadScenario(Source::parquet, (int) $params['rows']))->run(); + new ReadScenario(Source::parquet, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_floe'])] #[Bench\Groups(['pipeline-read', 'pipeline-floe'])] public function bench_read_floe(array $params): void { - (new ReadScenario(Source::floe, (int) $params['rows']))->run(); + new ReadScenario(Source::floe, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_array'])] #[Bench\Groups(['pipeline-read', 'pipeline-array'])] public function bench_read_array(array $params): void { - (new ReadScenario(Source::array, (int) $params['rows']))->run(); + new ReadScenario(Source::array, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_memory'])] #[Bench\Groups(['pipeline-read', 'pipeline-memory'])] public function bench_read_memory(array $params): void { - (new ReadScenario(Source::memory, (int) $params['rows']))->run(); + new ReadScenario(Source::memory, (int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Pipeline/PipelineStagesBench.php b/benchmarks/suites/Pipeline/PipelineStagesBench.php index 03dab8ed86..0bee7ab9dc 100644 --- a/benchmarks/suites/Pipeline/PipelineStagesBench.php +++ b/benchmarks/suites/Pipeline/PipelineStagesBench.php @@ -16,35 +16,35 @@ final class PipelineStagesBench { public function warm(array $params): void { - (new SourceFixture(Source::from((string) $params['source']), (int) $params['rows']))->warm(); + new SourceFixture(Source::from((string) $params['source']), (int) $params['rows'])->warm(); } #[Bench\ParamProviders(['rows', 'source_csv'])] #[Bench\Groups(['pipeline-stages', 'pipeline-csv'])] public function bench_stage_read_select_csv(array $params): void { - (new StageScenario(Source::csv, Stage::read_select, (int) $params['rows']))->run(); + new StageScenario(Source::csv, Stage::read_select, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_csv'])] #[Bench\Groups(['pipeline-stages', 'pipeline-csv'])] public function bench_stage_read_select_write_csv(array $params): void { - (new StageScenario(Source::csv, Stage::read_select_write, (int) $params['rows']))->run(); + new StageScenario(Source::csv, Stage::read_select_write, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_parquet'])] #[Bench\Groups(['pipeline-stages', 'pipeline-parquet'])] public function bench_stage_read_select_parquet(array $params): void { - (new StageScenario(Source::parquet, Stage::read_select, (int) $params['rows']))->run(); + new StageScenario(Source::parquet, Stage::read_select, (int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'source_parquet'])] #[Bench\Groups(['pipeline-stages', 'pipeline-parquet'])] public function bench_stage_read_select_write_parquet(array $params): void { - (new StageScenario(Source::parquet, Stage::read_select_write, (int) $params['rows']))->run(); + new StageScenario(Source::parquet, Stage::read_select_write, (int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Schema/SchemaBench.php b/benchmarks/suites/Schema/SchemaBench.php index ca96daa6c4..12ed39b2fd 100644 --- a/benchmarks/suites/Schema/SchemaBench.php +++ b/benchmarks/suites/Schema/SchemaBench.php @@ -21,7 +21,7 @@ public function warm(array $params): void public function warmRows(array $params): void { - (new RowsSchemaScenario((int) $params['batch']))->warm(); + new RowsSchemaScenario((int) $params['batch'])->warm(); } #[Bench\ParamProviders('rows')] @@ -31,7 +31,7 @@ public function warmRows(array $params): void #[Bench\OutputTimeUnit('milliseconds', precision: 4)] public function bench_schema_inference(array $params): void { - (new SchemaInferenceScenario((int) $params['rows']))->run(); + new SchemaInferenceScenario((int) $params['rows'])->run(); } #[Bench\ParamProviders('rows')] @@ -41,7 +41,7 @@ public function bench_schema_inference(array $params): void #[Bench\OutputTimeUnit('milliseconds', precision: 4)] public function bench_schema_from_footer(array $params): void { - (new FooterSchemaScenario((int) $params['rows']))->run(); + new FooterSchemaScenario((int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'batches'])] @@ -49,7 +49,7 @@ public function bench_schema_from_footer(array $params): void #[Bench\BeforeMethods('warmRows')] public function bench_rows_schema(array $params): void { - (new RowsSchemaScenario((int) $params['batch']))->run(); + new RowsSchemaScenario((int) $params['batch'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Service/Doctrine/DoctrinePipelineBench.php b/benchmarks/suites/Service/Doctrine/DoctrinePipelineBench.php index 7b68821e35..71b6905176 100644 --- a/benchmarks/suites/Service/Doctrine/DoctrinePipelineBench.php +++ b/benchmarks/suites/Service/Doctrine/DoctrinePipelineBench.php @@ -17,19 +17,19 @@ final class DoctrinePipelineBench { public static function seed(): void { - (new DoctrinePipelineScenario(BenchmarkRows::count()))->seed(); + new DoctrinePipelineScenario(BenchmarkRows::count())->seed(); } public static function drop(): void { - (new DoctrinePipelineScenario(BenchmarkRows::count()))->dropTable(); + new DoctrinePipelineScenario(BenchmarkRows::count())->dropTable(); } #[Bench\ParamProviders('rows')] #[Bench\Groups(['pipeline-service', 'service', 'service-doctrine'])] public function bench_pipeline_doctrine(array $params): void { - (new DoctrinePipelineScenario((int) $params['rows']))->run(); + new DoctrinePipelineScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Service/Doctrine/DoctrineReadBench.php b/benchmarks/suites/Service/Doctrine/DoctrineReadBench.php index 2b08fbd2ca..6e61b9273c 100644 --- a/benchmarks/suites/Service/Doctrine/DoctrineReadBench.php +++ b/benchmarks/suites/Service/Doctrine/DoctrineReadBench.php @@ -14,29 +14,29 @@ final class DoctrineReadBench { public static function seedRead(): void { - (new DoctrineReadScenario(BenchmarkRows::count()))->seed(); + new DoctrineReadScenario(BenchmarkRows::count())->seed(); } public static function dropRead(): void { - (new DoctrineReadScenario(BenchmarkRows::count()))->dropTable(); + new DoctrineReadScenario(BenchmarkRows::count())->dropTable(); } #[Bench\ParamProviders('rows')] #[Bench\Groups(['service', 'service-doctrine'])] public function bench_doctrine_read(array $params): void { - (new DoctrineReadScenario((int) $params['rows']))->run(); + new DoctrineReadScenario((int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'limits'])] #[Bench\Groups(['service', 'service-doctrine'])] public function bench_limit_pushdown(array $params): void { - (new DoctrineReadScenario( + new DoctrineReadScenario( (int) $params['rows'], $params['limit'] === null ? null : (int) $params['limit'], - ))->run(); + )->run(); } public function limits(): Generator diff --git a/benchmarks/suites/Service/Doctrine/DoctrineWrappedWriteBench.php b/benchmarks/suites/Service/Doctrine/DoctrineWrappedWriteBench.php index 73a2a78166..d6e28a61e8 100644 --- a/benchmarks/suites/Service/Doctrine/DoctrineWrappedWriteBench.php +++ b/benchmarks/suites/Service/Doctrine/DoctrineWrappedWriteBench.php @@ -20,14 +20,14 @@ public function warm(array $params): void public function setUpWrappedWrite(array $params): void { - (new DoctrineWrappedWriteScenario((int) $params['rows']))->setUp(); + new DoctrineWrappedWriteScenario((int) $params['rows'])->setUp(); } public static function dropWrappedWrite(): void { - (new DoctrineWrappedWriteScenario(100_000))->dropTable(); + new DoctrineWrappedWriteScenario(100_000)->dropTable(); - (new DoctrineWrappedWriteScenario(BenchmarkRows::count()))->dropTable(); + new DoctrineWrappedWriteScenario(BenchmarkRows::count())->dropTable(); } #[Bench\ParamProviders('rows')] @@ -35,7 +35,7 @@ public static function dropWrappedWrite(): void #[Bench\BeforeMethods('setUpWrappedWrite')] public function bench_doctrine_wrapped_write(array $params): void { - (new DoctrineWrappedWriteScenario((int) $params['rows']))->run(); + new DoctrineWrappedWriteScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Service/Doctrine/DoctrineWriteBench.php b/benchmarks/suites/Service/Doctrine/DoctrineWriteBench.php index 92af1943e8..115f97764a 100644 --- a/benchmarks/suites/Service/Doctrine/DoctrineWriteBench.php +++ b/benchmarks/suites/Service/Doctrine/DoctrineWriteBench.php @@ -20,14 +20,14 @@ public function warm(array $params): void public function setUpWrite(array $params): void { - (new DoctrineWriteScenario((int) $params['rows']))->setUp(); + new DoctrineWriteScenario((int) $params['rows'])->setUp(); } public static function dropWrite(): void { - (new DoctrineWriteScenario(100_000))->dropTable(); + new DoctrineWriteScenario(100_000)->dropTable(); - (new DoctrineWriteScenario(BenchmarkRows::count()))->dropTable(); + new DoctrineWriteScenario(BenchmarkRows::count())->dropTable(); } #[Bench\ParamProviders('rows')] @@ -35,7 +35,7 @@ public static function dropWrite(): void #[Bench\BeforeMethods('setUpWrite')] public function bench_doctrine_write(array $params): void { - (new DoctrineWriteScenario((int) $params['rows']))->run(); + new DoctrineWriteScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Service/Postgresql/PostgresqlPipelineBench.php b/benchmarks/suites/Service/Postgresql/PostgresqlPipelineBench.php index 96f0fcbfd2..d9ebe77ad3 100644 --- a/benchmarks/suites/Service/Postgresql/PostgresqlPipelineBench.php +++ b/benchmarks/suites/Service/Postgresql/PostgresqlPipelineBench.php @@ -17,19 +17,19 @@ final class PostgresqlPipelineBench { public static function seed(): void { - (new PostgresqlPipelineScenario(BenchmarkRows::count()))->seed(); + new PostgresqlPipelineScenario(BenchmarkRows::count())->seed(); } public static function drop(): void { - (new PostgresqlPipelineScenario(BenchmarkRows::count()))->dropTable(); + new PostgresqlPipelineScenario(BenchmarkRows::count())->dropTable(); } #[Bench\ParamProviders('rows')] #[Bench\Groups(['pipeline-service', 'service', 'service-postgresql'])] public function bench_pipeline_postgresql(array $params): void { - (new PostgresqlPipelineScenario((int) $params['rows']))->run(); + new PostgresqlPipelineScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Service/Postgresql/PostgresqlReadBench.php b/benchmarks/suites/Service/Postgresql/PostgresqlReadBench.php index 6a2fff328d..21b5d61cd4 100644 --- a/benchmarks/suites/Service/Postgresql/PostgresqlReadBench.php +++ b/benchmarks/suites/Service/Postgresql/PostgresqlReadBench.php @@ -14,29 +14,29 @@ final class PostgresqlReadBench { public static function seedRead(): void { - (new PostgresqlReadScenario(BenchmarkRows::count()))->seed(); + new PostgresqlReadScenario(BenchmarkRows::count())->seed(); } public static function dropRead(): void { - (new PostgresqlReadScenario(BenchmarkRows::count()))->dropTable(); + new PostgresqlReadScenario(BenchmarkRows::count())->dropTable(); } #[Bench\ParamProviders('rows')] #[Bench\Groups(['service', 'service-postgresql'])] public function bench_postgresql_read(array $params): void { - (new PostgresqlReadScenario((int) $params['rows']))->run(); + new PostgresqlReadScenario((int) $params['rows'])->run(); } #[Bench\ParamProviders(['rows', 'limits'])] #[Bench\Groups(['service', 'service-postgresql'])] public function bench_limit_pushdown(array $params): void { - (new PostgresqlReadScenario( + new PostgresqlReadScenario( (int) $params['rows'], $params['limit'] === null ? null : (int) $params['limit'], - ))->run(); + )->run(); } public function limits(): Generator diff --git a/benchmarks/suites/Service/Postgresql/PostgresqlWriteBench.php b/benchmarks/suites/Service/Postgresql/PostgresqlWriteBench.php index b0faff2ea3..445a909fe8 100644 --- a/benchmarks/suites/Service/Postgresql/PostgresqlWriteBench.php +++ b/benchmarks/suites/Service/Postgresql/PostgresqlWriteBench.php @@ -20,14 +20,14 @@ public function warm(array $params): void public function setUpWrite(array $params): void { - (new PostgresqlWriteScenario((int) $params['rows']))->setUp(); + new PostgresqlWriteScenario((int) $params['rows'])->setUp(); } public static function dropWrite(): void { - (new PostgresqlWriteScenario(100_000))->dropTable(); + new PostgresqlWriteScenario(100_000)->dropTable(); - (new PostgresqlWriteScenario(BenchmarkRows::count()))->dropTable(); + new PostgresqlWriteScenario(BenchmarkRows::count())->dropTable(); } #[Bench\ParamProviders('rows')] @@ -35,7 +35,7 @@ public static function dropWrite(): void #[Bench\BeforeMethods('setUpWrite')] public function bench_postgresql_write(array $params): void { - (new PostgresqlWriteScenario((int) $params['rows']))->run(); + new PostgresqlWriteScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Service/Seal/SealWriteBench.php b/benchmarks/suites/Service/Seal/SealWriteBench.php index 218724d682..c3b59b2bb9 100644 --- a/benchmarks/suites/Service/Seal/SealWriteBench.php +++ b/benchmarks/suites/Service/Seal/SealWriteBench.php @@ -14,14 +14,14 @@ final class SealWriteBench { public function setUpWrite(array $params): void { - (new SealWriteScenario((int) $params['rows']))->setUp(); + new SealWriteScenario((int) $params['rows'])->setUp(); } public static function dropWrite(): void { - (new SealWriteScenario(100_000))->dropIndex(); + new SealWriteScenario(100_000)->dropIndex(); - (new SealWriteScenario(BenchmarkRows::count()))->dropIndex(); + new SealWriteScenario(BenchmarkRows::count())->dropIndex(); } #[Bench\ParamProviders('rows')] @@ -29,7 +29,7 @@ public static function dropWrite(): void #[Bench\BeforeMethods('setUpWrite')] public function bench_seal_write(array $params): void { - (new SealWriteScenario((int) $params['rows']))->run(); + new SealWriteScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Sorting/SortOrdersBench.php b/benchmarks/suites/Sorting/SortOrdersBench.php index e3cd99c939..2e172b5064 100644 --- a/benchmarks/suites/Sorting/SortOrdersBench.php +++ b/benchmarks/suites/Sorting/SortOrdersBench.php @@ -21,14 +21,14 @@ public function warm(array $params): void #[Bench\Groups(['sorting'])] public function bench_sort_orders(array $params): void { - (new SortOrdersScenario((int) $params['rows']))->run(); + new SortOrdersScenario((int) $params['rows'])->run(); } #[Bench\ParamProviders('rows')] #[Bench\Groups(['sorting'])] public function bench_sort_orders_spilling(array $params): void { - (new SortOrdersSpillingScenario((int) $params['rows']))->run(); + new SortOrdersSpillingScenario((int) $params['rows'])->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Transformation/NestedTransformationBench.php b/benchmarks/suites/Transformation/NestedTransformationBench.php index fea63adddc..7916c893ea 100644 --- a/benchmarks/suites/Transformation/NestedTransformationBench.php +++ b/benchmarks/suites/Transformation/NestedTransformationBench.php @@ -28,7 +28,7 @@ public function bench_bare_branch(array $params): void { $branch = to_branch(ref('order_id')->isNotNull(), new NoopLoader()); - (new NestedTransformationScenario((int) $params['rows'], $branch))->run(); + new NestedTransformationScenario((int) $params['rows'], $branch)->run(); } #[Bench\ParamProviders('rows')] @@ -37,7 +37,7 @@ public function bench_blocking_transformation(array $params): void { $branch = to_transformation(new SortByCreatedAt(), new NoopLoader()); - (new NestedTransformationScenario((int) $params['rows'], $branch))->run(); + new NestedTransformationScenario((int) $params['rows'], $branch)->run(); } #[Bench\ParamProviders('rows')] @@ -46,7 +46,7 @@ public function bench_branch_with_transformation(array $params): void { $branch = to_branch(ref('order_id')->isNotNull(), to_transformation(new SortByCreatedAt(), new NoopLoader())); - (new NestedTransformationScenario((int) $params['rows'], $branch))->run(); + new NestedTransformationScenario((int) $params['rows'], $branch)->run(); } #[Bench\ParamProviders('rows')] @@ -55,7 +55,7 @@ public function bench_streaming_transformation(array $params): void { $branch = to_transformation(select('order_id'), new NoopLoader()); - (new NestedTransformationScenario((int) $params['rows'], $branch))->run(); + new NestedTransformationScenario((int) $params['rows'], $branch)->run(); } public function rows(): Generator diff --git a/benchmarks/suites/Window/WindowBench.php b/benchmarks/suites/Window/WindowBench.php index 65e8f03111..448123893a 100644 --- a/benchmarks/suites/Window/WindowBench.php +++ b/benchmarks/suites/Window/WindowBench.php @@ -22,47 +22,47 @@ public function warm(array $params): void #[Bench\Groups(['window'])] public function bench_moving_average(array $params): void { - (new MovingAverageScenario( + new MovingAverageScenario( (int) $params['rows'], PartitionCardinality::from((string) $params['cardinality']), - ))->run(); + )->run(); } #[Bench\ParamProviders(['rows', 'cardinalities'])] #[Bench\Groups(['window'])] public function bench_rank(array $params): void { - (new RankScenario((int) $params['rows'], PartitionCardinality::from((string) $params['cardinality'])))->run(); + new RankScenario((int) $params['rows'], PartitionCardinality::from((string) $params['cardinality']))->run(); } #[Bench\ParamProviders(['rows', 'cardinalities'])] #[Bench\Groups(['window'])] public function bench_row_number(array $params): void { - (new RowNumberScenario( + new RowNumberScenario( (int) $params['rows'], PartitionCardinality::from((string) $params['cardinality']), - ))->run(); + )->run(); } #[Bench\ParamProviders(['rows', 'cardinalities'])] #[Bench\Groups(['window'])] public function bench_running_total(array $params): void { - (new RunningTotalScenario( + new RunningTotalScenario( (int) $params['rows'], PartitionCardinality::from((string) $params['cardinality']), - ))->run(); + )->run(); } #[Bench\ParamProviders(['rows', 'cardinalities'])] #[Bench\Groups(['window'])] public function bench_whole_partition(array $params): void { - (new WholePartitionScenario( + new WholePartitionScenario( (int) $params['rows'], PartitionCardinality::from((string) $params['cardinality']), - ))->run(); + )->run(); } public function cardinalities(): Generator diff --git a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Datasets/FixtureFingerprintTest.php b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Datasets/FixtureFingerprintTest.php index 155a406092..44bd9ef85e 100644 --- a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Datasets/FixtureFingerprintTest.php +++ b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Datasets/FixtureFingerprintTest.php @@ -18,15 +18,15 @@ final class FixtureFingerprintTest extends TestCase public function test_csv_and_json_fingerprints_differ(): void { static::assertNotSame( - (new FixtureFingerprint(FixtureFormat::csv))->value(), - (new FixtureFingerprint(FixtureFormat::json))->value(), + new FixtureFingerprint(FixtureFormat::csv)->value(), + new FixtureFingerprint(FixtureFormat::json)->value(), ); } public function test_fingerprint_is_eight_lowercase_hex_characters(): void { foreach (FixtureFormat::cases() as $format) { - static::assertMatchesRegularExpression('/^[0-9a-f]{8}$/', (new FixtureFingerprint($format))->value()); + static::assertMatchesRegularExpression('/^[0-9a-f]{8}$/', new FixtureFingerprint($format)->value()); } } @@ -44,11 +44,11 @@ public function test_every_format_maps_to_its_own_extension(): void public function test_no_two_formats_resolve_to_the_same_path(): void { - $paths = array_map(static fn(FixtureFormat $format): string => (new FixturePath( + $paths = array_map(static fn(FixtureFormat $format): string => new FixturePath( 'orders', 1, $format, - ))->path(), FixtureFormat::cases()); + )->path(), FixtureFormat::cases()); static::assertCount(count($paths), array_unique($paths)); } @@ -56,16 +56,16 @@ public function test_no_two_formats_resolve_to_the_same_path(): void public function test_json_and_json_lines_share_a_fingerprint(): void { static::assertSame( - (new FixtureFingerprint(FixtureFormat::json))->value(), - (new FixtureFingerprint(FixtureFormat::json_lines))->value(), + new FixtureFingerprint(FixtureFormat::json)->value(), + new FixtureFingerprint(FixtureFormat::json_lines)->value(), ); } public function test_parquet_and_floe_share_a_fingerprint(): void { static::assertSame( - (new FixtureFingerprint(FixtureFormat::parquet))->value(), - (new FixtureFingerprint(FixtureFormat::floe))->value(), + new FixtureFingerprint(FixtureFormat::parquet)->value(), + new FixtureFingerprint(FixtureFormat::floe)->value(), ); } } diff --git a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Datasets/FixturePathTest.php b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Datasets/FixturePathTest.php index 58114bf40f..000c0c6b27 100644 --- a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Datasets/FixturePathTest.php +++ b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Datasets/FixturePathTest.php @@ -22,7 +22,7 @@ public function test_path_carries_the_fingerprint_segment(): void { static::assertMatchesRegularExpression( '#/fixture_path_test_1\.[0-9a-f]{8}\.csv$#', - (new FixturePath('fixture_path_test', 1, FixtureFormat::csv))->path(), + new FixturePath('fixture_path_test', 1, FixtureFormat::csv)->path(), ); } diff --git a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Datasets/SourceTreeDigestTest.php b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Datasets/SourceTreeDigestTest.php index e621dd7527..c59d0ccb9f 100644 --- a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Datasets/SourceTreeDigestTest.php +++ b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Datasets/SourceTreeDigestTest.php @@ -18,7 +18,7 @@ public function test_a_single_file_tree_is_digested(): void try { static::assertMatchesRegularExpression( '/^[0-9a-f]{32}$/', - (new SourceTreeDigest($tree->relativePath() . '/only.php'))->value(), + new SourceTreeDigest($tree->relativePath() . '/only.php')->value(), ); } finally { $tree->remove(); @@ -31,10 +31,10 @@ public function test_digest_changes_when_a_php_file_in_the_tree_changes(): void $tree->write('a.php', 'relativePath()))->value(); + $before = new SourceTreeDigest($tree->relativePath())->value(); $tree->write('a.php', 'relativePath()))->value()); + static::assertNotSame($before, new SourceTreeDigest($tree->relativePath())->value()); } finally { $tree->remove(); } @@ -46,10 +46,10 @@ public function test_digest_ignores_non_php_files(): void $tree->write('a.php', 'relativePath()))->value(); + $before = new SourceTreeDigest($tree->relativePath())->value(); $tree->write('notes.txt', 'anything at all'); - static::assertSame($before, (new SourceTreeDigest($tree->relativePath()))->value()); + static::assertSame($before, new SourceTreeDigest($tree->relativePath())->value()); } finally { $tree->remove(); } @@ -62,13 +62,13 @@ public function test_digest_is_order_independent(): void try { $tree->write('a.php', 'write('nested/b.php', 'relativePath()))->value(); + $ascending = new SourceTreeDigest($tree->relativePath())->value(); $tree->remove(); $tree->write('nested/b.php', 'write('a.php', 'relativePath()))->value()); + static::assertSame($ascending, new SourceTreeDigest($tree->relativePath())->value()); } finally { $tree->remove(); } @@ -81,8 +81,8 @@ public function test_digest_is_stable_across_calls(): void try { static::assertSame( - (new SourceTreeDigest($tree->relativePath()))->value(), - (new SourceTreeDigest($tree->relativePath()))->value(), + new SourceTreeDigest($tree->relativePath())->value(), + new SourceTreeDigest($tree->relativePath())->value(), ); } finally { $tree->remove(); diff --git a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Partitioning/PartitionedTreeTest.php b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Partitioning/PartitionedTreeTest.php index 52e79d6a53..a9ce0d2d72 100644 --- a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Partitioning/PartitionedTreeTest.php +++ b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Partitioning/PartitionedTreeTest.php @@ -50,7 +50,7 @@ public function test_the_write_scenario_partitions_by_its_cardinality_column( PartitionCardinality $cardinality, ): void { try { - $root = (new PartitionedWriteScenario($cardinality, self::ROWS))->run(); + $root = new PartitionedWriteScenario($cardinality, self::ROWS)->run(); $partitions = glob($root . '/*') ?: []; static::assertNotSame([], $partitions); @@ -82,8 +82,8 @@ public function test_pruning_a_partition_reads_fewer_rows_than_reading_them_all( PartitionedTree::clear(); try { - $all = (new PartitionedReadScenario(PartitionCardinality::high, false, self::ROWS))->run(); - $pruned = (new PartitionedReadScenario(PartitionCardinality::high, true, self::ROWS))->run(); + $all = new PartitionedReadScenario(PartitionCardinality::high, false, self::ROWS)->run(); + $pruned = new PartitionedReadScenario(PartitionCardinality::high, true, self::ROWS)->run(); static::assertSame(self::ROWS, $all); static::assertLessThan($all, $pruned); diff --git a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/NodePipelineScenarioTest.php b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/NodePipelineScenarioTest.php index 4bc15d49d0..c117ef8748 100644 --- a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/NodePipelineScenarioTest.php +++ b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/NodePipelineScenarioTest.php @@ -34,10 +34,10 @@ public static function sources(): Generator #[DataProvider('sources')] public function test_it_writes_one_record_per_source_row(NodeSource $source, string $marker): void { - (new NodeFixture($source, self::ROWS))->warm(); + new NodeFixture($source, self::ROWS)->warm(); $written = new WrittenFile(Paths::var() . '/pipeline_' . $source->value . '_*.txt'); - (new NodePipelineScenario($source, self::ROWS))->run(); + new NodePipelineScenario($source, self::ROWS)->run(); $contents = (string) file_get_contents($written->path()); $written->remove(); diff --git a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/PipelineCostScenariosTest.php b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/PipelineCostScenariosTest.php index 438a7b1333..624111c159 100644 --- a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/PipelineCostScenariosTest.php +++ b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/PipelineCostScenariosTest.php @@ -55,7 +55,7 @@ public static function limits(): Generator #[DataProvider('mixes')] public function test_the_column_mix_scenario_projects_exactly_its_mix(ColumnMix $mix): void { - (new SourceFixture(Source::csv, self::ROWS))->warm(); + new SourceFixture(Source::csv, self::ROWS)->warm(); $scenario = new ColumnMixScenario(Source::csv, $mix, self::ROWS); $scenario->run(); @@ -65,7 +65,7 @@ public function test_the_column_mix_scenario_projects_exactly_its_mix(ColumnMix #[DataProvider('widths')] public function test_the_width_scenario_projects_exactly_that_many_columns(int $width): void { - (new SourceFixture(Source::csv, self::ROWS))->warm(); + new SourceFixture(Source::csv, self::ROWS)->warm(); $scenario = new PipelineWidthScenario(Source::csv, $width, self::ROWS); $scenario->run(); @@ -79,17 +79,17 @@ public function test_the_width_scenario_projects_exactly_that_many_columns(int $ #[DataProvider('depths')] public function test_the_plan_depth_scenario_runs(int $depth): void { - (new SourceFixture(Source::csv, self::ROWS))->warm(); + new SourceFixture(Source::csv, self::ROWS)->warm(); static::assertCount( count(OrdersSchema::of(Source::csv)->definitions()) + $depth, - (new PlanDepthScenario(Source::csv, $depth, self::ROWS))->run()->definitions(), + new PlanDepthScenario(Source::csv, $depth, self::ROWS)->run()->definitions(), ); } public function test_the_fetch_scenario_runs(): void { - (new SourceFixture(Source::csv, self::ROWS))->warm(); - $rows = (new FetchScenario(Source::csv, self::ROWS))->run(); + new SourceFixture(Source::csv, self::ROWS)->warm(); + $rows = new FetchScenario(Source::csv, self::ROWS)->run(); static::assertCount(self::ROWS, $rows); static::assertSame(['order_id', 'customer'], array_keys($rows->values(0))); @@ -98,7 +98,7 @@ public function test_the_fetch_scenario_runs(): void #[DataProvider('limits')] public function test_the_limit_pushdown_scenario_keeps_its_limit_in_the_plan(?int $limit): void { - (new SourceFixture(Source::csv, self::ROWS))->warm(); + new SourceFixture(Source::csv, self::ROWS)->warm(); $scenario = new LimitPushdownScenario(Source::csv, $limit, self::ROWS); $scenario->run(); diff --git a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/PipelineScenarioTest.php b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/PipelineScenarioTest.php index def597cec1..830993a44c 100644 --- a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/PipelineScenarioTest.php +++ b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/PipelineScenarioTest.php @@ -31,10 +31,10 @@ public static function sources(): Generator #[DataProvider('sources')] public function test_it_writes_the_five_projected_columns_for_every_row(Source $source): void { - (new SourceFixture($source, self::ROWS))->warm(); + new SourceFixture($source, self::ROWS)->warm(); $written = new WrittenFile(Paths::var() . '/pipeline_' . $source->value . '_*.floe'); - (new PipelineScenario($source, SchemaMode::declared, self::ROWS))->run(); + new PipelineScenario($source, SchemaMode::declared, self::ROWS)->run(); $rows = data_frame()->read(from_floe($written->path()))->fetch(); $written->remove(); @@ -49,15 +49,15 @@ public function test_it_writes_the_five_projected_columns_for_every_row(Source $ #[DataProvider('sources')] public function test_the_inferred_and_declared_arms_produce_the_same_columns(Source $source): void { - (new SourceFixture($source, self::ROWS))->warm(); + new SourceFixture($source, self::ROWS)->warm(); $declaredFile = new WrittenFile(Paths::var() . '/pipeline_' . $source->value . '_*.floe'); - (new PipelineScenario($source, SchemaMode::declared, self::ROWS))->run(); + new PipelineScenario($source, SchemaMode::declared, self::ROWS)->run(); $declared = array_keys(data_frame()->read(from_floe($declaredFile->path()))->fetch()->values(0)); $declaredFile->remove(); $inferredFile = new WrittenFile(Paths::var() . '/pipeline_' . $source->value . '_*.floe'); - (new PipelineScenario($source, SchemaMode::inferred, self::ROWS))->run(); + new PipelineScenario($source, SchemaMode::inferred, self::ROWS)->run(); $inferred = array_keys(data_frame()->read(from_floe($inferredFile->path()))->fetch()->values(0)); $inferredFile->remove(); diff --git a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/ReadScenarioTest.php b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/ReadScenarioTest.php index e6e0a61ce8..5850eb67f5 100644 --- a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/ReadScenarioTest.php +++ b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/ReadScenarioTest.php @@ -27,8 +27,8 @@ public static function sources(): Generator #[DataProvider('sources')] public function test_it_runs_for_every_source(Source $source): void { - (new SourceFixture($source, self::ROWS))->warm(); - (new ReadScenario($source, self::ROWS))->run(); + new SourceFixture($source, self::ROWS)->warm(); + new ReadScenario($source, self::ROWS)->run(); static::assertTrue(true); } @@ -40,11 +40,11 @@ public function test_it_runs_for_every_source(Source $source): void #[DataProvider('sources')] public function test_it_reads_through_the_same_declared_extractor_as_the_other_rungs(Source $source): void { - (new SourceFixture($source, self::ROWS))->warm(); + new SourceFixture($source, self::ROWS)->warm(); static::assertEquals( - (new SourceExtractor($source, SchemaMode::declared, self::ROWS))->extractor(), - (new ReadScenario($source, self::ROWS))->extractor(), + new SourceExtractor($source, SchemaMode::declared, self::ROWS)->extractor(), + new ReadScenario($source, self::ROWS)->extractor(), ); } } diff --git a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/SourceExtractorTest.php b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/SourceExtractorTest.php index d02d875813..ff4abeb49a 100644 --- a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/SourceExtractorTest.php +++ b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/SourceExtractorTest.php @@ -36,33 +36,33 @@ public static function sources_taking_a_schema(): Generator #[DataProvider('sources')] public function test_declared_mode_attaches_the_frozen_schema(Source $source): void { - (new SourceFixture($source, self::ROWS))->warm(); + new SourceFixture($source, self::ROWS)->warm(); static::assertEquals( OrdersSchema::of($source), - (new SourceExtractor($source, SchemaMode::declared, self::ROWS))->extractor()->schema(), + new SourceExtractor($source, SchemaMode::declared, self::ROWS)->extractor()->schema(), ); } #[DataProvider('sources_taking_a_schema')] public function test_inferred_mode_attaches_no_schema(Source $source): void { - (new SourceFixture($source, self::ROWS))->warm(); + new SourceFixture($source, self::ROWS)->warm(); static::assertNotEquals( - (new SourceExtractor($source, SchemaMode::declared, self::ROWS))->extractor(), - (new SourceExtractor($source, SchemaMode::inferred, self::ROWS))->extractor(), + new SourceExtractor($source, SchemaMode::declared, self::ROWS)->extractor(), + new SourceExtractor($source, SchemaMode::inferred, self::ROWS)->extractor(), ); } #[DataProvider('sources')] public function test_the_frozen_schema_still_equals_what_the_source_infers(Source $source): void { - (new SourceFixture($source, self::ROWS))->warm(); + new SourceFixture($source, self::ROWS)->warm(); static::assertEquals( OrdersSchema::of($source), - (new SourceExtractor($source, SchemaMode::inferred, self::ROWS))->extractor()->schema(), + new SourceExtractor($source, SchemaMode::inferred, self::ROWS)->extractor()->schema(), ); } } diff --git a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/StageScenarioTest.php b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/StageScenarioTest.php index 689fbbabdd..e9a7ff5b9b 100644 --- a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/StageScenarioTest.php +++ b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Pipeline/StageScenarioTest.php @@ -31,9 +31,9 @@ public static function laddered(): Generator #[DataProvider('laddered')] public function test_the_read_select_stage_runs_without_writing(Source $source): void { - (new SourceFixture($source, self::ROWS))->warm(); + new SourceFixture($source, self::ROWS)->warm(); - (new StageScenario($source, Stage::read_select, self::ROWS))->run(); + new StageScenario($source, Stage::read_select, self::ROWS)->run(); static::assertSame([], glob(Paths::var() . '/stage_' . $source->value . '_*.floe') ?: []); } @@ -41,10 +41,10 @@ public function test_the_read_select_stage_runs_without_writing(Source $source): #[DataProvider('laddered')] public function test_the_read_select_write_stage_writes_the_five_projected_columns(Source $source): void { - (new SourceFixture($source, self::ROWS))->warm(); + new SourceFixture($source, self::ROWS)->warm(); $written = new WrittenFile(Paths::var() . '/stage_' . $source->value . '_*.floe'); - (new StageScenario($source, Stage::read_select_write, self::ROWS))->run(); + new StageScenario($source, Stage::read_select_write, self::ROWS)->run(); $rows = data_frame()->read(from_floe($written->path()))->fetch(); $written->remove(); diff --git a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Schema/SchemaScenariosTest.php b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Schema/SchemaScenariosTest.php index e405372da4..684fda3a1f 100644 --- a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Schema/SchemaScenariosTest.php +++ b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Schema/SchemaScenariosTest.php @@ -44,8 +44,8 @@ public function test_the_rows_scenario_memoises_its_batch(int $batch): void public function test_the_footer_and_inference_scenarios_agree_on_the_schema(): void { static::assertEquals( - (new FooterSchemaScenario(self::ROWS))->run(), - (new SchemaInferenceScenario(self::ROWS))->run(), + new FooterSchemaScenario(self::ROWS)->run(), + new SchemaInferenceScenario(self::ROWS)->run(), ); } } diff --git a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Window/WindowPartitioningTest.php b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Window/WindowPartitioningTest.php index eaed8a293f..e99bf7c09d 100644 --- a/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Window/WindowPartitioningTest.php +++ b/benchmarks/tests/Flow/Benchmarks/Tests/Unit/Window/WindowPartitioningTest.php @@ -26,7 +26,7 @@ public function test_both_arms_derive_the_key_so_only_the_partition_column_varie static::assertContains( 'day', array_keys( - (new WindowPartitioning($cardinality)) + new WindowPartitioning($cardinality) ->derive(data_frame()->read(from_floe(Datasets::orders(self::ROWS)->floe()))) ->fetch() ->values(0), @@ -39,7 +39,7 @@ public function test_both_arms_derive_the_key_so_only_the_partition_column_varie public function test_the_reference_names_the_cardinality_column(): void { foreach (PartitionCardinality::cases() as $cardinality) { - static::assertSame($cardinality->column(), (new WindowPartitioning($cardinality))->reference()->name()); + static::assertSame($cardinality->column(), new WindowPartitioning($cardinality)->reference()->name()); } } } diff --git a/bin/docs.php b/bin/docs.php index 7afd74f7f3..fd223e8506 100755 --- a/bin/docs.php +++ b/bin/docs.php @@ -31,8 +31,8 @@ require __DIR__ . '/../vendor/autoload.php'; -if (version_compare(PHP_VERSION, '8.4', '>=')) { - print PHP_EOL . 'Building docs can be run only on the lowest supported version of PHP: 8.3' . PHP_EOL; +if (version_compare(PHP_VERSION, '8.6', '>=')) { + print PHP_EOL . 'Building docs can be run only on the lowest supported version of PHP: 8.5' . PHP_EOL; exit(1); } @@ -208,11 +208,11 @@ public function execute(InputInterface $input, OutputInterface $output): int $repositoryRootPath = dirname(__DIR__) . '/'; $roots = [Flow::class]; - foreach ((new FunctionsExtractor( + foreach (new FunctionsExtractor( $repositoryRootPath, $this->reflector, $this->astLocator, - ))->extract($this->dslPaths) as $function) { + )->extract($this->dslPaths) as $function) { foreach ([...$function->returnType->types, ...$function->parameters->types()] as $type) { if ($type->namespace !== null) { $roots[] = $type->namespace . '\\' . $type->name; @@ -222,7 +222,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $normalizedClasses = []; - foreach ((new ClassesExtractor($repositoryRootPath, $this->reflector))->extract($roots) as $class) { + foreach (new ClassesExtractor($repositoryRootPath, $this->reflector)->extract($roots) as $class) { $normalizedClasses[] = $class->normalize(); } @@ -282,7 +282,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $classes = []; - foreach ((new ClassesExtractor('', $reflector, $this->phpExtensions))->extract(array_keys(array_filter( + foreach (new ClassesExtractor('', $reflector, $this->phpExtensions)->extract(array_keys(array_filter( type_map(type_string(), type_string())->assert(PhpStormStubsMap::CLASSES), $this->isPlaygroundStub(...), ))) as $class) { diff --git a/bin/thrift.php b/bin/thrift.php index 241dff0b5b..7a733ad434 100755 --- a/bin/thrift.php +++ b/bin/thrift.php @@ -38,7 +38,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $models = $source . '/Flow/Parquet/ThriftModel'; $thrift = $input->getOption('thrift') === null - ? (new ExecutableFinder())->find('thrift') + ? new ExecutableFinder()->find('thrift') : type_string()->assert($input->getOption('thrift')); if (!is_string($thrift) || !is_executable($thrift)) { @@ -57,7 +57,7 @@ public function execute(InputInterface $input, OutputInterface $output): int unlink($file); } - (new Process([$thrift, '--gen', 'php', '--out', $source, $idl]))->mustRun( + new Process([$thrift, '--gen', 'php', '--out', $source, $idl])->mustRun( static fn(string $type, string $buffer) => $output->write($buffer), ); @@ -70,7 +70,7 @@ public function execute(InputInterface $input, OutputInterface $output): int } /** @var array $spec */ - $spec = (new ReflectionProperty($class, '_TSPEC'))->getValue(); + $spec = new ReflectionProperty($class, '_TSPEC')->getValue(); $model = (string) file_get_contents($file); $rewritten = $model; diff --git a/composer.json b/composer.json index 706c86c74f..ece28279bf 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "load" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "ext-bcmath": "*", "ext-dom": "*", "ext-hash": "*", @@ -24,11 +24,11 @@ "ext-zlib": "*", "composer-runtime-api": "^2.2", "async-aws/s3": "^2.6 || ^3.0", - "brick/math": "^0.12 || ^0.13 || ^0.14 || ^0.15 || ^0.16 || ^0.17 || ^0.18 || ^1.0", + "brick/math": "^0.14.2 || ^0.15 || ^0.16 || ^0.17 || ^0.18 || ^1.0", "cmsig/seal": "^0.12", "coduo/php-humanizer": "^5.0", "cuyz/valinor": "^2.4", - "doctrine/dbal": "^4.5", + "doctrine/dbal": "^4.6", "google/apiclient": "^2.13", "google/protobuf": "^4.0 || ^5.0", "halaxa/json-machine": "^1.2", @@ -43,15 +43,15 @@ "psr/http-message": "^1.0 || ^2.0", "psr/log": "^2.0 || ^3.0", "psr/simple-cache": "^1.0 || ^2.0 || ^3.0", - "symfony/config": "^6.4 || ^7.4 || ^8.0", - "symfony/console": "^6.4.34 || ^7.4.6 || ^8.0.6", - "symfony/dependency-injection": "^6.4 || ^7.4 || ^8.0", - "symfony/event-dispatcher": "^6.4 || ^7.4 || ^8.0", - "symfony/http-foundation": "^6.4 || ^7.4 || ^8.0", - "symfony/http-kernel": "^6.4 || ^7.4 || ^8.0", + "symfony/config": "^7.4 || ^8.0", + "symfony/console": "^7.4.6 || ^8.0.6", + "symfony/dependency-injection": "^7.4 || ^8.0", + "symfony/event-dispatcher": "^7.4 || ^8.0", + "symfony/http-foundation": "^7.4 || ^8.0", + "symfony/http-kernel": "^7.4 || ^8.0", "symfony/polyfill-mbstring": "^1.33", - "symfony/string": "^6.4 || ^7.4 || ^8.0", - "symfony/uid": "^6.4 || ^7.4 || ^8.0" + "symfony/string": "^7.4 || ^8.0", + "symfony/uid": "^7.4 || ^8.0" }, "require-dev": { "cmsig/seal-elasticsearch-adapter": "^0.12", @@ -68,31 +68,31 @@ "phpstan/phpstan": "^2.1.34", "ramsey/uuid": "^4.5", "roave/better-reflection": "^6.69", - "symfony/cache": "^6.4 || ^7.4 || ^8.0", - "symfony/clock": "^6.4 || ^7.4 || ^8.0", - "symfony/dotenv": "^6.4 || ^7.4 || ^8.0", - "symfony/filesystem": "^6.4 || ^7.4 || ^8.0", - "symfony/finder": "^6.4 || ^7.4 || ^8.0", - "symfony/framework-bundle": "^6.4 || ^7.4 || ^8.0", - "symfony/http-client": "^6.4 || ^7.4 || ^8.0", - "symfony/lock": "^6.4 || ^7.4 || ^8.0", - "symfony/messenger": "^6.4 || ^7.4 || ^8.0", - "symfony/options-resolver": "^6.4 || ^7.4 || ^8.0", - "symfony/password-hasher": "^6.4 || ^7.4 || ^8.0", + "symfony/cache": "^7.4 || ^8.0", + "symfony/clock": "^7.4 || ^8.0", + "symfony/dotenv": "^7.4 || ^8.0", + "symfony/filesystem": "^7.4 || ^8.0", + "symfony/finder": "^7.4 || ^8.0", + "symfony/framework-bundle": "^7.4 || ^8.0", + "symfony/http-client": "^7.4 || ^8.0", + "symfony/lock": "^7.4 || ^8.0", + "symfony/messenger": "^7.4 || ^8.0", + "symfony/options-resolver": "^7.4 || ^8.0", + "symfony/password-hasher": "^7.4 || ^8.0", "symfony/process": "^7.4 || ^8.0", - "symfony/property-access": "^6.4 || ^7.4 || ^8.0", - "symfony/property-info": "^6.4 || ^7.4 || ^8.0", - "symfony/routing": "^6.4 || ^7.4 || ^8.0", - "symfony/security-bundle": "^6.4 || ^7.4 || ^8.0", - "symfony/security-core": "^6.4 || ^7.4 || ^8.0", - "symfony/security-http": "^6.4 || ^7.4 || ^8.0", - "symfony/serializer": "^6.4 || ^7.4 || ^8.0", - "symfony/twig-bridge": "^6.4 || ^7.4 || ^8.0", - "symfony/twig-bundle": "^6.4 || ^7.4 || ^8.0", - "symfony/var-dumper": "^6.4 || ^7.4 || ^8.0", - "symfony/var-exporter": "^6.4 || ^7.4 || ^8.0", - "symfony/web-profiler-bundle": "^6.4 || ^7.4 || ^8.0", - "symfony/yaml": "^6.4 || ^7.4 || ^8.0", + "symfony/property-access": "^7.4 || ^8.0", + "symfony/property-info": "^7.4 || ^8.0", + "symfony/routing": "^7.4 || ^8.0", + "symfony/security-bundle": "^7.4 || ^8.0", + "symfony/security-core": "^7.4 || ^8.0", + "symfony/security-http": "^7.4 || ^8.0", + "symfony/serializer": "^7.4 || ^8.0", + "symfony/twig-bridge": "^7.4 || ^8.0", + "symfony/twig-bundle": "^7.4 || ^8.0", + "symfony/var-dumper": "^7.4 || ^8.0", + "symfony/var-exporter": "^7.4 || ^8.0", + "symfony/web-profiler-bundle": "^7.4 || ^8.0", + "symfony/yaml": "^7.4 || ^8.0", "twig/twig": "^3.0" }, "replace": { diff --git a/composer.lock b/composer.lock index 9b90f99acd..a938165887 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cf8471e5757659d804ff7eb347ce6453", + "content-hash": "63b79363f9accc9cb91a7d117350ecfa", "packages": [ { "name": "async-aws/core", @@ -76,7 +76,8 @@ "type": "github" } ], - "time": "2026-09-09T11:10:02+00:00" + "time": "2026-09-09T11:10:02+00:00", + "published-time": "2026-09-09T11:13:13+00:00" }, { "name": "async-aws/s3", @@ -141,7 +142,8 @@ "type": "github" } ], - "time": "2026-09-09T11:10:02+00:00" + "time": "2026-09-09T11:10:02+00:00", + "published-time": "2026-09-09T11:13:04+00:00" }, { "name": "brick/math", @@ -201,7 +203,8 @@ "type": "github" } ], - "time": "2026-09-12T10:28:18+00:00" + "time": "2026-09-12T10:28:18+00:00", + "published-time": "2026-09-12T12:23:30+00:00" }, { "name": "cmsig/seal", @@ -276,7 +279,8 @@ "type": "github" } ], - "time": "2026-10-15T12:25:02+00:00" + "time": "2026-10-15T12:25:02+00:00", + "published-time": "2026-10-16T08:49:08+00:00" }, { "name": "coduo/php-humanizer", @@ -343,7 +347,8 @@ "type": "github" } ], - "time": "2025-12-11T20:13:52+00:00" + "time": "2025-12-11T20:13:52+00:00", + "published-time": "2025-12-11T21:35:07+00:00" }, { "name": "cuyz/valinor", @@ -425,20 +430,21 @@ "type": "github" } ], - "time": "2026-11-19T15:08:51+00:00" + "time": "2026-11-19T15:08:51+00:00", + "published-time": "2026-11-19T15:22:15+00:00" }, { "name": "doctrine/dbal", - "version": "4.5.0", + "version": "4.6.0", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "c435cd7ea33e17d2a89288caf994cf3d4549b879" + "reference": "1b56fbfb22704712786fea81ff4bb156fcc6427e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/c435cd7ea33e17d2a89288caf994cf3d4549b879", - "reference": "c435cd7ea33e17d2a89288caf994cf3d4549b879", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/1b56fbfb22704712786fea81ff4bb156fcc6427e", + "reference": "1b56fbfb22704712786fea81ff4bb156fcc6427e", "shasum": "" }, "require": { @@ -451,14 +457,15 @@ "doctrine/coding-standard": "14.0.0", "fig/log-test": "^1", "jetbrains/phpstorm-stubs": "2023.2", - "phpstan/phpstan": "2.1.30", + "phpstan/phpstan": "2.3.4", "phpstan/phpstan-phpunit": "2.0.7", "phpstan/phpstan-strict-rules": "^2", "phpunit/phpunit": "11.5.56", "slevomat/coding-standard": "8.31.1", "squizlabs/php_codesniffer": "4.0.4", "symfony/cache": "^6.3.8|^7.0|^8.0", - "symfony/console": "^5.4|^6.3|^7.0|^8.0" + "symfony/console": "^5.4|^6.3|^7.0|^8.0", + "symfony/service-contracts": "^2.2 || ^3.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." @@ -515,7 +522,7 @@ ], "support": { "issues": "https://github.com/doctrine/dbal/issues", - "source": "https://github.com/doctrine/dbal/tree/4.5.0" + "source": "https://github.com/doctrine/dbal/tree/4.6.0" }, "funding": [ { @@ -531,7 +538,8 @@ "type": "tidelift" } ], - "time": "2026-09-24T16:11:26+00:00" + "time": "2026-11-14T18:08:09+00:00", + "published-time": "2026-11-14T18:18:19+00:00" }, { "name": "doctrine/deprecations", @@ -579,20 +587,21 @@ "issues": "https://github.com/doctrine/deprecations/issues", "source": "https://github.com/doctrine/deprecations/tree/1.2.0" }, - "time": "2026-11-11T10:04:49+00:00" + "time": "2026-11-11T10:04:49+00:00", + "published-time": "2026-11-11T10:12:24+00:00" }, { "name": "firebase/php-jwt", - "version": "v7.2.1", + "version": "v7.2.2", "source": { "type": "git", "url": "https://github.com/googleapis/php-jwt.git", - "reference": "0501f5729b9e2448516674aff07c7d1727869b8e" + "reference": "99efeb17d6def8c0295777f2d45b07ff4fdb4e40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/php-jwt/zipball/0501f5729b9e2448516674aff07c7d1727869b8e", - "reference": "0501f5729b9e2448516674aff07c7d1727869b8e", + "url": "https://api.github.com/repos/googleapis/php-jwt/zipball/99efeb17d6def8c0295777f2d45b07ff4fdb4e40", + "reference": "99efeb17d6def8c0295777f2d45b07ff4fdb4e40", "shasum": "" }, "require": { @@ -651,9 +660,10 @@ ], "support": { "issues": "https://github.com/googleapis/php-jwt/issues", - "source": "https://github.com/googleapis/php-jwt/tree/v7.2.1" + "source": "https://github.com/googleapis/php-jwt/tree/v7.2.2" }, - "time": "2026-09-28T17:51:46+00:00" + "time": "2026-11-17T00:25:19+00:00", + "published-time": "2026-11-17T19:16:00+00:00" }, { "name": "google/apiclient", @@ -724,20 +734,21 @@ "issues": "https://github.com/googleapis/google-api-php-client/issues", "source": "https://github.com/googleapis/google-api-php-client/tree/v2.20.1" }, - "time": "2026-09-25T18:54:19+00:00" + "time": "2026-09-25T18:54:19+00:00", + "published-time": "2026-09-25T18:54:32+00:00" }, { "name": "google/apiclient-services", - "version": "v0.467.0", + "version": "v0.468.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-api-php-client-services.git", - "reference": "f6c99f89b7f4d85e882fe68ed8fe3149d6e8a609" + "reference": "761ffc3214b8ec3159d710f2fb19df3967c78ad2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/f6c99f89b7f4d85e882fe68ed8fe3149d6e8a609", - "reference": "f6c99f89b7f4d85e882fe68ed8fe3149d6e8a609", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/761ffc3214b8ec3159d710f2fb19df3967c78ad2", + "reference": "761ffc3214b8ec3159d710f2fb19df3967c78ad2", "shasum": "" }, "require": { @@ -766,9 +777,10 @@ ], "support": { "issues": "https://github.com/googleapis/google-api-php-client-services/issues", - "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.467.0" + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.468.0" }, - "time": "2026-11-16T01:08:16+00:00" + "time": "2026-11-23T01:00:38+00:00", + "published-time": "2026-11-23T01:23:42+00:00" }, { "name": "google/auth", @@ -838,7 +850,8 @@ "issues": "https://github.com/googleapis/google-auth-library-php/issues", "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.55.3" }, - "time": "2026-10-28T23:00:54+00:00" + "time": "2026-10-28T23:00:54+00:00", + "published-time": "2026-10-29T13:53:15+00:00" }, { "name": "google/protobuf", @@ -882,26 +895,27 @@ "support": { "source": "https://github.com/protocolbuffers/protobuf-php/tree/v5.36.2" }, - "time": "2026-09-17T15:56:42+00:00" + "time": "2026-09-17T15:56:42+00:00", + "published-time": "2026-09-17T15:56:48+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.16.2", + "version": "7.17.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "22e3847536750e5a7b89d4f880f28aaf7b72e287" + "reference": "fb9a458ae0be20eb36c5d16fefdf3ee4e303f080" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/22e3847536750e5a7b89d4f880f28aaf7b72e287", - "reference": "22e3847536750e5a7b89d4f880f28aaf7b72e287", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/fb9a458ae0be20eb36c5d16fefdf3ee4e303f080", + "reference": "fb9a458ae0be20eb36c5d16fefdf3ee4e303f080", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^2.6", - "guzzlehttp/psr7": "^2.13.3", + "guzzlehttp/promises": "^2.6.2", + "guzzlehttp/psr7": "^2.13.6", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.5 || ^3.0", @@ -994,7 +1008,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.16.2" + "source": "https://github.com/guzzle/guzzle/tree/7.17.2" }, "funding": [ { @@ -1010,20 +1024,21 @@ "type": "tidelift" } ], - "time": "2026-11-17T03:22:11+00:00" + "time": "2026-12-01T23:28:22+00:00", + "published-time": "2026-12-01T23:29:35+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.6.0", + "version": "2.6.2", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "3d88c829bd5f13d13847b39067dbf09a60af2154" + "reference": "72e93ed2b1f3d8c09d1460c950bd5726face7ccd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/3d88c829bd5f13d13847b39067dbf09a60af2154", - "reference": "3d88c829bd5f13d13847b39067dbf09a60af2154", + "url": "https://api.github.com/repos/guzzle/promises/zipball/72e93ed2b1f3d8c09d1460c950bd5726face7ccd", + "reference": "72e93ed2b1f3d8c09d1460c950bd5726face7ccd", "shasum": "" }, "require": { @@ -1078,7 +1093,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.6.0" + "source": "https://github.com/guzzle/promises/tree/2.6.2" }, "funding": [ { @@ -1094,20 +1109,21 @@ "type": "tidelift" } ], - "time": "2026-10-18T12:46:59+00:00" + "time": "2026-11-21T03:45:23+00:00", + "published-time": "2026-11-21T03:46:19+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.13.3", + "version": "2.13.6", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "6d3cd8285a97eaa352956a4ada92fa03ecce1c4e" + "reference": "2bd3dccf56e99cdacf74b1ad5e06a08a5a7739f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/6d3cd8285a97eaa352956a4ada92fa03ecce1c4e", - "reference": "6d3cd8285a97eaa352956a4ada92fa03ecce1c4e", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/2bd3dccf56e99cdacf74b1ad5e06a08a5a7739f2", + "reference": "2bd3dccf56e99cdacf74b1ad5e06a08a5a7739f2", "shasum": "" }, "require": { @@ -1197,7 +1213,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.13.3" + "source": "https://github.com/guzzle/psr7/tree/2.13.6" }, "funding": [ { @@ -1213,7 +1229,8 @@ "type": "tidelift" } ], - "time": "2026-11-12T15:57:42+00:00" + "time": "2026-11-21T23:48:40+00:00", + "published-time": "2026-11-21T23:49:39+00:00" }, { "name": "halaxa/json-machine", @@ -1275,7 +1292,8 @@ "type": "other" } ], - "time": "2026-11-21T15:26:54+00:00" + "time": "2026-11-21T15:26:54+00:00", + "published-time": "2026-11-21T15:27:01+00:00" }, { "name": "monolog/monolog", @@ -1380,20 +1398,21 @@ "type": "tidelift" } ], - "time": "2026-11-16T10:43:05+00:00" + "time": "2026-11-16T10:43:05+00:00", + "published-time": "2026-11-16T10:45:37+00:00" }, { "name": "openspout/openspout", - "version": "v5.3.0", + "version": "v5.15.4", "source": { "type": "git", "url": "https://github.com/openspout/openspout.git", - "reference": "bc0d2cdefa3fa90c7caceb778192654b20f414f7" + "reference": "52094ff9a2fb0cf1e1fc21dcf6770fed4e72ef3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/openspout/openspout/zipball/bc0d2cdefa3fa90c7caceb778192654b20f414f7", - "reference": "bc0d2cdefa3fa90c7caceb778192654b20f414f7", + "url": "https://api.github.com/repos/openspout/openspout/zipball/52094ff9a2fb0cf1e1fc21dcf6770fed4e72ef3e", + "reference": "52094ff9a2fb0cf1e1fc21dcf6770fed4e72ef3e", "shasum": "" }, "require": { @@ -1402,21 +1421,25 @@ "ext-libxml": "*", "ext-xmlreader": "*", "ext-zip": "*", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0" + "php": "~8.4.0 || ~8.5.0 || ~8.6.0" }, "require-dev": { + "ext-fileinfo": "*", + "ext-mbstring": "*", + "ext-openssl": "*", "ext-zlib": "*", - "friendsofphp/php-cs-fixer": "^3.93.1", - "infection/infection": "^0.32.3", - "phpbench/phpbench": "^1.4.3", - "phpstan/phpstan": "^2.1.38", - "phpstan/phpstan-phpunit": "^2.0.12", - "phpstan/phpstan-strict-rules": "^2.0.8", - "phpunit/phpunit": "^12.5.8" + "friendsofphp/php-cs-fixer": "^3.95.32", + "infection/infection": "^0.35.12", + "phpbench/phpbench": "^1.7.1", + "phpstan/phpstan": "^2.3.7", + "phpstan/phpstan-phpunit": "^2.1.3", + "phpstan/phpstan-strict-rules": "^2.1.2", + "phpunit/phpunit": "^13.4.8" }, "suggest": { "ext-iconv": "To handle non UTF-8 CSV files (if \"php-mbstring\" is not already installed or is too limited)", - "ext-mbstring": "To handle non UTF-8 CSV files (if \"iconv\" is not already installed)" + "ext-mbstring": "To handle non UTF-8 CSV files (if \"iconv\" is not already installed)", + "ext-openssl": "To read and write password-protected XLSX files" }, "type": "library", "extra": { @@ -1460,7 +1483,7 @@ ], "support": { "issues": "https://github.com/openspout/openspout/issues", - "source": "https://github.com/openspout/openspout/tree/v5.3.0" + "source": "https://github.com/openspout/openspout/tree/v5.15.4" }, "funding": [ { @@ -1472,7 +1495,8 @@ "type": "github" } ], - "time": "2026-02-02T13:08:39+00:00" + "time": "2026-11-26T15:03:06+00:00", + "published-time": "2026-11-26T15:03:39+00:00" }, { "name": "packaged/thrift", @@ -1511,20 +1535,21 @@ "issues": "https://github.com/packaged/thrift/issues", "source": "https://github.com/packaged/thrift/tree/0.15.0" }, - "time": "2021-09-23T10:34:40+00:00" + "time": "2021-09-23T10:34:40+00:00", + "published-time": "2021-09-23T10:35:14+00:00" }, { "name": "paragonie/constant_time_encoding", - "version": "v3.1.4", + "version": "v3.1.5", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "5efef6e6cb43e088ccab7d0c1e2f2ab25b9e8b54" + "reference": "ceed38ba49d98b85808edfc4f04750ff61eb9739" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/5efef6e6cb43e088ccab7d0c1e2f2ab25b9e8b54", - "reference": "5efef6e6cb43e088ccab7d0c1e2f2ab25b9e8b54", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/ceed38ba49d98b85808edfc4f04750ff61eb9739", + "reference": "ceed38ba49d98b85808edfc4f04750ff61eb9739", "shasum": "" }, "require": { @@ -1580,20 +1605,21 @@ "issues": "https://github.com/paragonie/constant_time_encoding/issues", "source": "https://github.com/paragonie/constant_time_encoding" }, - "time": "2026-11-06T20:31:19+00:00" + "time": "2026-11-18T13:55:22+00:00", + "published-time": "2026-11-18T13:55:46+00:00" }, { "name": "php-http/discovery", - "version": "1.20.0", + "version": "1.21.0", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d" + "reference": "ada129ac8a187eadcd9ebaaa48ff6f989bd179f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d", - "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d", + "url": "https://api.github.com/repos/php-http/discovery/zipball/ada129ac8a187eadcd9ebaaa48ff6f989bd179f6", + "reference": "ada129ac8a187eadcd9ebaaa48ff6f989bd179f6", "shasum": "" }, "require": { @@ -1613,12 +1639,11 @@ }, "require-dev": { "composer/composer": "^1.0.2|^2.0", - "graham-campbell/phpspec-skip-example-extension": "^5.0", "php-http/httplug": "^1.0 || ^2.0", "php-http/message-factory": "^1.0", - "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3 || ^8.0", "sebastian/comparator": "^3.0.5 || ^4.0.8", - "symfony/phpunit-bridge": "^6.4.4 || ^7.0.1" + "symfony/phpunit-bridge": "^6.4.4 || ^7.0.1 || ^8.0" }, "type": "composer-plugin", "extra": { @@ -1657,9 +1682,10 @@ ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.20.0" + "source": "https://github.com/php-http/discovery/tree/1.21.0" }, - "time": "2024-10-02T11:20:13+00:00" + "time": "2026-11-29T13:21:59+00:00", + "published-time": "2026-11-29T13:22:22+00:00" }, { "name": "phpseclib/phpseclib", @@ -1775,7 +1801,8 @@ "type": "tidelift" } ], - "time": "2026-11-20T07:41:04+00:00" + "time": "2026-11-20T07:41:04+00:00", + "published-time": "2026-11-20T07:46:17+00:00" }, { "name": "psr/cache", @@ -1824,7 +1851,8 @@ "support": { "source": "https://github.com/php-fig/cache/tree/3.0.0" }, - "time": "2021-02-03T23:26:27+00:00" + "time": "2021-02-03T23:26:27+00:00", + "published-time": "2021-02-03T23:27:34+00:00" }, { "name": "psr/clock", @@ -1872,7 +1900,8 @@ "issues": "https://github.com/php-fig/clock/issues", "source": "https://github.com/php-fig/clock/tree/1.0.0" }, - "time": "2022-11-25T14:36:26+00:00" + "time": "2022-11-25T14:36:26+00:00", + "published-time": "2022-11-25T14:59:22+00:00" }, { "name": "psr/container", @@ -2029,7 +2058,8 @@ "support": { "source": "https://github.com/php-fig/http-client" }, - "time": "2023-09-23T14:17:50+00:00" + "time": "2023-09-23T14:17:50+00:00", + "published-time": "2023-09-23T14:18:12+00:00" }, { "name": "psr/http-factory", @@ -2084,7 +2114,8 @@ "support": { "source": "https://github.com/php-fig/http-factory" }, - "time": "2024-04-15T12:06:14+00:00" + "time": "2024-04-15T12:06:14+00:00", + "published-time": "2024-05-10T07:32:19+00:00" }, { "name": "psr/http-message", @@ -2137,7 +2168,8 @@ "support": { "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2023-04-04T09:54:51+00:00" + "time": "2023-04-04T09:54:51+00:00", + "published-time": "2023-04-04T09:55:35+00:00" }, { "name": "psr/log", @@ -2187,7 +2219,8 @@ "support": { "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2024-09-11T13:17:53+00:00" + "time": "2024-09-11T13:17:53+00:00", + "published-time": "2024-09-11T13:21:14+00:00" }, { "name": "psr/simple-cache", @@ -2238,7 +2271,8 @@ "support": { "source": "https://github.com/php-fig/simple-cache/tree/3.0.0" }, - "time": "2021-10-29T13:26:27+00:00" + "time": "2021-10-29T13:26:27+00:00", + "published-time": "2021-10-29T13:27:19+00:00" }, { "name": "ralouphie/getallheaders", @@ -2282,38 +2316,38 @@ "issues": "https://github.com/ralouphie/getallheaders/issues", "source": "https://github.com/ralouphie/getallheaders/tree/develop" }, - "time": "2019-03-08T08:55:37+00:00" + "time": "2019-03-08T08:55:37+00:00", + "published-time": "2019-03-08T09:01:32+00:00" }, { "name": "symfony/config", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "8ef666abf731e85e59cf478929dda6c7cb2fa9c4" + "reference": "f1a8e636c695d52f5dd39ce989375eca3f9024eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/8ef666abf731e85e59cf478929dda6c7cb2fa9c4", - "reference": "8ef666abf731e85e59cf478929dda6c7cb2fa9c4", + "url": "https://api.github.com/repos/symfony/config/zipball/f1a8e636c695d52f5dd39ce989375eca3f9024eb", + "reference": "f1a8e636c695d52f5dd39ce989375eca3f9024eb", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/filesystem": "^7.1|^8.0", - "symfony/polyfill-ctype": "~1.8" + "symfony/filesystem": "^7.4|^8.0", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/finder": "<6.4", "symfony/service-contracts": "<2.5" }, "require-dev": { - "symfony/event-dispatcher": "^6.4|^7.0|^8.0", - "symfony/finder": "^6.4|^7.0|^8.0", - "symfony/messenger": "^6.4|^7.0|^8.0", + "symfony/event-dispatcher": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", "symfony/service-contracts": "^2.5|^3", - "symfony/yaml": "^6.4|^7.0|^8.0" + "symfony/yaml": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2341,7 +2375,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v7.4.23" + "source": "https://github.com/symfony/config/tree/v8.2.0" }, "funding": [ { @@ -2361,51 +2395,54 @@ "type": "tidelift" } ], - "time": "2026-11-04T08:27:22+00:00" + "time": "2026-11-23T10:37:23+00:00", + "published-time": "2026-11-28T12:12:57+00:00" }, { "name": "symfony/console", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "81957c2440c05c962fe8291f318de6e85f8db330" + "reference": "ea1860277087a43c75a02591d71a5a217682f494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/81957c2440c05c962fe8291f318de6e85f8db330", - "reference": "81957c2440c05c962fe8291f318de6e85f8db330", + "url": "https://api.github.com/repos/symfony/console/zipball/ea1860277087a43c75a02591d71a5a217682f494", + "reference": "ea1860277087a43c75a02591d71a5a217682f494", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php85": "^1.33", "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^7.2|^8.0" + "symfony/string": "^7.4.6|^8.0.6" }, "conflict": { - "symfony/dependency-injection": "<6.4", - "symfony/dotenv": "<6.4", - "symfony/event-dispatcher": "<6.4", - "symfony/lock": "<6.4", - "symfony/process": "<6.4" + "symfony/dependency-injection": "<8.2", + "symfony/event-dispatcher": "<8.1" }, "provide": { "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/event-dispatcher": "^6.4|^7.0|^8.0", - "symfony/http-foundation": "^6.4|^7.0|^8.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/lock": "^6.4|^7.0|^8.0", - "symfony/messenger": "^6.4|^7.0|^8.0", - "symfony/process": "^6.4|^7.0|^8.0", - "symfony/stopwatch": "^6.4|^7.0|^8.0", - "symfony/var-dumper": "^6.4|^7.0|^8.0" + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^8.2", + "symfony/event-dispatcher": "^8.1", + "symfony/filesystem": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/lock": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/mime": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/uid": "^7.4|^8.0", + "symfony/validator": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2439,7 +2476,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.4.23" + "source": "https://github.com/symfony/console/tree/v8.2.0" }, "funding": [ { @@ -2459,43 +2496,44 @@ "type": "tidelift" } ], - "time": "2026-11-03T21:47:07+00:00" + "time": "2026-11-24T16:01:15+00:00", + "published-time": "2026-11-28T12:13:07+00:00" }, { "name": "symfony/dependency-injection", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "4df0d83a8253d95b222c2f136b9dca3a1a9451a7" + "reference": "52cd089850293e423f640a79a2dea81405ecc710" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/4df0d83a8253d95b222c2f136b9dca3a1a9451a7", - "reference": "4df0d83a8253d95b222c2f136b9dca3a1a9451a7", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/52cd089850293e423f640a79a2dea81405ecc710", + "reference": "52cd089850293e423f640a79a2dea81405ecc710", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "psr/container": "^1.1|^2.0", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/service-contracts": "^3.6", - "symfony/var-exporter": "^6.4.20|^7.2.5|^8.0" + "symfony/service-contracts": "^3.8.1", + "symfony/var-exporter": "^8.1" }, "conflict": { "ext-psr": "<1.1|>=2", - "symfony/config": "<6.4", - "symfony/finder": "<6.4", - "symfony/yaml": "<6.4" + "symfony/config": "<8.2", + "symfony/http-kernel": "<8.2" }, "provide": { "psr/container-implementation": "1.1|2.0", "symfony/service-implementation": "1.1|2.0|3.0" }, "require-dev": { - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/yaml": "^6.4|^7.0|^8.0" + "symfony/config": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/routing": "^8.2", + "symfony/yaml": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2523,7 +2561,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v7.4.23" + "source": "https://github.com/symfony/dependency-injection/tree/v8.2.0" }, "funding": [ { @@ -2543,7 +2581,8 @@ "type": "tidelift" } ], - "time": "2026-11-01T17:38:00+00:00" + "time": "2026-11-26T07:29:52+00:00", + "published-time": "2026-11-28T12:12:17+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2619,33 +2658,32 @@ }, { "name": "symfony/error-handler", - "version": "v7.4.22", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "545852cfe9c4979c82389155b4d8d05f8864e4f1" + "reference": "ea571e24449e210a6b1f0d292f8374c95f63731f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/545852cfe9c4979c82389155b4d8d05f8864e4f1", - "reference": "545852cfe9c4979c82389155b4d8d05f8864e4f1", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/ea571e24449e210a6b1f0d292f8374c95f63731f", + "reference": "ea571e24449e210a6b1f0d292f8374c95f63731f", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "psr/log": "^1|^2|^3", "symfony/polyfill-php85": "^1.32", - "symfony/var-dumper": "^6.4|^7.0|^8.0" + "symfony/var-dumper": "^8.1" }, "conflict": { - "symfony/deprecation-contracts": "<2.5", - "symfony/http-kernel": "<6.4" + "symfony/deprecation-contracts": "<2.5" }, "require-dev": { - "symfony/console": "^6.4|^7.0|^8.0", + "symfony/console": "^7.4|^8.0", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/serializer": "^6.4|^7.0|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/serializer": "^7.4|^8.0", "symfony/webpack-encore-bundle": "^1.0|^2.0" }, "bin": [ @@ -2677,7 +2715,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v7.4.22" + "source": "https://github.com/symfony/error-handler/tree/v8.2.0" }, "funding": [ { @@ -2697,29 +2735,31 @@ "type": "tidelift" } ], - "time": "2026-10-25T14:40:16+00:00", - "published-time": "2026-10-28T18:20:15+00:00" + "time": "2026-11-27T14:48:42+00:00", + "published-time": "2026-11-28T12:13:29+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v7.4.17", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "d269974ee93c61d03620ffee358355bfdb471d66" + "reference": "b18c4241475a44e262ceee9066eac8927324a64c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d269974ee93c61d03620ffee358355bfdb471d66", - "reference": "d269974ee93c61d03620ffee358355bfdb471d66", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b18c4241475a44e262ceee9066eac8927324a64c", + "reference": "b18c4241475a44e262ceee9066eac8927324a64c", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/event-dispatcher-contracts": "^2.5|^3" + "php": ">=8.4.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/event-dispatcher-contracts": "^3.8.1" }, "conflict": { - "symfony/dependency-injection": "<6.4", + "symfony/dependency-injection": "<8.2", + "symfony/security-http": "<7.4", "symfony/service-contracts": "<2.5" }, "provide": { @@ -2728,14 +2768,15 @@ }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/error-handler": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/framework-bundle": "^6.4|^7.0|^8.0", - "symfony/http-foundation": "^6.4|^7.0|^8.0", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^8.2", + "symfony/error-handler": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/framework-bundle": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", "symfony/service-contracts": "^2.5|^3", - "symfony/stopwatch": "^6.4|^7.0|^8.0" + "symfony/stopwatch": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2763,7 +2804,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v7.4.17" + "source": "https://github.com/symfony/event-dispatcher/tree/v8.2.0" }, "funding": [ { @@ -2783,7 +2824,8 @@ "type": "tidelift" } ], - "time": "2026-08-21T17:40:08+00:00" + "time": "2026-11-04T11:35:44+00:00", + "published-time": "2026-11-28T12:11:10+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -2868,25 +2910,26 @@ }, { "name": "symfony/filesystem", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "53d609da66578dad5a39fe290e8f924ec8f05e93" + "reference": "3225b1890286c7f8f1b48aac013e8762b97679e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/53d609da66578dad5a39fe290e8f924ec8f05e93", - "reference": "53d609da66578dad5a39fe290e8f924ec8f05e93", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/3225b1890286c7f8f1b48aac013e8762b97679e7", + "reference": "3225b1890286c7f8f1b48aac013e8762b97679e7", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.8" }, "require-dev": { - "symfony/process": "^6.4|^7.0|^8.0" + "symfony/process": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2914,7 +2957,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.4.23" + "source": "https://github.com/symfony/filesystem/tree/v8.2.0" }, "funding": [ { @@ -2934,35 +2977,35 @@ "type": "tidelift" } ], - "time": "2026-11-04T08:27:22+00:00" + "time": "2026-11-27T13:28:56+00:00", + "published-time": "2026-11-28T12:12:22+00:00" }, { "name": "symfony/http-client", - "version": "v7.4.25", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "fe047cdc68aee54b315b2f142ab4c0e9c705cefc" + "reference": "88dbd3f478bd5ceca3d177e53a428eb80f3f612f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/fe047cdc68aee54b315b2f142ab4c0e9c705cefc", - "reference": "fe047cdc68aee54b315b2f142ab4c0e9c705cefc", + "url": "https://api.github.com/repos/symfony/http-client/zipball/88dbd3f478bd5ceca3d177e53a428eb80f3f612f", + "reference": "88dbd3f478bd5ceca3d177e53a428eb80f3f612f", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "psr/log": "^1|^2|^3", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/http-client-contracts": "~3.4.4|^3.5.2", - "symfony/polyfill-php83": "^1.29", - "symfony/service-contracts": "^2.5|^3" + "symfony/deprecation-contracts": "^2.5|^3.0", + "symfony/http-client-contracts": "^3.7", + "symfony/service-contracts": "^3.8.1" }, "conflict": { - "amphp/amp": "<2.5", - "amphp/socket": "<1.1", + "amphp/amp": "<3.0.1", "php-http/discovery": "<1.15", - "symfony/http-foundation": "<6.4" + "symfony/config": "<8.2", + "symfony/dependency-injection": "<8.2" }, "provide": { "php-http/async-client-implementation": "*", @@ -2971,21 +3014,24 @@ "symfony/http-client-implementation": "3.0" }, "require-dev": { - "amphp/http-client": "^4.2.1|^5.0", - "amphp/http-tunnel": "^1.0|^2.0", - "guzzlehttp/promises": "^1.4|^2.0", + "amphp/dns": "^2.1.2", + "amphp/http-client": "^5.3.2", + "amphp/http-tunnel": "^2.0", + "amphp/socket": "^2.3.1", + "guzzlehttp/guzzle": "^7.10|^8.0", "nyholm/psr7": "^1.0", "php-http/httplug": "^1.0|^2.0", "psr/http-client": "^1.0", - "symfony/amphp-http-client-meta": "^1.0|^2.0", - "symfony/cache": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/http-foundation": "^6.4.50|^7.4.23|^8.1.11", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/messenger": "^6.4|^7.0|^8.0", - "symfony/process": "^6.4|^7.0|^8.0", - "symfony/rate-limiter": "^6.4|^7.0|^8.0", - "symfony/stopwatch": "^6.4|^7.0|^8.0" + "symfony/cache": "^7.4|^8.0", + "symfony/clock": "^7.4|^8.0", + "symfony/config": "^8.2", + "symfony/dependency-injection": "^8.2", + "symfony/http-foundation": "^7.4.23|^8.1.11", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -3016,7 +3062,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.4.25" + "source": "https://github.com/symfony/http-client/tree/v8.2.0" }, "funding": [ { @@ -3036,8 +3082,8 @@ "type": "tidelift" } ], - "time": "2026-11-27T13:02:26+00:00", - "published-time": "2026-11-27T14:42:41+00:00" + "time": "2026-11-28T11:47:39+00:00", + "published-time": "2026-11-28T12:12:56+00:00" }, { "name": "symfony/http-client-contracts", @@ -3124,37 +3170,37 @@ }, { "name": "symfony/http-foundation", - "version": "v7.4.25", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "1ebfef402856383ce114ff009d4fc961bf290743" + "reference": "1685f3e33f16f0114c3232f470da627090d9ce48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/1ebfef402856383ce114ff009d4fc961bf290743", - "reference": "1ebfef402856383ce114ff009d4fc961bf290743", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/1685f3e33f16f0114c3232f470da627090d9ce48", + "reference": "1685f3e33f16f0114c3232f470da627090d9ce48", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-deepclone": "^1.43.1", "symfony/polyfill-mbstring": "^1.1" }, "conflict": { - "doctrine/dbal": "<3.6", - "symfony/cache": "<6.4.12|>=7.0,<7.1.5" + "doctrine/dbal": "<4.3" }, "require-dev": { - "doctrine/dbal": "^3.6|^4", + "doctrine/dbal": "^4.3", "predis/predis": "^1.1|^2.0", - "symfony/cache": "^6.4.12|^7.1.5|^8.0", - "symfony/clock": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/mime": "^6.4|^7.0|^8.0", - "symfony/rate-limiter": "^6.4|^7.0|^8.0" + "symfony/cache": "^7.4|^8.0", + "symfony/clock": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/mime": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -3182,7 +3228,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.4.25" + "source": "https://github.com/symfony/http-foundation/tree/v8.2.0" }, "funding": [ { @@ -3202,79 +3248,80 @@ "type": "tidelift" } ], - "time": "2026-11-27T13:27:53+00:00", - "published-time": "2026-11-27T14:42:01+00:00" + "time": "2026-11-27T14:09:33+00:00", + "published-time": "2026-11-28T12:13:01+00:00" }, { "name": "symfony/http-kernel", - "version": "v7.4.25", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "b510604a58547c9c28a599a16ad7ab0d8df64076" + "reference": "76872b19c99773485622d973cfa3c0a9bdf5f847" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/b510604a58547c9c28a599a16ad7ab0d8df64076", - "reference": "b510604a58547c9c28a599a16ad7ab0d8df64076", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/76872b19c99773485622d973cfa3c0a9bdf5f847", + "reference": "76872b19c99773485622d973cfa3c0a9bdf5f847", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "psr/log": "^1|^2|^3", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/error-handler": "^6.4|^7.0|^8.0", - "symfony/event-dispatcher": "^7.3|^8.0", - "symfony/http-foundation": "^7.4.24|^8.1.12", + "symfony/error-handler": "^7.4|^8.0", + "symfony/event-dispatcher": "^8.2", + "symfony/http-foundation": "^8.2", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/browser-kit": "<6.4", - "symfony/cache": "<6.4", - "symfony/config": "<6.4", - "symfony/console": "<6.4", - "symfony/dependency-injection": "<6.4", - "symfony/doctrine-bridge": "<6.4", + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.2", "symfony/flex": "<2.10", - "symfony/form": "<6.4", - "symfony/http-client": "<6.4", "symfony/http-client-contracts": "<2.5", - "symfony/mailer": "<6.4", - "symfony/messenger": "<6.4", - "symfony/translation": "<6.4", + "symfony/rate-limiter": "<8.2", + "symfony/routing": "<8.2", + "symfony/serializer": "<7.4.15|>=8.0,<8.0.15|>=8.1,<8.1.2", "symfony/translation-contracts": "<2.5", - "symfony/twig-bridge": "<6.4", - "symfony/validator": "<6.4", - "symfony/var-dumper": "<6.4", - "twig/twig": "<3.12" + "symfony/var-dumper": "<8.2", + "symfony/web-profiler-bundle": "<8.1", + "twig/twig": "<3.21" }, "provide": { "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { + "phpstan/phpdoc-parser": "^1.0|^2.0", "psr/cache": "^1.0|^2.0|^3.0", - "symfony/browser-kit": "^6.4|^7.0|^8.0", - "symfony/clock": "^6.4|^7.0|^8.0", - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/console": "^6.4|^7.0|^8.0", - "symfony/css-selector": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4.1|^7.0.1|^8.0", - "symfony/dom-crawler": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/finder": "^6.4|^7.0|^8.0", + "symfony/browser-kit": "^7.4|^8.0", + "symfony/cache": "^8.2", + "symfony/clock": "^7.4|^8.0", + "symfony/config": "^7.4|^8.0", + "symfony/console": "^8.2", + "symfony/css-selector": "^7.4|^8.0", + "symfony/dependency-injection": "^8.2", + "symfony/dom-crawler": "^7.4|^8.0", + "symfony/expression-language": "^8.2", + "symfony/finder": "^7.4|^8.0", + "symfony/http-client": "^7.4|^8.0", "symfony/http-client-contracts": "^2.5|^3", - "symfony/process": "^6.4|^7.0|^8.0", - "symfony/property-access": "^7.1|^8.0", - "symfony/routing": "^6.4|^7.0|^8.0", - "symfony/serializer": "^7.1|^8.0", - "symfony/stopwatch": "^6.4|^7.0|^8.0", - "symfony/translation": "^6.4|^7.0|^8.0", + "symfony/json-streamer": "^7.4|^8.0", + "symfony/lock": "^7.4|^8.0", + "symfony/object-mapper": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/property-access": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0", + "symfony/routing": "^8.2", + "symfony/serializer": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/translation": "^7.4|^8.0", "symfony/translation-contracts": "^2.5|^3", - "symfony/uid": "^6.4|^7.0|^8.0", - "symfony/validator": "^6.4|^7.0|^8.0", - "symfony/var-dumper": "^6.4|^7.0|^8.0", - "symfony/var-exporter": "^6.4|^7.0|^8.0", - "twig/twig": "^3.12|^4.0" + "symfony/type-info": "^7.4|^8.0", + "symfony/uid": "^7.4|^8.0", + "symfony/validator": "^7.4|^8.0", + "symfony/var-dumper": "^8.2", + "symfony/var-exporter": "^7.4|^8.0", + "twig/twig": "^3.21|^4.0" }, "type": "library", "autoload": { @@ -3302,7 +3349,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v7.4.25" + "source": "https://github.com/symfony/http-kernel/tree/v8.2.0" }, "funding": [ { @@ -3322,8 +3369,8 @@ "type": "tidelift" } ], - "time": "2026-11-27T14:40:20+00:00", - "published-time": "2026-11-27T14:42:30+00:00" + "time": "2026-11-28T12:09:59+00:00", + "published-time": "2026-11-28T12:13:18+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3410,24 +3457,27 @@ "published-time": "2026-04-26T14:44:50+00:00" }, { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.43.3", + "name": "symfony/polyfill-deepclone", + "version": "v1.43.2", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "5a8f33c87aeecffce24e721b5064fab05f4becf8" + "url": "https://github.com/symfony/polyfill-deepclone.git", + "reference": "82274308b59f6e96f53a3fb37fc40877d843e5a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/5a8f33c87aeecffce24e721b5064fab05f4becf8", - "reference": "5a8f33c87aeecffce24e721b5064fab05f4becf8", + "url": "https://api.github.com/repos/symfony/polyfill-deepclone/zipball/82274308b59f6e96f53a3fb37fc40877d843e5a5", + "reference": "82274308b59f6e96f53a3fb37fc40877d843e5a5", "shasum": "" }, "require": { - "php": ">=7.2" + "php": ">=8.1" + }, + "provide": { + "ext-deepclone": "*" }, "suggest": { - "ext-intl": "For best performance" + "ext-deepclone": "For best performance" }, "type": "library", "extra": { @@ -3441,8 +3491,11 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - } + "Symfony\\Polyfill\\DeepClone\\": "" + }, + "classmap": [ + "Resources/stubs" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3458,18 +3511,17 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for intl's grapheme_* functions", + "description": "Symfony polyfill for the deepclone extension", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "grapheme", - "intl", + "deepclone", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.43.3" + "source": "https://github.com/symfony/polyfill-deepclone/tree/v1.43.2" }, "funding": [ { @@ -3489,20 +3541,21 @@ "type": "tidelift" } ], - "time": "2026-10-15T09:18:53+00:00" + "time": "2026-10-14T07:17:09+00:00", + "published-time": "2026-10-14T09:42:25+00:00" }, { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.43.0", + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.43.3", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "ebd57ccc7edb93d632e184efbe7693d2517bab3b" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "5a8f33c87aeecffce24e721b5064fab05f4becf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/ebd57ccc7edb93d632e184efbe7693d2517bab3b", - "reference": "ebd57ccc7edb93d632e184efbe7693d2517bab3b", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/5a8f33c87aeecffce24e721b5064fab05f4becf8", + "reference": "5a8f33c87aeecffce24e721b5064fab05f4becf8", "shasum": "" }, "require": { @@ -3523,11 +3576,8 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "classmap": [ - "Resources/stubs" - ] + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3543,18 +3593,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for intl's Normalizer class and related functions", + "description": "Symfony polyfill for intl's grapheme_* functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "grapheme", "intl", - "normalizer", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.43.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.43.3" }, "funding": [ { @@ -3574,31 +3624,28 @@ "type": "tidelift" } ], - "time": "2026-09-23T22:02:09+00:00" + "time": "2026-10-15T09:18:53+00:00", + "published-time": "2026-10-28T10:07:44+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.43.3", + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.43.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "122889ed24dc000165bcbfd77ec412f15cbdfc6a" + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "ebd57ccc7edb93d632e184efbe7693d2517bab3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/122889ed24dc000165bcbfd77ec412f15cbdfc6a", - "reference": "122889ed24dc000165bcbfd77ec412f15cbdfc6a", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/ebd57ccc7edb93d632e184efbe7693d2517bab3b", + "reference": "ebd57ccc7edb93d632e184efbe7693d2517bab3b", "shasum": "" }, "require": { - "ext-iconv": "*", "php": ">=7.2" }, - "provide": { - "ext-mbstring": "*" - }, "suggest": { - "ext-mbstring": "For best performance" + "ext-intl": "For best performance" }, "type": "library", "extra": { @@ -3612,8 +3659,11 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -3629,17 +3679,18 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony polyfill for intl's Normalizer class and related functions", "homepage": "https://symfony.com", "keywords": [ "compatibility", - "mbstring", + "intl", + "normalizer", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.43.3" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.43.0" }, "funding": [ { @@ -3659,25 +3710,33 @@ "type": "tidelift" } ], - "time": "2026-10-28T09:35:49+00:00" + "time": "2026-09-23T22:02:09+00:00", + "published-time": "2026-09-30T10:23:47+00:00" }, { - "name": "symfony/polyfill-php80", - "version": "v1.43.0", + "name": "symfony/polyfill-mbstring", + "version": "v1.43.3", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "9c6a5d6b01ca51d486c813e9a9c0ed55f208bb74" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "122889ed24dc000165bcbfd77ec412f15cbdfc6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/9c6a5d6b01ca51d486c813e9a9c0ed55f208bb74", - "reference": "9c6a5d6b01ca51d486c813e9a9c0ed55f208bb74", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/122889ed24dc000165bcbfd77ec412f15cbdfc6a", + "reference": "122889ed24dc000165bcbfd77ec412f15cbdfc6a", "shasum": "" }, "require": { + "ext-iconv": "*", "php": ">=7.2" }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, "type": "library", "extra": { "thanks": { @@ -3690,21 +3749,14 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "classmap": [ - "Resources/stubs" - ] + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -3714,16 +3766,17 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "description": "Symfony polyfill for the Mbstring extension", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "mbstring", "polyfill", "portable", "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.43.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.43.3" }, "funding": [ { @@ -3743,21 +3796,21 @@ "type": "tidelift" } ], - "time": "2026-09-25T15:50:05+00:00", - "published-time": "2026-09-30T10:23:35+00:00" + "time": "2026-10-28T09:35:49+00:00", + "published-time": "2026-10-28T10:07:45+00:00" }, { - "name": "symfony/polyfill-php82", + "name": "symfony/polyfill-php80", "version": "v1.43.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php82.git", - "reference": "843bbe8b2a7934307b749751eede0f111f5d1cfc" + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "9c6a5d6b01ca51d486c813e9a9c0ed55f208bb74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php82/zipball/843bbe8b2a7934307b749751eede0f111f5d1cfc", - "reference": "843bbe8b2a7934307b749751eede0f111f5d1cfc", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/9c6a5d6b01ca51d486c813e9a9c0ed55f208bb74", + "reference": "9c6a5d6b01ca51d486c813e9a9c0ed55f208bb74", "shasum": "" }, "require": { @@ -3775,7 +3828,7 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Php82\\": "" + "Symfony\\Polyfill\\Php80\\": "" }, "classmap": [ "Resources/stubs" @@ -3786,6 +3839,10 @@ "MIT" ], "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -3795,7 +3852,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.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", @@ -3804,7 +3861,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php82/tree/v1.43.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.43.0" }, "funding": [ { @@ -3824,20 +3881,21 @@ "type": "tidelift" } ], - "time": "2026-09-25T15:50:05+00:00" + "time": "2026-09-25T15:50:05+00:00", + "published-time": "2026-09-30T10:23:35+00:00" }, { - "name": "symfony/polyfill-php83", + "name": "symfony/polyfill-php82", "version": "v1.43.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php83.git", - "reference": "80ccff923a8d61f73ebe9da0aa94e25232f004ce" + "url": "https://github.com/symfony/polyfill-php82.git", + "reference": "843bbe8b2a7934307b749751eede0f111f5d1cfc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/80ccff923a8d61f73ebe9da0aa94e25232f004ce", - "reference": "80ccff923a8d61f73ebe9da0aa94e25232f004ce", + "url": "https://api.github.com/repos/symfony/polyfill-php82/zipball/843bbe8b2a7934307b749751eede0f111f5d1cfc", + "reference": "843bbe8b2a7934307b749751eede0f111f5d1cfc", "shasum": "" }, "require": { @@ -3855,7 +3913,7 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Php83\\": "" + "Symfony\\Polyfill\\Php82\\": "" }, "classmap": [ "Resources/stubs" @@ -3875,7 +3933,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 8.2+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -3884,7 +3942,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php83/tree/v1.43.0" + "source": "https://github.com/symfony/polyfill-php82/tree/v1.43.0" }, "funding": [ { @@ -3905,7 +3963,7 @@ } ], "time": "2026-09-25T15:50:05+00:00", - "published-time": "2026-09-30T10:23:43+00:00" + "published-time": "2026-09-30T10:23:32+00:00" }, { "name": "symfony/polyfill-php85", @@ -3988,89 +4046,6 @@ "time": "2026-10-30T15:20:09+00:00", "published-time": "2026-11-15T14:20:22+00:00" }, - { - "name": "symfony/polyfill-uuid", - "version": "v1.43.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-uuid.git", - "reference": "b23ff8245cc5c4479ea2be3d0132d2e6dd433993" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/b23ff8245cc5c4479ea2be3d0132d2e6dd433993", - "reference": "b23ff8245cc5c4479ea2be3d0132d2e6dd433993", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-uuid": "*" - }, - "suggest": { - "ext-uuid": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Uuid\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Grégoire Pineau", - "email": "lyrixx@lyrixx.info" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for uuid functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "uuid" - ], - "support": { - "source": "https://github.com/symfony/polyfill-uuid/tree/v1.43.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-09-24T05:20:52+00:00" - }, { "name": "symfony/service-contracts", "version": "v3.8.1", @@ -4161,35 +4136,34 @@ }, { "name": "symfony/string", - "version": "v7.4.22", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "8dff7da3a56638f1d189c5368183294102de4ced" + "reference": "24a5a339853a0742edfc8a456d55e3314d489555" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/8dff7da3a56638f1d189c5368183294102de4ced", - "reference": "8dff7da3a56638f1d189c5368183294102de4ced", + "url": "https://api.github.com/repos/symfony/string/zipball/24a5a339853a0742edfc8a456d55e3314d489555", + "reference": "24a5a339853a0742edfc8a456d55e3314d489555", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-intl-grapheme": "~1.33", - "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=8.4.1", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-intl-grapheme": "^1.33", + "symfony/polyfill-intl-normalizer": "^1.0", + "symfony/polyfill-mbstring": "^1.0" }, "conflict": { "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/emoji": "^7.1|^8.0", - "symfony/http-client": "^6.4|^7.0|^8.0", - "symfony/intl": "^6.4|^7.0|^8.0", + "symfony/emoji": "^7.4|^8.0", + "symfony/http-client": "^7.4|^8.0", + "symfony/intl": "^7.4|^8.0", "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^6.4|^7.0|^8.0" + "symfony/var-exporter": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -4228,7 +4202,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.4.22" + "source": "https://github.com/symfony/string/tree/v8.2.0" }, "funding": [ { @@ -4248,56 +4222,56 @@ "type": "tidelift" } ], - "time": "2026-10-23T16:51:52+00:00" + "time": "2026-11-27T13:28:56+00:00", + "published-time": "2026-11-28T12:12:38+00:00" }, { "name": "symfony/translation", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "00dc42a2c904e95433825c7b58fe24c08550d1c8" + "reference": "264c617ec5632d333b0802fa17c3736ecce72125" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/00dc42a2c904e95433825c7b58fe24c08550d1c8", - "reference": "00dc42a2c904e95433825c7b58fe24c08550d1c8", + "url": "https://api.github.com/repos/symfony/translation/zipball/264c617ec5632d333b0802fa17c3736ecce72125", + "reference": "264c617ec5632d333b0802fa17c3736ecce72125", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^2.5.3|^3.3" + "php": ">=8.4.1", + "symfony/polyfill-mbstring": "^1.0", + "symfony/translation-contracts": "^3.6.1" }, "conflict": { "nikic/php-parser": "<5.0", - "symfony/config": "<6.4", - "symfony/console": "<6.4", - "symfony/dependency-injection": "<6.4", + "symfony/config": "<8.2", + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.2", + "symfony/framework-bundle": "<8.2", "symfony/http-client-contracts": "<2.5", - "symfony/http-kernel": "<6.4", - "symfony/service-contracts": "<2.5", - "symfony/twig-bundle": "<6.4", - "symfony/yaml": "<6.4" + "symfony/service-contracts": "<2.5" }, "provide": { "symfony/translation-implementation": "2.3|3.0" }, "require-dev": { "nikic/php-parser": "^5.0", + "psr/container": "^1.1|^2.0", "psr/log": "^1|^2|^3", - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/console": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/finder": "^6.4|^7.0|^8.0", + "symfony/config": "^8.2", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^8.2", + "symfony/finder": "^7.4|^8.0", + "symfony/framework-bundle": "^8.2", "symfony/http-client-contracts": "^2.5|^3.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/intl": "^6.4|^7.0|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/intl": "^7.4|^8.0", "symfony/polyfill-intl-icu": "^1.21", - "symfony/routing": "^6.4|^7.0|^8.0", + "symfony/routing": "^7.4|^8.0", "symfony/service-contracts": "^2.5|^3", - "symfony/yaml": "^6.4|^7.0|^8.0" + "symfony/yaml": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -4328,7 +4302,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v7.4.23" + "source": "https://github.com/symfony/translation/tree/v8.2.0" }, "funding": [ { @@ -4348,7 +4322,8 @@ "type": "tidelift" } ], - "time": "2026-11-01T22:26:51+00:00" + "time": "2026-11-26T07:35:06+00:00", + "published-time": "2026-11-28T12:11:43+00:00" }, { "name": "symfony/translation-contracts", @@ -4430,28 +4405,35 @@ "type": "tidelift" } ], - "time": "2026-10-03T08:17:19+00:00" + "time": "2026-10-03T08:17:19+00:00", + "published-time": "2026-11-04T11:25:31+00:00" }, { "name": "symfony/uid", - "version": "v7.4.21", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/uid.git", - "reference": "3e706a245b5343ea93be9cafe84525bfb54e60fc" + "reference": "99e23541e3c9f3ef266be02ff7556671bbdd4544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/uid/zipball/3e706a245b5343ea93be9cafe84525bfb54e60fc", - "reference": "3e706a245b5343ea93be9cafe84525bfb54e60fc", + "url": "https://api.github.com/repos/symfony/uid/zipball/99e23541e3c9f3ef266be02ff7556671bbdd4544", + "reference": "99e23541e3c9f3ef266be02ff7556671bbdd4544", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/polyfill-uuid": "^1.15" + "php": ">=8.4.1" + }, + "conflict": { + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.1" }, "require-dev": { - "symfony/console": "^6.4|^7.0|^8.0" + "symfony/config": "^7.4|^8.0", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^8.1", + "symfony/http-kernel": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -4488,7 +4470,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/uid/tree/v7.4.21" + "source": "https://github.com/symfony/uid/tree/v8.2.0" }, "funding": [ { @@ -4508,35 +4490,37 @@ "type": "tidelift" } ], - "time": "2026-10-12T14:31:36+00:00" + "time": "2026-10-22T16:53:57+00:00", + "published-time": "2026-11-28T12:13:01+00:00" }, { "name": "symfony/var-dumper", - "version": "v7.4.22", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "6e6ff33ea8cf5df27f00a5561ebd5ee9bd7f1618" + "reference": "459bfdcf52cdea470ff75ce9a81b91acf6b90964" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/6e6ff33ea8cf5df27f00a5561ebd5ee9bd7f1618", - "reference": "6e6ff33ea8cf5df27f00a5561ebd5ee9bd7f1618", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/459bfdcf52cdea470ff75ce9a81b91acf6b90964", + "reference": "459bfdcf52cdea470ff75ce9a81b91acf6b90964", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=8.4.1", + "symfony/polyfill-mbstring": "^1.0" }, "conflict": { - "symfony/console": "<6.4" + "symfony/console": "<8.2", + "symfony/error-handler": "<7.4" }, "require-dev": { - "symfony/console": "^6.4|^7.0|^8.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/process": "^6.4|^7.0|^8.0", - "symfony/uid": "^6.4|^7.0|^8.0", + "symfony/console": "^8.2", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/uid": "^7.4|^8.0", "twig/twig": "^3.12|^4.0" }, "bin": [ @@ -4575,7 +4559,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v7.4.22" + "source": "https://github.com/symfony/var-dumper/tree/v8.2.0" }, "funding": [ { @@ -4595,30 +4579,32 @@ "type": "tidelift" } ], - "time": "2026-10-25T21:04:04+00:00" + "time": "2026-11-12T10:33:36+00:00", + "published-time": "2026-11-28T12:12:43+00:00" }, { "name": "symfony/var-exporter", - "version": "v7.4.22", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "6c967db30708068f6eaedb6ed37973bd86de2241" + "reference": "928c131f248af2221532d33c389d06b4575e9b38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/6c967db30708068f6eaedb6ed37973bd86de2241", - "reference": "6c967db30708068f6eaedb6ed37973bd86de2241", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/928c131f248af2221532d33c389d06b4575e9b38", + "reference": "928c131f248af2221532d33c389d06b4575e9b38", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3" + "php": ">=8.4.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-deepclone": "^1.43.1" }, "require-dev": { - "symfony/property-access": "^6.4|^7.0|^8.0", - "symfony/serializer": "^6.4|^7.0|^8.0", - "symfony/var-dumper": "^6.4|^7.0|^8.0" + "symfony/property-access": "^7.4|^8.0", + "symfony/serializer": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -4643,11 +4629,12 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Allows exporting any serializable PHP data structure to plain PHP code", + "description": "Provides tools to export, instantiate, hydrate, clone and lazy-load PHP objects", "homepage": "https://symfony.com", "keywords": [ "clone", "construct", + "deep-clone", "export", "hydrate", "instantiate", @@ -4656,7 +4643,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v7.4.22" + "source": "https://github.com/symfony/var-exporter/tree/v8.2.0" }, "funding": [ { @@ -4676,7 +4663,8 @@ "type": "tidelift" } ], - "time": "2026-10-22T14:50:44+00:00" + "time": "2026-10-22T14:35:59+00:00", + "published-time": "2026-11-28T12:12:42+00:00" } ], "packages-dev": [ @@ -4744,7 +4732,8 @@ "type": "github" } ], - "time": "2023-12-20T15:40:13+00:00" + "time": "2023-12-20T15:40:13+00:00", + "published-time": "2023-12-20T15:43:41+00:00" }, { "name": "cmsig/seal-elasticsearch-adapter", @@ -4821,7 +4810,8 @@ "type": "github" } ], - "time": "2026-10-15T12:25:02+00:00" + "time": "2026-10-15T12:25:02+00:00", + "published-time": "2026-10-16T08:49:10+00:00" }, { "name": "cmsig/seal-memory-adapter", @@ -4892,7 +4882,8 @@ "type": "github" } ], - "time": "2026-10-15T12:25:02+00:00" + "time": "2026-10-15T12:25:02+00:00", + "published-time": "2026-10-16T08:49:24+00:00" }, { "name": "composer/semver", @@ -4969,7 +4960,8 @@ "type": "github" } ], - "time": "2026-10-29T09:13:34+00:00" + "time": "2026-10-29T09:13:34+00:00", + "published-time": "2026-10-29T09:14:11+00:00" }, { "name": "elastic/transport", @@ -5027,7 +5019,8 @@ "issues": "https://github.com/elastic/elastic-transport-php/issues", "source": "https://github.com/elastic/elastic-transport-php/tree/v8.11.1" }, - "time": "2026-10-22T14:57:01+00:00" + "time": "2026-10-22T14:57:01+00:00", + "published-time": "2026-10-22T14:57:39+00:00" }, { "name": "elasticsearch/elasticsearch", @@ -5084,7 +5077,8 @@ "issues": "https://github.com/elastic/elasticsearch-php/issues", "source": "https://github.com/elastic/elasticsearch-php/tree/v8.19.0" }, - "time": "2025-08-06T16:58:06+00:00" + "time": "2025-08-06T16:58:06+00:00", + "published-time": "2025-08-06T17:07:33+00:00" }, { "name": "fakerphp/faker", @@ -5147,7 +5141,8 @@ "issues": "https://github.com/FakerPHP/Faker/issues", "source": "https://github.com/FakerPHP/Faker/tree/v1.24.1" }, - "time": "2024-11-21T13:46:39+00:00" + "time": "2024-11-21T13:46:39+00:00", + "published-time": "2024-11-21T13:47:18+00:00" }, { "name": "fig/log-test", @@ -5196,20 +5191,21 @@ "issues": "https://github.com/php-fig/log-test/issues", "source": "https://github.com/php-fig/log-test/tree/1.2.1" }, - "time": "2025-11-11T10:33:05+00:00" + "time": "2025-11-11T10:33:05+00:00", + "published-time": "2025-11-11T10:34:27+00:00" }, { "name": "grpc/grpc", - "version": "1.85.0", + "version": "1.86.0", "source": { "type": "git", "url": "https://github.com/grpc/grpc-php.git", - "reference": "08bd482ca6f99d45fa85ad0bd70876e7455e39cf" + "reference": "9a57c4cf4f9f4a810747b6683c930809cd28ab0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/grpc/grpc-php/zipball/08bd482ca6f99d45fa85ad0bd70876e7455e39cf", - "reference": "08bd482ca6f99d45fa85ad0bd70876e7455e39cf", + "url": "https://api.github.com/repos/grpc/grpc-php/zipball/9a57c4cf4f9f4a810747b6683c930809cd28ab0a", + "reference": "9a57c4cf4f9f4a810747b6683c930809cd28ab0a", "shasum": "" }, "require": { @@ -5238,22 +5234,23 @@ "rpc" ], "support": { - "source": "https://github.com/grpc/grpc-php/tree/v1.85.0" + "source": "https://github.com/grpc/grpc-php/tree/v1.86.0" }, - "time": "2026-10-28T05:30:17+00:00" + "time": "2026-11-30T14:01:08+00:00", + "published-time": "2026-11-30T14:01:14+00:00" }, { "name": "jetbrains/phpstorm-stubs", - "version": "v2025.3", + "version": "v2026.2", "source": { "type": "git", "url": "https://github.com/JetBrains/phpstorm-stubs", - "reference": "d1ee5e570343bd4276a3d5959e6e1c2530b006d0" + "reference": "709e512210784a7c0a677b3a89d35def844a59b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/d1ee5e570343bd4276a3d5959e6e1c2530b006d0", - "reference": "d1ee5e570343bd4276a3d5959e6e1c2530b006d0", + "url": "https://api.github.com/repos/JetBrains/phpstorm-stubs/zipball/709e512210784a7c0a677b3a89d35def844a59b9", + "reference": "709e512210784a7c0a677b3a89d35def844a59b9", "shasum": "" }, "require-dev": { @@ -5284,20 +5281,21 @@ "stubs", "type" ], - "time": "2025-09-18T15:47:24+00:00" + "time": "2026-06-12T13:19:10+00:00", + "published-time": "2026-07-22T11:41:13+00:00" }, { "name": "nikic/php-parser", - "version": "v5.9.0", + "version": "v5.10.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def" + "reference": "95d3450d7b8421795182fb4e310aa3c949423fa7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9e33da9553fe7786f0962b35f4e4ecf01be89def", - "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/95d3450d7b8421795182fb4e310aa3c949423fa7", + "reference": "95d3450d7b8421795182fb4e310aa3c949423fa7", "shasum": "" }, "require": { @@ -5339,22 +5337,23 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.9.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.10.0" }, - "time": "2026-09-13T18:51:52+00:00" + "time": "2026-11-28T17:47:43+00:00", + "published-time": "2026-11-28T17:48:41+00:00" }, { "name": "nyholm/psr7", - "version": "1.8.2", + "version": "1.8.3", "source": { "type": "git", "url": "https://github.com/Nyholm/psr7.git", - "reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3" + "reference": "26c1581611614447a5ff753a450390a23f3e323e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Nyholm/psr7/zipball/a71f2b11690f4b24d099d6b16690a90ae14fc6f3", - "reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3", + "url": "https://api.github.com/repos/Nyholm/psr7/zipball/26c1581611614447a5ff753a450390a23f3e323e", + "reference": "26c1581611614447a5ff753a450390a23f3e323e", "shasum": "" }, "require": { @@ -5407,7 +5406,7 @@ ], "support": { "issues": "https://github.com/Nyholm/psr7/issues", - "source": "https://github.com/Nyholm/psr7/tree/1.8.2" + "source": "https://github.com/Nyholm/psr7/tree/1.8.3" }, "funding": [ { @@ -5419,20 +5418,21 @@ "type": "github" } ], - "time": "2024-09-09T07:06:30+00:00" + "time": "2026-11-26T08:19:16+00:00", + "published-time": "2026-11-26T08:20:50+00:00" }, { "name": "open-telemetry/api", - "version": "1.11.0", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/api.git", - "reference": "bc169d9ecd11858e941657770dc708c6a15fc5f4" + "reference": "2dace793114f43ce879c15cbbd34411add11272d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/bc169d9ecd11858e941657770dc708c6a15fc5f4", - "reference": "bc169d9ecd11858e941657770dc708c6a15fc5f4", + "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/2dace793114f43ce879c15cbbd34411add11272d", + "reference": "2dace793114f43ce879c15cbbd34411add11272d", "shasum": "" }, "require": { @@ -5459,7 +5459,7 @@ ] }, "branch-alias": { - "dev-main": "1.11.x-dev" + "dev-main": "1.13.x-dev" } }, "autoload": { @@ -5496,7 +5496,8 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2026-11-05T11:54:49+00:00" + "time": "2026-11-26T01:07:02+00:00", + "published-time": "2026-11-26T01:12:13+00:00" }, { "name": "open-telemetry/context", @@ -5554,7 +5555,8 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2026-11-05T11:54:49+00:00" + "time": "2026-11-05T11:54:49+00:00", + "published-time": "2026-11-05T12:00:45+00:00" }, { "name": "php-http/client-common", @@ -5621,7 +5623,8 @@ "issues": "https://github.com/php-http/client-common/issues", "source": "https://github.com/php-http/client-common/tree/2.7.3" }, - "time": "2025-11-29T19:12:34+00:00" + "time": "2025-11-29T19:12:34+00:00", + "published-time": "2025-11-29T19:13:36+00:00" }, { "name": "php-http/curl-client", @@ -5686,7 +5689,8 @@ "issues": "https://github.com/php-http/curl-client/issues", "source": "https://github.com/php-http/curl-client/tree/2.4.0" }, - "time": "2025-12-09T12:02:56+00:00" + "time": "2025-12-09T12:02:56+00:00", + "published-time": "2025-12-09T12:03:28+00:00" }, { "name": "php-http/httplug", @@ -5743,7 +5747,8 @@ "issues": "https://github.com/php-http/httplug/issues", "source": "https://github.com/php-http/httplug/tree/2.4.1" }, - "time": "2024-09-23T11:39:58+00:00" + "time": "2024-09-23T11:39:58+00:00", + "published-time": "2024-09-23T11:40:47+00:00" }, { "name": "php-http/message", @@ -5812,7 +5817,8 @@ "issues": "https://github.com/php-http/message/issues", "source": "https://github.com/php-http/message/tree/1.16.2" }, - "time": "2024-10-02T11:34:13+00:00" + "time": "2024-10-02T11:34:13+00:00", + "published-time": "2024-10-02T11:35:49+00:00" }, { "name": "php-http/mock-client", @@ -5874,7 +5880,8 @@ "issues": "https://github.com/php-http/mock-client/issues", "source": "https://github.com/php-http/mock-client/tree/1.6.1" }, - "time": "2024-10-31T10:30:18+00:00" + "time": "2024-10-31T10:30:18+00:00", + "published-time": "2024-10-31T10:30:48+00:00" }, { "name": "php-http/promise", @@ -5926,15 +5933,16 @@ "issues": "https://github.com/php-http/promise/issues", "source": "https://github.com/php-http/promise/tree/1.3.1" }, - "time": "2024-03-15T13:55:21+00:00" + "time": "2024-03-15T13:55:21+00:00", + "published-time": "2024-03-15T13:55:45+00:00" }, { "name": "phpstan/phpstan", - "version": "2.3.6", + "version": "2.3.7", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/00cedebb76cc82c1592414fa4f616cefdccda16f", - "reference": "00cedebb76cc82c1592414fa4f616cefdccda16f", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/90c91c2498849ab8cc4e873864bbf1cb2bf6ea12", + "reference": "90c91c2498849ab8cc4e873864bbf1cb2bf6ea12", "shasum": "" }, "require": { @@ -5990,7 +5998,8 @@ "type": "github" } ], - "time": "2026-11-15T19:58:26+00:00" + "time": "2026-11-19T10:31:11+00:00", + "published-time": "2026-11-19T10:31:27+00:00" }, { "name": "ramsey/collection", @@ -6066,7 +6075,8 @@ "issues": "https://github.com/ramsey/collection/issues", "source": "https://github.com/ramsey/collection/tree/2.1.1" }, - "time": "2025-03-22T05:38:12+00:00" + "time": "2025-03-22T05:38:12+00:00", + "published-time": "2025-03-22T05:39:22+00:00" }, { "name": "ramsey/uuid", @@ -6143,34 +6153,35 @@ "issues": "https://github.com/ramsey/uuid/issues", "source": "https://github.com/ramsey/uuid/tree/4.10.0" }, - "time": "2026-11-14T23:23:20+00:00" + "time": "2026-11-14T23:23:20+00:00", + "published-time": "2026-11-14T23:35:39+00:00" }, { "name": "roave/better-reflection", - "version": "6.69.0", + "version": "6.75.0", "source": { "type": "git", "url": "https://github.com/Roave/BetterReflection.git", - "reference": "dccbd10b5b3da8718f2945ad50faf90a1cb2db55" + "reference": "b68eed282302be0278a2615ccb4448a9c9d1d4c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/BetterReflection/zipball/dccbd10b5b3da8718f2945ad50faf90a1cb2db55", - "reference": "dccbd10b5b3da8718f2945ad50faf90a1cb2db55", + "url": "https://api.github.com/repos/Roave/BetterReflection/zipball/b68eed282302be0278a2615ccb4448a9c9d1d4c3", + "reference": "b68eed282302be0278a2615ccb4448a9c9d1d4c3", "shasum": "" }, "require": { "ext-json": "*", - "jetbrains/phpstorm-stubs": "2025.3", - "nikic/php-parser": "^5.7.0", - "php": "~8.3.2 || ~8.4.1 || ~8.5.0" + "jetbrains/phpstorm-stubs": "2026.2", + "nikic/php-parser": "^5.9.0", + "php": "~8.4.1 || ~8.5.0 || ~8.6.0" }, "conflict": { "thecodingmachine/safe": "<1.1.3" }, "require-dev": { - "phpbench/phpbench": "^1.4.3", - "phpunit/phpunit": "^12.5.8" + "phpbench/phpbench": "^1.7.0", + "phpunit/phpunit": "^13.4.3" }, "suggest": { "composer/composer": "Required to use the ComposerSourceLocator" @@ -6210,39 +6221,40 @@ "description": "Better Reflection - an improved code reflection API", "support": { "issues": "https://github.com/Roave/BetterReflection/issues", - "source": "https://github.com/Roave/BetterReflection/tree/6.69.0" + "source": "https://github.com/Roave/BetterReflection/tree/6.75.0" }, - "time": "2026-02-01T13:20:30+00:00" + "time": "2026-10-17T21:34:56+00:00", + "published-time": "2026-10-17T21:38:19+00:00" }, { "name": "symfony/cache", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "bbaa2ca4a93a94532285bdd5a0caf225d34ff578" + "reference": "b11f6d367bf69cd717f7a9ad276ce732820d24a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/bbaa2ca4a93a94532285bdd5a0caf225d34ff578", - "reference": "bbaa2ca4a93a94532285bdd5a0caf225d34ff578", + "url": "https://api.github.com/repos/symfony/cache/zipball/b11f6d367bf69cd717f7a9ad276ce732820d24a6", + "reference": "b11f6d367bf69cd717f7a9ad276ce732820d24a6", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "psr/cache": "^2.0|^3.0", "psr/log": "^1.1|^2|^3", - "symfony/cache-contracts": "^3.6", - "symfony/deprecation-contracts": "^2.5|^3", + "symfony/cache-contracts": "^3.8.1", "symfony/service-contracts": "^2.5|^3", - "symfony/var-exporter": "^6.4|^7.0|^8.0" + "symfony/var-exporter": "^8.1.1" }, "conflict": { - "doctrine/dbal": "<3.6", + "ext-redis": "<6.1", "ext-relay": "<0.12.1", - "symfony/dependency-injection": "<6.4", - "symfony/http-kernel": "<6.4", - "symfony/var-dumper": "<6.4" + "symfony/config": "<8.2", + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.2", + "symfony/framework-bundle": "<8.2" }, "provide": { "psr/cache-implementation": "2.0|3.0", @@ -6250,17 +6262,19 @@ "symfony/cache-implementation": "1.1|2.0|3.0" }, "require-dev": { - "cache/integration-tests": "^1.0.3", - "doctrine/dbal": "^3.6|^4", + "cache/integration-tests": "^1.0.5", + "doctrine/dbal": "^4.3", "predis/predis": "^1.1|^2.0", + "psr/clock": "^1.0", "psr/simple-cache": "^1.0|^2.0|^3.0", - "symfony/clock": "^6.4|^7.0|^8.0", - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/filesystem": "^6.4|^7.0|^8.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/messenger": "^6.4|^7.0|^8.0", - "symfony/var-dumper": "^6.4|^7.0|^8.0" + "symfony/clock": "^7.4|^8.0", + "symfony/config": "^8.2", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^8.2", + "symfony/filesystem": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -6295,7 +6309,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v7.4.23" + "source": "https://github.com/symfony/cache/tree/v8.2.0" }, "funding": [ { @@ -6315,7 +6329,8 @@ "type": "tidelift" } ], - "time": "2026-11-01T22:26:51+00:00" + "time": "2026-11-27T14:09:33+00:00", + "published-time": "2026-11-28T12:11:56+00:00" }, { "name": "symfony/cache-contracts", @@ -6395,26 +6410,26 @@ "type": "tidelift" } ], - "time": "2026-09-26T07:05:14+00:00" + "time": "2026-09-26T07:05:14+00:00", + "published-time": "2026-11-04T11:25:38+00:00" }, { "name": "symfony/clock", - "version": "v7.4.21", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/clock.git", - "reference": "07437f612dca89c1894c1db04491002b1e798f03" + "reference": "7e6b34563da2870b8041066a12f21e2f69101458" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/clock/zipball/07437f612dca89c1894c1db04491002b1e798f03", - "reference": "07437f612dca89c1894c1db04491002b1e798f03", + "url": "https://api.github.com/repos/symfony/clock/zipball/7e6b34563da2870b8041066a12f21e2f69101458", + "reference": "7e6b34563da2870b8041066a12f21e2f69101458", "shasum": "" }, "require": { - "php": ">=8.2", - "psr/clock": "^1.0", - "symfony/polyfill-php83": "^1.28" + "php": ">=8.4.1", + "psr/clock": "^1.0" }, "provide": { "psr/clock-implementation": "1.0" @@ -6453,7 +6468,7 @@ "time" ], "support": { - "source": "https://github.com/symfony/clock/tree/v7.4.21" + "source": "https://github.com/symfony/clock/tree/v8.2.0" }, "funding": [ { @@ -6473,32 +6488,32 @@ "type": "tidelift" } ], - "time": "2026-10-12T14:31:36+00:00" + "time": "2026-10-12T14:32:11+00:00", + "published-time": "2026-11-28T12:13:22+00:00" }, { "name": "symfony/dotenv", - "version": "v7.4.18", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "99b5b14953237c89ed24f1af5ba34225caf598a4" + "reference": "1da3ae3c05f4ea227986ad01dcb8d9190b7bafaa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/99b5b14953237c89ed24f1af5ba34225caf598a4", - "reference": "99b5b14953237c89ed24f1af5ba34225caf598a4", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/1da3ae3c05f4ea227986ad01dcb8d9190b7bafaa", + "reference": "1da3ae3c05f4ea227986ad01dcb8d9190b7bafaa", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.4.1" }, "conflict": { - "symfony/console": "<6.4", - "symfony/process": "<6.4" + "symfony/console": "<8.2" }, "require-dev": { - "symfony/console": "^6.4|^7.0|^8.0", - "symfony/process": "^6.4|^7.0|^8.0" + "symfony/console": "^8.2", + "symfony/process": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -6531,7 +6546,7 @@ "environment" ], "support": { - "source": "https://github.com/symfony/dotenv/tree/v7.4.18" + "source": "https://github.com/symfony/dotenv/tree/v8.2.0" }, "funding": [ { @@ -6551,27 +6566,28 @@ "type": "tidelift" } ], - "time": "2026-07-26T10:22:28+00:00" + "time": "2026-10-22T16:53:57+00:00", + "published-time": "2026-11-28T12:12:28+00:00" }, { "name": "symfony/finder", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "c723f990aefe8c1053b18374faf4231eba84f518" + "reference": "79610bbc37de349047f9a85676f6aa5ce4308e51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/c723f990aefe8c1053b18374faf4231eba84f518", - "reference": "c723f990aefe8c1053b18374faf4231eba84f518", + "url": "https://api.github.com/repos/symfony/finder/zipball/79610bbc37de349047f9a85676f6aa5ce4308e51", + "reference": "79610bbc37de349047f9a85676f6aa5ce4308e51", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.4.1" }, "require-dev": { - "symfony/filesystem": "^6.4|^7.0|^8.0" + "symfony/filesystem": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -6599,7 +6615,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.4.23" + "source": "https://github.com/symfony/finder/tree/v8.2.0" }, "funding": [ { @@ -6619,116 +6635,127 @@ "type": "tidelift" } ], - "time": "2026-11-02T10:56:49+00:00" + "time": "2026-11-27T14:09:33+00:00", + "published-time": "2026-11-28T12:12:27+00:00" }, { "name": "symfony/framework-bundle", - "version": "v7.4.24", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "9014dc179c0d9b91d86849e3318202b2a1e92353" + "reference": "44303ae3c7d1938e7de77bd92bf1235e9986f80e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/9014dc179c0d9b91d86849e3318202b2a1e92353", - "reference": "9014dc179c0d9b91d86849e3318202b2a1e92353", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/44303ae3c7d1938e7de77bd92bf1235e9986f80e", + "reference": "44303ae3c7d1938e7de77bd92bf1235e9986f80e", "shasum": "" }, "require": { "composer-runtime-api": ">=2.1", "ext-xml": "*", - "php": ">=8.2", - "symfony/cache": "^6.4.12|^7.0|^8.0", - "symfony/config": "^7.4.4|^8.0.4", - "symfony/dependency-injection": "^7.4.15|~8.0.15|^8.1.2", + "php": ">=8.4.1", + "symfony/cache": "^8.2", + "symfony/config": "^8.2", + "symfony/dependency-injection": "^8.2", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/error-handler": "^7.3|^8.0", - "symfony/event-dispatcher": "^6.4|^7.0|^8.0", - "symfony/filesystem": "^7.1|^8.0", - "symfony/finder": "^6.4|^7.0|^8.0", - "symfony/http-foundation": "^7.4.23|^8.1.11", - "symfony/http-kernel": "^7.4|^8.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php85": "^1.32", - "symfony/routing": "^7.4|^8.0" + "symfony/error-handler": "^7.4|^8.0", + "symfony/event-dispatcher": "^8.2", + "symfony/filesystem": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", + "symfony/http-foundation": "^8.2", + "symfony/http-kernel": "^8.2", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php85": "^1.33", + "symfony/routing": "^8.2", + "symfony/service-contracts": "^3.7.1", + "symfony/var-exporter": "^8.1.1" }, "conflict": { "doctrine/persistence": "<1.3", "phpdocumentor/reflection-docblock": "<5.2|>=7", "phpdocumentor/type-resolver": "<1.5.1", - "symfony/asset": "<6.4", - "symfony/asset-mapper": "<6.4", - "symfony/clock": "<6.4", - "symfony/console": "<6.4.43|>=7.0,<7.4.15|>=8.0,<8.0.15", - "symfony/dom-crawler": "<6.4", - "symfony/dotenv": "<6.4", - "symfony/form": "<7.4", - "symfony/http-client": "<6.4", - "symfony/lock": "<6.4", - "symfony/mailer": "<6.4.44|>=7.0,<7.4.17|>=8.0,<8.1.5", - "symfony/messenger": "<7.4", - "symfony/mime": "<6.4.37|>=7.0,<7.4.9|>=8.0,<8.0.9", - "symfony/property-access": "<6.4", - "symfony/property-info": "<6.4", - "symfony/runtime": "<6.4.13|>=7.0,<7.1.6", - "symfony/scheduler": "<6.4.4|>=7.0.0,<7.0.4", - "symfony/security-core": "<6.4", - "symfony/security-csrf": "<7.2", - "symfony/serializer": "<7.2.5", - "symfony/stopwatch": "<6.4", - "symfony/translation": "<7.3", - "symfony/twig-bridge": "<6.4", - "symfony/twig-bundle": "<6.4", - "symfony/validator": "<6.4", - "symfony/web-profiler-bundle": "<6.4", - "symfony/webhook": "<7.4", - "symfony/workflow": "<7.4" + "symfony/asset": "<8.2", + "symfony/asset-mapper": "<8.2", + "symfony/console": "<8.2", + "symfony/form": "<8.2", + "symfony/html-sanitizer": "<8.2", + "symfony/http-client": "<8.2", + "symfony/json-path": "<8.2", + "symfony/json-streamer": "<8.2", + "symfony/key-management": "<8.2", + "symfony/lock": "<8.2", + "symfony/mailer": "<8.2", + "symfony/messenger": "<8.2", + "symfony/mime": "<8.2", + "symfony/notifier": "<8.2", + "symfony/object-mapper": "<8.2", + "symfony/process": "<8.2", + "symfony/property-access": "<8.2", + "symfony/property-info": "<8.2", + "symfony/rate-limiter": "<8.2", + "symfony/remote-event": "<8.2", + "symfony/scheduler": "<8.2", + "symfony/security-csrf": "<7.4", + "symfony/semaphore": "<8.2", + "symfony/serializer": "<8.2", + "symfony/translation": "<8.2", + "symfony/type-info": "<8.2", + "symfony/uid": "<8.2", + "symfony/validator": "<8.2", + "symfony/web-link": "<8.2", + "symfony/webhook": "<8.2", + "symfony/workflow": "<8.2" }, "require-dev": { "dragonmantank/cron-expression": "^3.1", + "opis/json-schema": "^2.6", "phpdocumentor/reflection-docblock": "^5.2|^6.0", + "phpstan/phpdoc-parser": "^1.0|^2.0", "seld/jsonlint": "^1.10", - "symfony/asset": "^6.4|^7.0|^8.0", - "symfony/asset-mapper": "^6.4|^7.0|^8.0", - "symfony/browser-kit": "^6.4|^7.0|^8.0", - "symfony/clock": "^6.4|^7.0|^8.0", - "symfony/console": "^6.4.43|^7.4.15|^8.0.15", - "symfony/css-selector": "^6.4|^7.0|^8.0", - "symfony/dom-crawler": "^6.4|^7.0|^8.0", - "symfony/dotenv": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", + "symfony/asset": "^8.2", + "symfony/asset-mapper": "^8.2", + "symfony/browser-kit": "^7.4|^8.0", + "symfony/clock": "^7.4|^8.0", + "symfony/console": "^8.2", + "symfony/css-selector": "^7.4|^8.0", + "symfony/dom-crawler": "^7.4|^8.0", + "symfony/dotenv": "^7.4|^8.0", + "symfony/expression-language": "^8.2", "symfony/form": "^7.4|^8.0", - "symfony/html-sanitizer": "^6.4|^7.0|^8.0", - "symfony/http-client": "^6.4|^7.0|^8.0", - "symfony/json-streamer": "^7.3|^8.0", - "symfony/lock": "^6.4|^7.0|^8.0", - "symfony/mailer": "^6.4|^7.0|^8.0", - "symfony/messenger": "^7.4|^8.0", - "symfony/mime": "^6.4.37|^7.4.9|^8.0.9", - "symfony/notifier": "^6.4|^7.0|^8.0", - "symfony/object-mapper": "^7.3|^8.0", - "symfony/polyfill-intl-icu": "~1.0", - "symfony/process": "^6.4|^7.0|^8.0", - "symfony/property-info": "^6.4|^7.0|^8.0", - "symfony/rate-limiter": "^6.4|^7.0|^8.0", - "symfony/runtime": "^6.4.13|^7.1.6|^8.0", - "symfony/scheduler": "^6.4.4|^7.0.4|^8.0", - "symfony/security-bundle": "^6.4|^7.0|^8.0", - "symfony/semaphore": "^6.4|^7.0|^8.0", - "symfony/serializer": "^7.2.5|^8.0", - "symfony/stopwatch": "^6.4|^7.0|^8.0", - "symfony/string": "^6.4|^7.0|^8.0", - "symfony/translation": "^7.3|^8.0", - "symfony/twig-bundle": "^6.4|^7.0|^8.0", - "symfony/type-info": "^7.1.8|^8.0", - "symfony/uid": "^6.4|^7.0|^8.0", - "symfony/validator": "^7.4|^8.0", - "symfony/web-link": "^6.4|^7.0|^8.0", - "symfony/webhook": "^7.4|^8.0", - "symfony/workflow": "^7.4|^8.0", - "symfony/yaml": "^7.3|^8.0", - "twig/twig": "^3.12|^4.0" + "symfony/html-sanitizer": "^8.2", + "symfony/http-client": "^8.2", + "symfony/json-streamer": "^8.2", + "symfony/key-management": "^8.2", + "symfony/lock": "^8.2", + "symfony/mailer": "^8.2", + "symfony/messenger": "^8.2", + "symfony/mime": "^8.2", + "symfony/notifier": "^8.2", + "symfony/object-mapper": "^8.2", + "symfony/polyfill-intl-icu": "^1.0", + "symfony/process": "^8.2", + "symfony/property-access": "^8.2", + "symfony/property-info": "^8.2", + "symfony/rate-limiter": "^8.2", + "symfony/remote-event": "^8.2", + "symfony/runtime": "^7.4|^8.0", + "symfony/scheduler": "^8.2", + "symfony/security-bundle": "^7.4|^8.0", + "symfony/semaphore": "^8.2", + "symfony/serializer": "^8.2", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/string": "^7.4|^8.0", + "symfony/translation": "^8.2", + "symfony/twig-bundle": "^7.4|^8.0", + "symfony/type-info": "^8.2", + "symfony/uid": "^8.2", + "symfony/validator": "^8.2", + "symfony/web-link": "^8.2", + "symfony/webhook": "^8.2", + "symfony/workflow": "^8.2", + "symfony/yaml": "^7.4|^8.0" }, "type": "symfony-bundle", "autoload": { @@ -6756,7 +6783,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v7.4.24" + "source": "https://github.com/symfony/framework-bundle/tree/v8.2.0" }, "funding": [ { @@ -6776,34 +6803,37 @@ "type": "tidelift" } ], - "time": "2026-11-24T18:01:43+00:00", - "published-time": "2026-11-25T09:24:55+00:00" + "time": "2026-11-27T13:35:08+00:00", + "published-time": "2026-11-28T12:12:39+00:00" }, { "name": "symfony/lock", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/lock.git", - "reference": "1c89b44cf414dfb98e2f83a02b6a7487ccedeb17" + "reference": "39862b1c3fe5d874ba4f6979ace2f06791df0524" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/lock/zipball/1c89b44cf414dfb98e2f83a02b6a7487ccedeb17", - "reference": "1c89b44cf414dfb98e2f83a02b6a7487ccedeb17", + "url": "https://api.github.com/repos/symfony/lock/zipball/39862b1c3fe5d874ba4f6979ace2f06791df0524", + "reference": "39862b1c3fe5d874ba4f6979ace2f06791df0524", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "psr/log": "^1|^2|^3" }, "conflict": { - "doctrine/dbal": "<3.6", - "symfony/cache": "<6.4" + "doctrine/dbal": "<4.3", + "symfony/config": "<8.2", + "symfony/dependency-injection": "<8.2" }, "require-dev": { - "doctrine/dbal": "^3.6|^4", + "doctrine/dbal": "^4.3", "predis/predis": "^1.1|^2.0", + "symfony/config": "^8.2", + "symfony/dependency-injection": "^8.2", "symfony/serializer": "^6.4|^7.0" }, "type": "library", @@ -6840,7 +6870,7 @@ "semaphore" ], "support": { - "source": "https://github.com/symfony/lock/tree/v7.4.23" + "source": "https://github.com/symfony/lock/tree/v8.2.0" }, "funding": [ { @@ -6860,53 +6890,61 @@ "type": "tidelift" } ], - "time": "2026-11-01T22:26:51+00:00" + "time": "2026-11-23T15:03:02+00:00", + "published-time": "2026-11-28T12:12:44+00:00" }, { "name": "symfony/messenger", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/messenger.git", - "reference": "ef17b7002fc6b12261dc7c28da81046e51ba91b5" + "reference": "720594254031c34331aa66f8575d1396249eeff9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/messenger/zipball/ef17b7002fc6b12261dc7c28da81046e51ba91b5", - "reference": "ef17b7002fc6b12261dc7c28da81046e51ba91b5", + "url": "https://api.github.com/repos/symfony/messenger/zipball/720594254031c34331aa66f8575d1396249eeff9", + "reference": "720594254031c34331aa66f8575d1396249eeff9", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "psr/log": "^1|^2|^3", - "symfony/clock": "^6.4|^7.0|^8.0", + "symfony/clock": "^7.4|^8.0", "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { - "symfony/console": "<7.2", - "symfony/event-dispatcher": "<6.4", + "symfony/config": "<8.2", + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.2", + "symfony/event-dispatcher": "<8.2", "symfony/event-dispatcher-contracts": "<2.5", - "symfony/framework-bundle": "<6.4", - "symfony/http-kernel": "<7.3", "symfony/lock": "<7.4", - "symfony/serializer": "<6.4.32|>=7.3,<7.3.10|>=7.4,<7.4.4|>=8.0,<8.0.4" + "symfony/routing": "<8.2", + "symfony/serializer": "<7.4.4|>=8.0,<8.0.4", + "symfony/service-contracts": "<3.7.1" }, "require-dev": { + "amphp/dns": "^2.1.2", + "amphp/parallel": "^2.0", + "amphp/socket": "^2.3.1", "psr/cache": "^1.0|^2.0|^3.0", - "symfony/console": "^7.2|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/event-dispatcher": "^6.4|^7.0|^8.0", - "symfony/http-kernel": "^7.3|^8.0", + "symfony/config": "^8.2", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^8.2", + "symfony/event-dispatcher": "^8.2", + "symfony/http-kernel": "^7.4|^8.0", "symfony/lock": "^7.4|^8.0", - "symfony/process": "^6.4|^7.0|^8.0", - "symfony/property-access": "^6.4|^7.0|^8.0", - "symfony/rate-limiter": "^6.4|^7.0|^8.0", - "symfony/routing": "^6.4|^7.0|^8.0", - "symfony/serializer": "^6.4.32|~7.3.10|^7.4.4|^8.0.4", - "symfony/service-contracts": "^2.5|^3", - "symfony/stopwatch": "^6.4|^7.0|^8.0", - "symfony/validator": "^6.4|^7.0|^8.0", - "symfony/var-dumper": "^6.4|^7.0|^8.0" + "symfony/process": "^7.4|^8.0", + "symfony/property-access": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0", + "symfony/routing": "^8.2", + "symfony/serializer": "^7.4.4|^8.0.4", + "symfony/service-contracts": "^3.7.1", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/uid": "^7.4|^8.0", + "symfony/validator": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -6934,7 +6972,7 @@ "description": "Helps applications send and receive messages to/from other applications or via message queues", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/messenger/tree/v7.4.23" + "source": "https://github.com/symfony/messenger/tree/v8.2.0" }, "funding": [ { @@ -6954,24 +6992,25 @@ "type": "tidelift" } ], - "time": "2026-11-02T10:56:49+00:00" + "time": "2026-11-27T14:02:36+00:00", + "published-time": "2026-11-28T12:11:36+00:00" }, { "name": "symfony/options-resolver", - "version": "v7.4.22", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "c95dd81729944936b48f9fecb38ff524eeaf97c0" + "reference": "0a2aa769aced59924bbf5a370aa3def83c836a0f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/c95dd81729944936b48f9fecb38ff524eeaf97c0", - "reference": "c95dd81729944936b48f9fecb38ff524eeaf97c0", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/0a2aa769aced59924bbf5a370aa3def83c836a0f", + "reference": "0a2aa769aced59924bbf5a370aa3def83c836a0f", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3" }, "type": "library", @@ -7005,7 +7044,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v7.4.22" + "source": "https://github.com/symfony/options-resolver/tree/v8.2.0" }, "funding": [ { @@ -7025,31 +7064,33 @@ "type": "tidelift" } ], - "time": "2026-10-18T14:39:27+00:00" + "time": "2026-11-06T11:00:24+00:00", + "published-time": "2026-11-28T12:11:55+00:00" }, { "name": "symfony/password-hasher", - "version": "v7.4.8", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/password-hasher.git", - "reference": "18a7d92126c95962f7efbcc9e421ba710a366847" + "reference": "464fff1b1e3d2c7e0af29392a55e6abc0928ec5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/password-hasher/zipball/18a7d92126c95962f7efbcc9e421ba710a366847", - "reference": "18a7d92126c95962f7efbcc9e421ba710a366847", + "url": "https://api.github.com/repos/symfony/password-hasher/zipball/464fff1b1e3d2c7e0af29392a55e6abc0928ec5d", + "reference": "464fff1b1e3d2c7e0af29392a55e6abc0928ec5d", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.4.1", + "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { - "symfony/security-core": "<6.4" + "symfony/console": "<8.2" }, "require-dev": { - "symfony/console": "^6.4|^7.0|^8.0", - "symfony/security-core": "^6.4|^7.0|^8.0" + "symfony/console": "^8.2", + "symfony/security-core": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -7081,7 +7122,7 @@ "password" ], "support": { - "source": "https://github.com/symfony/password-hasher/tree/v7.4.8" + "source": "https://github.com/symfony/password-hasher/tree/v8.2.0" }, "funding": [ { @@ -7101,105 +7142,32 @@ "type": "tidelift" } ], - "time": "2026-03-24T13:12:05+00:00" - }, - { - "name": "symfony/polyfill-php84", - "version": "v1.43.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php84.git", - "reference": "22c6548499cbe5c5bb072fc0c42312dff062a015" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/22c6548499cbe5c5bb072fc0c42312dff062a015", - "reference": "22c6548499cbe5c5bb072fc0c42312dff062a015", - "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\\Php84\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "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 backporting some PHP 8.4+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php84/tree/v1.43.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-09-23T22:01:09+00:00", - "published-time": "2026-09-30T10:23:33+00:00" + "time": "2026-10-22T16:53:57+00:00", + "published-time": "2026-11-28T12:12:28+00:00" }, { "name": "symfony/process", - "version": "v7.4.22", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "a5a6912edbbfc4c98cd080bc4bbe37c8e7eeb20a" + "reference": "2c176461fd9614ffa1bb292ca7c95205d0e928c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/a5a6912edbbfc4c98cd080bc4bbe37c8e7eeb20a", - "reference": "a5a6912edbbfc4c98cd080bc4bbe37c8e7eeb20a", + "url": "https://api.github.com/repos/symfony/process/zipball/2c176461fd9614ffa1bb292ca7c95205d0e928c9", + "reference": "2c176461fd9614ffa1bb292ca7c95205d0e928c9", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.4.1" + }, + "conflict": { + "symfony/dependency-injection": "<8.1" + }, + "require-dev": { + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^8.1" }, "type": "library", "autoload": { @@ -7227,7 +7195,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.4.22" + "source": "https://github.com/symfony/process/tree/v8.2.0" }, "funding": [ { @@ -7247,29 +7215,36 @@ "type": "tidelift" } ], - "time": "2026-10-25T14:40:16+00:00" + "time": "2026-11-23T09:50:06+00:00", + "published-time": "2026-11-28T12:12:23+00:00" }, { "name": "symfony/property-access", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "4dce45112d7a31d530d2e0e69143fc88eaa1521f" + "reference": "ef39edef17b04c451ef16d3c384b055a540c544d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/4dce45112d7a31d530d2e0e69143fc88eaa1521f", - "reference": "4dce45112d7a31d530d2e0e69143fc88eaa1521f", + "url": "https://api.github.com/repos/symfony/property-access/zipball/ef39edef17b04c451ef16d3c384b055a540c544d", + "reference": "ef39edef17b04c451ef16d3c384b055a540c544d", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/property-info": "^6.4.32|~7.3.10|^7.4.4|^8.0.4" + "php": ">=8.4.1", + "symfony/property-info": "^7.4.4|^8.0.4" + }, + "conflict": { + "symfony/config": "<8.2", + "symfony/dependency-injection": "<8.2" }, "require-dev": { - "symfony/cache": "^6.4|^7.0|^8.0", - "symfony/var-exporter": "^6.4.1|^7.0.1|^8.0" + "symfony/cache": "^7.4|^8.0", + "symfony/config": "^8.2", + "symfony/dependency-injection": "^8.2", + "symfony/var-exporter": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -7308,7 +7283,7 @@ "reflection" ], "support": { - "source": "https://github.com/symfony/property-access/tree/v7.4.23" + "source": "https://github.com/symfony/property-access/tree/v8.2.0" }, "funding": [ { @@ -7328,41 +7303,43 @@ "type": "tidelift" } ], - "time": "2026-11-01T19:17:22+00:00" + "time": "2026-11-27T13:28:56+00:00", + "published-time": "2026-11-28T12:11:09+00:00" }, { "name": "symfony/property-info", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "1eeaa666bcd1864b883b98cad9e5188064ddac26" + "reference": "b9383c59655b11ce74c656580470a386ffb36a8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/1eeaa666bcd1864b883b98cad9e5188064ddac26", - "reference": "1eeaa666bcd1864b883b98cad9e5188064ddac26", + "url": "https://api.github.com/repos/symfony/property-info/zipball/b9383c59655b11ce74c656580470a386ffb36a8f", + "reference": "b9383c59655b11ce74c656580470a386ffb36a8f", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/string": "^6.4|^7.0|^8.0", - "symfony/type-info": "^7.4.7|^8.0.7" + "php": ">=8.4.1", + "symfony/string": "^7.4|^8.0", + "symfony/type-info": "^7.4.24|^8.1.12" }, "conflict": { "phpdocumentor/reflection-docblock": "<5.2|>=7", "phpdocumentor/type-resolver": "<1.5.1", - "symfony/cache": "<6.4", - "symfony/dependency-injection": "<6.4", - "symfony/serializer": "<6.4" + "symfony/cache": "<8.2", + "symfony/config": "<8.2", + "symfony/dependency-injection": "<8.2" }, "require-dev": { "phpdocumentor/reflection-docblock": "^5.2|^6.0", "phpstan/phpdoc-parser": "^1.0|^2.0", - "symfony/cache": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/serializer": "^6.4|^7.0|^8.0" + "symfony/cache": "^7.4|^8.0", + "symfony/config": "^8.2", + "symfony/dependency-injection": "^8.2", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/serializer": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -7398,7 +7375,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v7.4.23" + "source": "https://github.com/symfony/property-info/tree/v8.2.0" }, "funding": [ { @@ -7418,38 +7395,44 @@ "type": "tidelift" } ], - "time": "2026-11-02T10:56:49+00:00" + "time": "2026-11-23T20:28:37+00:00", + "published-time": "2026-11-28T12:13:06+00:00" }, { "name": "symfony/routing", - "version": "v7.4.24", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "63fd985c6afe7ac69f89fb90a72715ca20cddc08" + "reference": "8011ee5bd1b7a9236b9f2292ca8e674ab2c8ca0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/63fd985c6afe7ac69f89fb90a72715ca20cddc08", - "reference": "63fd985c6afe7ac69f89fb90a72715ca20cddc08", + "url": "https://api.github.com/repos/symfony/routing/zipball/8011ee5bd1b7a9236b9f2292ca8e674ab2c8ca0a", + "reference": "8011ee5bd1b7a9236b9f2292ca8e674ab2c8ca0a", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { - "symfony/config": "<6.4", - "symfony/dependency-injection": "<6.4", - "symfony/yaml": "<6.4" + "symfony/config": "<8.2", + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.2", + "symfony/framework-bundle": "<8.2" }, "require-dev": { + "psr/container": "^1.1|^2.0", "psr/log": "^1|^2|^3", - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/http-foundation": "^6.4|^7.0|^8.0", - "symfony/yaml": "^6.4|^7.0|^8.0" + "symfony/config": "^8.2", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^8.2", + "symfony/expression-language": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/yaml": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -7483,7 +7466,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v7.4.24" + "source": "https://github.com/symfony/routing/tree/v8.2.0" }, "funding": [ { @@ -7504,71 +7487,65 @@ } ], "time": "2026-11-24T18:01:43+00:00", - "published-time": "2026-11-25T09:25:58+00:00" + "published-time": "2026-11-28T12:12:00+00:00" }, { "name": "symfony/security-bundle", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/security-bundle.git", - "reference": "1cb338633172a5ce2fb92b31f5d39315f4aa4c00" + "reference": "69f1e1b4217ca063147b4e5c4d3744b2aaa9a349" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-bundle/zipball/1cb338633172a5ce2fb92b31f5d39315f4aa4c00", - "reference": "1cb338633172a5ce2fb92b31f5d39315f4aa4c00", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/69f1e1b4217ca063147b4e5c4d3744b2aaa9a349", + "reference": "69f1e1b4217ca063147b4e5c4d3744b2aaa9a349", "shasum": "" }, "require": { "composer-runtime-api": ">=2.1", "ext-xml": "*", - "php": ">=8.2", - "symfony/clock": "^6.4|^7.0|^8.0", - "symfony/config": "^7.4|^8.0", - "symfony/dependency-injection": "^6.4.11|^7.1.4|^8.0", + "php": ">=8.4.1", + "symfony/clock": "^7.4|^8.0", + "symfony/config": "^8.2", + "symfony/dependency-injection": "^8.2", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/event-dispatcher": "^6.4|^7.0|^8.0", - "symfony/http-foundation": "^6.4.50|^7.4.23|^8.1.11", - "symfony/http-kernel": "^6.4.13|^7.1.6|^8.0", - "symfony/password-hasher": "^6.4|^7.0|^8.0", - "symfony/security-core": "^7.4.22|^8.1.10", - "symfony/security-csrf": "^6.4|^7.0|^8.0", - "symfony/security-http": "^7.4.21|^8.1.9", + "symfony/event-dispatcher": "^8.2", + "symfony/http-foundation": "^7.4.23|^8.1.11", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/password-hasher": "^7.4|^8.0", + "symfony/security-core": "^8.2", + "symfony/security-csrf": "^8.2", + "symfony/security-http": "^8.2", "symfony/service-contracts": "^2.5|^3" }, "conflict": { - "symfony/browser-kit": "<6.4", - "symfony/console": "<6.4", - "symfony/framework-bundle": "<6.4", - "symfony/http-client": "<6.4", - "symfony/ldap": "<6.4", - "symfony/serializer": "<6.4", - "symfony/twig-bundle": "<6.4", - "symfony/validator": "<6.4" + "symfony/console": "<8.2", + "symfony/framework-bundle": "<8.2" }, "require-dev": { - "symfony/asset": "^6.4|^7.0|^8.0", - "symfony/browser-kit": "^6.4|^7.0|^8.0", - "symfony/console": "^6.4|^7.0|^8.0", - "symfony/css-selector": "^6.4|^7.0|^8.0", - "symfony/dom-crawler": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/form": "^6.4|^7.0|^8.0", - "symfony/framework-bundle": "^6.4.13|^7.1.6|^8.0", - "symfony/http-client": "^6.4|^7.0|^8.0", - "symfony/ldap": "^6.4|^7.0|^8.0", - "symfony/lock": "^6.4|^7.0|^8.0", - "symfony/process": "^6.4|^7.0|^8.0", - "symfony/rate-limiter": "^6.4|^7.0|^8.0", - "symfony/runtime": "^6.4.13|^7.1.6|^8.0", - "symfony/serializer": "^6.4|^7.0|^8.0", - "symfony/translation": "^6.4|^7.0|^8.0", - "symfony/twig-bridge": "^6.4|^7.0|^8.0", - "symfony/twig-bundle": "^6.4|^7.0|^8.0", - "symfony/validator": "^6.4|^7.0|^8.0", - "symfony/yaml": "^6.4|^7.0|^8.0", - "twig/twig": "^3.15|^4.0", + "symfony/asset": "^7.4|^8.0", + "symfony/browser-kit": "^7.4|^8.0", + "symfony/console": "^8.2", + "symfony/css-selector": "^7.4|^8.0", + "symfony/dom-crawler": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/form": "^7.4|^8.0", + "symfony/framework-bundle": "^8.2", + "symfony/http-client": "^7.4|^8.0", + "symfony/ldap": "^7.4|^8.0", + "symfony/lock": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/property-info": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0", + "symfony/runtime": "^7.4|^8.0", + "symfony/serializer": "^7.4|^8.0", + "symfony/translation": "^7.4|^8.0", + "symfony/twig-bridge": "^8.2", + "symfony/twig-bundle": "^7.4|^8.0", + "symfony/validator": "^7.4|^8.0", + "symfony/yaml": "^7.4|^8.0", "web-token/jwt-library": "^3.3.2|^4.0" }, "type": "symfony-bundle", @@ -7597,7 +7574,7 @@ "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-bundle/tree/v7.4.23" + "source": "https://github.com/symfony/security-bundle/tree/v8.2.0" }, "funding": [ { @@ -7617,51 +7594,45 @@ "type": "tidelift" } ], - "time": "2026-11-04T08:27:22+00:00" + "time": "2026-11-27T23:16:02+00:00", + "published-time": "2026-11-28T12:11:27+00:00" }, { "name": "symfony/security-core", - "version": "v7.4.25", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "a5878baccfd19063b7990985df30039230557164" + "reference": "517fde33773050b9f272077b974935c22a5eba37" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/a5878baccfd19063b7990985df30039230557164", - "reference": "a5878baccfd19063b7990985df30039230557164", + "url": "https://api.github.com/repos/symfony/security-core/zipball/517fde33773050b9f272077b974935c22a5eba37", + "reference": "517fde33773050b9f272077b974935c22a5eba37", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", "symfony/event-dispatcher-contracts": "^2.5|^3", - "symfony/password-hasher": "^6.4|^7.0|^8.0", + "symfony/password-hasher": "^7.4|^8.0", "symfony/service-contracts": "^2.5|^3" }, - "conflict": { - "symfony/dependency-injection": "<6.4", - "symfony/event-dispatcher": "<6.4", - "symfony/http-foundation": "<6.4", - "symfony/ldap": "<6.4", - "symfony/translation": "<6.4.3|>=7.0,<7.0.3", - "symfony/validator": "<6.4" - }, "require-dev": { "psr/cache": "^1.0|^2.0|^3.0", "psr/container": "^1.1|^2.0", "psr/log": "^1|^2|^3", - "symfony/cache": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/event-dispatcher": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/http-foundation": "^6.4|^7.0|^8.0", - "symfony/ldap": "^6.4|^7.0|^8.0", - "symfony/property-access": "^6.4|^7.0|^8.0", - "symfony/string": "^6.4|^7.0|^8.0", - "symfony/translation": "^6.4.3|^7.0.3|^8.0", - "symfony/validator": "^6.4|^7.0|^8.0" + "symfony/cache": "^7.4|^8.0", + "symfony/clock": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/event-dispatcher": "^7.4|^8.0", + "symfony/expression-language": "^8.2", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/ldap": "^7.4|^8.0", + "symfony/property-access": "^7.4|^8.0", + "symfony/string": "^7.4|^8.0", + "symfony/translation": "^7.4|^8.0", + "symfony/validator": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -7689,7 +7660,7 @@ "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-core/tree/v7.4.25" + "source": "https://github.com/symfony/security-core/tree/v8.2.0" }, "funding": [ { @@ -7709,34 +7680,33 @@ "type": "tidelift" } ], - "time": "2026-11-25T12:48:49+00:00", - "published-time": "2026-11-27T14:41:49+00:00" + "time": "2026-11-27T13:10:27+00:00", + "published-time": "2026-11-28T12:12:58+00:00" }, { "name": "symfony/security-csrf", - "version": "v7.4.8", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/security-csrf.git", - "reference": "16b3aa2f67d02fb0dbd013a8759bbe90daaa9c5d" + "reference": "1accd7935b9e0113141e21903ebb8e8748825e1d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-csrf/zipball/16b3aa2f67d02fb0dbd013a8759bbe90daaa9c5d", - "reference": "16b3aa2f67d02fb0dbd013a8759bbe90daaa9c5d", + "url": "https://api.github.com/repos/symfony/security-csrf/zipball/1accd7935b9e0113141e21903ebb8e8748825e1d", + "reference": "1accd7935b9e0113141e21903ebb8e8748825e1d", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/security-core": "^6.4|^7.0|^8.0" - }, - "conflict": { - "symfony/http-foundation": "<6.4" + "php": ">=8.4.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/security-core": "^7.4|^8.0" }, "require-dev": { + "psr/container": "^1.1|^2.0", "psr/log": "^1|^2|^3", - "symfony/http-foundation": "^6.4|^7.0|^8.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0" + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -7764,7 +7734,7 @@ "description": "Symfony Security Component - CSRF Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-csrf/tree/v7.4.8" + "source": "https://github.com/symfony/security-csrf/tree/v8.2.0" }, "funding": [ { @@ -7784,52 +7754,52 @@ "type": "tidelift" } ], - "time": "2026-03-24T13:12:05+00:00" + "time": "2026-11-27T13:10:27+00:00", + "published-time": "2026-11-28T12:11:28+00:00" }, { "name": "symfony/security-http", - "version": "v7.4.24", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/security-http.git", - "reference": "1a821c485fa8ac4dd56b97bb9d4fef5a02e63745" + "reference": "5117d74eb5c2996168b6ca2ab9487a881f00c085" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-http/zipball/1a821c485fa8ac4dd56b97bb9d4fef5a02e63745", - "reference": "1a821c485fa8ac4dd56b97bb9d4fef5a02e63745", + "url": "https://api.github.com/repos/symfony/security-http/zipball/5117d74eb5c2996168b6ca2ab9487a881f00c085", + "reference": "5117d74eb5c2996168b6ca2ab9487a881f00c085", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/event-dispatcher": "^6.4|^7.0", - "symfony/http-foundation": "^6.4|^7.0|^8.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/property-access": "^6.4|^7.0|^8.0", - "symfony/security-core": "^7.3|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^8.2", + "symfony/polyfill-mbstring": "^1.0", + "symfony/property-access": "^7.4|^8.0", + "symfony/security-core": "^8.2", "symfony/service-contracts": "^2.5|^3" }, "conflict": { - "symfony/clock": "<6.4", + "symfony/event-dispatcher": "<8.2", "symfony/http-client-contracts": "<3.0", - "symfony/rate-limiter": "<6.4.33|>=7,<7.4.5|>=8,<8.0.5", - "symfony/security-bundle": "<6.4", - "symfony/security-csrf": "<6.4" + "symfony/rate-limiter": "<7.4.5|>=8,<8.0.5", + "symfony/security-bundle": "<8.2" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/cache": "^6.4|^7.0|^8.0", - "symfony/clock": "^6.4|^7.0|^8.0", - "symfony/console": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/http-client": "^6.4|^7.0|^8.0", + "symfony/cache": "^7.4.8|^8.0.8", + "symfony/clock": "^7.4|^8.0", + "symfony/console": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/http-client": "^7.4|^8.0", "symfony/http-client-contracts": "^3.0", - "symfony/rate-limiter": "^6.4|^7.0|^8.0", - "symfony/routing": "^6.4|^7.0|^8.0", - "symfony/security-csrf": "^6.4|^7.0|^8.0", - "symfony/translation": "^6.4|^7.0|^8.0", + "symfony/notifier": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0", + "symfony/routing": "^7.4|^8.0", + "symfony/security-csrf": "^7.4|^8.0", + "symfony/translation": "^7.4|^8.0", "web-token/jwt-library": "^3.3.2|^4.0" }, "type": "library", @@ -7858,7 +7828,7 @@ "description": "Symfony Security Component - HTTP Integration", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-http/tree/v7.4.24" + "source": "https://github.com/symfony/security-http/tree/v8.2.0" }, "funding": [ { @@ -7878,64 +7848,65 @@ "type": "tidelift" } ], - "time": "2026-11-24T18:01:43+00:00", - "published-time": "2026-11-25T09:25:08+00:00" + "time": "2026-11-27T23:16:02+00:00", + "published-time": "2026-11-28T12:11:48+00:00" }, { "name": "symfony/serializer", - "version": "v7.4.25", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "95bea3dda2008f543f12087a31ad20281d6e1689" + "reference": "1f4e3b5cde126e0c542bbead01fcfe4611a693cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/95bea3dda2008f543f12087a31ad20281d6e1689", - "reference": "95bea3dda2008f543f12087a31ad20281d6e1689", + "url": "https://api.github.com/repos/symfony/serializer/zipball/1f4e3b5cde126e0c542bbead01fcfe4611a693cb", + "reference": "1f4e3b5cde126e0c542bbead01fcfe4611a693cb", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-php84": "^1.30" + "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpdocumentor/reflection-docblock": "<5.2|>=7", "phpdocumentor/type-resolver": "<1.5.1", - "symfony/dependency-injection": "<6.4", - "symfony/property-access": "<6.4.31|>=7.0,<7.4.2|>=8.0,<8.0.2", - "symfony/property-info": "<6.4.43", - "symfony/type-info": "<7.2.5", - "symfony/uid": "<6.4", - "symfony/validator": "<6.4", - "symfony/yaml": "<6.4" + "symfony/cache": "<8.2", + "symfony/config": "<8.2", + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.2", + "symfony/framework-bundle": "<8.2", + "symfony/property-access": "<8.1", + "symfony/property-info": "<7.4.15", + "symfony/type-info": "<8.2" }, "require-dev": { "phpdocumentor/reflection-docblock": "^5.2|^6.0", "phpstan/phpdoc-parser": "^1.0|^2.0", "seld/jsonlint": "^1.10", - "symfony/cache": "^6.4|^7.0|^8.0", - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/console": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^7.2|^8.0", - "symfony/error-handler": "^6.4|^7.0|^8.0", - "symfony/filesystem": "^6.4|^7.0|^8.0", - "symfony/form": "^6.4|^7.0|^8.0", - "symfony/http-foundation": "^6.4|^7.0|^8.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/messenger": "^6.4|^7.0|^8.0", - "symfony/mime": "^6.4|^7.0|^8.0", - "symfony/property-access": "^6.4.31|^7.4.2|^8.0.2", - "symfony/property-info": "^6.4.43|^7.4.15|^8.0.15", + "symfony/cache": "^7.4|^8.0", + "symfony/config": "^8.2", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^8.2", + "symfony/error-handler": "^7.4|^8.0", + "symfony/filesystem": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", + "symfony/form": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/mime": "^7.4|^8.0", + "symfony/property-access": "^8.1", + "symfony/property-info": "^7.4.15|~8.0.15|^8.1.2", "symfony/translation-contracts": "^2.5|^3", - "symfony/type-info": "^7.2.5|^8.0", - "symfony/uid": "^6.4|^7.0|^8.0", - "symfony/validator": "^6.4|^7.0|^8.0", - "symfony/var-dumper": "^6.4|^7.0|^8.0", - "symfony/var-exporter": "^6.4|^7.0|^8.0", - "symfony/yaml": "^6.4|^7.0|^8.0" + "symfony/type-info": "^8.2", + "symfony/uid": "^7.4|^8.0", + "symfony/validator": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0", + "symfony/var-exporter": "^7.4|^8.0", + "symfony/yaml": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -7963,7 +7934,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v7.4.25" + "source": "https://github.com/symfony/serializer/tree/v8.2.0" }, "funding": [ { @@ -7983,72 +7954,67 @@ "type": "tidelift" } ], - "time": "2026-11-27T13:49:14+00:00", - "published-time": "2026-11-27T14:41:38+00:00" + "time": "2026-11-27T14:09:33+00:00", + "published-time": "2026-11-28T12:12:51+00:00" }, { "name": "symfony/twig-bridge", - "version": "v7.4.22", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "c959c7d2396e72e64c899fc9d0abba50733ea042" + "reference": "6b5759b35cfc009854c049b19d8b58e04cc86f51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/c959c7d2396e72e64c899fc9d0abba50733ea042", - "reference": "c959c7d2396e72e64c899fc9d0abba50733ea042", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/6b5759b35cfc009854c049b19d8b58e04cc86f51", + "reference": "6b5759b35cfc009854c049b19d8b58e04cc86f51", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.4.1", "symfony/translation-contracts": "^2.5|^3", - "twig/twig": "^3.21|^4.0" + "twig/twig": "^3.29|^4.0" }, "conflict": { "phpdocumentor/reflection-docblock": "<5.2|>=7", "phpdocumentor/type-resolver": "<1.5.1", - "symfony/console": "<6.4", - "symfony/form": "<6.4.32|>7,<7.3.10|>7.4,<7.4.4|>8.0,<8.0.4", - "symfony/http-foundation": "<6.4", - "symfony/http-kernel": "<6.4", - "symfony/mime": "<6.4.37|>7,<7.4.9|>8.0,<8.0.9", - "symfony/serializer": "<6.4", - "symfony/translation": "<6.4", - "symfony/workflow": "<6.4" + "symfony/console": "<8.2", + "symfony/form": "<7.4.4|>8.0,<8.0.4", + "symfony/mime": "<7.4.9|>8.0,<8.0.9", + "symfony/security-http": "<8.2" }, "require-dev": { "egulias/email-validator": "^2.1.10|^3|^4", "league/html-to-markdown": "^5.0", "phpdocumentor/reflection-docblock": "^5.2|^6.0", - "symfony/asset": "^6.4|^7.0|^8.0", - "symfony/asset-mapper": "^6.4|^7.0|^8.0", - "symfony/console": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/emoji": "^7.1|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/finder": "^6.4|^7.0|^8.0", - "symfony/form": "^6.4.32|~7.3.10|^7.4.4|^8.0.4", - "symfony/html-sanitizer": "^6.4|^7.0|^8.0", - "symfony/http-foundation": "^7.3|^8.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/intl": "^6.4|^7.0|^8.0", - "symfony/mime": "^6.4.37|^7.4.9|^8.0.9", - "symfony/polyfill-intl-icu": "~1.0", - "symfony/property-info": "^6.4|^7.0|^8.0", - "symfony/routing": "^6.4|^7.0|^8.0", + "symfony/asset": "^7.4|^8.0", + "symfony/asset-mapper": "^7.4|^8.0", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/emoji": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", + "symfony/form": "^7.4.4|^8.0.4", + "symfony/html-sanitizer": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/intl": "^7.4|^8.0", + "symfony/mime": "^7.4.9|^8.0.9", + "symfony/polyfill-intl-icu": "^1.0", + "symfony/property-info": "^7.4|^8.0", + "symfony/routing": "^7.4|^8.0", "symfony/security-acl": "^2.8|^3.0", - "symfony/security-core": "^6.4|^7.0|^8.0", - "symfony/security-csrf": "^6.4|^7.0|^8.0", - "symfony/security-http": "^6.4|^7.0|^8.0", - "symfony/serializer": "^6.4.44|^7.4.17|^8.1.5", - "symfony/stopwatch": "^6.4|^7.0|^8.0", - "symfony/translation": "^6.4|^7.0|^8.0", - "symfony/validator": "^6.4|^7.0|^8.0", - "symfony/web-link": "^6.4|^7.0|^8.0", - "symfony/workflow": "^6.4|^7.0|^8.0", - "symfony/yaml": "^6.4|^7.0|^8.0", + "symfony/security-core": "^7.4|^8.0", + "symfony/security-csrf": "^7.4|^8.0", + "symfony/security-http": "^8.2", + "symfony/serializer": "^7.4.17|^8.1.5", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/translation": "^8.2", + "symfony/validator": "^7.4|^8.0", + "symfony/web-link": "^7.4|^8.0", + "symfony/workflow": "^7.4|^8.0", + "symfony/yaml": "^7.4|^8.0", "twig/cssinliner-extra": "^3", "twig/inky-extra": "^3", "twig/markdown-extra": "^3" @@ -8079,7 +8045,7 @@ "description": "Provides integration for Twig with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bridge/tree/v7.4.22" + "source": "https://github.com/symfony/twig-bridge/tree/v8.2.0" }, "funding": [ { @@ -8099,49 +8065,50 @@ "type": "tidelift" } ], - "time": "2026-10-15T16:00:28+00:00" + "time": "2026-11-17T17:46:43+00:00", + "published-time": "2026-11-28T12:12:05+00:00" }, { "name": "symfony/twig-bundle", - "version": "v7.4.21", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/twig-bundle.git", - "reference": "991586116d99e549621c70eeafe496dfcceeb1ce" + "reference": "fb44499b77f1fe030d9a77e5c08c52acb60aa21a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/991586116d99e549621c70eeafe496dfcceeb1ce", - "reference": "991586116d99e549621c70eeafe496dfcceeb1ce", + "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/fb44499b77f1fe030d9a77e5c08c52acb60aa21a", + "reference": "fb44499b77f1fe030d9a77e5c08c52acb60aa21a", "shasum": "" }, "require": { "composer-runtime-api": ">=2.1", - "php": ">=8.2", - "symfony/config": "^7.4|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/http-foundation": "^6.4|^7.0|^8.0", - "symfony/http-kernel": "^6.4.13|^7.1.6|^8.0", - "symfony/twig-bridge": "^7.3|^8.0", - "twig/twig": "^3.12|^4.0" + "php": ">=8.4.1", + "symfony/config": "^8.2", + "symfony/dependency-injection": "^8.2", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/twig-bridge": "^7.4|^8.0" }, "conflict": { - "symfony/framework-bundle": "<6.4", - "symfony/translation": "<6.4" + "symfony/console": "<8.2", + "symfony/framework-bundle": "<8.2" }, "require-dev": { - "symfony/asset": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/finder": "^6.4|^7.0|^8.0", - "symfony/form": "^6.4|^7.0|^8.0", - "symfony/framework-bundle": "^6.4.13|^7.1.6|^8.0", - "symfony/routing": "^6.4|^7.0|^8.0", - "symfony/runtime": "^6.4.13|^7.1.6", - "symfony/stopwatch": "^6.4|^7.0|^8.0", - "symfony/translation": "^6.4|^7.0|^8.0", - "symfony/web-link": "^6.4|^7.0|^8.0", - "symfony/yaml": "^6.4|^7.0|^8.0" + "symfony/asset": "^7.4|^8.0", + "symfony/console": "^8.2", + "symfony/expression-language": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", + "symfony/form": "^7.4|^8.0", + "symfony/framework-bundle": "^8.2", + "symfony/property-info": "^7.4|^8.0", + "symfony/routing": "^7.4|^8.0", + "symfony/runtime": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/translation": "^7.4|^8.0", + "symfony/web-link": "^7.4|^8.0", + "symfony/yaml": "^7.4|^8.0" }, "type": "symfony-bundle", "autoload": { @@ -8169,7 +8136,7 @@ "description": "Provides a tight integration of Twig into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bundle/tree/v7.4.21" + "source": "https://github.com/symfony/twig-bundle/tree/v8.2.0" }, "funding": [ { @@ -8189,32 +8156,35 @@ "type": "tidelift" } ], - "time": "2026-10-09T16:12:31+00:00" + "time": "2026-11-16T22:50:59+00:00", + "published-time": "2026-11-28T12:12:00+00:00" }, { "name": "symfony/type-info", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/type-info.git", - "reference": "eca5fdb294539268ad3245b2214f32f24b337e09" + "reference": "5c580dedcbcd312b8544af28f0a6bb7cf375d4fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/type-info/zipball/eca5fdb294539268ad3245b2214f32f24b337e09", - "reference": "eca5fdb294539268ad3245b2214f32f24b337e09", + "url": "https://api.github.com/repos/symfony/type-info/zipball/5c580dedcbcd312b8544af28f0a6bb7cf375d4fc", + "reference": "5c580dedcbcd312b8544af28f0a6bb7cf375d4fc", "shasum": "" }, "require": { - "php": ">=8.2", - "psr/container": "^1.1|^2.0", - "symfony/deprecation-contracts": "^2.5|^3" + "php": ">=8.4.1", + "psr/container": "^1.1|^2.0" }, "conflict": { - "phpstan/phpdoc-parser": "<1.30" + "phpstan/phpdoc-parser": "<1.30", + "symfony/dependency-injection": "<8.1" }, "require-dev": { - "phpstan/phpdoc-parser": "^1.30|^2.0" + "phpstan/phpdoc-parser": "^1.30|^2.0", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^8.1" }, "type": "library", "autoload": { @@ -8252,7 +8222,7 @@ "type" ], "support": { - "source": "https://github.com/symfony/type-info/tree/v7.4.23" + "source": "https://github.com/symfony/type-info/tree/v8.2.0" }, "funding": [ { @@ -8272,46 +8242,45 @@ "type": "tidelift" } ], - "time": "2026-11-02T09:31:16+00:00" + "time": "2026-11-16T12:56:42+00:00", + "published-time": "2026-11-28T12:11:50+00:00" }, { "name": "symfony/web-profiler-bundle", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/web-profiler-bundle.git", - "reference": "5f632731e0a9c129cd1939da8d13949af1ee505a" + "reference": "85bbef1ffc0fba0f05b84a58c9705adf09195f04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/5f632731e0a9c129cd1939da8d13949af1ee505a", - "reference": "5f632731e0a9c129cd1939da8d13949af1ee505a", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/85bbef1ffc0fba0f05b84a58c9705adf09195f04", + "reference": "85bbef1ffc0fba0f05b84a58c9705adf09195f04", "shasum": "" }, "require": { "composer-runtime-api": ">=2.1", - "php": ">=8.2", - "symfony/config": "^7.3|^8.0", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/framework-bundle": "^6.4.13|^7.1.6|^8.0", - "symfony/http-kernel": "^6.4.13|^7.1.6|^8.0", - "symfony/routing": "^6.4|^7.0|^8.0", - "symfony/twig-bundle": "^6.4|^7.0|^8.0", - "twig/twig": "^3.15|^4.0" + "php": ">=8.4.1", + "symfony/config": "^8.2", + "symfony/framework-bundle": "^7.4|^8.0", + "symfony/http-kernel": "^8.1", + "symfony/routing": "^7.4|^8.0", + "symfony/twig-bundle": "^7.4|^8.0" }, "conflict": { - "symfony/form": "<6.4", - "symfony/mailer": "<6.4", - "symfony/messenger": "<6.4", - "symfony/serializer": "<7.2", - "symfony/workflow": "<7.3" + "symfony/dependency-injection": "<8.2", + "symfony/event-dispatcher": "<8.2", + "symfony/http-client": "<8.2", + "symfony/serializer": "<7.4", + "symfony/workflow": "<7.4" }, "require-dev": { - "symfony/browser-kit": "^6.4|^7.0|^8.0", - "symfony/console": "^6.4|^7.0|^8.0", - "symfony/css-selector": "^6.4|^7.0|^8.0", - "symfony/runtime": "^6.4.13|^7.1.6|^8.0", - "symfony/stopwatch": "^6.4|^7.0|^8.0" + "symfony/browser-kit": "^7.4|^8.0", + "symfony/console": "^7.4|^8.0", + "symfony/css-selector": "^7.4|^8.0", + "symfony/runtime": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0" }, "type": "symfony-bundle", "autoload": { @@ -8342,7 +8311,7 @@ "dev" ], "support": { - "source": "https://github.com/symfony/web-profiler-bundle/tree/v7.4.23" + "source": "https://github.com/symfony/web-profiler-bundle/tree/v8.2.0" }, "funding": [ { @@ -8362,32 +8331,34 @@ "type": "tidelift" } ], - "time": "2026-10-30T12:52:42+00:00" + "time": "2026-11-27T15:07:20+00:00", + "published-time": "2026-11-28T12:13:23+00:00" }, { "name": "symfony/yaml", - "version": "v7.4.23", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "1e601207ffe627a2e621faa9d661f1d32dcf1cec" + "reference": "f73c6c770da98c69037cccfebc314cead3333599" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/1e601207ffe627a2e621faa9d661f1d32dcf1cec", - "reference": "1e601207ffe627a2e621faa9d661f1d32dcf1cec", + "url": "https://api.github.com/repos/symfony/yaml/zipball/f73c6c770da98c69037cccfebc314cead3333599", + "reference": "f73c6c770da98c69037cccfebc314cead3333599", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.4.1", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<6.4" + "symfony/console": "<8.2" }, "require-dev": { - "symfony/console": "^6.4|^7.0|^8.0" + "opis/json-schema": "^2.6", + "symfony/console": "^8.2", + "yaml/yaml-test-suite": "*" }, "bin": [ "Resources/bin/yaml-lint" @@ -8418,7 +8389,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v7.4.23" + "source": "https://github.com/symfony/yaml/tree/v8.2.0" }, "funding": [ { @@ -8438,7 +8409,8 @@ "type": "tidelift" } ], - "time": "2026-11-04T08:27:22+00:00" + "time": "2026-11-27T13:28:56+00:00", + "published-time": "2026-11-28T12:11:52+00:00" }, { "name": "twig/twig", @@ -8528,7 +8500,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "ext-bcmath": "*", "ext-dom": "*", "ext-hash": "*", diff --git a/documentation/components/adapters/doctrine.md b/documentation/components/adapters/doctrine.md index 846dfc0bb7..3293428b12 100644 --- a/documentation/components/adapters/doctrine.md +++ b/documentation/components/adapters/doctrine.md @@ -77,7 +77,7 @@ data_frame() A custom map replaces the default map. To keep the other types, spread `TypesMap::FLOW_TYPES`: ```php -use Doctrine\DBAL\Types\TextType; +use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\Values\Schema\TypesMap; use Flow\Types\Type\Native\StringType; @@ -86,7 +86,7 @@ use function Flow\ETL\DSL\{data_frame, from_array}; $customTypesMap = new TypesMap([ ...TypesMap::FLOW_TYPES, - StringType::class => TextType::class, + StringType::class => Types::TEXT, ]); data_frame() @@ -308,21 +308,21 @@ This generates: use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; new Table( 'test', [ - new Column('int', Type::getType('integer'), ['notnull' => true]), - new Column('str', Type::getType('string'), ['notnull' => true]), - new Column('str_with_length', Type::getType('string'), ['notnull' => false, 'length' => 255]), - new Column('str_unique', Type::getType('string'), ['notnull' => false]), - new Column('date', Type::getType('date_immutable'), ['notnull' => false]), - new Column('float', Type::getType('float'), ['notnull' => false, 'precision' => 10, 'scale' => 2]), - new Column('bool', Type::getType('boolean'), ['notnull' => false, 'default' => true]), - new Column('json', Type::getType('json'), ['notnull' => false, 'platformOptions' => ['jsonb' => true]]), - new Column('list', Type::getType('json'), ['notnull' => true, 'columnDefinition' => 'integer[]']), - new Column('map', Type::getType('json'), ['notnull' => true, 'comment' => 'test comment!']), + new Column('int', Types::INTEGER, ['notnull' => true]), + new Column('str', Types::STRING, ['notnull' => true]), + new Column('str_with_length', Types::STRING, ['notnull' => false, 'length' => 255]), + new Column('str_unique', Types::STRING, ['notnull' => false]), + new Column('date', Types::DATE_IMMUTABLE, ['notnull' => false]), + new Column('float', Types::FLOAT, ['notnull' => false, 'precision' => 10, 'scale' => 2]), + new Column('bool', Types::BOOLEAN, ['notnull' => false, 'default' => true]), + new Column('json', Types::JSON, ['notnull' => false, 'platformOptions' => ['jsonb' => true]]), + new Column('list', Types::JSON, ['notnull' => true, 'columnDefinition' => 'integer[]']), + new Column('map', Types::JSON, ['notnull' => true, 'comment' => 'test comment!']), ], [ new Index('pk_test', ['int', 'str'], true, true), @@ -364,16 +364,16 @@ The `TypesMap` class maps Flow types to Doctrine DBAL types, and Doctrine DBAL t ```php use Flow\ETL\Adapter\Doctrine\Values\Schema\TypesMap; use Flow\Types\Type\Native\StringType; -use Doctrine\DBAL\Types\TextType; +use Doctrine\DBAL\Types\Types; // Create custom type mapping $customMap = new TypesMap([ - StringType::class => TextType::class, + StringType::class => Types::TEXT, ]); // Convert Flow type to DBAL type $dbalType = $customMap->toDbalType(StringType::class); // Convert DBAL type to Flow type instance -$flowType = $customMap->toFlowType(TextType::class); +$flowType = $customMap->toFlowType(Types::TEXT); ``` \ No newline at end of file diff --git a/documentation/components/adapters/postgresql.md b/documentation/components/adapters/postgresql.md index 25bb33fb70..32d7a8b0fc 100644 --- a/documentation/components/adapters/postgresql.md +++ b/documentation/components/adapters/postgresql.md @@ -17,7 +17,7 @@ For the installation instructions, read the [installation page](/documentation/i ## Requirements -- PHP 8.3+ +- PHP 8.5+ - ext-pgsql - ext-pg_query (optional, for query builder support) diff --git a/documentation/components/bridges/phpstan-types-bridge.md b/documentation/components/bridges/phpstan-types-bridge.md index bb7b49ed31..c0d33a96c5 100644 --- a/documentation/components/bridges/phpstan-types-bridge.md +++ b/documentation/components/bridges/phpstan-types-bridge.md @@ -56,7 +56,7 @@ $schema = type_structure([ ## Requirements -- PHP 8.3+ +- PHP 8.5+ - flow-php/types - phpstan/phpstan ^2.1 diff --git a/documentation/components/bridges/psr18-telemetry-bridge.md b/documentation/components/bridges/psr18-telemetry-bridge.md index 3a26e31630..801782d968 100644 --- a/documentation/components/bridges/psr18-telemetry-bridge.md +++ b/documentation/components/bridges/psr18-telemetry-bridge.md @@ -31,7 +31,7 @@ Use cases: ## Requirements -- PHP 8.3+ +- PHP 8.5+ - flow-php/telemetry - psr/http-client ^1.0 - psr/http-message ^1.0 || ^2.0 diff --git a/documentation/components/bridges/psr7-telemetry-bridge.md b/documentation/components/bridges/psr7-telemetry-bridge.md index 35923a0b3e..adba923b8c 100644 --- a/documentation/components/bridges/psr7-telemetry-bridge.md +++ b/documentation/components/bridges/psr7-telemetry-bridge.md @@ -35,7 +35,7 @@ Use cases: ## Requirements -- PHP 8.3+ +- PHP 8.5+ - flow-php/telemetry - psr/http-message ^1.1 || ^2.0 diff --git a/documentation/components/bridges/symfony-filesystem-bundle.md b/documentation/components/bridges/symfony-filesystem-bundle.md index 5bbb1511d4..1ba4660cb7 100644 --- a/documentation/components/bridges/symfony-filesystem-bundle.md +++ b/documentation/components/bridges/symfony-filesystem-bundle.md @@ -794,7 +794,7 @@ Notes: Bundle has no console commands. - Telemetry: to wire OTel `TraceableFilesystem`, set `telemetry.enabled: true` for each fstab. - Attribute discovery uses autoconfiguration for `#[AsFilesystemFactory]` and `#[AsFilesystem]`. All other tagged - services and compiler-pass actions are explicit. This follows the bundle best practices of Symfony 6.4+/7.4+/8.0+. + services and compiler-pass actions are explicit. This follows the bundle best practices of Symfony 7.4+/8.0+. ## Complete Example diff --git a/documentation/components/bridges/symfony-http-foundation-telemetry-bridge.md b/documentation/components/bridges/symfony-http-foundation-telemetry-bridge.md index 235d8e7006..5b41d5585b 100644 --- a/documentation/components/bridges/symfony-http-foundation-telemetry-bridge.md +++ b/documentation/components/bridges/symfony-http-foundation-telemetry-bridge.md @@ -34,6 +34,6 @@ Use cases: ## Requirements -- PHP 8.3+ +- PHP 8.5+ - flow-php/telemetry -- symfony/http-foundation ^6.4 || ^7.3 || ^8.0 +- symfony/http-foundation ^7.4 || ^8.0 diff --git a/documentation/components/core/pipe-operator.md b/documentation/components/core/pipe-operator.md index 1150482099..b28b363673 100644 --- a/documentation/components/core/pipe-operator.md +++ b/documentation/components/core/pipe-operator.md @@ -113,13 +113,3 @@ final class UppercaseNames implements Transformation ```php ignore df() |> read(from_array([['name' => 'alice']])) |> new UppercaseNames() |> fetch(); ``` - -## PHP 8.3 and 8.4 - -`|>` needs PHP 8.5. The steps work on every supported PHP version as plain calls: - -```php -use function Flow\ETL\DSL\{df, fetch, filter, from_array, lit, ref}; - -$rows = fetch()(filter(ref('a')->greaterThan(lit(1)))(df()->read(from_array([['a' => 1], ['a' => 2]])))); -``` diff --git a/documentation/components/extensions/arrow-ext.md b/documentation/components/extensions/arrow-ext.md index 3c54b8c49a..c15dba755f 100644 --- a/documentation/components/extensions/arrow-ext.md +++ b/documentation/components/extensions/arrow-ext.md @@ -41,7 +41,7 @@ The Arrow Rust crates have more I/O features. This extension can add them in the ## Requirements -- PHP 8.3+ +- PHP 8.5+ - Rust toolchain (rustc, cargo), from [rustup.rs](https://rustup.rs/) - clang / libclang (for ext-php-rs bindgen) - make diff --git a/documentation/components/extensions/pg-query-ext.md b/documentation/components/extensions/pg-query-ext.md index 26836d860b..d4e1dd00f0 100644 --- a/documentation/components/extensions/pg-query-ext.md +++ b/documentation/components/extensions/pg-query-ext.md @@ -27,7 +27,7 @@ interface with strongly-typed AST nodes, read the [PostgreSQL library](/document ## Requirements -- PHP 8.3+ +- PHP 8.5+ - C compiler (gcc/clang) - git (for auto-downloading libpg_query) - make diff --git a/documentation/components/libs/doctrine-dbal-bulk.md b/documentation/components/libs/doctrine-dbal-bulk.md index c16864aaba..07dc86839e 100644 --- a/documentation/components/libs/doctrine-dbal-bulk.md +++ b/documentation/components/libs/doctrine-dbal-bulk.md @@ -44,7 +44,7 @@ To bind with exactly your types, give them to `BulkData`: ```php insert( @@ -56,9 +56,9 @@ Bulk::create()->insert( ['id' => 2, 'name' => 'Name Two', 'created_at' => new \DateTimeImmutable()], ], [ - 'id' => Type::getType(Types::INTEGER), - 'name' => Type::getType(Types::STRING), - 'created_at' => Type::getType(Types::DATETIME_IMMUTABLE), + 'id' => Types::INTEGER, + 'name' => Types::STRING, + 'created_at' => Types::DATETIME_IMMUTABLE, ], ), ); diff --git a/documentation/components/libs/telemetry/opentelemetry-sdk.md b/documentation/components/libs/telemetry/opentelemetry-sdk.md index fe3cbd1854..3af9704e26 100644 --- a/documentation/components/libs/telemetry/opentelemetry-sdk.md +++ b/documentation/components/libs/telemetry/opentelemetry-sdk.md @@ -44,7 +44,7 @@ $client = psr18_traceable_client($client, $telemetry); | Composer packages | `open-telemetry/sdk` requires 13 packages, with a PSR-18 client and PSR-17 factories | `psr/clock` and `symfony/polyfill-mbstring` | | HTTP export | A PSR-18 client found with `php-http/discovery` | A curl transport in the OTLP bridge | | Protobuf | The OTLP exporter always installs `google/protobuf` | Optional. OTLP over HTTP with JSON needs no package | -| PHP version | 8.2 or newer | 8.3 or newer | +| PHP version | 8.2 or newer | 8.5 or newer | The SDK column describes `open-telemetry/sdk` 1.18.0 and the `open-telemetry/opentelemetry-php-contrib` instrumentation packages, as read in their source on 2026-12-01. diff --git a/documentation/contributing/environment.md b/documentation/contributing/environment.md index de20f82a4b..08df54a50b 100644 --- a/documentation/contributing/environment.md +++ b/documentation/contributing/environment.md @@ -1,8 +1,8 @@ ## Prepare Project: To run the tests locally, you need a running [docker](https://www.docker.com/). -You also need [PHP 8.3](https://www.php.net/) and [composer](https://getcomposer.org/) in your CLI. -The minimum PHP version is 8.3, and 8.4, 8.5 and 8.6 are also supported. Development uses the minimum version, PHP 8.3. +You also need [PHP 8.5](https://www.php.net/) and [composer](https://getcomposer.org/) in your CLI. +Flow supports PHP 8.5 and 8.6. Development uses PHP 8.5. See [PHP Versions](/documentation/installation/php-versions/). Instead of the PHP on your host machine, you can use Nix Shell. @@ -76,7 +76,7 @@ and `lint-actions` (GitHub Actions audit). `just analyze` runs `mago guard` and the Mago static analysis. Run the static analysis on the lowest supported PHP version, with the dependencies that `composer.lock` locks. -Use PHP 8.3, and run the `just install` command first. +Use PHP 8.5, and run the `just install` command first. ## Fixing Coding Standards diff --git a/documentation/contributing/guidelines.md b/documentation/contributing/guidelines.md index deab3e4e34..693a2c948a 100644 --- a/documentation/contributing/guidelines.md +++ b/documentation/contributing/guidelines.md @@ -103,8 +103,8 @@ These rules also apply to namespaces. For example, the `CSV` adapter cannot depe # PHP Versions -This project supports the PHP versions 8.3, 8.4, 8.5 and 8.6. -Development uses the lowest supported version, at this time PHP 8.3. +This project supports the PHP versions 8.5 and 8.6. +Development uses PHP 8.5. The tests run on all three versions, so you can use any of them for development. # Tools diff --git a/documentation/contributing/nix.md b/documentation/contributing/nix.md index 1165df8043..bd41972ee7 100644 --- a/documentation/contributing/nix.md +++ b/documentation/contributing/nix.md @@ -163,12 +163,14 @@ On Linux, the flag also sets `opcache.huge_code_pages=1`. To override a value, c ## Changing PHP Versions -To change the PHP version, start the nix shell with the `--arg php-version 8.3` flag: +To change the PHP version, start the nix shell with the `--arg php-version 8.6` flag: ```shell -nix-shell --arg php-version 8.3 +nix-shell --arg php-version 8.6 ``` +On PHP 8.6 the shell starts without pcov and protobuf, because nixpkgs does not build them for PHP 8.6 yet. + > Usually, do not change the PHP version. Development must always use the lowest supported PHP version. > > This feature is mostly for tests of new integrations diff --git a/documentation/installation.md b/documentation/installation.md index 406a2339f7..8838c61998 100644 --- a/documentation/installation.md +++ b/documentation/installation.md @@ -16,6 +16,8 @@ This reduces the maintenance overhead and makes the dependencies between compone Do not install the full repository with all dependencies. Install only the components that you need. +Flow supports PHP 8.5 and 8.6. See [PHP Versions](/documentation/installation/php-versions/). + ## Per-Package Installation > Flow PHP [Releases Explained](/blog/2025-03-16/flow-php-release-cycle) diff --git a/documentation/installation/packages/arrow-ext.md b/documentation/installation/packages/arrow-ext.md index 3971373fb9..a9ddb7143d 100644 --- a/documentation/installation/packages/arrow-ext.md +++ b/documentation/installation/packages/arrow-ext.md @@ -24,7 +24,7 @@ Available platforms: - Linux ARM64 - Linux x86_64 -PHP versions: 8.3, 8.4, 8.5, 8.6 (each with NTS and ZTS variants). +PHP versions: 8.5, 8.6 (each with NTS and ZTS variants). ### Installation diff --git a/documentation/installation/packages/flow-php-ext.md b/documentation/installation/packages/flow-php-ext.md index 79bc6a5416..eae368cd80 100644 --- a/documentation/installation/packages/flow-php-ext.md +++ b/documentation/installation/packages/flow-php-ext.md @@ -24,7 +24,7 @@ Available platforms: - Linux ARM64: glibc (Debian, Ubuntu, ...) and musl (Alpine) - Linux x86_64: glibc (Debian, Ubuntu, ...) and musl (Alpine) -PHP versions: 8.3, 8.4, 8.5, 8.6 (each with NTS and ZTS variants). +PHP versions: 8.5, 8.6 (each with NTS and ZTS variants). ### Installation diff --git a/documentation/installation/php-versions.md b/documentation/installation/php-versions.md new file mode 100644 index 0000000000..7150cbba1e --- /dev/null +++ b/documentation/installation/php-versions.md @@ -0,0 +1,38 @@ +--- +seo_title: PHP Versions +seo_description: > + Flow supports PHP 8.5 and 8.6. Read which PHP versions Flow supports, which version is used for development, + and how to use Flow on an older PHP version. +--- + +# PHP Versions + +[DOC_LINK:/documentation/introduction.md] + +[TOC] + +Flow supports PHP 8.5 and 8.6. + +## Policy + +Flow supports the PHP versions in [active support](https://www.php.net/supported-versions.php). An actively supported +version gets fixes for reported bugs and security issues, and regular point releases. + +There is one exception: in 2026, Flow skips PHP 8.4, which is in active support until 31 Dec 2026. + +| Version | Initial release | Active support until | +|---------|-----------------|----------------------| +| 8.5 | 20 Nov 2025 | 31 Dec 2027 | +| 8.6 | 19 Nov 2026 | 31 Dec 2028 | + +## Development Version + +Flow is developed and tested first on PHP 8.5. The development shell (`nix-shell`) starts PHP 8.5 by default. +See [Environment](/documentation/contributing/environment/). + +## Older PHP Versions + +Flow releases up to `0.48.x` support PHP 8.3 and 8.4. You can still install them with composer, but they get no new +features: Flow is developed on the `1.x` branch until release 1.0. + +A paid custom branch is available for an older PHP version that did not reach its end of life. diff --git a/documentation/upgrading.md b/documentation/upgrading.md index c63ca4a42e..5676d01687 100644 --- a/documentation/upgrading.md +++ b/documentation/upgrading.md @@ -203,6 +203,80 @@ To keep the old deadline, set `timeout_ms: 5000`. | `Scope: my-tracer vunknown` | `Scope: my-tracer unknown` | | the `STDOUT` constant, an error outside the CLI | the `php://stdout` stream | +### 20) all `flow-php/*` packages - PHP 8.3 and 8.4 are no longer supported + +| Before | After | +|---------------------------------------------------|-----------------------------| +| `"php": "~8.3.0 \|\| ~8.4.0 \|\| ~8.5.0 \|\| ~8.6.0"` | `"php": "~8.5.0 \|\| ~8.6.0"` | + +### 21) `flow-php/*` packages that require Symfony - Symfony 6.4 is no longer supported + +| Before | After | +|-------------------------------------|------------------------| +| `"^6.4 \|\| ^7.4 \|\| ^8.0"` | `"^7.4 \|\| ^8.0"` | +| `"^6.4.34 \|\| ^7.4.6 \|\| ^8.0.6"` | `"^7.4.6 \|\| ^8.0.6"` | + +Applies to these packages: + +- `flow-php/etl`, `flow-php/cli`, `flow-php/parquet-viewer` +- `flow-php/filesystem-async-aws-bridge`, `flow-php/filesystem-azure-bridge` +- `flow-php/symfony-console-bridge`, `flow-php/symfony-filesystem-bundle`, `flow-php/symfony-filesystem-cache-bridge` +- `flow-php/symfony-http-foundation-bridge`, `flow-php/symfony-http-foundation-telemetry-bridge` +- `flow-php/symfony-postgresql-bundle`, `flow-php/symfony-postgresql-cache-bridge` +- `flow-php/symfony-postgresql-messenger-bridge`, `flow-php/symfony-postgresql-session-bridge` +- `flow-php/symfony-telemetry-bundle` + +### 22) `flow-php/etl` - `RequiredPHPVersionException` is removed + +| Before | After | +|-------------------------------------------------------------|---------| +| `Flow\ETL\Foundation\Exception\RequiredPHPVersionException` | removed | + +### 23) `flow-php/etl-adapter-doctrine`, `flow-php/doctrine-dbal-bulk`, `flow-php/symfony-telemetry-bundle` - `doctrine/dbal` 4.5 is no longer supported + +| Before | After | +|----------------------------|----------------------------| +| `"doctrine/dbal": "^4.5"` | `"doctrine/dbal": "^4.6"` | + +### 24) `flow-php/etl-adapter-doctrine`, `flow-php/doctrine-dbal-bulk` - DBAL types are given by name, not by class or instance + +| Before | After | +|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------| +| `new TypesMap([StringType::class => TextType::class])` | `new TypesMap([StringType::class => Types::TEXT])` | +| `to_dbal_schema_table($schema, 'orders', types_map: [StringType::class => TextType::class])` | `to_dbal_schema_table($schema, 'orders', types_map: [StringType::class => Types::TEXT])` | +| `table_schema_to_flow_schema($table, [StringType::class => TextType::class])` | `table_schema_to_flow_schema($table, [StringType::class => Types::TEXT])` | +| `TypesMap::DBAL_TYPES` keys and `TypesMap::FLOW_TYPES` values are type classes | DBAL type names | +| `TypesMap::toFlowType(TextType::class)` | `TypesMap::toFlowType(Types::TEXT)` | +| `TypesMap::flowSchemaTypes()` returns `array` | returns `array`, column name to type name | +| `new BulkData($rows, ['id' => Type::getType(Types::INTEGER)])` | `new BulkData($rows, ['id' => Types::INTEGER])` | +| `BulkData::types()` returns `array` | returns `array` | +| an unknown DBAL type in `TypesMap` fails in the constructor | fails at first use with Doctrine's `UnknownColumnType` | +| a type registered only on the connection fails in `BulkData` | `BulkData` resolves it through the type provider of the connection | +| no `TableDefinition::dbalType()` | `TableDefinition::dbalType(string $typeName): Type` | + +### 25) `flow-php/doctrine-dbal-bulk`, `flow-php/etl-adapter-doctrine` - the table name is the exact stored name + +| Before | After | +|----------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------| +| the table name is written into the SQL as given | the table name is the exact stored name. A `.` separates the schema. Flow quotes every part | +| `'Orders'` for a PostgreSQL table created as `CREATE TABLE Orders` | `'orders'`, the name that PostgreSQL stores | +| `'"Orders"'` to keep the case | `'Orders'`. Double quotes only group a part that contains a `.`, for example `'"my.table"'` | +| `'flow.orders'` on MySQL or SQLite | `'orders'`. A schema qualifier on MySQL or SQLite throws `RuntimeException` | +| a missing table fails with `Column with name id, not found in table: ...` | `Table "orders" not found, no table has the exact name "orders".` | +| no `TableDefinition::quotedName()` | `TableDefinition::quotedName(): string`, the table name as the dialects write it | + +### 26) `flow-php/etl-adapter-parquet` - `empty_generator()` is removed + +| Before | After | +|-----------------------------------------------|--------------------------------------| +| `Flow\ETL\Adapter\Parquet\empty_generator()` | `Flow\Parquet\empty_generator()` | + +### 27) `flow-php/etl` - `brick/math` 0.12, 0.13 and 0.14.0 to 0.14.1 are no longer supported + +| Before | After | +|--------------------------------------------------------|------------------------------------| +| `"brick/math": "^0.12 \|\| ^0.13 \|\| ^0.14 \|\| ..."` | `"brick/math": "^0.14.2 \|\| ..."` | + --- ## Upgrading from 0.47.x to 0.48.x diff --git a/mago.toml b/mago.toml index 09a8129558..34314c9cc6 100644 --- a/mago.toml +++ b/mago.toml @@ -1,4 +1,4 @@ -php-version = "8.3" +php-version = "8.5" [source] paths = [ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index df976c146a..6b9e20f904 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -14,7 +14,7 @@ src/core/etl/tests/Flow/ETL/Tests/Unit src/core/etl/tests/Flow/Floe/Tests/Unit - src/core/etl/tests/Flow/ETL/Tests/Pipe + src/core/etl/tests/Flow/ETL/Tests/Pipe src/core/etl/tests/Flow/ETL/Tests/Integration diff --git a/shell.nix b/shell.nix index 9117619fbb..0ce2458bc4 100644 --- a/shell.nix +++ b/shell.nix @@ -1,8 +1,8 @@ { - php-version ? 8.3, + php-version ? 8.5, with-blackfire ? false, with-xdebug ? false, - with-pcov ? !with-blackfire && !with-php-benchmark, + with-pcov ? php-version != 8.6 && !with-blackfire && !with-php-benchmark, with-php-benchmark ? false, with-duckdb ? false, with-polars ? false, @@ -15,7 +15,7 @@ with-terraform ? false, with-wasm ? false, with-grpc ? false, - with-protobuf ? true, + with-protobuf ? php-version != 8.6, with-protoc ? false }: @@ -51,16 +51,12 @@ let ]; }; - base-php = if php-version == 8.3 then - pkgs.php83 - else if php-version == 8.4 then - pkgs.php84 - else if php-version == 8.5 then + base-php = if php-version == 8.5 then pkgs.php85 else if php-version == 8.6 then pkgs.php86 else - throw "Unknown php version ${php-version}"; + throw "Unsupported php version, Flow supports 8.5 and 8.6"; php-brotli = pkgs.callPackage ./.nix/pkgs/php-brotli/package.nix { php = base-php; }; php-snappy = pkgs.callPackage ./.nix/pkgs/php-snappy/package.nix { php = base-php; }; diff --git a/src/adapter/etl-adapter-avro/composer.json b/src/adapter/etl-adapter-avro/composer.json index de6abaae0e..ab41e8efec 100644 --- a/src/adapter/etl-adapter-avro/composer.json +++ b/src/adapter/etl-adapter-avro/composer.json @@ -11,7 +11,7 @@ "adapter" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "ext-json": "*", "flow-php/etl": "self.version" }, diff --git a/src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Unit/IO/Extractor/AvroExtractorTest.php b/src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Unit/IO/Extractor/AvroExtractorTest.php index 149a3f6cba..64920fea7b 100644 --- a/src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Unit/IO/Extractor/AvroExtractorTest.php +++ b/src/adapter/etl-adapter-avro/tests/Flow/ETL/Adapter/Avro/Tests/Unit/IO/Extractor/AvroExtractorTest.php @@ -17,7 +17,7 @@ public function test_it_declares_no_partition_columns(): void // the constructor always throws, so only an instance built without it can be asked static::assertEquals( schema(), - (new ReflectionClass(AvroExtractor::class))->newInstanceWithoutConstructor()->partitionSchema(), + new ReflectionClass(AvroExtractor::class)->newInstanceWithoutConstructor()->partitionSchema(), ); } } diff --git a/src/adapter/etl-adapter-chartjs/composer.json b/src/adapter/etl-adapter-chartjs/composer.json index c8a3f3953b..67df36dbbc 100644 --- a/src/adapter/etl-adapter-chartjs/composer.json +++ b/src/adapter/etl-adapter-chartjs/composer.json @@ -11,7 +11,7 @@ "adapter" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/etl": "self.version" }, "config": { diff --git a/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/functions.php b/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/functions.php index 63643841b4..73c4e852ab 100644 --- a/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/functions.php +++ b/src/adapter/etl-adapter-chartjs/src/Flow/ETL/Adapter/ChartJS/functions.php @@ -85,5 +85,5 @@ function to_chartjs_file( #[DocumentationDSL(module: Module::CHART_JS, type: Type::LOADER)] function to_chartjs_var(Chart $type, array &$output): ChartJSLoader { - return (new ChartJSLoader($type))->withOutputVar($output); + return new ChartJSLoader($type)->withOutputVar($output); } diff --git a/src/adapter/etl-adapter-chartjs/tests/Flow/ETL/Adapter/ChartJS/Tests/Unit/DescribableRoundTripTest.php b/src/adapter/etl-adapter-chartjs/tests/Flow/ETL/Adapter/ChartJS/Tests/Unit/DescribableRoundTripTest.php index 0cd910f745..d0f73f58e1 100644 --- a/src/adapter/etl-adapter-chartjs/tests/Flow/ETL/Adapter/ChartJS/Tests/Unit/DescribableRoundTripTest.php +++ b/src/adapter/etl-adapter-chartjs/tests/Flow/ETL/Adapter/ChartJS/Tests/Unit/DescribableRoundTripTest.php @@ -6,7 +6,6 @@ use Flow\ETL\Adapter\ChartJS\Tests\Context\DescribableFixtures; use Flow\ETL\Foundation\Describe\Describable; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Foundation\Exception\RuntimeException; use Flow\ETL\Tests\Context\DescribeRoundTrip; use Flow\ETL\Tests\Context\ExtractorClasses; @@ -58,11 +57,7 @@ public function test_a_rebuilt_describable_equals_the_described_one(string $clas $this->expectException(RuntimeException::class); } - try { - $describable = DescribableFixtures::all()[$class](); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $describable = DescribableFixtures::all()[$class](); if (in_array($class, DescribableFixtures::undescribable(), true)) { static::assertNull($describable->describe()); diff --git a/src/adapter/etl-adapter-csv/composer.json b/src/adapter/etl-adapter-csv/composer.json index 6a60005ffc..cc0db6f18b 100644 --- a/src/adapter/etl-adapter-csv/composer.json +++ b/src/adapter/etl-adapter-csv/composer.json @@ -11,7 +11,7 @@ "adapter" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/etl": "self.version", "symfony/polyfill-mbstring": "^1.33" }, diff --git a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/IO/Extractor/CSVExtractor.php b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/IO/Extractor/CSVExtractor.php index ba96f557b5..15cfe5c41f 100644 --- a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/IO/Extractor/CSVExtractor.php +++ b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/IO/Extractor/CSVExtractor.php @@ -201,7 +201,7 @@ private function describe(): Schema $this->inference->candidates(), ); - $inferred = (new SchemaInferrer($this->inference))->infer($sniffer, $this->inferenceProgress); + $inferred = new SchemaInferrer($this->inference)->infer($sniffer, $this->inferenceProgress); $derived = $this->derived->learn($inferred->schema, $sniffer->header()->source ?? ''); $this->sampled = $inferred->units; } diff --git a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/IO/Extractor/CSVSourceOpener.php b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/IO/Extractor/CSVSourceOpener.php index ab168e9069..d220a0a32b 100644 --- a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/IO/Extractor/CSVSourceOpener.php +++ b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/IO/Extractor/CSVSourceOpener.php @@ -162,7 +162,7 @@ public function dialect(SourceStream $stream): CSVDialect return new CSVDialect($this->options->separator, $this->options->enclosure, $this->options->escape); } - $detected = (new CSVDetector($stream))->detect(); + $detected = new CSVDetector($stream)->detect(); return new CSVDialect( $this->options->separator ?? $detected->separator, diff --git a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/IO/Loader/CSVLoader.php b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/IO/Loader/CSVLoader.php index 3e428b86c7..2c0d283af3 100644 --- a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/IO/Loader/CSVLoader.php +++ b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/IO/Loader/CSVLoader.php @@ -83,10 +83,10 @@ public function __construct( public static function fromDescription(#[SensitiveParameter] array $data, Rebuild $rebuild): static { - $loader = (new self( + $loader = new self( Path::fromArray(type_array()->assert($data['path'] ?? null)), $rebuild->of($data['filesystem'] ?? null, ConfiguredFilesystem::class)->filesystem(), - )) + ) ->saveMode(type_enum(SaveMode::class)->assert(constant( SaveMode::class . '::' . type_string()->assert($data['save_mode'] ?? null), ))) @@ -170,7 +170,7 @@ public function partitioning(): Partitioning public function inTask(Part $task): static { - $loader = (new self($this->path, $this->filesystem, $this->extension)) + $loader = new self($this->path, $this->filesystem, $this->extension) ->saveMode($this->saveMode) ->withDateFormat($this->dateFormat) ->withDateTimeFormat($this->dateTimeFormat) diff --git a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/functions.php b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/functions.php index cd6c593185..072ca5a9a2 100644 --- a/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/functions.php +++ b/src/adapter/etl-adapter-csv/src/Flow/ETL/Adapter/CSV/functions.php @@ -46,7 +46,7 @@ function from_csv( ?Schema $schema = null, Filesystem $filesystem = new NativeLocalFilesystem(), ): CSVExtractor { - $loader = (new CSVExtractor(is_string($path) ? path_real($path) : $path, $filesystem)) + $loader = new CSVExtractor(is_string($path) ? path_real($path) : $path, $filesystem) ->withHeader($with_header) ->withEmptyToNull($empty_to_null) ->withCharactersReadInLine($characters_read_in_line); @@ -90,7 +90,7 @@ function to_csv( string $datetime_format = DateTimeInterface::ATOM, Filesystem $filesystem = new NativeLocalFilesystem(), ): CSVLoader { - return (new CSVLoader(is_string($uri) ? path_real($uri) : $uri, $filesystem)) + return new CSVLoader(is_string($uri) ? path_real($uri) : $uri, $filesystem) ->withHeader($with_header) ->withSeparator($separator) ->withEnclosure($enclosure) @@ -112,5 +112,5 @@ function csv_detect_separator( ?Option $fallback = new Option(',', '"', '\\'), ?Options $options = null, ): Option { - return (new CSVDetector($stream, $fallback, $options))->detect($lines); + return new CSVDetector($stream, $fallback, $options)->detect($lines); } diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Context/CSVFixtureContext.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Context/CSVFixtureContext.php index 51ff99dd2a..34048d1a1e 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Context/CSVFixtureContext.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Context/CSVFixtureContext.php @@ -70,7 +70,7 @@ public static function globSniffer( ): CSVSniffer { $sources = []; - foreach ((new FileListing($filesystem))->list(path(self::path($glob)), new OnlyFiles()) as $status) { + foreach (new FileListing($filesystem)->list(path(self::path($glob)), new OnlyFiles()) as $status) { $sources[] = new SourceFile($status->path, $status->size); } @@ -82,7 +82,7 @@ public static function open( Filesystem $filesystem = new NativeLocalFilesystem(), CSVReadOptions $options = new CSVReadOptions(), ): CSVOpenSource { - return (new CSVSourceOpener($filesystem, $options))->open(self::source($fixture)); + return new CSVSourceOpener($filesystem, $options)->open(self::source($fixture)); } /** @@ -313,7 +313,7 @@ public static function records(CSVOpenSource $open): array */ public static function infer(SchemaInference $inference, string ...$fixtures): Schema { - return (new SchemaInferrer($inference))->infer( + return new SchemaInferrer($inference)->infer( self::sniffer(array_values($fixtures), $inference), new VoidProgress(), )->schema; @@ -342,7 +342,7 @@ public static function inferPhp(SchemaInference $inference, string ...$fixtures) $units[] = iterator_to_array(self::phpRecords($fixture), false); } - return (new SchemaInferrer($inference))->infer( + return new SchemaInferrer($inference)->infer( new FakeSniffer($units, new StringTypeNarrower($inference->candidates()->toArray()), $names), new VoidProgress(), )->schema; diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Context/DescribableFixtures.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Context/DescribableFixtures.php index 65f842138b..af9d4853cf 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Context/DescribableFixtures.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Context/DescribableFixtures.php @@ -39,7 +39,7 @@ public static function all(): array new CSVReadOptions(false, false, false, ';', "'", '\\', 2048), ), ETLDescribableFixtures::inferredColumns(), - (new SchemaInference(filesToSniff: 3, unionByName: true))->everyRow(), + new SchemaInference(filesToSniff: 3, unionByName: true)->everyRow(), ), CSVLoader::class => static fn(): Describable => new CSVLoader( path('local://data/out.csv'), diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/CSVExtractorTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/CSVExtractorTest.php index ae70d2a102..29b9838e1d 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/CSVExtractorTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/CSVExtractorTest.php @@ -1611,10 +1611,10 @@ public function test_html_or_xml_candidates_fall_back_to_the_php_path(): void public function test_one_extractor_read_twice_interleaved_gives_each_read_every_row_and_closes_every_stream(): void { $filesystem = new RecordingFilesystem(native_local_filesystem()); - [$first, $second] = ExtractedRows::interleaved((new CSVExtractor( + [$first, $second] = ExtractedRows::interleaved(new CSVExtractor( path_real(__DIR__ . '/../../../Fixtures/glob_with_empty/*.csv'), $filesystem, - ))->withBatchSize(7)); + )->withBatchSize(7)); static::assertGreaterThan(0, $first->count()); static::assertSame($first->toArray(), $second->toArray()); @@ -1708,7 +1708,7 @@ public function test_extract_split_stops_on_the_stop_signal(): void $generator = FlowTestCase::extracted( $extractor, flow_context()->backend(), - (new Criteria())->withSplit($extractor->splits(new Criteria(), 100)[1]), + new Criteria()->withSplit($extractor->splits(new Criteria(), 100)[1]), ); $totalRows = 0; @@ -1732,7 +1732,7 @@ public function test_extract_split_reads_no_more_than_the_limit(): void foreach (FlowTestCase::extracted( $extractor, flow_context()->backend(), - (new Criteria(3))->withSplit($extractor->splits(new Criteria(), 100)[1]), + new Criteria(3)->withSplit($extractor->splits(new Criteria(), 100)[1]), ) as $rows) { $total += $rows->count(); } @@ -1825,7 +1825,7 @@ public function test_a_pushed_path_filter_prunes_the_files_splits_are_cut_from() static::assertEquals( [new FileSplit($extractor->source(), 0, null)], - $extractor->splits((new Criteria())->withPathFilter(new RejectingFilter()), 1), + $extractor->splits(new Criteria()->withPathFilter(new RejectingFilter()), 1), ); } @@ -1833,7 +1833,7 @@ public function test_a_pushed_partition_filter_splits_only_the_admitted_files(): { $extractor = from_csv(CSVFixtureContext::path('partitioned/group=*/*.csv')); $filter = ref('group')->equals(lit('1')); - $criteria = (new Criteria()) + $criteria = new Criteria() ->withFilter($filter) ->withPathFilter( new ScalarFunctionFilter($filter, $extractor->partitionSchema(), flow_context()->backend()), diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/CSVSourceOpenerTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/CSVSourceOpenerTest.php index 9161162be6..d2fc3d835f 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/CSVSourceOpenerTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/CSVSourceOpenerTest.php @@ -39,10 +39,10 @@ final class CSVSourceOpenerTest extends FlowTestCase { public function test_a_pinned_separator_wins_over_detection(): void { - $open = (new CSVSourceOpener( + $open = new CSVSourceOpener( new CountingFilesystem(new NativeLocalFilesystem()), new CSVReadOptions(separator: ','), - ))->open(CSVFixtureContext::source('semicolon.csv')); + )->open(CSVFixtureContext::source('semicolon.csv')); try { static::assertSame(['id;name'], $open->columns()); @@ -53,10 +53,10 @@ public function test_a_pinned_separator_wins_over_detection(): void public function test_a_fully_declared_dialect_is_not_detected(): void { - $dialect = (new CSVSourceOpener( + $dialect = new CSVSourceOpener( new NativeLocalFilesystem(), new CSVReadOptions(separator: ';', enclosure: '"', escape: '\\'), - ))->dialect(new ThrowingSourceStream(path(CSVFixtureContext::path('semicolon.csv')))); + )->dialect(new ThrowingSourceStream(path(CSVFixtureContext::path('semicolon.csv')))); static::assertSame([';', '"', '\\'], [$dialect->separator, $dialect->enclosure, $dialect->escape]); } @@ -74,11 +74,11 @@ public function test_a_split_opens_its_file_once(int $start, int $length, bool $ $filesystem = new LengthCapturingFilesystem(new NativeLocalFilesystem()); static::assertNotSame( [], - CSVFixtureContext::records((new CSVSourceOpener( + CSVFixtureContext::records(new CSVSourceOpener( $filesystem, new CSVReadOptions(), extension: $native ? null : new FlowPhpExtension(false, null), - ))->openSplit( + )->openSplit( CSVFixtureContext::source('five_rows.csv'), new FileSplit(path(CSVFixtureContext::path('five_rows.csv')), $start, $length), )), @@ -110,7 +110,7 @@ public function test_only_the_first_window_refuses_a_diverging_header(): void public function test_columns_leaves_the_stream_open(): void { $opener = new CSVSourceOpener(new NativeLocalFilesystem(), new CSVReadOptions()); - $stream = (new NativeLocalFilesystem())->readFrom(path(CSVFixtureContext::path('five_rows.csv'))); + $stream = new NativeLocalFilesystem()->readFrom(path(CSVFixtureContext::path('five_rows.csv'))); try { static::assertSame(['id', 'name'], $opener->columns($stream, $opener->dialect($stream))); @@ -181,7 +181,7 @@ public function test_a_detected_dialect_is_learned(): void { $source = CSVFixtureContext::source('semicolon.csv'); $dialects = new CSVDialects(); - (new CSVSourceOpener(new NativeLocalFilesystem(), new CSVReadOptions(), $dialects)) + new CSVSourceOpener(new NativeLocalFilesystem(), new CSVReadOptions(), $dialects) ->open($source) ->close(); @@ -190,10 +190,10 @@ public function test_a_detected_dialect_is_learned(): void public function test_open_detects_the_dialect(): void { - $open = (new CSVSourceOpener( + $open = new CSVSourceOpener( new CountingFilesystem(new NativeLocalFilesystem()), new CSVReadOptions(), - ))->open(CSVFixtureContext::source('semicolon.csv')); + )->open(CSVFixtureContext::source('semicolon.csv')); try { static::assertSame(['id', 'name'], $open->columns()); @@ -205,7 +205,7 @@ public function test_open_detects_the_dialect(): void public function test_open_opens_the_source_exactly_once(): void { $counting = new CountingFilesystem(new NativeLocalFilesystem()); - $open = (new CSVSourceOpener($counting, new CSVReadOptions()))->open(CSVFixtureContext::source('two_rows.csv')); + $open = new CSVSourceOpener($counting, new CSVReadOptions())->open(CSVFixtureContext::source('two_rows.csv')); static::assertSame(1, $counting->readFromCalls); static::assertSame(0, $counting->closedStreams()); @@ -237,10 +237,10 @@ public function test_open_split_of_a_file_without_columns_reads_nothing(): void { static::assertSame( [], - CSVFixtureContext::records((new CSVSourceOpener( + CSVFixtureContext::records(new CSVSourceOpener( new NativeLocalFilesystem(), new CSVReadOptions(), - ))->openSplit( + )->openSplit( CSVFixtureContext::source('empty.csv'), new FileSplit(path(CSVFixtureContext::path('empty.csv')), 0, 10), )), @@ -251,10 +251,10 @@ public function test_open_split_reads_the_first_window_with_its_header(): void { static::assertSame( [['id' => '1', 'name' => 'a']], - CSVFixtureContext::records((new CSVSourceOpener( + CSVFixtureContext::records(new CSVSourceOpener( new NativeLocalFilesystem(), new CSVReadOptions(), - ))->openSplit( + )->openSplit( CSVFixtureContext::source('five_rows.csv'), new FileSplit(path(CSVFixtureContext::path('five_rows.csv')), 0, 12), )), @@ -265,10 +265,10 @@ public function test_open_split_reads_only_the_records_starting_in_its_window(): { static::assertSame( [['id' => '3', 'name' => 'c'], ['id' => '4', 'name' => 'd']], - CSVFixtureContext::records((new CSVSourceOpener( + CSVFixtureContext::records(new CSVSourceOpener( new NativeLocalFilesystem(), new CSVReadOptions(), - ))->openSplit( + )->openSplit( CSVFixtureContext::source('five_rows.csv'), new FileSplit(path(CSVFixtureContext::path('five_rows.csv')), 13, 8), )), @@ -277,13 +277,13 @@ public function test_open_split_reads_only_the_records_starting_in_its_window(): public function test_an_opener_over_the_local_filesystem_describes_and_rebuilds_equal(): void { - $opener = new CSVSourceOpener(new NativeLocalFilesystem(), (new CSVReadOptions())->withSeparator(';')); + $opener = new CSVSourceOpener(new NativeLocalFilesystem(), new CSVReadOptions()->withSeparator(';')); $description = $opener->describe(); static::assertNotNull($description); static::assertTrue($description->sensitive()); static::assertSame(';', type_array()->assert($description->data['options'])['separator']); - static::assertEquals($opener, (new Rebuild())->object( + static::assertEquals($opener, new Rebuild()->object( Description::fromArray($description->normalize()), CSVSourceOpener::class, )); @@ -291,7 +291,7 @@ public function test_an_opener_over_the_local_filesystem_describes_and_rebuilds_ public function test_an_opener_over_a_memory_filesystem_does_not_describe(): void { - static::assertNull((new CSVSourceOpener(CSVFixtureContext::memory('id\n'), new CSVReadOptions()))->describe()); + static::assertNull(new CSVSourceOpener(CSVFixtureContext::memory('id\n'), new CSVReadOptions())->describe()); } public function test_a_rebuilt_opener_keeps_the_dialects_it_learned(): void @@ -299,11 +299,11 @@ public function test_a_rebuilt_opener_keeps_the_dialects_it_learned(): void $source = CSVFixtureContext::source('semicolon.csv'); $dialects = new CSVDialects(); $dialects->learn($source->uri(), new CSVDialect(',', '"', '\\')); - $description = (new CSVSourceOpener(new NativeLocalFilesystem(), new CSVReadOptions(), $dialects))->describe(); + $description = new CSVSourceOpener(new NativeLocalFilesystem(), new CSVReadOptions(), $dialects)->describe(); static::assertNotNull($description); - $open = (new Rebuild()) + $open = new Rebuild() ->object(Description::fromArray($description->normalize()), CSVSourceOpener::class) ->open($source); @@ -316,10 +316,9 @@ public function test_a_rebuilt_opener_keeps_the_dialects_it_learned(): void public function test_a_file_without_a_record_has_no_columns(): void { - $open = (new CSVSourceOpener( - new NativeLocalFilesystem(), - new CSVReadOptions(), - ))->open(CSVFixtureContext::source('empty.csv')); + $open = new CSVSourceOpener(new NativeLocalFilesystem(), new CSVReadOptions())->open(CSVFixtureContext::source( + 'empty.csv', + )); try { static::assertSame([], $open->columns()); @@ -333,8 +332,8 @@ public function test_every_instance_opens_its_own_stream(): void $filesystem = new CountingFilesystem(new NativeLocalFilesystem()); $source = CSVFixtureContext::source('header_only.csv'); - $first = (new CSVSourceOpener($filesystem, new CSVReadOptions()))->open($source); - $second = (new CSVSourceOpener($filesystem, new CSVReadOptions()))->open($source); + $first = new CSVSourceOpener($filesystem, new CSVReadOptions())->open($source); + $second = new CSVSourceOpener($filesystem, new CSVReadOptions())->open($source); try { static::assertSame(['id', 'name'], $first->columns()); @@ -351,7 +350,7 @@ public function test_with_the_extension_the_rust_source_reads(): void static::markTestSkipped('flow_php extension is not loaded'); } - $open = (new CSVSourceOpener(CSVFixtureContext::memory("id,name\n1,a\n"), new CSVReadOptions()))->open( + $open = new CSVSourceOpener(CSVFixtureContext::memory("id,name\n1,a\n"), new CSVReadOptions())->open( CSVFixtureContext::memorySource(), ); @@ -368,7 +367,7 @@ public function test_without_the_extension_the_php_source_reads(): void static::markTestSkipped('flow_php extension is loaded'); } - $open = (new CSVSourceOpener(CSVFixtureContext::memory("id,name\n1,a\n"), new CSVReadOptions()))->open( + $open = new CSVSourceOpener(CSVFixtureContext::memory("id,name\n1,a\n"), new CSVReadOptions())->open( CSVFixtureContext::memorySource(), ); @@ -382,7 +381,7 @@ public function test_without_the_extension_the_php_source_reads(): void public function test_characters_read_in_line_reaches_the_opened_source(): void { $filesystem = new LengthCapturingFilesystem(CSVFixtureContext::memory("id,name\n1,a\n")); - $open = (new CSVSourceOpener($filesystem, (new CSVReadOptions())->withCharactersReadInLine(4096)))->open( + $open = new CSVSourceOpener($filesystem, new CSVReadOptions()->withCharactersReadInLine(4096))->open( CSVFixtureContext::memorySource(), ); @@ -402,11 +401,11 @@ public function test_a_flow_php_of_another_abi_is_refused_before_the_file_is_ope $filesystem = new CountingFilesystem(new NativeLocalFilesystem()); try { - (new CSVSourceOpener( + new CSVSourceOpener( $filesystem, new CSVReadOptions(), extension: new FlowPhpExtension(true, FlowPhpExtension::ABI + 1, '0.46.0'), - ))->open(CSVFixtureContext::source('header_only.csv')); + )->open(CSVFixtureContext::source('header_only.csv')); static::fail('a skewed flow_php must be refused'); } catch (ETLRuntimeException $e) { static::assertStringContainsString('does not match flow-php/etl', $e->getMessage()); diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/CSVSplitReadTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/CSVSplitReadTest.php index 7858752485..1661dd55ed 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/CSVSplitReadTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/CSVSplitReadTest.php @@ -100,7 +100,7 @@ public function test_a_sized_split_is_read_without_listing(): void FlowTestCase::extracted( $reader, flow_context()->backend(), - (new Criteria())->withSplit( + new Criteria()->withSplit( new FileSplit($file, 0, null, (int) filesize($root->path() . '/report.csv')), ), ), @@ -148,7 +148,7 @@ public function test_a_reader_routes_its_rejects_after_a_rebuild_through_the_run $telemetry = new MemoryTelemetryContext(); $rows = iterator_to_array( - (new StepRunner())->steps( + new StepRunner()->steps( new PipelineSteps(), $task->extract(flow_context()->backend(), new Criteria()), $telemetry->flowContext, diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/RustCSVOpenSourceTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/RustCSVOpenSourceTest.php index e9372e873b..f146991b5b 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/RustCSVOpenSourceTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Extractor/RustCSVOpenSourceTest.php @@ -210,7 +210,7 @@ public function test_records_are_identical_across_chunk_sizes(int $chunkSize): v )), CSVFixtureContext::records(CSVFixtureContext::openNativeStream( new LengthCapturingSourceStream($contents, path('s3://bucket/a.csv')), - (new CSVReadOptions())->withCharactersReadInLine($chunkSize), + new CSVReadOptions()->withCharactersReadInLine($chunkSize), )), ); } @@ -250,7 +250,7 @@ public function test_a_remote_stream_is_read_in_steps_of_characters_read_in_line CSVFixtureContext::records(CSVFixtureContext::openNativeStream( $stream, - (new CSVReadOptions())->withCharactersReadInLine(4096), + new CSVReadOptions()->withCharactersReadInLine(4096), )); static::assertSame([4096], $stream->capturedIterateLengths); @@ -721,7 +721,7 @@ public static function batch_parity_cases(): Generator "id,name\n1\n2,b\n3,c,x\n", $idNullableName, 2, - (new CSVReadOptions())->withMissingColumnsAsNull(true), + new CSVReadOptions()->withMissingColumnsAsNull(true), ]; yield 'refused past the sample' => [ "id,name\n1,a\n2,b\nx,c\n", @@ -734,7 +734,7 @@ public static function batch_parity_cases(): Generator "e00,e01\n1,a\n2\n3,c\n", schema(str_schema('e00'), str_schema('e01', nullable: true)), 2, - (new CSVReadOptions())->withHeader(false), + new CSVReadOptions()->withHeader(false), null, 8, ]; @@ -803,7 +803,7 @@ public function test_batches_are_identical_across_chunk_sizes(int $chunkSize, st CSVFixtureContext::batchesOutcome( CSVFixtureContext::openNativeStream( new LengthCapturingSourceStream($content, path('s3://bucket/a.csv')), - (new CSVReadOptions())->withCharactersReadInLine($chunkSize), + new CSVReadOptions()->withCharactersReadInLine($chunkSize), ), $schema, 2, diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/FileFormatContractTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/FileFormatContractTest.php index 9851de6a45..5d190092cd 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/FileFormatContractTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/FileFormatContractTest.php @@ -40,109 +40,109 @@ public static function formats(): Generator #[DataProvider('formats')] public function test_overwrite_replaces_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->overwriteReplacesWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->overwriteReplacesWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_append_keeps_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->appendKeepsWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->appendKeepsWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_ignore_leaves_an_existing_destination_untouched(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->ignoreLeavesAnExistingDestinationUntouched($format); + new FileFormatContract($this->cacheDir)->ignoreLeavesAnExistingDestinationUntouched($format); } #[DataProvider('formats')] public function test_exception_if_exists_refuses_an_existing_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->exceptionIfExistsRefusesAnExistingDestination($format); + new FileFormatContract($this->cacheDir)->exceptionIfExistsRefusesAnExistingDestination($format); } #[DataProvider('formats')] public function test_a_batch_of_zero_rows_creates_no_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aBatchOfZeroRowsCreatesNoFile($format); + new FileFormatContract($this->cacheDir)->aBatchOfZeroRowsCreatesNoFile($format); } #[DataProvider('formats')] public function test_a_write_that_ends_reports_its_file_operations(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aWriteThatEndsReportsItsFileOperations($format); + new FileFormatContract($this->cacheDir)->aWriteThatEndsReportsItsFileOperations($format); } #[DataProvider('formats')] public function test_a_partitioned_write_reads_back_every_partition(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPartitionedWriteReadsBackEveryPartition($format); + new FileFormatContract($this->cacheDir)->aPartitionedWriteReadsBackEveryPartition($format); } #[DataProvider('formats')] public function test_a_loader_in_a_task_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderInATaskSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->aLoaderInATaskSurvivesDescribe($format); } #[DataProvider('formats')] public function test_an_extractor_reader_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorReaderSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->anExtractorReaderSurvivesDescribe($format); } #[DataProvider('formats')] public function test_the_splits_read_every_row_once(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theSplitsReadEveryRowOnce($format); + new FileFormatContract($this->cacheDir)->theSplitsReadEveryRowOnce($format); } #[DataProvider('formats')] public function test_metadata_columns_name_the_source_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->metadataColumnsNameTheSourceFile($format); + new FileFormatContract($this->cacheDir)->metadataColumnsNameTheSourceFile($format); } #[DataProvider('formats')] public function test_the_batch_size_bounds_every_batch(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theBatchSizeBoundsEveryBatch($format); + new FileFormatContract($this->cacheDir)->theBatchSizeBoundsEveryBatch($format); } #[DataProvider('formats')] public function test_refresh_lists_the_files_written_after_a_read(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->refreshListsTheFilesWrittenAfterARead($format); + new FileFormatContract($this->cacheDir)->refreshListsTheFilesWrittenAfterARead($format); } #[DataProvider('formats')] public function test_a_failed_run_leaves_no_file_at_the_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aFailedRunLeavesNoFileAtTheDestination($format); + new FileFormatContract($this->cacheDir)->aFailedRunLeavesNoFileAtTheDestination($format); } #[DataProvider('formats')] public function test_an_extractor_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_a_loader_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_reads_back_through_the_same_filesystem_instance(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->readsBackThroughTheSameFilesystemInstance($format); + new FileFormatContract($this->cacheDir)->readsBackThroughTheSameFilesystemInstance($format); } #[DataProvider('formats')] public function test_a_pushed_filter_returns_what_the_filter_node_returns(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPushedFilterReturnsWhatTheFilterNodeReturns( + new FileFormatContract($this->cacheDir)->aPushedFilterReturnsWhatTheFilterNodeReturns( $format, ref('id')->notEquals(lit('b')), ); diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Inference/CSVSnifferTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Inference/CSVSnifferTest.php index b9377f680c..f8a05b5373 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Inference/CSVSnifferTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Integration/IO/Inference/CSVSnifferTest.php @@ -232,11 +232,11 @@ public function test_a_window_part_rebuilt_from_its_description_sniffs_the_same( public function test_a_sniffer_over_a_memory_filesystem_does_not_describe(): void { static::assertNull( - (new CSVSniffer( + new CSVSniffer( new CSVSourceOpener(CSVFixtureContext::memory("id,name\n1,a\n"), new CSVReadOptions()), [CSVFixtureContext::memorySource()], InferredTypes::default(), - ))->describe(), + )->describe(), ); } @@ -247,11 +247,11 @@ public function test_bytes_are_the_listed_size(): void public function test_unbounded_inference_is_independent_of_execution_order(): void { - $inference = (new SchemaInference(unionByName: true))->everyRow()->everySource(); + $inference = new SchemaInference(unionByName: true)->everyRow()->everySource(); $fixtures = ['five_rows.csv', 'ragged.csv', 'orders_flow.csv']; static::assertEquals( - (new SchemaInferrer($inference))->infer( + new SchemaInferrer($inference)->infer( CSVFixtureContext::sniffer($fixtures, $inference), new VoidProgress(), )->schema, diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/DescribableRoundTripTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/DescribableRoundTripTest.php index 6462be5001..ff177d83ba 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/DescribableRoundTripTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/DescribableRoundTripTest.php @@ -6,7 +6,6 @@ use Flow\ETL\Adapter\CSV\Tests\Context\DescribableFixtures; use Flow\ETL\Foundation\Describe\Describable; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Foundation\Exception\RuntimeException; use Flow\ETL\Tests\Context\DescribeRoundTrip; use Flow\ETL\Tests\Context\ExtractorClasses; @@ -58,11 +57,7 @@ public function test_a_rebuilt_describable_equals_the_described_one(string $clas $this->expectException(RuntimeException::class); } - try { - $describable = DescribableFixtures::all()[$class](); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $describable = DescribableFixtures::all()[$class](); if (in_array($class, DescribableFixtures::undescribable(), true)) { static::assertNull($describable->describe()); diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVDecoderTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVDecoderTest.php index 2fea839550..205a82d498 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVDecoderTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVDecoderTest.php @@ -100,7 +100,7 @@ public function test_empty_quoted_fields_are_empty_strings(): void public function test_headers_are_null_before_any_line_is_decoded(): void { - static::assertNull((new CSVDecoder())->headers()); + static::assertNull(new CSVDecoder()->headers()); } public function test_an_empty_header_cell_is_named_by_position(): void diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVEnclosureScanTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVEnclosureScanTest.php index 404bcb7c7e..f089c38411 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVEnclosureScanTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVEnclosureScanTest.php @@ -21,7 +21,7 @@ public function test_the_scan_decides_exactly_like_the_pattern( ): void { static::assertSame( $complete, - (new CSVEnclosureScan($separator, $enclosure, $escape))->endsOutsideAnEnclosure($buffer), + new CSVEnclosureScan($separator, $enclosure, $escape)->endsOutsideAnEnclosure($buffer), ); } } diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVFileBatchesTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVFileBatchesTest.php index 1f1910cdeb..e9e219e268 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVFileBatchesTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVFileBatchesTest.php @@ -37,10 +37,10 @@ final class CSVFileBatchesTest extends FlowTestCase { public function test_a_file_yields_its_rows_and_consumes_no_offset(): void { - $file = (new CSVFileBatches( + $file = new CSVFileBatches( new CSVSourceOpener(MemoryFiles::with(['memory://a.csv' => "id\n1\n2\n3\n"]), new CSVReadOptions()), null, - ))->batches( + )->batches( FileReadMother::of(schema(int_schema('id')), null, 2), new Criteria(), new SourceFile(path('memory://a.csv')), @@ -66,10 +66,10 @@ public function test_a_file_whose_header_diverges_is_refused_before_a_row_is_rea $source = new SourceFile(path('memory://b.csv')); try { - iterator_to_array((new CSVFileBatches( + iterator_to_array(new CSVFileBatches( new CSVSourceOpener($filesystem, new CSVReadOptions()), new InferredColumns(schema(int_schema('id')), [], new SchemaInference(), 'memory://a.csv'), - ))->batches( + )->batches( FileReadMother::of(schema(int_schema('id')), null, 2), new Criteria(), $source, diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVLineReaderTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVLineReaderTest.php index 79ea94d9b8..f414e17170 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVLineReaderTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVLineReaderTest.php @@ -50,7 +50,7 @@ public function test_a_record_ending_outside_an_enclosure_is_complete(): void { static::assertSame( ['"a",b', 'c,d'], - iterator_to_array((new CSVLineReader('"'))->readLines(new MemorySourceStream("\"a\",b\nc,d"))), + iterator_to_array(new CSVLineReader('"')->readLines(new MemorySourceStream("\"a\",b\nc,d"))), ); } @@ -58,7 +58,7 @@ public function test_a_record_ending_inside_an_enclosure_is_incomplete(): void { static::assertSame( ["\"a\nb\",c", 'd'], - iterator_to_array((new CSVLineReader('"'))->readLines(new MemorySourceStream("\"a\nb\",c\nd"))), + iterator_to_array(new CSVLineReader('"')->readLines(new MemorySourceStream("\"a\nb\",c\nd"))), ); } @@ -66,7 +66,7 @@ public function test_an_escaped_enclosure_does_not_close_the_record(): void { static::assertSame( ["\"x\\\"y\nz\",1", '"p",2'], - iterator_to_array((new CSVLineReader('"'))->readLines(new MemorySourceStream("\"x\\\"y\nz\",1\n\"p\",2"))), + iterator_to_array(new CSVLineReader('"')->readLines(new MemorySourceStream("\"x\\\"y\nz\",1\n\"p\",2"))), ); } @@ -74,7 +74,7 @@ public function test_a_doubled_enclosure_does_not_close_the_record(): void { static::assertSame( ["\"a\"\"\nb\",1", '"c",2'], - iterator_to_array((new CSVLineReader('"'))->readLines(new MemorySourceStream("\"a\"\"\nb\",1\n\"c\",2"))), + iterator_to_array(new CSVLineReader('"')->readLines(new MemorySourceStream("\"a\"\"\nb\",1\n\"c\",2"))), ); } @@ -82,7 +82,7 @@ public function test_an_enclosure_inside_an_unenclosed_field_is_a_literal_byte() { static::assertSame( ['x"y,1', '"p",2'], - iterator_to_array((new CSVLineReader('"'))->readLines(new MemorySourceStream("x\"y,1\n\"p\",2"))), + iterator_to_array(new CSVLineReader('"')->readLines(new MemorySourceStream("x\"y,1\n\"p\",2"))), ); } @@ -92,11 +92,11 @@ public function test_an_empty_escape_makes_the_escape_character_ordinary(): void static::assertSame( ["\"x\\\",1\n\"p\",2"], - iterator_to_array((new CSVLineReader('"', escape: '\\'))->readLines(new MemorySourceStream($content))), + iterator_to_array(new CSVLineReader('"', escape: '\\')->readLines(new MemorySourceStream($content))), ); static::assertSame( ['"x\\",1', '"p",2'], - iterator_to_array((new CSVLineReader('"', escape: ''))->readLines(new MemorySourceStream($content))), + iterator_to_array(new CSVLineReader('"', escape: '')->readLines(new MemorySourceStream($content))), ); } @@ -104,7 +104,7 @@ public function test_a_buffer_without_any_enclosure_is_complete(): void { static::assertSame( ['a,b', 'c,d'], - iterator_to_array((new CSVLineReader('"'))->readLines(new MemorySourceStream("a,b\nc,d"))), + iterator_to_array(new CSVLineReader('"')->readLines(new MemorySourceStream("a,b\nc,d"))), ); } @@ -112,7 +112,7 @@ public function test_a_custom_separator_and_enclosure_are_honoured(): void { static::assertSame( ["x,'y;1", "a;'b\nc';d", 'e;f'], - iterator_to_array((new CSVLineReader("'", ';'))->readLines( + iterator_to_array(new CSVLineReader("'", ';')->readLines( new MemorySourceStream("x,'y;1\na;'b\nc';d\ne;f"), )), ); @@ -124,7 +124,7 @@ public function test_a_buffer_of_one_megabyte_without_a_closing_enclosure_does_n static::assertSame( [$open . "\nd"], - iterator_to_array((new CSVLineReader('"'))->readLines(new MemorySourceStream($open . "\nd"))), + iterator_to_array(new CSVLineReader('"')->readLines(new MemorySourceStream($open . "\nd"))), ); static::assertSame(PREG_NO_ERROR, preg_last_error()); } @@ -136,11 +136,11 @@ public function test_a_record_with_more_fields_than_pcre_can_match_is_still_spli static::assertSame( [$closed, 'c'], - iterator_to_array((new CSVLineReader('"'))->readLines(new MemorySourceStream($closed . "\nc"))), + iterator_to_array(new CSVLineReader('"')->readLines(new MemorySourceStream($closed . "\nc"))), ); static::assertSame( [$open . "\nc\""], - iterator_to_array((new CSVLineReader('"'))->readLines(new MemorySourceStream($open . "\nc\""))), + iterator_to_array(new CSVLineReader('"')->readLines(new MemorySourceStream($open . "\nc\""))), ); } @@ -158,7 +158,7 @@ public function test_the_pattern_splits_records_at_their_end( ): void { static::assertSame( $expected, - iterator_to_array((new CSVLineReader($enclosure, $separator, $escape))->readLines( + iterator_to_array(new CSVLineReader($enclosure, $separator, $escape)->readLines( new MemorySourceStream($content), )), ); @@ -168,7 +168,7 @@ public function test_characters_read_in_line_is_passed_through_to_the_stream(): { $stream = new LengthCapturingSourceStream("id,name\n1,foo", path('s3://bucket/users.csv')); - iterator_to_array((new CSVLineReader('"', charactersReadInLine: 4096))->readLines($stream)); + iterator_to_array(new CSVLineReader('"', charactersReadInLine: 4096)->readLines($stream)); static::assertSame([4096], $stream->capturedLengths); } @@ -177,7 +177,7 @@ public function test_null_characters_read_in_line_lets_the_stream_choose_its_def { $stream = new LengthCapturingSourceStream("id,name\n1,foo", path('s3://bucket/users.csv')); - iterator_to_array((new CSVLineReader('"'))->readLines($stream)); + iterator_to_array(new CSVLineReader('"')->readLines($stream)); static::assertSame([null], $stream->capturedLengths); } diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVReadOptionsTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVReadOptionsTest.php index 0e9f1aa6eb..6b01672dbf 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVReadOptionsTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVReadOptionsTest.php @@ -30,7 +30,7 @@ public function test_a_dialect_value_that_is_not_a_single_byte_is_refused(array public function test_an_empty_escape_is_accepted(): void { - static::assertSame('', (new CSVReadOptions())->withEscape('')->escape); + static::assertSame('', new CSVReadOptions()->withEscape('')->escape); } public function test_a_wither_returns_a_new_instance(): void @@ -75,7 +75,7 @@ public function test_the_withers_compose(): void { static::assertEquals( new CSVReadOptions(withHeader: false, separator: ';', escape: '/'), - (new CSVReadOptions()) + new CSVReadOptions() ->withHeader(false) ->withSeparator(';') ->withEscape('/'), @@ -84,7 +84,7 @@ public function test_the_withers_compose(): void public function test_normalize_round_trips_a_null_separator_and_a_set_escape(): void { - $options = (new CSVReadOptions(separator: null, escape: '\\')) + $options = new CSVReadOptions(separator: null, escape: '\\') ->withCharactersReadInLine(64) ->withMissingColumnsAsNull(true); @@ -102,6 +102,6 @@ public function test_normalize_round_trips_a_null_separator_and_a_set_escape(): $options->normalize(), ); static::assertEquals($options, CSVReadOptions::fromArray($options->normalize())); - static::assertEquals(new CSVReadOptions(), CSVReadOptions::fromArray((new CSVReadOptions())->normalize())); + static::assertEquals(new CSVReadOptions(), CSVReadOptions::fromArray(new CSVReadOptions()->normalize())); } } diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVRecordBoundaryTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVRecordBoundaryTest.php index 4d6b3789b6..b45d2b0ff3 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVRecordBoundaryTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVRecordBoundaryTest.php @@ -21,7 +21,7 @@ public function test_a_record_is_complete_when_the_buffer_ends_outside_an_enclos string $buffer, bool $complete, ): void { - static::assertSame($complete, (new CSVRecordBoundary($enclosure, $separator, $escape))->isComplete($buffer)); + static::assertSame($complete, new CSVRecordBoundary($enclosure, $separator, $escape)->isComplete($buffer)); } public function test_a_record_with_more_fields_than_pcre_can_match_is_decided_by_the_scan(): void diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVRecordResyncTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVRecordResyncTest.php index 79599041c2..330d607bf9 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVRecordResyncTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/CSVRecordResyncTest.php @@ -23,7 +23,7 @@ public function test_a_cut_between_records_is_accepted_immediately(): void { $csv = "a,b\n1,2\n3,4\n5,6\n"; - static::assertSame(4, (new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2))->after( + static::assertSame(4, new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2)->after( new StringSourceStream(path('memory://resync.csv'), $csv), 4, )); @@ -36,7 +36,7 @@ public function test_a_cut_inside_a_quoted_value_containing_newlines_is_not_fool static::assertSame( strlen($record), - (new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2))->after( + new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2)->after( new StringSourceStream(path('memory://resync.csv'), $record . "2,x\n3,y\n4,z\n"), strlen($inside), ), @@ -50,7 +50,7 @@ public function test_a_cut_inside_a_quoted_value_containing_the_separator_is_not static::assertSame( strlen($record), - (new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2))->after( + new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2)->after( new StringSourceStream(path('memory://resync.csv'), $record . "2,x\n3,y\n4,z\n"), strlen($inside), ), @@ -64,7 +64,7 @@ public function test_a_cut_inside_a_quoted_value_skips_to_the_next_real_record() static::assertSame( strlen($record), - (new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2))->after( + new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2)->after( new StringSourceStream(path('memory://resync.csv'), $record . "2,x\n3,y\n4,z\n"), strlen($inside), ), @@ -79,7 +79,7 @@ public function test_a_cut_inside_a_quoted_value_skips_to_the_next_real_record() #[TestWith([100])] public function test_a_cut_past_the_last_record_returns_null(int $from): void { - static::assertNull((new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2))->after( + static::assertNull(new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2)->after( new StringSourceStream(path('memory://resync.csv'), "a,b\n1,2\n3,4\n5,6\n"), $from, )); @@ -91,7 +91,7 @@ public function test_a_ragged_row_does_not_confirm_a_candidate(): void static::assertSame( strlen($ragged), - (new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2))->after( + new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2)->after( new StringSourceStream(path('memory://resync.csv'), $ragged . "4,5\n6,7\n8,9\n"), 4, ), @@ -105,7 +105,7 @@ public function test_a_record_longer_than_a_read_chunk_is_found(): void static::assertSame( strlen("a,b\n1," . $long . "\n"), - (new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2))->after( + new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2)->after( new StringSourceStream(path('memory://resync.csv'), $csv), 10, ), @@ -114,7 +114,7 @@ public function test_a_record_longer_than_a_read_chunk_is_found(): void public function test_fewer_records_than_confirmations_before_the_end_are_enough(): void { - static::assertSame(8, (new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2))->after( + static::assertSame(8, new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2)->after( new StringSourceStream(path('memory://resync.csv'), "a,b\n1,2\n3,4"), 5, )); @@ -122,7 +122,7 @@ public function test_fewer_records_than_confirmations_before_the_end_are_enough( public function test_offset_zero_starts_a_record(): void { - static::assertSame(0, (new CSVRecordResync(new CSVDialect(',', '"', '\\'), 5))->after( + static::assertSame(0, new CSVRecordResync(new CSVDialect(',', '"', '\\'), 5)->after( new StringSourceStream(path('memory://resync.csv'), "a,b\n"), 0, )); @@ -130,7 +130,7 @@ public function test_offset_zero_starts_a_record(): void public function test_offset_zero_of_an_empty_stream_starts_nothing(): void { - static::assertNull((new CSVRecordResync(new CSVDialect(',', '"', '\\'), 1))->after( + static::assertNull(new CSVRecordResync(new CSVDialect(',', '"', '\\'), 1)->after( new StringSourceStream(path('memory://resync.csv'), ''), 0, )); @@ -152,7 +152,7 @@ public function test_rejected_candidates_cost_one_inner_read_per_block_not_per_l new StringSourceStream(path('memory://resync.csv'), "a,b\n" . str_repeat("1\n", 50_000)), ); - static::assertNull((new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2))->after($stream, 5)); + static::assertNull(new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2)->after($stream, 5)); static::assertLessThan(5, count($stream->reads)); } @@ -182,16 +182,15 @@ public function test_confirms_only_well_formed_records_of_the_expected_width( int $records, bool $confirms, ): void { - static::assertSame($confirms, (new CSVRecordResync( - new CSVDialect(',', '"', '\\'), - $fields, - $records, - ))->confirms(new StringSourceStream(path('memory://shape.csv'), $csv), 0)); + static::assertSame($confirms, new CSVRecordResync(new CSVDialect(',', '"', '\\'), $fields, $records)->confirms( + new StringSourceStream(path('memory://shape.csv'), $csv), + 0, + )); } public function test_a_blank_separator_is_a_separator_not_a_blank(): void { - static::assertTrue((new CSVRecordResync(new CSVDialect("\t", '"', '\\'), 3, 1))->confirms( + static::assertTrue(new CSVRecordResync(new CSVDialect("\t", '"', '\\'), 3, 1)->confirms( new StringSourceStream(path('memory://shape.tsv'), "a\t\t\"b\"\n"), 0, )); @@ -199,7 +198,7 @@ public function test_a_blank_separator_is_a_separator_not_a_blank(): void public function test_an_escape_equal_to_the_enclosure_only_doubles(): void { - static::assertTrue((new CSVRecordResync(new CSVDialect(',', '"', '"'), 2, 1))->confirms( + static::assertTrue(new CSVRecordResync(new CSVDialect(',', '"', '"'), 2, 1)->confirms( new StringSourceStream(path('memory://shape.csv'), "\"a\"\"b\",1\n"), 0, )); @@ -207,7 +206,7 @@ public function test_an_escape_equal_to_the_enclosure_only_doubles(): void public function test_it_reads_from_the_position(): void { - static::assertTrue((new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2, 1))->confirms( + static::assertTrue(new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2, 1)->confirms( new StringSourceStream(path('memory://shape.csv'), "garbage\"\n1,2\n"), 9, )); @@ -215,7 +214,7 @@ public function test_it_reads_from_the_position(): void public function test_records_span_read_chunks(): void { - static::assertTrue((new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2, 2))->confirms( + static::assertTrue(new CSVRecordResync(new CSVDialect(',', '"', '\\'), 2, 2)->confirms( new StringSourceStream(path('memory://shape.csv'), '"' . str_repeat("x\n", 40_000) . "\",1\n2,3\n"), 0, )); diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php index 666c8ecbf5..d55a0d056b 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php @@ -31,7 +31,7 @@ public static function extractors(): Generator #[DataProvider('extractors')] public function test_an_extractor_carries_the_metadata_setter_only_when_it_declares_metadata(string $class): void { - if ((new ReflectionClass($class))->implementsInterface(MetadataColumnsExtractor::class)) { + if (new ReflectionClass($class)->implementsInterface(MetadataColumnsExtractor::class)) { MetadataColumnsContract::declares($class); return; diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Loader/CSVLoaderTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Loader/CSVLoaderTest.php index 3451b3a8e4..ab80f76ed9 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Loader/CSVLoaderTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Loader/CSVLoaderTest.php @@ -44,7 +44,7 @@ final class CSVLoaderTest extends FlowTestCase public function test_setting_content_type_on_path(): void { static::assertEquals( - (new CSVLoader(path(__DIR__ . '/file.csv'))) + new CSVLoader(path(__DIR__ . '/file.csv')) ->destination() ->getOption(Option::CONTENT_TYPE), ContentType::CSV, @@ -272,7 +272,7 @@ public function test_a_writer_writes_with_the_options_of_the_loader(): void { $stream = new StringDestinationStream(path('memory://out.csv')); - (new CSVLoader(path('memory://out.csv'), memory_filesystem())) + new CSVLoader(path('memory://out.csv'), memory_filesystem()) ->withSeparator(';') ->withNewLineSeparator("\n") ->writer($stream, schema(int_schema('id'), str_schema('name')), new PhpBackend()) @@ -285,7 +285,7 @@ public function test_a_writer_without_a_header(): void { $stream = new StringDestinationStream(path('memory://out.csv')); - (new CSVLoader(path('memory://out.csv'), memory_filesystem())) + new CSVLoader(path('memory://out.csv'), memory_filesystem()) ->withHeader(false) ->withNewLineSeparator("\n") ->writer($stream, schema(int_schema('id')), new PhpBackend()) @@ -299,11 +299,11 @@ public function test_a_flow_php_of_another_abi_is_refused(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('does not match flow-php/etl'); - (new CSVLoader( + new CSVLoader( path('memory://out.csv'), memory_filesystem(), new FlowPhpExtension(true, FlowPhpExtension::ABI + 1, '0.46.0'), - ))->writer(new StringDestinationStream(path('memory://out.csv')), schema(int_schema('id')), new PhpBackend()); + )->writer(new StringDestinationStream(path('memory://out.csv')), schema(int_schema('id')), new PhpBackend()); } public function test_in_task_keeps_the_lane_override(): void @@ -311,11 +311,11 @@ public function test_in_task_keeps_the_lane_override(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('does not match flow-php/etl'); - (new CSVLoader( + new CSVLoader( path('memory://out.csv'), memory_filesystem(), new FlowPhpExtension(true, FlowPhpExtension::ABI + 1, '0.46.0'), - )) + ) ->inTask(new Part(0, 1, '1a2b3c4d5e6f7a8b', false)) ->writer( new StringDestinationStream(path('memory://other.csv')), @@ -328,7 +328,7 @@ public function test_without_flow_php_the_php_encoder_writes(): void { $stream = new StringDestinationStream(path('memory://out.csv')); - (new CSVLoader(path('memory://out.csv'), memory_filesystem(), new FlowPhpExtension(false, null))) + new CSVLoader(path('memory://out.csv'), memory_filesystem(), new FlowPhpExtension(false, null)) ->withHeader(false) ->withNewLineSeparator("\n") ->writer($stream, schema(int_schema('id')), new PhpBackend()) diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Loader/CSVWriteOptionsTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Loader/CSVWriteOptionsTest.php index 78c747ce32..38e5587e42 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Loader/CSVWriteOptionsTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Loader/CSVWriteOptionsTest.php @@ -28,7 +28,7 @@ public function test_defaults(): void public function test_an_empty_escape_is_accepted(): void { - static::assertSame('', (new CSVWriteOptions(escape: ''))->escape); + static::assertSame('', new CSVWriteOptions(escape: '')->escape); } #[TestWith(['', '"', '\\', 'Separator must be a single character'])] diff --git a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Loader/PhpCSVEncoderTest.php b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Loader/PhpCSVEncoderTest.php index 407f32f2d5..99d03aa010 100644 --- a/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Loader/PhpCSVEncoderTest.php +++ b/src/adapter/etl-adapter-csv/tests/Flow/ETL/Adapter/CSV/Tests/Unit/IO/Loader/PhpCSVEncoderTest.php @@ -60,7 +60,7 @@ public function test_encode_encloses_a_field_as_fputcsv_does(?string $value, str { static::assertSame( $expected, - (new PhpCSVEncoder(new CSVWriteOptions(newLineSeparator: "\n")))->encode(array_to_rows([[ + new PhpCSVEncoder(new CSVWriteOptions(newLineSeparator: "\n"))->encode(array_to_rows([[ 'a' => $value, ]], schema(str_schema('a', nullable: true)))), ); @@ -70,11 +70,11 @@ public function test_encode_with_a_custom_separator_and_enclosure(): void { static::assertSame( "'a;b';1;'it''s'\r\nplain;2;\"q\"\r\n", - (new PhpCSVEncoder(new CSVWriteOptions( + new PhpCSVEncoder(new CSVWriteOptions( separator: ';', enclosure: "'", newLineSeparator: "\r\n", - )))->encode(array_to_rows( + ))->encode(array_to_rows( [['a' => 'a;b', 'b' => 1, 'c' => "it's"], ['a' => 'plain', 'b' => 2, 'c' => '"q"']], schema(str_schema('a'), int_schema('b'), str_schema('c')), )), @@ -85,7 +85,7 @@ public function test_encode_without_an_escape_character_doubles_every_enclosure( { static::assertSame( "\"a\\\"\"b\"\nback\\slash\n", - (new PhpCSVEncoder(new CSVWriteOptions(escape: '', newLineSeparator: "\n")))->encode(array_to_rows([ + new PhpCSVEncoder(new CSVWriteOptions(escape: '', newLineSeparator: "\n"))->encode(array_to_rows([ ['a' => 'a\"b'], ['a' => 'back\slash'], ], schema(str_schema('a')))), @@ -96,11 +96,11 @@ public function test_encode_encloses_a_datetime_whose_format_holds_a_space(): vo { static::assertSame( "\"2023-10-01 12:02:01\",\"01 Oct 2023\"\n", - (new PhpCSVEncoder(new CSVWriteOptions( + new PhpCSVEncoder(new CSVWriteOptions( newLineSeparator: "\n", dateTimeFormat: 'Y-m-d H:i:s', dateFormat: 'd M Y', - )))->encode(array_to_rows( + ))->encode(array_to_rows( [[ 'at' => new DateTimeImmutable('2023-10-01 12:02:01 UTC'), 'on' => new DateTimeImmutable('2023-10-01'), @@ -122,10 +122,7 @@ public function test_encode_encloses_numbers_and_booleans_that_hold_the_separato ): void { static::assertSame( $expected, - (new PhpCSVEncoder(new CSVWriteOptions( - separator: $separator, - newLineSeparator: "\n", - )))->encode(array_to_rows( + new PhpCSVEncoder(new CSVWriteOptions(separator: $separator, newLineSeparator: "\n"))->encode(array_to_rows( [['f' => 1.5, 'i' => -2, 'b' => true, 'g' => 1.0e25]], schema(float_schema('f'), int_schema('i'), bool_schema('b'), float_schema('g')), )), @@ -144,7 +141,7 @@ public function test_encode_renders_eleven_columns_in_schema_order(): void static::assertSame( "0,1,2,3,4,5,6,7,8,9,10\n0,1,2,3,4,5,6,7,8,9,10\n", - (new PhpCSVEncoder(new CSVWriteOptions(newLineSeparator: "\n")))->encode(array_to_rows( + new PhpCSVEncoder(new CSVWriteOptions(newLineSeparator: "\n"))->encode(array_to_rows( array_fill(0, 2, $row), schema(...$definitions), )), @@ -185,7 +182,7 @@ public function test_encode_writes_random_strings_as_fputcsv_does(): void static::assertSame( $expected, - (new PhpCSVEncoder(new CSVWriteOptions(newLineSeparator: "\n")))->encode(array_to_rows($rows, schema( + new PhpCSVEncoder(new CSVWriteOptions(newLineSeparator: "\n"))->encode(array_to_rows($rows, schema( str_schema('a'), str_schema('b'), str_schema('c'), @@ -197,7 +194,7 @@ public function test_encode_of_an_empty_batch_is_empty(): void { static::assertSame( '', - (new PhpCSVEncoder(new CSVWriteOptions()))->encode(array_to_rows([], schema(int_schema('a')))), + new PhpCSVEncoder(new CSVWriteOptions())->encode(array_to_rows([], schema(int_schema('a')))), ); } @@ -205,7 +202,7 @@ public function test_encode_writes_a_null_as_an_empty_field_and_encloses_a_neste { static::assertSame( "1,true,\"[\"\"a b\"\",\"\"c\"\"]\",2023-10-01T12:02:01+00:00\n,,,\n", - (new PhpCSVEncoder(new CSVWriteOptions(newLineSeparator: "\n")))->encode(array_to_rows( + new PhpCSVEncoder(new CSVWriteOptions(newLineSeparator: "\n"))->encode(array_to_rows( [ [ 'id' => 1, @@ -229,11 +226,11 @@ public function test_encode_header(): void { static::assertSame( "id;'first name';'it''s'|", - (new PhpCSVEncoder(new CSVWriteOptions( + new PhpCSVEncoder(new CSVWriteOptions( separator: ';', enclosure: "'", newLineSeparator: '|', - )))->encodeHeader([ + ))->encodeHeader([ 'id', 'first name', "it's", @@ -275,7 +272,7 @@ public function test_encode_keeps_every_byte_of_a_binary_string(): void static::assertSame( $bytes . "\n", - (new PhpCSVEncoder(new CSVWriteOptions(newLineSeparator: "\n")))->encode(array_to_rows([[ + new PhpCSVEncoder(new CSVWriteOptions(newLineSeparator: "\n"))->encode(array_to_rows([[ 'a' => $bytes, ]], schema(str_schema('a')))), ); diff --git a/src/adapter/etl-adapter-doctrine/composer.json b/src/adapter/etl-adapter-doctrine/composer.json index cad6c746d9..e048d81597 100644 --- a/src/adapter/etl-adapter-doctrine/composer.json +++ b/src/adapter/etl-adapter-doctrine/composer.json @@ -13,8 +13,8 @@ "loader" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", - "doctrine/dbal": "^4.5", + "php": "~8.5.0 || ~8.6.0", + "doctrine/dbal": "^4.6", "flow-php/doctrine-dbal-bulk": "self.version", "flow-php/etl": "self.version" }, diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalKeySetExtractor.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalKeySetExtractor.php index 768626af02..e6675fa8ec 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalKeySetExtractor.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalKeySetExtractor.php @@ -182,7 +182,7 @@ public function extract(Backend $backend, Criteria $criteria): Generator $rawBatch[] = $row; } - $rows = (new RowsBuilder($schema, $backend)) + $rows = new RowsBuilder($schema, $backend) ->appendRows($rawBatch) ->finish(); @@ -216,7 +216,7 @@ public function schema(): Schema try { // The base builder, never the page SQL: the key_ alias lives on a per-page clone. - return $this->derived ??= (new DbalResultSchema())->of( + return $this->derived ??= new DbalResultSchema()->of( $this->connection, $this->queryBuilder->getSQL(), self::class, @@ -230,7 +230,7 @@ public function schema(): Schema public function statistics(): Statistics { - return $this->statistics ??= new Statistics(rows: (new ExplainedRows())->of( + return $this->statistics ??= new Statistics(rows: new ExplainedRows()->of( $this->connection, $this->queryBuilder->getSQL(), $this->queryBuilder->getParameters(), diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalLimitOffsetExtractor.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalLimitOffsetExtractor.php index cfce7fb589..18f468dbfd 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalLimitOffsetExtractor.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalLimitOffsetExtractor.php @@ -132,7 +132,7 @@ public function extract(Backend $backend, Criteria $criteria): Generator $yielded = 0; - for ($page = 0; $page < (new Pages($total, $this->batchSize->size))->pages(); $page++) { + for ($page = 0; $page < new Pages($total, $this->batchSize->size)->pages(); $page++) { // the request asks only for what is still wanted, while the offset keeps striding by the batch size $pageSize = $maximum === null ? $this->batchSize->size : min($this->batchSize->size, $maximum - $yielded); @@ -154,7 +154,7 @@ public function extract(Backend $backend, Criteria $criteria): Generator $rawBatch[] = $row; } - $rows = (new RowsBuilder($schema, $backend)) + $rows = new RowsBuilder($schema, $backend) ->appendRows($rawBatch) ->finish(); @@ -184,7 +184,7 @@ public function schema(): Schema } try { - return $this->derived ??= (new DbalResultSchema())->of( + return $this->derived ??= new DbalResultSchema()->of( $this->connection, $this->queryBuilder->getSQL(), self::class, @@ -201,7 +201,7 @@ public function schema(): Schema */ public function statistics(): Statistics { - return $this->statistics ??= new Statistics(rows: (new ExplainedRows())->of( + return $this->statistics ??= new Statistics(rows: new ExplainedRows()->of( $this->connection, $this->queryBuilder->getSQL(), $this->queryBuilder->getParameters(), diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalQueryExtractor.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalQueryExtractor.php index 2bffaa7a0b..8e3b7cba27 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalQueryExtractor.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalQueryExtractor.php @@ -108,7 +108,7 @@ public function extract(Backend $backend, Criteria $criteria): Generator return; } - $all = (new RowsBuilder($schema, $backend)) + $all = new RowsBuilder($schema, $backend) ->appendRows($this->connection->fetchAllAssociative($this->query, $parameters, $this->types)) ->finish(); @@ -144,7 +144,7 @@ public function schema(): Schema try { // The SQL - and so the result shape - is identical for every parameter set, so the probe binds none of them. - return $this->derived ??= (new DbalResultSchema())->of($this->connection, $this->query, self::class); + return $this->derived ??= new DbalResultSchema()->of($this->connection, $this->query, self::class); } catch (SchemaNotDerivableException $refusal) { $this->refusal = $refusal; @@ -164,7 +164,7 @@ public function statistics(): Statistics $rows = Cardinality::exact(0); foreach ($explained as $parameters) { - $rows = $rows->merge((new ExplainedRows())->of( + $rows = $rows->merge(new ExplainedRows()->of( $this->connection, $this->query, $parameters, diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalResultSchema.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalResultSchema.php index d0bd145413..af8be118ae 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalResultSchema.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/DbalResultSchema.php @@ -37,19 +37,19 @@ public function of(Connection $connection, string $sql, string $extractor): Sche try { return match (true) { - $native instanceof PgSqlConnection => (new TypedColumns())->schema( - (new PgSqlResultColumns())->of($native, (new DescribeQuery())->of($sql)), + $native instanceof PgSqlConnection => new TypedColumns()->schema( + new PgSqlResultColumns()->of($native, new DescribeQuery()->of($sql)), new PgSqlTypesMap(), $extractor, ), - $native instanceof mysqli => (new TypedColumns())->schema( - (new MysqliResultColumns())->of($native, $sql, $extractor), + $native instanceof mysqli => new TypedColumns()->schema( + new MysqliResultColumns()->of($native, $sql, $extractor), new MysqliTypesMap(), $extractor, ), $native instanceof SQLite3, $native instanceof PDO && $native->getAttribute(PDO::ATTR_DRIVER_NAME) === 'sqlite', - => (new SqliteResultSchema())->of($native, $sql, $extractor), + => new SqliteResultSchema()->of($native, $sql, $extractor), default => throw SchemaNotDerivableException::extractor($extractor, sprintf( 'the %s driver reports no column types for a query result, so this query cannot be typed', get_debug_type($native), diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/Explain/ExplainedRows.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/Explain/ExplainedRows.php index 16cc9ea4ea..bf9ce1537f 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/Explain/ExplainedRows.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/Explain/ExplainedRows.php @@ -32,13 +32,13 @@ public function of( ): Cardinality { $platform = $connection->getDatabasePlatform(); $planned = match (true) { - $platform instanceof PostgreSQLPlatform => (new PostgreSqlExplainedRows())->of( + $platform instanceof PostgreSQLPlatform => new PostgreSqlExplainedRows()->of( $connection, $sql, $parameters, $types, ), - $platform instanceof MySQL80Platform => (new MySqlExplainedRows())->of( + $platform instanceof MySQL80Platform => new MySqlExplainedRows()->of( $connection, $sql, $parameters, diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/MysqliResultColumns.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/MysqliResultColumns.php index 06f8da71eb..f6d359bd04 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/MysqliResultColumns.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/MysqliResultColumns.php @@ -26,7 +26,7 @@ public function of(mysqli $connection, string $sql, string $extractor): array { try { - $statement = $connection->prepare((new NativePlaceholders())->toMysqli($sql)->sql) + $statement = $connection->prepare(new NativePlaceholders()->toMysqli($sql)->sql) ?: throw new ProbeRefusal( sprintf('MySQL refused to prepare this query (%s)', $connection->error), $connection->errno, diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/MysqliTypesMap.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/MysqliTypesMap.php index 32a1766c53..961db2b622 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/MysqliTypesMap.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/MysqliTypesMap.php @@ -41,7 +41,7 @@ /** * mysqli_result::fetch_fields() reports an integer type constant per column. * MYSQLI_TYPE_CHAR is an alias of MYSQLI_TYPE_TINY (both 1) - listing both is a duplicate-arm - * fatal. MYSQLI_TYPE_VARCHAR does not exist in PHP 8.3. TINY maps to integer, not boolean: + * fatal. MYSQLI_TYPE_VARCHAR does not exist in PHP. TINY maps to integer, not boolean: * the result route is told a type constant, not a display width, so tinyint(1) and tinyint(4) * are indistinguishable. * diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/NativePlaceholders.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/NativePlaceholders.php index fd87d6e5b6..953f7e70e4 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/NativePlaceholders.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/NativePlaceholders.php @@ -11,11 +11,11 @@ { public function toMysqli(string $sql): RewrittenSql { - return (new PlaceholderRewriter(new MysqliPlaceholders()))->rewrite($sql); + return new PlaceholderRewriter(new MysqliPlaceholders())->rewrite($sql); } public function toPostgreSql(string $sql): RewrittenSql { - return (new PlaceholderRewriter(new PostgreSqlPlaceholders()))->rewrite($sql); + return new PlaceholderRewriter(new PostgreSqlPlaceholders())->rewrite($sql); } } diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/PgSqlResultColumns.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/PgSqlResultColumns.php index 8931210fb0..845f55c0b8 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/PgSqlResultColumns.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/PgSqlResultColumns.php @@ -34,7 +34,7 @@ public function of(PgSqlConnection $connection, string $probe): array { // DBAL emits :name, libpq speaks $1..$n. - $rewritten = (new NativePlaceholders())->toPostgreSql($probe); + $rewritten = new NativePlaceholders()->toPostgreSql($probe); // pg_query_params() returns false and keeps no SQLSTATE; the result of a sent query carries it if (!@pg_send_query_params($connection, $rewritten->sql, array_fill(0, $rewritten->parameters, null))) { diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/PlaceholderRewriter.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/PlaceholderRewriter.php index c996d611ee..f90d9ed372 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/PlaceholderRewriter.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/PlaceholderRewriter.php @@ -50,7 +50,7 @@ public function rewrite(string $sql): RewrittenSql $this->buffer = []; $this->count = 0; - (new Parser($this->dialect->usesBackslashEscapes()))->parse($sql, $this); + new Parser($this->dialect->usesBackslashEscapes())->parse($sql, $this); return new RewrittenSql(implode('', $this->buffer), $this->count); } diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/SqliteResultSchema.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/SqliteResultSchema.php index 8e6ce89d30..4a2feaa30c 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/SqliteResultSchema.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Extractor/SqliteResultSchema.php @@ -20,10 +20,10 @@ */ public function of(SQLite3|PDO $connection, string $sql, string $extractor): Schema { - $probe = (new DescribeQuery())->of($sql); + $probe = new DescribeQuery()->of($sql); $names = $connection instanceof SQLite3 - ? (new Sqlite3ColumnNames())->of($connection, $probe) - : (new PdoSqliteColumnNames())->of($connection, $probe); + ? new Sqlite3ColumnNames()->of($connection, $probe) + : new PdoSqliteColumnNames()->of($connection, $probe); $columns = []; @@ -31,6 +31,6 @@ public function of(SQLite3|PDO $connection, string $sql, string $extractor): Sch $columns[] = new ResultColumn($name); } - return (new TypedColumns())->schema($columns, new SqliteTypes(), $extractor); + return new TypedColumns()->schema($columns, new SqliteTypes(), $extractor); } } diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Loader/DbalLoader.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Loader/DbalLoader.php index 8dbb3a6b20..32a4491d6e 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Loader/DbalLoader.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/IO/Loader/DbalLoader.php @@ -79,10 +79,10 @@ public static function fromConnection( public static function fromDescription(#[SensitiveParameter] array $data, Rebuild $rebuild): static { - return (new self( + return new self( type_string()->assert($data['table_name'] ?? null), type_map(type_string(), type_mixed())->assert($data['connection_params'] ?? null), - ))->withOperation(type_string()->assert($data['operation'] ?? null)); + )->withOperation(type_string()->assert($data['operation'] ?? null)); } public function collection(): string diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Values/Schema/SchemaConverter.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Values/Schema/SchemaConverter.php index 2ea54cd0ca..63dd5f5c67 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Values/Schema/SchemaConverter.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Values/Schema/SchemaConverter.php @@ -11,7 +11,6 @@ use Doctrine\DBAL\Schema\Name\UnqualifiedName; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type as DbalType; use Flow\ETL\Foundation\Exception\InvalidArgumentException; use Flow\ETL\Values\Schema; use Flow\ETL\Values\Schema\Definition; @@ -28,14 +27,13 @@ use function implode; use function in_array; use function is_scalar; -use function sprintf; final readonly class SchemaConverter { private TypesMap $typesMap; /** - * @param array>, class-string<\Doctrine\DBAL\Types\Type>> $map + * @param array>, string> $map */ public function __construct(array $map = []) { @@ -78,7 +76,7 @@ public function toFlowSchema(Table $table): Schema */ private function columnToFlow(Column $column, Table $table): Definition { - $type = $this->typesMap->toFlowType(DbalType::getType($column->getTypeName())::class); + $type = $this->typesMap->toFlowType($column->getTypeName()); $nullable = !$column->getNotnull(); @@ -182,26 +180,6 @@ private function columnToFlow(Column $column, Table $table): Definition */ private function flowToColumn(string $name, Type $type, bool $nullable, ?Metadata $metadata = null): Column { - $dbalTypeClass = $this->typesMap->toDbalType($type::class); - - if ($metadata?->has(DbalMetadata::TYPE->value)) { - $dbalType = DbalType::getType((string) $metadata->getAs(DbalMetadata::TYPE->value, type_string())); - } else { - $dbalType = null; - - foreach (DbalType::getTypesMap() as $typeName => $class) { - if ($class === $dbalTypeClass) { - $dbalType = DbalType::getType($typeName); - - break; - } - } - } - - if ($dbalType === null) { - throw new InvalidArgumentException(sprintf('"%s" is not a valid Doctrine DBAL type.', $dbalType)); - } - $options = [ 'notnull' => !$nullable, ]; @@ -246,7 +224,13 @@ private function flowToColumn(string $name, Type $type, bool $nullable, ?Metadat $options['customSchemaOptions'] = $metadata->get(DbalMetadata::CUSTOM_SCHEMA_OPTIONS->value); } - return new Column($name, $dbalType, $options); + return new Column( + $name, + $metadata?->has(DbalMetadata::TYPE->value) + ? (string) $metadata->getAs(DbalMetadata::TYPE->value, type_string()) + : $this->typesMap->toDbalType($type::class), + $options, + ); } private function withIndexes(Schema $schema, Table $table): Table diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Values/Schema/TypesMap.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Values/Schema/TypesMap.php index cc08d71c5b..17f24fc4b0 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Values/Schema/TypesMap.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/Values/Schema/TypesMap.php @@ -4,27 +4,7 @@ namespace Flow\ETL\Adapter\Doctrine\Values\Schema; -use Doctrine\DBAL\Types\BigIntType; -use Doctrine\DBAL\Types\BlobType; -use Doctrine\DBAL\Types\BooleanType as DoctrineBooleanType; -use Doctrine\DBAL\Types\DateImmutableType; -use Doctrine\DBAL\Types\DateTimeImmutableType; -use Doctrine\DBAL\Types\DateTimeType as DoctrineDateTimeType; -use Doctrine\DBAL\Types\DateTimeTzImmutableType; -use Doctrine\DBAL\Types\DateTimeTzType; -use Doctrine\DBAL\Types\DateType as DoctrineDateType; -use Doctrine\DBAL\Types\DecimalType; -use Doctrine\DBAL\Types\FloatType as DoctrineFloatType; -use Doctrine\DBAL\Types\GuidType; -use Doctrine\DBAL\Types\IntegerType as DoctrineIntegerType; -use Doctrine\DBAL\Types\JsonType as DoctrineJsonType; -use Doctrine\DBAL\Types\SmallFloatType; -use Doctrine\DBAL\Types\SmallIntType; -use Doctrine\DBAL\Types\StringType as DoctrineStringType; -use Doctrine\DBAL\Types\TextType; -use Doctrine\DBAL\Types\TimeImmutableType; -use Doctrine\DBAL\Types\TimeType as DoctrineTimeType; -use Doctrine\DBAL\Types\Type as DbalType; +use Doctrine\DBAL\Types\Types; use Flow\ETL\Foundation\Exception\InvalidArgumentException; use Flow\ETL\Values\Schema; use Flow\Types\Type as FlowType; @@ -48,7 +28,6 @@ use Flow\Types\Type\Native\StringType; use InvalidArgumentException as BaseInvalidArgumentException; -use function array_flip; use function array_key_exists; use function count; use function is_a; @@ -57,57 +36,57 @@ final class TypesMap { /** - * @var array, class-string>> + * @var array>> */ public const array DBAL_TYPES = [ - DoctrineStringType::class => StringType::class, - TextType::class => StringType::class, - DoctrineIntegerType::class => IntegerType::class, - BigIntType::class => IntegerType::class, - SmallIntType::class => IntegerType::class, - DoctrineFloatType::class => FloatType::class, - SmallFloatType::class => FloatType::class, - DoctrineBooleanType::class => BooleanType::class, - DoctrineDateType::class => DateType::class, - DateImmutableType::class => DateType::class, - TimeImmutableType::class => TimeType::class, - DoctrineTimeType::class => TimeType::class, - DateTimeImmutableType::class => DateTimeType::class, - DateTimeTzImmutableType::class => DateTimeType::class, - DateTimeTzType::class => DateTimeType::class, - DoctrineDateTimeType::class => DateTimeType::class, - GuidType::class => UuidType::class, - DoctrineJsonType::class => JsonType::class, - BlobType::class => StringType::class, - DecimalType::class => FloatType::class, + Types::STRING => StringType::class, + Types::TEXT => StringType::class, + Types::INTEGER => IntegerType::class, + Types::BIGINT => IntegerType::class, + Types::SMALLINT => IntegerType::class, + Types::FLOAT => FloatType::class, + Types::SMALLFLOAT => FloatType::class, + Types::BOOLEAN => BooleanType::class, + 'date' => DateType::class, + Types::DATE_IMMUTABLE => DateType::class, + Types::TIME_IMMUTABLE => TimeType::class, + 'time' => TimeType::class, + Types::DATETIME_IMMUTABLE => DateTimeType::class, + Types::DATETIMETZ_IMMUTABLE => DateTimeType::class, + 'datetimetz' => DateTimeType::class, + 'datetime' => DateTimeType::class, + Types::GUID => UuidType::class, + Types::JSON => JsonType::class, + Types::BLOB => StringType::class, + Types::DECIMAL => FloatType::class, ]; /** - * @var array>, class-string> + * @var array>, non-empty-string> */ public const array FLOW_TYPES = [ - StringType::class => DoctrineStringType::class, - IntegerType::class => DoctrineIntegerType::class, - FloatType::class => DoctrineFloatType::class, - BooleanType::class => DoctrineBooleanType::class, - DateType::class => DateImmutableType::class, - TimeType::class => TimeImmutableType::class, - DateTimeType::class => DateTimeImmutableType::class, - UuidType::class => GuidType::class, - TimeZoneType::class => DoctrineStringType::class, - JsonType::class => DoctrineJsonType::class, - XMLType::class => DoctrineStringType::class, - XMLElementType::class => DoctrineStringType::class, - HTMLType::class => DoctrineStringType::class, - HTMLElementType::class => DoctrineStringType::class, - EnumType::class => DoctrineStringType::class, - ListType::class => DoctrineJsonType::class, - MapType::class => DoctrineJsonType::class, - StructureType::class => DoctrineJsonType::class, + StringType::class => Types::STRING, + IntegerType::class => Types::INTEGER, + FloatType::class => Types::FLOAT, + BooleanType::class => Types::BOOLEAN, + DateType::class => Types::DATE_IMMUTABLE, + TimeType::class => Types::TIME_IMMUTABLE, + DateTimeType::class => Types::DATETIME_IMMUTABLE, + UuidType::class => Types::GUID, + TimeZoneType::class => Types::STRING, + JsonType::class => Types::JSON, + XMLType::class => Types::STRING, + XMLElementType::class => Types::STRING, + HTMLType::class => Types::STRING, + HTMLElementType::class => Types::STRING, + EnumType::class => Types::STRING, + ListType::class => Types::JSON, + MapType::class => Types::JSON, + StructureType::class => Types::JSON, ]; /** - * @var array>, class-string> + * @var array>, non-empty-string> */ private array $map; @@ -121,37 +100,31 @@ public function __construct(array $map) throw new InvalidArgumentException(sprintf('"%s" is not a valid type.', $flowType)); } - if (!is_a($dbalType, DbalType::class, true)) { - throw new InvalidArgumentException(sprintf('"%s" is not a valid Doctrine DBAL type.', $dbalType)); + if ($dbalType === '') { + throw new InvalidArgumentException(sprintf( + 'Doctrine DBAL type name for "%s" must be a non-empty string.', + $flowType, + )); } } if (!count($map)) { $this->map = self::FLOW_TYPES; } else { - /** @var array>, class-string> $map */ + /** @var array>, non-empty-string> $map */ $this->map = $map; } } /** - * Build DBAL types array from a schema's definitions. - * - * @return array Column name => DBAL Type instance + * @return array Column name => DBAL type name */ public function flowSchemaTypes(Schema $schema): array { $types = []; - $typeClassToName = array_flip(DbalType::getTypesMap()); foreach ($schema->definitions() as $definition) { - $dbalTypeClass = $this->toDbalType($definition->type()::class); - - if (!array_key_exists($dbalTypeClass, $typeClassToName)) { - throw new BaseInvalidArgumentException(sprintf('DBAL type "%s" is not registered.', $dbalTypeClass)); - } - - $types[$definition->name()] = DbalType::getType($typeClassToName[$dbalTypeClass]); + $types[$definition->name()] = $this->toDbalType($definition->type()::class); } return $types; @@ -160,7 +133,7 @@ public function flowSchemaTypes(Schema $schema): array /** * @param class-string> $flowType * - * @return class-string + * @return non-empty-string */ public function toDbalType(string $flowType): string { diff --git a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/functions.php b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/functions.php index e9a54c18df..6924bf6618 100644 --- a/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/functions.php +++ b/src/adapter/etl-adapter-doctrine/src/Flow/ETL/Adapter/Doctrine/functions.php @@ -101,7 +101,7 @@ function from_dbal_limit_offset_qb( int $page_size = 1000, ?int $maximum = null, ): DbalLimitOffsetExtractor { - $loader = (new DbalLimitOffsetExtractor($connection, $queryBuilder))->withBatchSize($page_size); + $loader = new DbalLimitOffsetExtractor($connection, $queryBuilder)->withBatchSize($page_size); if ($maximum !== null) { $loader->withMaximum($maximum); @@ -206,7 +206,7 @@ function dbal_from_query( function to_dbal_table_insert(array|Connection $connection, string $table, ?InsertOptions $options = null): DbalLoader { return is_array($connection) - ? (new DbalLoader($table, $connection))->withOperationOptions($options) + ? new DbalLoader($table, $connection)->withOperationOptions($options) : DbalLoader::fromConnection($connection, $table, $options); } @@ -223,7 +223,7 @@ function to_dbal_table_insert(array|Connection $connection, string $table, ?Inse function to_dbal_table_update(array|Connection $connection, string $table, ?UpdateOptions $options = null): DbalLoader { return is_array($connection) - ? (new DbalLoader($table, $connection)) + ? new DbalLoader($table, $connection) ->withOperation('update') ->withOperationOptions($options) : DbalLoader::fromConnection($connection, $table, $options, 'update'); @@ -243,7 +243,7 @@ function to_dbal_table_delete(array|Connection $connection, string $table): Dbal { return $connection instanceof Connection ? DbalLoader::fromConnection($connection, $table, null, 'delete') - : (new DbalLoader($table, $connection))->withOperation('delete'); + : new DbalLoader($table, $connection)->withOperation('delete'); } /** @@ -251,7 +251,7 @@ function to_dbal_table_delete(array|Connection $connection, string $table): Dbal * * @param Schema $schema * @param array $table_options - * @param array>, class-string<\Doctrine\DBAL\Types\Type>> $types_map + * @param array>, string> $types_map */ #[DocumentationDSL(module: Module::DOCTRINE, type: DSLType::HELPER)] function to_dbal_schema_table( @@ -260,20 +260,20 @@ function to_dbal_schema_table( array $table_options = [], array $types_map = [], ): DoctrineTable { - return (new SchemaConverter($types_map))->toDbalTable($schema, $table_name, $table_options); + return new SchemaConverter($types_map)->toDbalTable($schema, $table_name, $table_options); } /** * Converts a Doctrine\DBAL\Schema\Table to a Flow\ETL\Values\Schema. * - * @param array>, class-string<\Doctrine\DBAL\Types\Type>> $types_map + * @param array>, string> $types_map * * @return Schema */ #[DocumentationDSL(module: Module::DOCTRINE, type: DSLType::HELPER)] function table_schema_to_flow_schema(DoctrineTable $table, array $types_map = []): Schema { - return (new SchemaConverter($types_map))->toFlowSchema($table); + return new SchemaConverter($types_map)->toFlowSchema($table); } /** diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/InMemorySqlite.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/InMemorySqlite.php index 3cacb2be7e..2d92162ca0 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/InMemorySqlite.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/InMemorySqlite.php @@ -19,7 +19,7 @@ public static function connection(Middleware ...$middlewares): Connection return DriverManager::getConnection([ 'driver' => 'pdo_sqlite', 'memory' => true, - ], (new Configuration())->setMiddlewares($middlewares)); + ], new Configuration()->setMiddlewares($middlewares)); } /** diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/KeySetSqlite.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/KeySetSqlite.php index d1ef980cc5..e553a9b061 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/KeySetSqlite.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/KeySetSqlite.php @@ -8,7 +8,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\ETL\Values\Schema; @@ -24,13 +23,13 @@ public static function withCaseInsensitiveKeys(Connection $connection, string $t $connection ->createSchemaManager() ->createTable( - (new Table($table, [ - new Column('id', Type::getType(Types::INTEGER)), - new Column('k', Type::getType(Types::STRING), [ + new Table($table, [ + new Column('id', Types::INTEGER), + new Column('k', Types::STRING, [ 'length' => 10, 'platformOptions' => ['collation' => 'NOCASE'], ]), - ])) + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/PlannedTable.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/PlannedTable.php index 2abed612f6..4cc6aafcc5 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/PlannedTable.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Context/PlannedTable.php @@ -8,7 +8,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; final class PlannedTable @@ -19,10 +18,10 @@ final class PlannedTable public static function create(DatabaseContext $context, string $name, int $rows): void { $context->createTable( - (new Table($name, [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('grp', Type::getType(Types::INTEGER), ['notnull' => true]), - ])) + new Table($name, [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('grp', Types::INTEGER, ['notnull' => true]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLDbalLimitOffsetExtractorTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLDbalLimitOffsetExtractorTest.php index 1dbf20bd92..81d0be5dd5 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLDbalLimitOffsetExtractorTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLDbalLimitOffsetExtractorTest.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\IO\Extractor\Order; use Flow\ETL\Adapter\Doctrine\IO\Extractor\OrderBy; @@ -31,11 +30,11 @@ final class MySQLDbalLimitOffsetExtractorTest extends IntegrationTestCase public function test_extracting_entire_table(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -76,11 +75,11 @@ public function test_extracting_entire_table(): void public function test_extracting_entire_table_using_qb(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -125,11 +124,11 @@ public function test_extracting_entire_table_using_qb(): void public function test_extracting_using_qb_with_offset_set_on_query_and_maximum_on_extractor(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -176,11 +175,11 @@ public function test_extracting_using_qb_with_offset_set_on_query_and_maximum_on public function test_extracting_entire_table_using_qb_with_maximum_and_offset_set_on_query(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -220,11 +219,11 @@ public function test_extracting_entire_table_using_qb_with_maximum_and_offset_se public function test_extracting_entire_table_using_qb_with_maximum_set_on_query(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -266,11 +265,11 @@ public function test_extracting_entire_table_using_qb_with_maximum_set_on_query( public function test_extracting_entire_table_using_qb_with_schema(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -341,12 +340,12 @@ public function test_extracting_entire_table_using_qb_with_schema(): void public function test_extracting_entire_table_with_group_by(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('type', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('type', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -395,11 +394,11 @@ public function test_extracting_entire_table_with_group_by(): void public function test_extracting_limited_number_of_rows_from_table(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -440,11 +439,11 @@ public function test_extracting_limited_number_of_rows_from_table(): void public function test_extracting_selected_columns(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLDbalLoaderTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLDbalLoaderTest.php index 068e5c2870..574cef0912 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLDbalLoaderTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLDbalLoaderTest.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use DOMDocument; use Flow\Doctrine\Bulk\Dialect\MySQLInsertOptions; @@ -26,10 +25,10 @@ final class MySQLDbalLoaderTest extends IntegrationTestCase public function test_delete_non_existent_rows(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -66,10 +65,10 @@ public function test_delete_non_existent_rows(): void public function test_delete_rows_using_existing_connection(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -106,11 +105,11 @@ public function test_delete_rows_using_existing_connection(): void public function test_delete_with_composite_keys(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('group_id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('group_id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint( PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id', 'group_id')->create(), @@ -151,11 +150,11 @@ public function test_delete_with_composite_keys(): void public function test_deletes_rows_by_single_key(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -195,11 +194,11 @@ public function test_deletes_rows_by_single_key(): void public function test_inserts_empty_rows(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -224,11 +223,11 @@ public function test_inserts_empty_rows(): void public function test_inserts_multiple_rows_at_once(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -251,11 +250,11 @@ public function test_inserts_multiple_rows_at_once(): void public function test_inserts_multiple_rows_at_once_using_existing_connection(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -279,11 +278,11 @@ public function test_inserts_multiple_rows_at_once_using_existing_connection(): public function test_inserts_multiple_rows_in_two_insert_queries(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -304,11 +303,11 @@ public function test_inserts_multiple_rows_in_two_insert_queries(): void public function test_inserts_new_rows_and_skip_already_existed(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -350,11 +349,11 @@ public function test_inserts_new_rows_and_skip_already_existed(): void public function test_inserts_xml_element_entry(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -394,11 +393,11 @@ public function test_inserts_xml_element_entry(): void public function test_inserts_xml_entry(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -438,11 +437,11 @@ public function test_inserts_xml_entry(): void public function test_update_multiple_rows_at_once(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLDbalQueryExtractorTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLDbalQueryExtractorTest.php index f2512d0495..09e4bfc61b 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLDbalQueryExtractorTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLDbalQueryExtractorTest.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\IO\Extractor\ParametersSet; use Flow\ETL\Adapter\Doctrine\IO\Loader\DbalLoader; @@ -31,11 +30,11 @@ final class MySQLDbalQueryExtractorTest extends IntegrationTestCase public function test_extracting_multiple_rows_at_once(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -67,11 +66,11 @@ public function test_extracting_multiple_rows_at_once(): void public function test_extracting_multiple_rows_multiple_times(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -128,11 +127,11 @@ public function test_extracting_multiple_rows_multiple_times(): void public function test_extracting_multiple_rows_with_schema(): void { $this->mysqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLSchemaDerivationTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLSchemaDerivationTest.php index bc106f74c2..bed1f5f72b 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLSchemaDerivationTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLSchemaDerivationTest.php @@ -11,7 +11,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\Foundation\Exception\ProbeRefusal; use Flow\ETL\Adapter\Doctrine\IO\Extractor\MysqliResultColumns; @@ -47,17 +46,17 @@ protected function setUp(): void parent::setUp(); $this->mysqlDatabaseContext->createTable( - (new Table('orders', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('amount', Type::getType(Types::DECIMAL), [ + new Table('orders', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('amount', Types::DECIMAL, [ 'notnull' => true, 'precision' => 10, 'scale' => 2, ]), - new Column('placed_at', Type::getType(Types::DATETIME_MUTABLE), ['notnull' => false]), - new Column('opens_at', Type::getType(Types::TIME_MUTABLE), ['notnull' => false]), - ])) + new Column('placed_at', 'datetime', ['notnull' => false]), + new Column('opens_at', 'time', ['notnull' => false]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -254,11 +253,11 @@ public function test_the_native_type_probe_refuses_when_the_driver_reports_no_ex $native = $this->mysqlDatabaseContext->connection()->getNativeConnection(); static::assertInstanceOf(mysqli::class, $native); - $reporting = (new mysqli_driver())->report_mode; + $reporting = new mysqli_driver()->report_mode; mysqli_report(MYSQLI_REPORT_OFF); try { - (new MysqliResultColumns())->of($native, 'SELECT id FROM missing', self::class); + new MysqliResultColumns()->of($native, 'SELECT id FROM missing', self::class); static::fail('a query the database refuses must not describe'); } catch (ProbeRefusal $e) { static::assertStringContainsString('MySQL refused to prepare this query', $e->getMessage()); @@ -277,7 +276,7 @@ public function test_the_native_type_probe_refuses_with_the_driver_message(): vo static::assertInstanceOf(mysqli::class, $native); try { - (new MysqliResultColumns())->of($native, 'SELECT id FROM missing', self::class); + new MysqliResultColumns()->of($native, 'SELECT id FROM missing', self::class); static::fail('a query the database refuses must not describe'); } catch (ProbeRefusal $e) { static::assertMatchesRegularExpression( diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLTransactionalTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLTransactionalTest.php index 904b3bdd72..da40810540 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLTransactionalTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/MySQLTransactionalTest.php @@ -9,7 +9,6 @@ use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\TransactionIsolationLevel; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Exception; use Flow\ETL\Adapter\Doctrine\IO\Loader\DbalTransaction; @@ -36,8 +35,8 @@ public function test_multiple_batches_in_separate_transactions(): void } $table = new Table('test_table', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('value', Type::getType(Types::INTEGER), ['notnull' => true]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('value', Types::INTEGER, ['notnull' => true]), ]); $table = $table ->edit() @@ -75,8 +74,8 @@ public function test_rollback_on_failure(): void } $table = new Table('test_table', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), ]); $table = $table ->edit() @@ -125,8 +124,8 @@ public function test_transactional_delete_and_insert(): void } $table = new Table('test_table', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), ]); $table = $table ->edit() @@ -165,8 +164,8 @@ public function test_with_isolation_level(): void } $table = new Table('test_table', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), ]); $table = $table ->edit() diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PosgreSQLDbalLimitOffsetExtractorTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PosgreSQLDbalLimitOffsetExtractorTest.php index 204c93a2da..fd80b03ada 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PosgreSQLDbalLimitOffsetExtractorTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PosgreSQLDbalLimitOffsetExtractorTest.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\IO\Extractor\Order; use Flow\ETL\Adapter\Doctrine\IO\Extractor\OrderBy; @@ -33,11 +32,11 @@ final class PosgreSQLDbalLimitOffsetExtractorTest extends IntegrationTestCase public function test_extracting_entire_table(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -77,11 +76,11 @@ public function test_extracting_entire_table(): void public function test_extracting_entire_table_using_qb(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -125,11 +124,11 @@ public function test_extracting_entire_table_using_qb(): void public function test_extracting_using_qb_with_offset_set_on_query_and_maximum_on_extractor(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -176,11 +175,11 @@ public function test_extracting_using_qb_with_offset_set_on_query_and_maximum_on public function test_extracting_entire_table_using_qb_with_maximum_and_offset_set_on_query(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -220,11 +219,11 @@ public function test_extracting_entire_table_using_qb_with_maximum_and_offset_se public function test_extracting_entire_table_using_qb_with_maximum_set_on_query(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -266,11 +265,11 @@ public function test_extracting_entire_table_using_qb_with_maximum_set_on_query( public function test_extracting_entire_table_using_qb_with_schema(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -340,12 +339,12 @@ public function test_extracting_entire_table_using_qb_with_schema(): void public function test_extracting_entire_table_with_group_by(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('type', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('type', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -393,11 +392,11 @@ public function test_extracting_entire_table_with_group_by(): void public function test_extracting_limited_number_of_rows_from_table(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -437,11 +436,11 @@ public function test_extracting_limited_number_of_rows_from_table(): void public function test_extracting_selected_columns(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLDbalLoaderTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLDbalLoaderTest.php index e512e11ea0..3214207136 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLDbalLoaderTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLDbalLoaderTest.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use DOMDocument; use Flow\Doctrine\Bulk\Dialect\PostgreSQLInsertOptions; @@ -26,10 +25,10 @@ final class PostgreSQLDbalLoaderTest extends IntegrationTestCase public function test_delete_non_existent_rows(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -66,10 +65,10 @@ public function test_delete_non_existent_rows(): void public function test_delete_rows_using_existing_connection(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -106,11 +105,11 @@ public function test_delete_rows_using_existing_connection(): void public function test_delete_with_composite_keys(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('group_id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('group_id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint( PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id', 'group_id')->create(), @@ -151,11 +150,11 @@ public function test_delete_with_composite_keys(): void public function test_deletes_rows_by_single_key(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -194,11 +193,11 @@ public function test_deletes_rows_by_single_key(): void public function test_inserts_empty_rows(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -223,11 +222,11 @@ public function test_inserts_empty_rows(): void public function test_inserts_multiple_rows_at_once(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -250,11 +249,11 @@ public function test_inserts_multiple_rows_at_once(): void public function test_inserts_multiple_rows_at_once_using_existing_connection(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -278,11 +277,11 @@ public function test_inserts_multiple_rows_at_once_using_existing_connection(): public function test_inserts_multiple_rows_in_two_insert_queries(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -303,11 +302,11 @@ public function test_inserts_multiple_rows_in_two_insert_queries(): void public function test_inserts_new_rows_and_skip_already_existed(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -349,11 +348,11 @@ public function test_inserts_new_rows_and_skip_already_existed(): void public function test_inserts_new_rows_or_updates_already_existed_based_on_primary_key(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -396,11 +395,11 @@ public function test_inserts_new_rows_or_updates_already_existed_based_on_primar public function test_inserts_xml_element_entry(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -440,11 +439,11 @@ public function test_inserts_xml_element_entry(): void public function test_inserts_xml_entry(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -484,11 +483,11 @@ public function test_inserts_xml_entry(): void public function test_update_multiple_rows_at_once(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLDbalQueryExtractorTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLDbalQueryExtractorTest.php index 9187c2c77a..47a0cefa71 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLDbalQueryExtractorTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLDbalQueryExtractorTest.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\IO\Extractor\ParametersSet; use Flow\ETL\Adapter\Doctrine\IO\Loader\DbalLoader; @@ -34,11 +33,11 @@ final class PostgreSQLDbalQueryExtractorTest extends IntegrationTestCase public function test_extracting_multiple_rows_at_once(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -69,11 +68,11 @@ public function test_extracting_multiple_rows_at_once(): void public function test_extracting_multiple_rows_multiple_times(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -130,11 +129,11 @@ public function test_extracting_multiple_rows_multiple_times(): void public function test_extracting_multiple_rows_with_schema(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLSchemaDerivationTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLSchemaDerivationTest.php index 28e641d272..9e75e6efd2 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLSchemaDerivationTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLSchemaDerivationTest.php @@ -10,7 +10,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\Foundation\Exception\ProbeRefusal; use Flow\ETL\Adapter\Doctrine\IO\Extractor\DescribeQuery; @@ -41,16 +40,16 @@ protected function setUp(): void parent::setUp(); $this->pgsqlDatabaseContext->createTable( - (new Table('orders', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('amount', Type::getType(Types::DECIMAL), [ + new Table('orders', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('amount', Types::DECIMAL, [ 'notnull' => true, 'precision' => 10, 'scale' => 2, ]), - new Column('placed_at', Type::getType(Types::DATETIME_MUTABLE), ['notnull' => false]), - ])) + new Column('placed_at', 'datetime', ['notnull' => false]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -272,7 +271,7 @@ public function test_a_refused_probe_leaves_the_connection_usable(): void static::assertInstanceOf(PgSqlConnection::class, $native); try { - (new PgSqlResultColumns())->of($native, (new DescribeQuery())->of('SELECT id FROM missing')); + new PgSqlResultColumns()->of($native, new DescribeQuery()->of('SELECT id FROM missing')); static::fail('a query the database refuses must not describe'); } catch (ProbeRefusal) { } @@ -286,7 +285,7 @@ public function test_the_native_type_probe_refuses_with_the_driver_message(): vo static::assertInstanceOf(PgSqlConnection::class, $native); try { - (new PgSqlResultColumns())->of($native, (new DescribeQuery())->of('SELECT id FROM missing')); + new PgSqlResultColumns()->of($native, new DescribeQuery()->of('SELECT id FROM missing')); static::fail('a query the database refuses must not describe'); } catch (ProbeRefusal $e) { static::assertMatchesRegularExpression( diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLTransactionalTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLTransactionalTest.php index 8e6f6e8e11..8719644fbc 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLTransactionalTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/PostgreSQLTransactionalTest.php @@ -9,7 +9,6 @@ use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\TransactionIsolationLevel; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Exception; use Flow\ETL\Adapter\Doctrine\IO\Loader\DbalTransaction; @@ -36,8 +35,8 @@ public function test_multiple_batches_in_separate_transactions(): void } $table = new Table('test_table', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('value', Type::getType(Types::INTEGER), ['notnull' => true]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('value', Types::INTEGER, ['notnull' => true]), ]); $table = $table ->edit() @@ -75,8 +74,8 @@ public function test_rollback_on_failure(): void } $table = new Table('test_table', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), ]); $table = $table ->edit() @@ -125,8 +124,8 @@ public function test_transactional_delete_and_insert(): void } $table = new Table('test_table', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), ]); $table = $table ->edit() @@ -165,8 +164,8 @@ public function test_with_isolation_level(): void } $table = new Table('test_table', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), ]); $table = $table ->edit() diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteDbalLimitOffsetExtractorTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteDbalLimitOffsetExtractorTest.php index 212f592e3b..c9a194636e 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteDbalLimitOffsetExtractorTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteDbalLimitOffsetExtractorTest.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\IO\Extractor\Order; use Flow\ETL\Adapter\Doctrine\IO\Extractor\OrderBy; @@ -32,11 +31,11 @@ final class SqliteDbalLimitOffsetExtractorTest extends IntegrationTestCase public function test_extracting_entire_table(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -77,11 +76,11 @@ public function test_extracting_entire_table(): void public function test_extracting_entire_table_using_qb(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -126,11 +125,11 @@ public function test_extracting_entire_table_using_qb(): void public function test_extracting_using_qb_with_offset_set_on_query_and_maximum_on_extractor(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -177,11 +176,11 @@ public function test_extracting_using_qb_with_offset_set_on_query_and_maximum_on public function test_extracting_entire_table_using_qb_with_maximum_and_offset_set_on_query(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -221,9 +220,9 @@ public function test_extracting_entire_table_using_qb_with_maximum_and_offset_se public function test_extracting_using_qb_with_only_an_offset_set_on_query(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -255,11 +254,11 @@ public function test_extracting_using_qb_with_only_an_offset_set_on_query(): voi public function test_extracting_entire_table_using_qb_with_maximum_set_on_query(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -301,11 +300,11 @@ public function test_extracting_entire_table_using_qb_with_maximum_set_on_query( public function test_extracting_entire_table_using_qb_with_schema(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -376,12 +375,12 @@ public function test_extracting_entire_table_using_qb_with_schema(): void public function test_extracting_entire_table_with_group_by(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('type', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('type', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -430,11 +429,11 @@ public function test_extracting_entire_table_with_group_by(): void public function test_extracting_limited_number_of_rows_from_table(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -475,11 +474,11 @@ public function test_extracting_limited_number_of_rows_from_table(): void public function test_extracting_selected_columns(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteDbalLoaderTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteDbalLoaderTest.php index 8de5f95ee3..dea721bfe4 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteDbalLoaderTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteDbalLoaderTest.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use DOMDocument; use Flow\Doctrine\Bulk\Dialect\SqliteInsertOptions; @@ -25,10 +24,10 @@ final class SqliteDbalLoaderTest extends IntegrationTestCase public function test_delete_non_existent_rows(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -65,10 +64,10 @@ public function test_delete_non_existent_rows(): void public function test_delete_rows_using_existing_connection(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -105,11 +104,11 @@ public function test_delete_rows_using_existing_connection(): void public function test_delete_with_composite_keys(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('group_id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('group_id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint( PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id', 'group_id')->create(), @@ -150,11 +149,11 @@ public function test_delete_with_composite_keys(): void public function test_deletes_rows_by_single_key(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -193,11 +192,11 @@ public function test_deletes_rows_by_single_key(): void public function test_inserts_empty_rows(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -222,11 +221,11 @@ public function test_inserts_empty_rows(): void public function test_inserts_multiple_rows_at_once(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -249,11 +248,11 @@ public function test_inserts_multiple_rows_at_once(): void public function test_inserts_multiple_rows_at_once_using_existing_connection(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -277,11 +276,11 @@ public function test_inserts_multiple_rows_at_once_using_existing_connection(): public function test_inserts_multiple_rows_in_two_insert_queries(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -302,11 +301,11 @@ public function test_inserts_multiple_rows_in_two_insert_queries(): void public function test_inserts_new_rows_and_skip_already_existed(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -348,11 +347,11 @@ public function test_inserts_new_rows_and_skip_already_existed(): void public function test_inserts_new_rows_or_updates_already_existed_based_on_primary_key(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -391,11 +390,11 @@ public function test_inserts_new_rows_or_updates_already_existed_based_on_primar public function test_inserts_xml_element_entry(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -435,11 +434,11 @@ public function test_inserts_xml_element_entry(): void public function test_inserts_xml_entry(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -479,11 +478,11 @@ public function test_inserts_xml_entry(): void public function test_update_multiple_rows_at_once(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteDbalQueryExtractorTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteDbalQueryExtractorTest.php index abc88c62b5..3482495473 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteDbalQueryExtractorTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteDbalQueryExtractorTest.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\IO\Extractor\ParametersSet; use Flow\ETL\Adapter\Doctrine\IO\Loader\DbalLoader; @@ -31,11 +30,11 @@ final class SqliteDbalQueryExtractorTest extends IntegrationTestCase public function test_extracting_multiple_rows_at_once(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -67,11 +66,11 @@ public function test_extracting_multiple_rows_at_once(): void public function test_extracting_multiple_rows_multiple_times(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -128,11 +127,11 @@ public function test_extracting_multiple_rows_multiple_times(): void public function test_extracting_multiple_rows_with_schema(): void { $this->sqliteDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteSchemaDerivationTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteSchemaDerivationTest.php index b6df91607b..be4724fceb 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteSchemaDerivationTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteSchemaDerivationTest.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\IO\Extractor\Order; use Flow\ETL\Adapter\Doctrine\IO\Extractor\OrderBy; @@ -29,11 +28,11 @@ protected function setUp(): void parent::setUp(); $this->sqliteDatabaseContext->createTable( - (new Table('orders', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('amount', Type::getType(Types::FLOAT), ['notnull' => true]), - ])) + new Table('orders', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('amount', Types::FLOAT, ['notnull' => true]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteTransactionalTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteTransactionalTest.php index bd03839780..033df42ebe 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteTransactionalTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/Dialects/SqliteTransactionalTest.php @@ -9,7 +9,6 @@ use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\TransactionIsolationLevel; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Exception; use Flow\ETL\Adapter\Doctrine\IO\Loader\DbalTransaction; @@ -36,8 +35,8 @@ public function test_multiple_batches_in_separate_transactions(): void } $table = new Table('test_table', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('value', Type::getType(Types::INTEGER), ['notnull' => true]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('value', Types::INTEGER, ['notnull' => true]), ]); $table = $table ->edit() @@ -75,8 +74,8 @@ public function test_rollback_on_failure(): void } $table = new Table('test_table', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), ]); $table = $table ->edit() @@ -125,8 +124,8 @@ public function test_transactional_delete_and_insert(): void } $table = new Table('test_table', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), ]); $table = $table ->edit() @@ -165,8 +164,8 @@ public function test_with_isolation_level(): void } $table = new Table('test_table', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), ]); $table = $table ->edit() diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/DbalExtractorFactoryTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/DbalExtractorFactoryTest.php index c43363dda0..6a6aebc03f 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/DbalExtractorFactoryTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/DbalExtractorFactoryTest.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\IO\Extractor\LiteralParameter; use Flow\ETL\Adapter\Doctrine\IO\Extractor\Parameter; @@ -30,11 +29,11 @@ final class DbalExtractorFactoryTest extends IntegrationTestCase public function test_dataframe_factory(): void { $this->pgsqlDatabaseContext->createTable( - (new Table('flow_doctrine_data_factory_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table('flow_doctrine_data_factory_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -84,11 +83,11 @@ public function test_dataframe_factory(): void public function test_dataframe_factory_with_schema(): void { $this->pgsqlDatabaseContext->createTable( - (new Table('flow_doctrine_data_factory_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'length' => 255]), - ])) + new Table('flow_doctrine_data_factory_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('tags', Types::JSON, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/DbalLimitOffsetExtractorTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/DbalLimitOffsetExtractorTest.php index 7a99b4e13d..9dc6677f25 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/DbalLimitOffsetExtractorTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/DbalLimitOffsetExtractorTest.php @@ -7,9 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table as DoctrineTable; -use Doctrine\DBAL\Types\IntegerType as DoctrineIntegerType; -use Doctrine\DBAL\Types\TextType; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\IO\Extractor\Order; use Flow\ETL\Adapter\Doctrine\IO\Extractor\OrderBy; @@ -32,21 +29,21 @@ final class DbalLimitOffsetExtractorTest extends IntegrationTestCase public function test_creating_limit_offset_extractor_for_table(): void { $this->pgsqlDatabaseContext->createTable( - (new DoctrineTable($table = 'flow_doctrine_order_by_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('code', Type::getType(Types::INTEGER), ['notnull' => true]), - ])) + new DoctrineTable($table = 'flow_doctrine_order_by_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('code', Types::INTEGER, ['notnull' => true]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), ); $customTypesMap = new TypesMap([ - StringType::class => TextType::class, - IntegerType::class => DoctrineIntegerType::class, + StringType::class => Types::TEXT, + IntegerType::class => Types::INTEGER, ]); - $loader = (new DbalLoader($table, $this->postgresqlConnectionParams()))->withTypesMap($customTypesMap); + $loader = new DbalLoader($table, $this->postgresqlConnectionParams())->withTypesMap($customTypesMap); data_frame() ->read(from_array([ diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/Explain/ExplainedRowsTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/Explain/ExplainedRowsTest.php index 387bf05f8c..5e516fa11b 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/Explain/ExplainedRowsTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/Explain/ExplainedRowsTest.php @@ -17,7 +17,7 @@ public function test_a_maximum_bounds_and_caps_the_estimate(): void static::assertEquals( new Cardinality(atMost: 3, estimate: 3, relativeError: Cardinality::DEFAULT_RELATIVE_ERROR), - (new ExplainedRows())->of( + new ExplainedRows()->of( $this->pgsqlDatabaseContext->connection(), 'SELECT * FROM flow_explain_test', maximum: 3, @@ -31,7 +31,7 @@ public function test_mysql_plans_are_read(): void static::assertEquals( Cardinality::approximately(5), - (new ExplainedRows())->of($this->mysqlDatabaseContext->connection(), 'SELECT * FROM flow_explain_test'), + new ExplainedRows()->of($this->mysqlDatabaseContext->connection(), 'SELECT * FROM flow_explain_test'), ); } @@ -39,13 +39,13 @@ public function test_sqlite_declares_only_the_maximum(): void { PlannedTable::create($this->sqliteDatabaseContext, 'flow_explain_test', 5); - static::assertEquals(Cardinality::unknown(), (new ExplainedRows())->of( + static::assertEquals(Cardinality::unknown(), new ExplainedRows()->of( $this->sqliteDatabaseContext->connection(), 'SELECT * FROM flow_explain_test', )); static::assertEquals( Cardinality::atMost(3), - (new ExplainedRows())->of( + new ExplainedRows()->of( $this->sqliteDatabaseContext->connection(), 'SELECT * FROM flow_explain_test', maximum: 3, diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/Explain/MySqlExplainedRowsTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/Explain/MySqlExplainedRowsTest.php index 01d830885e..2ec74d2961 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/Explain/MySqlExplainedRowsTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/Explain/MySqlExplainedRowsTest.php @@ -14,7 +14,7 @@ public function test_a_group_by_read_back_from_a_temporary_table_is_unknown(): v { PlannedTable::create($this->mysqlDatabaseContext, 'flow_explain_test', 5); - static::assertNull((new MySqlExplainedRows())->of( + static::assertNull(new MySqlExplainedRows()->of( $this->mysqlDatabaseContext->connection(), 'SELECT grp, COUNT(*) FROM flow_explain_test GROUP BY grp', )); @@ -24,7 +24,7 @@ public function test_a_parameterised_query_is_planned(): void { PlannedTable::create($this->mysqlDatabaseContext, 'flow_explain_test', 100); - static::assertSame(10, (new MySqlExplainedRows())->of( + static::assertSame(10, new MySqlExplainedRows()->of( $this->mysqlDatabaseContext->connection(), 'SELECT * FROM flow_explain_test WHERE id > ?', [90], @@ -35,7 +35,7 @@ public function test_the_root_line_rows_are_the_estimate(): void { PlannedTable::create($this->mysqlDatabaseContext, 'flow_explain_test', 5); - static::assertSame(5, (new MySqlExplainedRows())->of( + static::assertSame(5, new MySqlExplainedRows()->of( $this->mysqlDatabaseContext->connection(), 'SELECT * FROM flow_explain_test', )); diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/Explain/PostgreSqlExplainedRowsTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/Explain/PostgreSqlExplainedRowsTest.php index 227aac88cd..12d3567309 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/Explain/PostgreSqlExplainedRowsTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Extractor/Explain/PostgreSqlExplainedRowsTest.php @@ -14,7 +14,7 @@ public function test_a_parameterised_query_is_planned(): void { PlannedTable::create($this->pgsqlDatabaseContext, 'flow_explain_test', 100); - static::assertSame(10, (new PostgreSqlExplainedRows())->of( + static::assertSame(10, new PostgreSqlExplainedRows()->of( $this->pgsqlDatabaseContext->connection(), 'SELECT * FROM flow_explain_test WHERE id > ?', [90], @@ -25,7 +25,7 @@ public function test_the_root_plan_rows_are_the_estimate(): void { PlannedTable::create($this->pgsqlDatabaseContext, 'flow_explain_test', 5); - static::assertSame(5, (new PostgreSqlExplainedRows())->of( + static::assertSame(5, new PostgreSqlExplainedRows()->of( $this->pgsqlDatabaseContext->connection(), 'SELECT * FROM flow_explain_test', )); diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Loader/DbalLoaderTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Loader/DbalLoaderTest.php index 0c1c44be4a..a3f6bc1c7a 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Loader/DbalLoaderTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Integration/IO/Loader/DbalLoaderTest.php @@ -7,9 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\IntegerType as DoctrineIntegerType; -use Doctrine\DBAL\Types\TextType; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\Doctrine\Bulk\Dialect\PostgreSQLInsertOptions; use Flow\ETL\Adapter\Doctrine\IO\Loader\DbalLoader; @@ -27,11 +24,11 @@ final class DbalLoaderTest extends IntegrationTestCase public function test_create_loader_with_invalid_operation(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -40,17 +37,17 @@ public function test_create_loader_with_invalid_operation(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Operation can be insert, update, or delete, invalid given.'); - (new DbalLoader($table, $this->postgresqlConnectionParams()))->withOperation('invalid'); + new DbalLoader($table, $this->postgresqlConnectionParams())->withOperation('invalid'); } public function test_create_loader_with_invalid_operation_from_connection(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -70,11 +67,11 @@ public function test_create_loader_with_invalid_operation_from_connection(): voi public function test_loader_with_custom_types_map(): void { $this->pgsqlDatabaseContext->createTable( - (new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::TEXT), ['notnull' => false]), - ])) + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::TEXT, ['notnull' => false]), + ]) ->edit() ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) ->create(), @@ -85,9 +82,9 @@ public function test_loader_with_custom_types_map(): void ['id' => 1, 'name' => 'Name One', 'description' => 'Description One'], ['id' => 2, 'name' => 'Name Two', 'description' => 'Description Two'], ])) - ->write((new DbalLoader($table, $this->postgresqlConnectionParams()))->withTypesMap(new TypesMap([ - StringType::class => TextType::class, - IntegerType::class => DoctrineIntegerType::class, + ->write(new DbalLoader($table, $this->postgresqlConnectionParams())->withTypesMap(new TypesMap([ + StringType::class => Types::TEXT, + IntegerType::class => Types::INTEGER, ]))) ->run(); @@ -103,7 +100,7 @@ public function test_loader_with_custom_types_map(): void public function test_describe_round_trips(): void { - $description = (new DbalLoader('flow_items', $this->sqliteConnectionParams())) + $description = new DbalLoader('flow_items', $this->sqliteConnectionParams()) ->withOperation('update') ->describe(); @@ -114,12 +111,12 @@ public function test_describe_round_trips(): void public function test_operation_options_do_not_describe(): void { static::assertNull( - (new DbalLoader('flow_items', $this->sqliteConnectionParams())) + new DbalLoader('flow_items', $this->sqliteConnectionParams()) ->withOperationOptions(PostgreSQLInsertOptions::new()) ->describe(), ); static::assertNull( - (new DbalLoader('flow_items', $this->sqliteConnectionParams())) + new DbalLoader('flow_items', $this->sqliteConnectionParams()) ->withTypesMap(new TypesMap([])) ->describe(), ); diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/IntegrationTestCase.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/IntegrationTestCase.php index 5020e23655..a348b39e76 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/IntegrationTestCase.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/IntegrationTestCase.php @@ -37,7 +37,7 @@ protected function setUp(): void $pgsqlParams = $this->postgresqlConnectionParams(); $this->pgsqlDatabaseContext = new DatabaseContext( - DriverManager::getConnection($pgsqlParams, (new Configuration())->setMiddlewares([ + DriverManager::getConnection($pgsqlParams, new Configuration()->setMiddlewares([ new Middleware($insertQueryCounter), new Middleware($selectQueryCounter), new Middleware($commitCounter), @@ -49,7 +49,7 @@ protected function setUp(): void $mysqlParams = $this->mysqlConnectionParams(); $this->mysqlDatabaseContext = new DatabaseContext( - DriverManager::getConnection($mysqlParams, (new Configuration())->setMiddlewares([ + DriverManager::getConnection($mysqlParams, new Configuration()->setMiddlewares([ new Middleware($insertQueryCounter), new Middleware($selectQueryCounter), new Middleware($commitCounter), @@ -61,7 +61,7 @@ protected function setUp(): void $sqliteParams = $this->sqliteConnectionParams(); $this->sqliteDatabaseContext = new DatabaseContext( - DriverManager::getConnection($sqliteParams, (new Configuration())->setMiddlewares([ + DriverManager::getConnection($sqliteParams, new Configuration()->setMiddlewares([ new Middleware($insertQueryCounter), new Middleware($selectQueryCounter), new Middleware($commitCounter), @@ -88,7 +88,7 @@ protected function tearDown(): void */ protected function mysqlConnectionParams(): array { - return (new DsnParser(['mysql' => 'mysqli']))->parse(getenv('MYSQL_DATABASE_URL') ?: ''); + return new DsnParser(['mysql' => 'mysqli'])->parse(getenv('MYSQL_DATABASE_URL') ?: ''); } /** @@ -96,7 +96,7 @@ protected function mysqlConnectionParams(): array */ protected function postgresqlConnectionParams(): array { - return (new DsnParser(['postgresql' => 'pdo_pgsql']))->parse(getenv('PGSQL_DATABASE_URL') ?: ''); + return new DsnParser(['postgresql' => 'pdo_pgsql'])->parse(getenv('PGSQL_DATABASE_URL') ?: ''); } /** @@ -111,7 +111,7 @@ protected function sqliteConnectionParams(): array @mkdir($folder, 0777, true); } - return (new DsnParser(['sqlite' => 'sqlite3']))->parse( + return new DsnParser(['sqlite' => 'sqlite3'])->parse( 'sqlite3://' . (str_starts_with($path, '/') ? '/' : '') . $path, ); } diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/DescribableRoundTripTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/DescribableRoundTripTest.php index c60ea103cb..ce05761233 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/DescribableRoundTripTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/DescribableRoundTripTest.php @@ -6,7 +6,6 @@ use Flow\ETL\Adapter\Doctrine\Tests\Context\DescribableFixtures; use Flow\ETL\Foundation\Describe\Describable; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Foundation\Exception\RuntimeException; use Flow\ETL\Tests\Context\DescribeRoundTrip; use Flow\ETL\Tests\Context\ExtractorClasses; @@ -58,11 +57,7 @@ public function test_a_rebuilt_describable_equals_the_described_one(string $clas $this->expectException(RuntimeException::class); } - try { - $describable = DescribableFixtures::all()[$class](); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $describable = DescribableFixtures::all()[$class](); if (in_array($class, DescribableFixtures::undescribable(), true)) { static::assertNull($describable->describe()); diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalExtractorBatchContractTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalExtractorBatchContractTest.php index 9bd99ac3ca..cf07759ac0 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalExtractorBatchContractTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalExtractorBatchContractTest.php @@ -26,11 +26,11 @@ public function test_key_set_extractor_honours_its_maximum(): void $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(), 5); self::assertExtractorHonoursMaximum( - static fn(int $maximum): DbalKeySetExtractor => (new DbalKeySetExtractor( + static fn(int $maximum): DbalKeySetExtractor => new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('id')->from('users'), pagination_key_set(pagination_key_asc('id')), - ))->withSchema(schema(int_schema('id')))->withMaximum($maximum), + )->withSchema(schema(int_schema('id')))->withMaximum($maximum), 3, ); } @@ -40,11 +40,11 @@ public function test_key_set_extractor_honours_the_batch_contract(): void $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(), 5); self::assertExtractorHonoursBatchContract( - static fn(): DbalKeySetExtractor => (new DbalKeySetExtractor( + static fn(): DbalKeySetExtractor => new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('id')->from('users'), pagination_key_set(pagination_key_asc('id')), - ))->withSchema(schema(int_schema('id'))), + )->withSchema(schema(int_schema('id'))), RowsMother::sequentialIds(5), ); } @@ -54,10 +54,10 @@ public function test_limit_offset_extractor_honours_its_maximum(): void $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(), 5); self::assertExtractorHonoursMaximum( - static fn(int $maximum): DbalLimitOffsetExtractor => (new DbalLimitOffsetExtractor( + static fn(int $maximum): DbalLimitOffsetExtractor => new DbalLimitOffsetExtractor( $connection, $connection->createQueryBuilder()->select('id')->from('users')->orderBy('id'), - )) + ) ->withSchema(schema(int_schema('id'))) ->withMaximum($maximum), 3, @@ -69,10 +69,10 @@ public function test_limit_offset_extractor_honours_the_batch_contract(): void $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(), 5); self::assertExtractorHonoursBatchContract( - static fn(): DbalLimitOffsetExtractor => (new DbalLimitOffsetExtractor( + static fn(): DbalLimitOffsetExtractor => new DbalLimitOffsetExtractor( $connection, $connection->createQueryBuilder()->select('id')->from('users')->orderBy('id'), - ))->withSchema(schema(int_schema('id'))), + )->withSchema(schema(int_schema('id'))), RowsMother::sequentialIds(5), ); } @@ -82,10 +82,10 @@ public function test_query_extractor_honours_the_batch_contract(): void $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(), 5); self::assertExtractorHonoursBatchContract( - static fn(): DbalQueryExtractor => (new DbalQueryExtractor( + static fn(): DbalQueryExtractor => new DbalQueryExtractor( $connection, 'SELECT id FROM users ORDER BY id', - ))->withSchema(schema(int_schema('id'))), + )->withSchema(schema(int_schema('id'))), RowsMother::sequentialIds(5), ); } diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalKeySetExtractorTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalKeySetExtractorTest.php index 3bc8fb6752..c56a7cc9bb 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalKeySetExtractorTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalKeySetExtractorTest.php @@ -97,11 +97,11 @@ public function test_a_refused_probe_is_memoised(): void public function test_schema_describes_the_base_builder_not_the_paged_sql(): void { $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(), 3); - $extractor = (new DbalKeySetExtractor( + $extractor = new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users'), pagination_key_set(pagination_key_asc('id')), - ))->withBatchSize(2); + )->withBatchSize(2); static::assertSame(['id', 'name', 'amount'], $extractor->schema()->names()); @@ -121,11 +121,11 @@ public function test_schema_is_derived_when_it_was_not_declared(): void static::assertEquals( schema(str_schema('id', true), str_schema('name', true), str_schema('amount', true)), - (new DbalKeySetExtractor( + new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users'), pagination_key_set(pagination_key_asc('id')), - ))->schema(), + )->schema(), ); } @@ -135,11 +135,11 @@ public function test_schema_is_the_declared_one(): void static::assertEquals( schema(int_schema('id')), - (new DbalKeySetExtractor( + new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users'), pagination_key_set(pagination_key_asc('id')), - ))->withSchema(schema(int_schema('id')))->schema(), + )->withSchema(schema(int_schema('id')))->schema(), ); } @@ -164,22 +164,22 @@ public function test_is_repeatable(): void $connection = InMemorySqlite::connection(); static::assertTrue( - (new DbalKeySetExtractor( + new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users'), pagination_key_set(pagination_key_asc('id')), - ))->isRepeatable(), + )->isRepeatable(), ); } public function test_a_new_maximum_drops_the_statistics(): void { $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(), 3); - $extractor = (new DbalKeySetExtractor( + $extractor = new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users'), pagination_key_set(pagination_key_asc('id')), - ))->withMaximum(2); + )->withMaximum(2); static::assertSame($extractor->statistics(), $extractor->statistics()); static::assertEquals(Cardinality::atMost(2), $extractor->statistics()->rows); @@ -195,11 +195,11 @@ public function test_extract_builds_through_the_config_backend(): void $backend = new SpyBackend(); iterator_to_array( - (new DbalKeySetExtractor( + new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users'), pagination_key_set(pagination_key_asc('id')), - ))->extract(flow_context(config_builder()->backend($backend)->build())->backend(), new Criteria()), + )->extract(flow_context(config_builder()->backend($backend)->build())->backend(), new Criteria()), false, ); @@ -226,11 +226,11 @@ public function test_duplicate_keys_throw_at_every_batch_size(int $batchSize): v $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Keyset pagination requires unique keys, but two rows share the key'); - iterator_to_array((new DbalKeySetExtractor( + iterator_to_array(new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('id', 'k')->from('keyset'), pagination_key_set(pagination_key_asc('k')), - ))->withBatchSize($batchSize)->extract(flow_context()->backend(), new Criteria())); + )->withBatchSize($batchSize)->extract(flow_context()->backend(), new Criteria())); } #[TestWith([1])] @@ -248,11 +248,11 @@ public function test_duplicate_keys_within_the_maximum_throw(int $batchSize): vo $this->expectExceptionMessage('Keyset pagination requires unique keys, but two rows share the key'); iterator_to_array( - (new DbalKeySetExtractor( + new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('id', 'k')->from('keyset'), pagination_key_set(pagination_key_asc('k')), - )) + ) ->withBatchSize($batchSize) ->withMaximum(2) ->extract(flow_context()->backend(), new Criteria()), @@ -270,11 +270,11 @@ public function test_equal_keys_under_a_case_insensitive_collation_throw(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Keyset pagination expected the next page to start at the key'); - iterator_to_array((new DbalKeySetExtractor( + iterator_to_array(new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('id', 'k')->from('keyset_nocase'), pagination_key_set(pagination_key_asc('k')), - ))->withBatchSize(1)->extract(flow_context()->backend(), new Criteria())); + )->withBatchSize(1)->extract(flow_context()->backend(), new Criteria())); } public function test_mixed_direction_composite_duplicate_keys_throw(): void @@ -289,11 +289,11 @@ public function test_mixed_direction_composite_duplicate_keys_throw(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Keyset pagination requires unique keys, but two rows share the key'); - iterator_to_array((new DbalKeySetExtractor( + iterator_to_array(new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('a', 'b')->from('keyset'), pagination_key_set(pagination_key_asc('b'), pagination_key_desc('a')), - ))->withBatchSize(1)->extract(flow_context()->backend(), new Criteria())); + )->withBatchSize(1)->extract(flow_context()->backend(), new Criteria())); } public function test_null_check_adds_is_null_to_the_query(): void @@ -307,11 +307,11 @@ public function test_null_check_adds_is_null_to_the_query(): void ); $counter->reset(); - iterator_to_array((new DbalKeySetExtractor( + iterator_to_array(new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('a', 'k')->from('keyset'), pagination_key_set(pagination_key_asc('k'), pagination_key_asc('a')), - ))->extract(flow_context()->backend(), new Criteria())); + )->extract(flow_context()->backend(), new Criteria())); static::assertStringContainsString('WHERE (a IS NULL) OR (k IS NULL)', $counter->queries[0]); static::assertStringContainsString('LIMIT 1', $counter->queries[0]); @@ -327,11 +327,11 @@ public function test_null_key_throws_with_one_query_at_every_batch_size(int $bat schema(int_schema('id'), int_schema('k', true)), [['id' => 1, 'k' => 1], ['id' => 2, 'k' => 2], ['id' => 3, 'k' => null]], ); - $generator = (new DbalKeySetExtractor( + $generator = new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('id', 'k')->from('keyset'), $keySet, - )) + ) ->withBatchSize($batchSize) ->withSchema(schema(int_schema('id'), int_schema('k', true))) ->extract(flow_context()->backend(), new Criteria()); @@ -384,11 +384,11 @@ public function test_short_page_ends_the_read(int $rows, int $expectedRows, int { $counter = new SelectQueryCounter(); $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(new Middleware($counter)), $rows); - $extractor = (new DbalKeySetExtractor( + $extractor = new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users'), pagination_key_set(pagination_key_asc('id')), - ))->withBatchSize(2)->withSchema(schema(int_schema('id'), str_schema('name'), str_schema('amount', true))); + )->withBatchSize(2)->withSchema(schema(int_schema('id'), str_schema('name'), str_schema('amount', true))); $counter->reset(); self::assertExtractedRowsCount($expectedRows, $extractor); @@ -402,11 +402,11 @@ public function test_unique_keys_read_every_row_at_every_batch_size(int $batchSi self::assertExtractedRowsCount( 5, - (new DbalKeySetExtractor( + new DbalKeySetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users'), pagination_key_set(pagination_key_asc('id')), - ))->withBatchSize($batchSize), + )->withBatchSize($batchSize), ); } } diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalLimitOffsetExtractorTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalLimitOffsetExtractorTest.php index 67fe27adb9..b3bf296574 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalLimitOffsetExtractorTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalLimitOffsetExtractorTest.php @@ -62,10 +62,10 @@ public function test_an_empty_page_is_not_yielded(): void array_map( static fn(Rows $rows): int => $rows->count(), iterator_to_array( - (new DbalLimitOffsetExtractor( + new DbalLimitOffsetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users')->orderBy('id'), - )) + ) ->withBatchSize(5) ->withMaximum(10) ->extract(flow_context()->backend(), new Criteria()), @@ -82,7 +82,7 @@ public function test_a_declared_schema_is_answered_without_probing(): void static::assertEquals( schema(int_schema('id')), - (new DbalLimitOffsetExtractor($connection, $connection->createQueryBuilder()->select('*')->from('users'))) + new DbalLimitOffsetExtractor($connection, $connection->createQueryBuilder()->select('*')->from('users')) ->withSchema(schema(int_schema('id'))) ->schema(), ); @@ -94,10 +94,10 @@ public function test_extract_derives_the_schema_once_and_reuses_it_across_batche $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(new Middleware($counter)), 5); $counter->reset(); - $extractor = (new DbalLimitOffsetExtractor( + $extractor = new DbalLimitOffsetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users')->orderBy('id'), - ))->withBatchSize(2); + )->withBatchSize(2); $batches = 0; @@ -118,7 +118,7 @@ public function test_extract_does_not_mutate_the_query_builder(): void $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(), 3); $queryBuilder = $connection->createQueryBuilder()->select('*')->from('users')->orderBy('id'); - foreach ((new DbalLimitOffsetExtractor($connection, $queryBuilder)) + foreach (new DbalLimitOffsetExtractor($connection, $queryBuilder) ->withBatchSize(2) ->extract(flow_context()->backend(), new Criteria()) as $_rows) { } @@ -161,7 +161,7 @@ public function test_schema_does_not_mutate_the_query_builder(): void $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(), 1); $queryBuilder = $connection->createQueryBuilder()->select('*')->from('users'); - (new DbalLimitOffsetExtractor($connection, $queryBuilder))->schema(); + new DbalLimitOffsetExtractor($connection, $queryBuilder)->schema(); static::assertNull($queryBuilder->getMaxResults()); static::assertSame(0, $queryBuilder->getFirstResult()); @@ -173,10 +173,10 @@ public function test_schema_is_derived_when_it_was_not_declared(): void static::assertEquals( schema(str_schema('id', true), str_schema('name', true), str_schema('amount', true)), - (new DbalLimitOffsetExtractor( + new DbalLimitOffsetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users'), - ))->schema(), + )->schema(), ); } @@ -186,7 +186,7 @@ public function test_schema_is_the_declared_one(): void static::assertEquals( schema(int_schema('id')), - (new DbalLimitOffsetExtractor($connection, $connection->createQueryBuilder()->select('*')->from('users'))) + new DbalLimitOffsetExtractor($connection, $connection->createQueryBuilder()->select('*')->from('users')) ->withSchema(schema(int_schema('id'))) ->schema(), ); @@ -198,10 +198,10 @@ public function test_sqlite_values_are_cast_to_string(): void $rows = []; - foreach ((new DbalLimitOffsetExtractor( + foreach (new DbalLimitOffsetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users'), - ))->extract(flow_context()->backend(), new Criteria()) as $batch) { + )->extract(flow_context()->backend(), new Criteria()) as $batch) { $rows = [...$rows, ...$batch->toArray()]; } @@ -212,10 +212,10 @@ public function test_pushed_limit_skips_the_count_query(): void { $counter = new SelectQueryCounter(); $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(new Middleware($counter)), 5); - $extractor = (new DbalLimitOffsetExtractor( + $extractor = new DbalLimitOffsetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users')->orderBy('id'), - ))->withBatchSize(2); + )->withBatchSize(2); $counter->reset(); self::assertExtractedRowsCount(5, $extractor, criteria: new Criteria(5)); @@ -228,10 +228,10 @@ public function test_stops_issuing_pages_when_a_page_comes_back_short(): void { $counter = new SelectQueryCounter(); $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(new Middleware($counter)), 3); - $extractor = (new DbalLimitOffsetExtractor( + $extractor = new DbalLimitOffsetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users')->orderBy('id'), - )) + ) ->withBatchSize(2) ->withMaximum(1000); $counter->reset(); @@ -246,20 +246,20 @@ public function test_is_repeatable(): void $connection = InMemorySqlite::connection(); static::assertTrue( - (new DbalLimitOffsetExtractor( + new DbalLimitOffsetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users'), - ))->isRepeatable(), + )->isRepeatable(), ); } public function test_a_new_maximum_drops_the_statistics(): void { $connection = InMemorySqlite::withUsers(InMemorySqlite::connection(), 3); - $extractor = (new DbalLimitOffsetExtractor( + $extractor = new DbalLimitOffsetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users')->orderBy('id'), - ))->withMaximum(2); + )->withMaximum(2); static::assertSame($extractor->statistics(), $extractor->statistics()); static::assertEquals(Cardinality::atMost(2), $extractor->statistics()->rows); @@ -275,10 +275,10 @@ public function test_the_query_builder_limit_bounds_the_rows(): void static::assertEquals( Cardinality::atMost(2), - (new DbalLimitOffsetExtractor( + new DbalLimitOffsetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users')->orderBy('id')->setMaxResults(2), - ))->statistics()->rows, + )->statistics()->rows, ); } @@ -288,10 +288,10 @@ public function test_extract_builds_through_the_config_backend(): void $backend = new SpyBackend(); iterator_to_array( - (new DbalLimitOffsetExtractor( + new DbalLimitOffsetExtractor( $connection, $connection->createQueryBuilder()->select('*')->from('users')->orderBy('id'), - ))->extract(flow_context(config_builder()->backend($backend)->build())->backend(), new Criteria()), + )->extract(flow_context(config_builder()->backend($backend)->build())->backend(), new Criteria()), false, ); diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalQueryExtractorTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalQueryExtractorTest.php index 276d0b9022..883b627010 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalQueryExtractorTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalQueryExtractorTest.php @@ -57,10 +57,10 @@ public function test_a_refused_probe_is_memoised(): void public function test_a_parameter_set_still_describes(): void { - $extractor = (new DbalQueryExtractor( + $extractor = new DbalQueryExtractor( InMemorySqlite::withUsers(InMemorySqlite::connection(), 3), 'SELECT id, name FROM users WHERE id > :min', - ))->withParameters(new ParametersSet(['min' => 1], ['min' => 2])); + )->withParameters(new ParametersSet(['min' => 1], ['min' => 2])); static::assertSame(['id', 'name'], $extractor->schema()->names()); @@ -77,10 +77,10 @@ public function test_schema_is_derived_when_it_was_not_declared(): void { static::assertEquals( schema(str_schema('id', true), str_schema('name', true), str_schema('amount', true)), - (new DbalQueryExtractor( + new DbalQueryExtractor( InMemorySqlite::withUsers(InMemorySqlite::connection(), 1), 'SELECT * FROM users', - ))->schema(), + )->schema(), ); } @@ -88,7 +88,7 @@ public function test_schema_is_the_declared_one(): void { static::assertEquals( schema(int_schema('id')), - (new DbalQueryExtractor(InMemorySqlite::connection(), 'SELECT * FROM users')) + new DbalQueryExtractor(InMemorySqlite::connection(), 'SELECT * FROM users') ->withSchema(schema(int_schema('id'))) ->schema(), ); @@ -96,10 +96,10 @@ public function test_schema_is_the_declared_one(): void public function test_sqlite_describes_as_all_string(): void { - $schema = (new DbalQueryExtractor( + $schema = new DbalQueryExtractor( InMemorySqlite::withUsers(InMemorySqlite::connection(), 1), 'SELECT id, name AS bb, amount * 2 AS calc FROM users', - ))->schema(); + )->schema(); static::assertSame(['id', 'bb', 'calc'], $schema->names()); @@ -124,10 +124,10 @@ public function test_the_derived_schema_is_memoised(): void public function test_pushed_limit_stops_querying_further_parameter_sets(int $batchSize, int $extractedRows): void { $counter = new SelectQueryCounter(); - $extractor = (new DbalQueryExtractor( + $extractor = new DbalQueryExtractor( InMemorySqlite::withUsers(InMemorySqlite::connection(new Middleware($counter)), 30), 'SELECT id, name FROM users WHERE id > :min AND id <= :max', - )) + ) ->withParameters( new ParametersSet(['min' => 0, 'max' => 10], ['min' => 10, 'max' => 20], ['min' => 20, 'max' => 30]), ) @@ -141,9 +141,7 @@ public function test_pushed_limit_stops_querying_further_parameter_sets(int $bat public function test_is_repeatable(): void { - static::assertTrue( - (new DbalQueryExtractor(InMemorySqlite::connection(), 'SELECT * FROM users'))->isRepeatable(), - ); + static::assertTrue(new DbalQueryExtractor(InMemorySqlite::connection(), 'SELECT * FROM users')->isRepeatable()); } public function test_new_parameters_drop_the_statistics(): void @@ -182,7 +180,7 @@ public function test_naive_datetime_text_reads_as_utc_under_non_utc_default(): v try { $values = []; - foreach ((new DbalQueryExtractor(InMemorySqlite::connection(), "SELECT '2026-01-01 14:30:00' AS at")) + foreach (new DbalQueryExtractor(InMemorySqlite::connection(), "SELECT '2026-01-01 14:30:00' AS at") ->withSchema(schema(datetime_schema('at'))) ->extract(flow_context()->backend(), new Criteria()) as $batch) { foreach ($batch->toArray() as $row) { @@ -203,10 +201,10 @@ public function test_batches_split_at_the_batch_size(): void array_map( static fn(Rows $rows): int => $rows->count(), iterator_to_array( - (new DbalQueryExtractor( + new DbalQueryExtractor( InMemorySqlite::withUsers(InMemorySqlite::connection(), 5), 'SELECT * FROM users', - )) + ) ->withBatchSize(2) ->extract(flow_context()->backend(), new Criteria()), false, @@ -220,10 +218,10 @@ public function test_extract_builds_through_the_config_backend(): void $backend = new SpyBackend(); iterator_to_array( - (new DbalQueryExtractor( + new DbalQueryExtractor( InMemorySqlite::withUsers(InMemorySqlite::connection(), 1), 'SELECT * FROM users', - ))->extract(flow_context(config_builder()->backend($backend)->build())->backend(), new Criteria()), + )->extract(flow_context(config_builder()->backend($backend)->build())->backend(), new Criteria()), false, ); diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalResultSchemaTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalResultSchemaTest.php index 3100597217..210f4ce42d 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalResultSchemaTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DbalResultSchemaTest.php @@ -25,7 +25,7 @@ public function test_a_missing_sqlite_column_rethrows_what_the_read_throws(): vo $this->expectException(DriverException::class); $this->expectExceptionMessage('no such column: nope'); - (new DbalResultSchema())->of( + new DbalResultSchema()->of( InMemorySqlite::withUsers(InMemorySqlite::connection(), 1), 'SELECT nope FROM users', self::class, @@ -36,13 +36,13 @@ public function test_a_missing_table_rethrows_what_the_read_throws(): void { $this->expectException(TableNotFoundException::class); - (new DbalResultSchema())->of(InMemorySqlite::connection(), 'SELECT id FROM missing', self::class); + new DbalResultSchema()->of(InMemorySqlite::connection(), 'SELECT id FROM missing', self::class); } public function test_a_query_the_probe_cannot_wrap_chains_the_driver_error(): void { try { - (new DbalResultSchema())->of(InMemorySqlite::connection(), 'SELECT 1; SELECT 2', self::class); + new DbalResultSchema()->of(InMemorySqlite::connection(), 'SELECT 1; SELECT 2', self::class); static::fail('a query the probe cannot wrap must not describe'); } catch (SchemaNotDerivableException $e) { static::assertInstanceOf(SyntaxErrorException::class, $e->getPrevious()); @@ -54,7 +54,7 @@ public function test_a_query_that_binds_parameters_describes(): void { static::assertEquals( schema(str_schema('id', true), str_schema('name', true)), - (new DbalResultSchema())->of( + new DbalResultSchema()->of( InMemorySqlite::withUsers(InMemorySqlite::connection(), 3), 'SELECT id, name FROM users WHERE id > :min', self::class, @@ -69,7 +69,7 @@ public function test_a_pdo_connection_that_is_not_sqlite_is_refused(): void $this->expectException(SchemaNotDerivableException::class); $this->expectExceptionMessage('reports no column types for a query result, so this query cannot be typed'); - (new DbalResultSchema())->of( + new DbalResultSchema()->of( InMemorySqlite::withUsers(InMemorySqlite::connection(new NativeHandleStub(new NonSqlitePdo())), 1), 'SELECT id FROM users', self::class, @@ -83,7 +83,7 @@ public function test_an_unsupported_driver_is_refused_by_name(): void 'the stdClass driver reports no column types for a query result, so this query cannot be typed', ); - (new DbalResultSchema())->of( + new DbalResultSchema()->of( InMemorySqlite::withUsers(InMemorySqlite::connection(new NativeHandleStub(new stdClass())), 1), 'SELECT id FROM users', self::class, @@ -94,7 +94,7 @@ public function test_the_wrapper_is_applied_so_a_trailing_semicolon_still_descri { static::assertSame( ['id'], - (new DbalResultSchema())->of( + new DbalResultSchema()->of( InMemorySqlite::withUsers(InMemorySqlite::connection(), 1), 'SELECT id FROM users;', self::class, diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DescribeQueryTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DescribeQueryTest.php index f092f7a36d..6b55322cd0 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DescribeQueryTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/DescribeQueryTest.php @@ -13,7 +13,7 @@ public function test_a_plain_query_is_wrapped(): void { static::assertSame( "SELECT * FROM (\nSELECT id FROM t\n) flow_describe WHERE 1=0", - (new DescribeQuery())->of('SELECT id FROM t'), + new DescribeQuery()->of('SELECT id FROM t'), ); } @@ -21,7 +21,7 @@ public function test_a_trailing_line_comment_is_closed_by_the_newline(): void { static::assertSame( "SELECT * FROM (\nSELECT id FROM t -- why\n) flow_describe WHERE 1=0", - (new DescribeQuery())->of('SELECT id FROM t -- why'), + new DescribeQuery()->of('SELECT id FROM t -- why'), ); } @@ -29,7 +29,7 @@ public function test_a_trailing_semicolon_is_stripped(): void { static::assertSame( "SELECT * FROM (\nSELECT id FROM t\n) flow_describe WHERE 1=0", - (new DescribeQuery())->of("SELECT id FROM t; \n"), + new DescribeQuery()->of("SELECT id FROM t; \n"), ); } } diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php index 9f66fbf1a3..ce0abbf944 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php @@ -31,7 +31,7 @@ public static function extractors(): Generator #[DataProvider('extractors')] public function test_an_extractor_carries_the_metadata_setter_only_when_it_declares_metadata(string $class): void { - if ((new ReflectionClass($class))->implementsInterface(MetadataColumnsExtractor::class)) { + if (new ReflectionClass($class)->implementsInterface(MetadataColumnsExtractor::class)) { MetadataColumnsContract::declares($class); return; diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/MysqliTypesMapTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/MysqliTypesMapTest.php index 4ac340e66e..487c5473c9 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/MysqliTypesMapTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/MysqliTypesMapTest.php @@ -80,7 +80,7 @@ public static function provide_mapped_constants(): Generator #[DataProvider('provide_mapped_constants')] public function test_every_mapped_constant(int $mysqliType, Type $expected): void { - static::assertEquals($expected, (new MysqliTypesMap())->toFlowType($mysqliType)); + static::assertEquals($expected, new MysqliTypesMap()->toFlowType($mysqliType)); } #[TestWith([MYSQLI_TYPE_BIT])] @@ -88,11 +88,11 @@ public function test_every_mapped_constant(int $mysqliType, Type $expected): voi #[TestWith([MYSQLI_TYPE_NULL])] public function test_an_unmapped_constant_returns_null(int $mysqliType): void { - static::assertNull((new MysqliTypesMap())->toFlowType($mysqliType)); + static::assertNull(new MysqliTypesMap()->toFlowType($mysqliType)); } public function test_tinyint_maps_to_integer_not_boolean(): void { - static::assertEquals(type_integer(), (new MysqliTypesMap())->toFlowType(MYSQLI_TYPE_TINY)); + static::assertEquals(type_integer(), new MysqliTypesMap()->toFlowType(MYSQLI_TYPE_TINY)); } } diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/NativePlaceholdersTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/NativePlaceholdersTest.php index 378f2f0b24..51b2a82ec6 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/NativePlaceholdersTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/NativePlaceholdersTest.php @@ -88,9 +88,9 @@ public function test_placeholders_are_rewritten_to_each_native_dialect( ): void { static::assertEquals( new RewrittenSql($postgreSql, $postgreSqlCount), - (new NativePlaceholders())->toPostgreSql($sql), + new NativePlaceholders()->toPostgreSql($sql), ); - static::assertEquals(new RewrittenSql($mysqli, $mysqliCount), (new NativePlaceholders())->toMysqli($sql)); + static::assertEquals(new RewrittenSql($mysqli, $mysqliCount), new NativePlaceholders()->toMysqli($sql)); } public function test_dollar_quoting_is_rewritten_inside_because_dbal_does_not_tokenise_it(): void @@ -98,7 +98,7 @@ public function test_dollar_quoting_is_rewritten_inside_because_dbal_does_not_to // Pins DBAL's parser, which ignores $$...$$; the expectation flips when DBAL fixes it. static::assertEquals( new RewrittenSql('SELECT $$ $1 $$ FROM t', 1), - (new NativePlaceholders())->toPostgreSql('SELECT $$ :nope $$ FROM t'), + new NativePlaceholders()->toPostgreSql('SELECT $$ :nope $$ FROM t'), ); } @@ -108,7 +108,7 @@ public function test_the_dbal_sql_parser_contract_is_still_what_we_depend_on(): ['acceptPositionalParameter', 'acceptNamedParameter', 'acceptOther'], array_map( static fn(ReflectionMethod $method): string => $method->getName(), - (new ReflectionClass(Visitor::class))->getMethods(), + new ReflectionClass(Visitor::class)->getMethods(), ), 'Doctrine\DBAL\SQL\Parser\Visitor changed shape - PlaceholderRewriter must follow', ); diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/PagesTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/PagesTest.php index 9f3da4bc45..bab9707ab1 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/PagesTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/PagesTest.php @@ -11,16 +11,16 @@ final class PagesTest extends FlowTestCase { public function test_total_even_pages(): void { - static::assertSame(100, (new Pages(1000, 10))->pages()); + static::assertSame(100, new Pages(1000, 10)->pages()); } public function test_total_pages_with_last_page_not_full(): void { - static::assertSame(100, (new Pages(999, 10))->pages()); + static::assertSame(100, new Pages(999, 10)->pages()); } public function test_total_pages_with_less_elements_than_page_size(): void { - static::assertSame(1, (new Pages(8, 10))->pages()); + static::assertSame(1, new Pages(8, 10)->pages()); } } diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/PgSqlTypesMapTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/PgSqlTypesMapTest.php index 08b7f77055..89b7ab7680 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/PgSqlTypesMapTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/PgSqlTypesMapTest.php @@ -57,7 +57,7 @@ public static function provide_mapped_types(): Generator #[DataProvider('provide_mapped_types')] public function test_every_mapped_type(string $pgType, Type $expected): void { - static::assertEquals($expected, (new PgSqlTypesMap())->toFlowType($pgType)); + static::assertEquals($expected, new PgSqlTypesMap()->toFlowType($pgType)); } #[TestWith(['_int4'])] @@ -72,6 +72,6 @@ public function test_every_mapped_type(string $pgType, Type $expected): void #[TestWith(['oid'])] public function test_an_unmapped_type_returns_null(string $pgType): void { - static::assertNull((new PgSqlTypesMap())->toFlowType($pgType)); + static::assertNull(new PgSqlTypesMap()->toFlowType($pgType)); } } diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/SqliteResultSchemaTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/SqliteResultSchemaTest.php index bc668a8503..54402bc939 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/SqliteResultSchemaTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/SqliteResultSchemaTest.php @@ -24,7 +24,7 @@ public function test_a_native_sqlite3_handle_describes(): void static::assertEquals( schema(str_schema('id', true), str_schema('bb', true), str_schema('calc', true)), - (new SqliteResultSchema())->of( + new SqliteResultSchema()->of( $sqlite, 'SELECT id, name AS bb, amount * 2 AS calc FROM users WHERE id > :min', self::class, @@ -36,7 +36,7 @@ public function test_a_parameterised_query_still_describes(): void { static::assertSame( ['id', 'name'], - (new SqliteResultSchema())->of( + new SqliteResultSchema()->of( InMemorySqlite::pdo(users: 1), 'SELECT id, name FROM users WHERE id > :min', self::class, @@ -47,7 +47,7 @@ public function test_a_parameterised_query_still_describes(): void public function test_a_query_the_database_refuses_is_refused_with_its_message(): void { try { - (new SqliteResultSchema())->of(InMemorySqlite::pdo(), 'SELECT id FROM missing', self::class); + new SqliteResultSchema()->of(InMemorySqlite::pdo(), 'SELECT id FROM missing', self::class); static::fail('a query the database refuses must not describe'); } catch (ProbeRefusal $e) { static::assertMatchesRegularExpression( @@ -61,7 +61,7 @@ public function test_a_query_the_database_refuses_is_refused_with_its_message(): public function test_a_query_the_native_sqlite3_refuses_is_refused_with_its_message(): void { try { - (new SqliteResultSchema())->of(InMemorySqlite::sqlite3(), 'SELECT id FROM missing', self::class); + new SqliteResultSchema()->of(InMemorySqlite::sqlite3(), 'SELECT id FROM missing', self::class); static::fail('a query the database refuses must not describe'); } catch (ProbeRefusal $e) { static::assertMatchesRegularExpression( @@ -74,7 +74,7 @@ public function test_a_query_the_native_sqlite3_refuses_is_refused_with_its_mess public function test_every_column_is_named_and_typed_string(): void { - $schema = (new SqliteResultSchema())->of( + $schema = new SqliteResultSchema()->of( InMemorySqlite::pdo(users: 1), 'SELECT o.id, o.name AS bb, o.amount * 2 AS calc FROM users o LEFT JOIN users x ON x.id = 99', self::class, diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/TypedColumnsTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/TypedColumnsTest.php index a6e7ebb45c..832449dbfa 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/TypedColumnsTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Extractor/TypedColumnsTest.php @@ -27,7 +27,7 @@ public function test_a_driver_type_without_a_flow_type_is_refused(): void $this->expectException(SchemaNotDerivableException::class); $this->expectExceptionMessage('column "tags" has driver type "_text", which Flow has no type for'); - (new TypedColumns())->schema( + new TypedColumns()->schema( [new ResultColumn('id', 'int4'), new ResultColumn('tags', '_text')], new PgSqlTypesMap(), self::class, @@ -39,12 +39,12 @@ public function test_a_mysqli_constant_without_a_flow_type_is_refused(): void $this->expectException(SchemaNotDerivableException::class); $this->expectExceptionMessage('column "flags" has driver type "16", which Flow has no type for'); - (new TypedColumns())->schema([new ResultColumn('flags', MYSQLI_TYPE_BIT)], new MysqliTypesMap(), self::class); + new TypedColumns()->schema([new ResultColumn('flags', MYSQLI_TYPE_BIT)], new MysqliTypesMap(), self::class); } public function test_duplicate_output_names_collapse_last_wins(): void { - $schema = (new TypedColumns())->schema( + $schema = new TypedColumns()->schema( [new ResultColumn('a', 'int4'), new ResultColumn('a', 'text')], new PgSqlTypesMap(), self::class, @@ -56,7 +56,7 @@ public function test_duplicate_output_names_collapse_last_wins(): void public function test_every_column_is_nullable(): void { - $schema = (new TypedColumns())->schema( + $schema = new TypedColumns()->schema( [new ResultColumn('id', MYSQLI_TYPE_LONG), new ResultColumn('name', MYSQLI_TYPE_LONG)], new MysqliTypesMap(), self::class, @@ -73,7 +73,7 @@ public function test_sqlite_columns_carry_no_native_type_and_describe_as_string( { static::assertEquals( schema(str_schema('id', true), str_schema('name', true)), - (new TypedColumns())->schema( + new TypedColumns()->schema( [new ResultColumn('id'), new ResultColumn('name')], new SqliteTypes(), self::class, diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/DbalEncoderTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/DbalEncoderTest.php index 947e204386..9b92e85db7 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/DbalEncoderTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/DbalEncoderTest.php @@ -23,7 +23,7 @@ final class DbalEncoderTest extends FlowTestCase { public function test_passes_scalar_values_through_unchanged_preserving_column_order(): void { - $encoded = (new DbalEncoder())->encode(array_to_rows( + $encoded = new DbalEncoder()->encode(array_to_rows( [['id' => 1, 'name' => 'Norbert', 'active' => true]], schema(int_schema('id'), str_schema('name'), bool_schema('active')), )); @@ -37,7 +37,7 @@ public function test_renders_a_dom_document_value_to_an_xml_string(): void $doc = new DOMDocument(); $doc->loadXML('Software Engineer'); - $encoded = (new DbalEncoder())->encode(array_to_rows( + $encoded = new DbalEncoder()->encode(array_to_rows( [['id' => 1, 'profile' => $doc]], schema(int_schema('id'), xml_schema('profile')), )); @@ -53,7 +53,7 @@ public function test_renders_a_dom_element_value_to_an_xml_string(): void $doc->loadXML('John Doe'); $element = $doc->getElementsByTagName('user')->item(0); - $encoded = (new DbalEncoder())->encode(array_to_rows([[ + $encoded = new DbalEncoder()->encode(array_to_rows([[ 'user_element' => $element, ]], schema(xml_element_schema('user_element')))); @@ -65,7 +65,7 @@ public function test_passes_null_through_unchanged(): void { static::assertSame( [['id' => 1, 'body' => null]], - (new DbalEncoder())->encode(array_to_rows( + new DbalEncoder()->encode(array_to_rows( [['id' => 1, 'body' => null]], schema(int_schema('id'), str_schema('body', nullable: true)), )), @@ -79,7 +79,7 @@ public function test_renders_an_empty_xml_element_with_an_end_tag(): void static::assertSame( [['e' => '']], - (new DbalEncoder())->encode(array_to_rows([[ + new DbalEncoder()->encode(array_to_rows([[ 'e' => $doc->getElementsByTagName('a')->item(0), ]], schema(xml_element_schema('e')))), ); @@ -91,7 +91,7 @@ public function test_passes_a_datetime_as_its_logical_value(): void static::assertEquals( [['at' => $at]], - (new DbalEncoder())->encode(array_to_rows([['at' => $at]], schema(datetime_schema('at')))), + new DbalEncoder()->encode(array_to_rows([['at' => $at]], schema(datetime_schema('at')))), ); } } diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/DbalLoaderTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/DbalLoaderTest.php index 946ed92ca2..f673c1e78a 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/DbalLoaderTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/DbalLoaderTest.php @@ -12,7 +12,7 @@ final class DbalLoaderTest extends TestCase { public function test_its_collection_is_the_table(): void { - static::assertSame('contacts', (new DbalLoader('contacts', ['host' => 'localhost']))->collection()); + static::assertSame('contacts', new DbalLoader('contacts', ['host' => 'localhost'])->collection()); } /** @@ -33,12 +33,12 @@ public function test_the_loader_declares_its_drivers_extensions(string $driver, { static::assertSame( $expected, - (new DbalLoader('t', ['driver' => $driver, 'host' => 'localhost']))->describe()?->extensions(), + new DbalLoader('t', ['driver' => $driver, 'host' => 'localhost'])->describe()?->extensions(), ); } public function test_a_loader_without_a_driver_declares_nothing(): void { - static::assertSame([], (new DbalLoader('t', ['host' => 'localhost']))->describe()?->extensions()); + static::assertSame([], new DbalLoader('t', ['host' => 'localhost'])->describe()?->extensions()); } } diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/DbalTransactionalTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/DbalTransactionalTest.php index 0ac9374003..f98b7b72b3 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/DbalTransactionalTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/DbalTransactionalTest.php @@ -8,7 +8,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Table; use Doctrine\DBAL\TransactionIsolationLevel; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\IO\Loader\DbalTransaction; use Flow\ETL\Adapter\Doctrine\Tests\Context\DatabaseContext; @@ -45,7 +44,7 @@ public function test_a_drain_failure_suppressed_by_the_error_handler_rolls_back_ new SelectQueryCounter(), new CommitCounter(), ); - $databaseContext->createTable(new Table('tx_drain', [new Column('id', Type::getType(Types::INTEGER), [ + $databaseContext->createTable(new Table('tx_drain', [new Column('id', Types::INTEGER, [ 'notnull' => true, ])])); @@ -85,7 +84,7 @@ public function test_a_failure_during_the_closure_transaction_rolls_back_the_dra new SelectQueryCounter(), new CommitCounter(), ); - $databaseContext->createTable(new Table('tx_drain', [new Column('id', Type::getType(Types::INTEGER), [ + $databaseContext->createTable(new Table('tx_drain', [new Column('id', Types::INTEGER, [ 'notnull' => true, ])])); diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/IsolationLevelRestoreTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/IsolationLevelRestoreTest.php index 818f711725..1310d3d34c 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/IsolationLevelRestoreTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/IO/Loader/IsolationLevelRestoreTest.php @@ -20,7 +20,7 @@ public function test_restore_sets_the_previous_level_back(): void ->method('setTransactionIsolation') ->with(TransactionIsolationLevel::READ_COMMITTED); - (new IsolationLevelRestore($connection, TransactionIsolationLevel::READ_COMMITTED))->restore(); + new IsolationLevelRestore($connection, TransactionIsolationLevel::READ_COMMITTED)->restore(); } public function test_a_failing_restore_is_suppressed(): void @@ -28,7 +28,7 @@ public function test_a_failing_restore_is_suppressed(): void $connection = $this->createStub(Connection::class); $connection->method('setTransactionIsolation')->willThrowException(new RuntimeException('restore failed')); - (new IsolationLevelRestore($connection, TransactionIsolationLevel::READ_COMMITTED))->restore(); + new IsolationLevelRestore($connection, TransactionIsolationLevel::READ_COMMITTED)->restore(); $this->addToAssertionCount(1); } diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/Values/Schema/SchemaConverterTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/Values/Schema/SchemaConverterTest.php index 72ab4129f9..4aaa840970 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/Values/Schema/SchemaConverterTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/Values/Schema/SchemaConverterTest.php @@ -8,7 +8,7 @@ use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\Values\Schema\DbalMetadata; use Flow\ETL\Tests\FlowTestCase; @@ -27,7 +27,6 @@ use function Flow\Types\DSL\type_list; use function Flow\Types\DSL\type_map; use function Flow\Types\DSL\type_string; -use function method_exists; final class SchemaConverterTest extends FlowTestCase { @@ -55,21 +54,21 @@ public function test_converting_flow_to_dbal_schema(): void $expectedTable = new Table( 'test', [ - new Column('int', Type::getType('integer'), ['notnull' => true]), - new Column('str', Type::getType('string'), ['notnull' => true]), - new Column('bigint', Type::getType('bigint'), ['notnull' => true]), - new Column('str_with_length', Type::getType('string'), ['notnull' => false, 'length' => 255]), - new Column('str_unique', Type::getType('string'), ['notnull' => false]), - new Column('float', Type::getType('float'), ['notnull' => false, 'precision' => 10, 'scale' => 2]), - new Column('float_default', Type::getType('float'), ['notnull' => true]), - new Column('bool', Type::getType('boolean'), ['notnull' => false, 'default' => true]), - new Column('json', Type::getType('json'), [ + new Column('int', Types::INTEGER, ['notnull' => true]), + new Column('str', Types::STRING, ['notnull' => true]), + new Column('bigint', Types::BIGINT, ['notnull' => true]), + new Column('str_with_length', Types::STRING, ['notnull' => false, 'length' => 255]), + new Column('str_unique', Types::STRING, ['notnull' => false]), + new Column('float', Types::FLOAT, ['notnull' => false, 'precision' => 10, 'scale' => 2]), + new Column('float_default', Types::FLOAT, ['notnull' => true]), + new Column('bool', Types::BOOLEAN, ['notnull' => false, 'default' => true]), + new Column('json', Types::JSON, [ 'notnull' => false, 'platformOptions' => ['jsonb' => true], ]), - new Column('list', Type::getType('json'), ['notnull' => true, 'columnDefinition' => 'integer[]']), - new Column('map', Type::getType('json'), ['notnull' => true, 'comment' => 'test comment!']), - new Column('date', Type::getType('date_immutable'), ['notnull' => false]), + new Column('list', Types::JSON, ['notnull' => true, 'columnDefinition' => 'integer[]']), + new Column('map', Types::JSON, ['notnull' => true, 'comment' => 'test comment!']), + new Column('date', Types::DATE_IMMUTABLE, ['notnull' => false]), ], [ new Index('idx_date', ['date'], false, false), @@ -97,8 +96,8 @@ public function test_converting_flow_to_dbal_schema_without_providing_pk_name(): ); $expectedTable = new Table('test', [ - new Column('int', Type::getType('integer'), ['notnull' => true]), - new Column('str', Type::getType('string'), ['notnull' => true]), + new Column('int', Types::INTEGER, ['notnull' => true]), + new Column('str', Types::STRING, ['notnull' => true]), ]); $expectedTable = $expectedTable ->edit() @@ -108,147 +107,33 @@ public function test_converting_flow_to_dbal_schema_without_providing_pk_name(): static::assertEquals($expectedTable, to_dbal_schema_table($flowSchema, 'test')); } - public function test_dbal_schema_to_flow_schema_dbal_36(): void + public function test_dbal_schema_to_flow_schema(): void { - // changeColumn was removed in doctrine/dbal 4.0 - // We are using it to perform a different assertion since prior to 4.0 all - // columns were also getting precision set to 10 due to a bug that was executing precision set - // even when precision value was null. - if (!method_exists(Table::class, 'changeColumn')) { - static::markTestSkipped('Doctrine DBAL >= 3.6+ < 4.0'); - } - - $inputTable = new Table( - 'test', - [ - new Column('int', Type::getType('integer'), ['notnull' => true]), - new Column('str', Type::getType('string'), ['notnull' => true]), - new Column('bigint', Type::getType('bigint'), ['notnull' => true]), - new Column('str_with_length', Type::getType('string'), ['notnull' => false, 'length' => 255]), - new Column('str_unique', Type::getType('string'), ['notnull' => false]), - new Column('float', Type::getType('float'), [ - 'notnull' => false, - 'precision' => 10, - 'scale' => 2, - ]), - new Column('float_default', Type::getType('float'), ['notnull' => true, 'scale' => 6]), - new Column('bool', Type::getType('boolean'), ['notnull' => false, 'default' => true]), - new Column('json', Type::getType('json'), [ - 'notnull' => false, - 'platformOptions' => ['jsonb' => true], - ]), - new Column('list', Type::getType('json'), [ - 'notnull' => true, - 'columnDefinition' => 'integer[]', - ]), - new Column('map', Type::getType('json'), ['notnull' => true, 'comment' => 'test comment!']), - new Column('date', Type::getType('date_immutable'), ['notnull' => false]), - ], - [ - new Index('idx_date', ['date'], false, false), - new Index('idx_str_unique', ['str_unique'], true, false), - ], - ); - $inputTable = $inputTable - ->edit() - ->addPrimaryKeyConstraint( - PrimaryKeyConstraint::editor() - ->setUnquotedName('pk_test') - ->setUnquotedColumnNames('int', 'str') - ->create(), - ) - ->create(); - - static::assertEquals( - schema( - int_schema( - 'int', - nullable: false, - metadata: DbalMetadata::primaryKey('pk_test')->merge(DbalMetadata::precision(10)), - ), - str_schema( - 'str', - nullable: false, - metadata: DbalMetadata::primaryKey('pk_test')->merge(DbalMetadata::precision(10)), - ), - int_schema('bigint', nullable: false, metadata: DbalMetadata::precision(10)), - str_schema('str_with_length', true, DbalMetadata::length(255)->merge(DbalMetadata::precision(10))), - str_schema( - 'str_unique', - true, - DbalMetadata::indexUnique('idx_str_unique')->merge(DbalMetadata::precision(10)), - ), - date_schema( - 'date', - nullable: true, - metadata: DbalMetadata::index('idx_date')->merge(DbalMetadata::precision(10)), - ), - float_schema( - 'float', - nullable: true, - metadata: DbalMetadata::precision(10) - ->merge(DbalMetadata::scale(2)) - ->merge(DbalMetadata::precision(10)), - ), - float_schema('float_default', metadata: DbalMetadata::scale(6)->merge(DbalMetadata::precision(10))), - bool_schema( - 'bool', - nullable: true, - metadata: DbalMetadata::default(true)->merge(DbalMetadata::precision(10)), - ), - json_schema( - 'json', - nullable: true, - metadata: DbalMetadata::platformOptions(['jsonb' => true])->merge(DbalMetadata::precision(10)), - ), - json_schema( - 'list', - metadata: DbalMetadata::columnDefinition('integer[]')->merge(DbalMetadata::precision(10)), - ), - json_schema( - 'map', - metadata: DbalMetadata::comment('test comment!')->merge(DbalMetadata::precision(10)), - ), - ), - table_schema_to_flow_schema($inputTable), - ); - } - - public function test_dbal_schema_to_flow_schema_dbal_40(): void - { - // changeColumn was removed in doctrine/dbal 4.0 - // We are using it to perform a different assertion since prior to 4.0 all - // columns were also getting precision set to 10 due to a bug that was executing precision set - // even when precision value was null. - if (method_exists(Table::class, 'changeColumn')) { - static::markTestSkipped('Doctrine DBAL >= 4.0+'); - } - $inputTable = new Table( 'test', [ - new Column('int', Type::getType('integer'), ['notnull' => true]), - new Column('str', Type::getType('string'), ['notnull' => true]), - new Column('bigint', Type::getType('bigint'), ['notnull' => true]), - new Column('str_with_length', Type::getType('string'), ['notnull' => false, 'length' => 255]), - new Column('str_unique', Type::getType('string'), ['notnull' => false]), - new Column('float', Type::getType('float'), [ + new Column('int', 'integer', ['notnull' => true]), + new Column('str', 'string', ['notnull' => true]), + new Column('bigint', 'bigint', ['notnull' => true]), + new Column('str_with_length', 'string', ['notnull' => false, 'length' => 255]), + new Column('str_unique', 'string', ['notnull' => false]), + new Column('float', 'float', [ 'notnull' => false, 'precision' => 10, 'scale' => 2, ]), - new Column('float_default', Type::getType('float'), ['notnull' => true, 'scale' => 6]), - new Column('bool', Type::getType('boolean'), ['notnull' => false, 'default' => true]), - new Column('json', Type::getType('json'), [ + new Column('float_default', 'float', ['notnull' => true, 'scale' => 6]), + new Column('bool', 'boolean', ['notnull' => false, 'default' => true]), + new Column('json', 'json', [ 'notnull' => false, 'platformOptions' => ['jsonb' => true], ]), - new Column('list', Type::getType('json'), [ + new Column('list', 'json', [ 'notnull' => true, 'columnDefinition' => 'integer[]', ]), - new Column('map', Type::getType('json'), ['notnull' => true, 'comment' => 'test comment!']), - new Column('date', Type::getType('date_immutable'), ['notnull' => false]), + new Column('map', 'json', ['notnull' => true, 'comment' => 'test comment!']), + new Column('date', 'date_immutable', ['notnull' => false]), ], [ new Index('idx_date', ['date'], false, false), @@ -291,7 +176,7 @@ public function test_dbal_schema_to_flow_schema_dbal_40(): void public function test_dbal_schema_to_flow_schema_drops_null_platform_options(): void { static::assertEquals(schema(int_schema('id', nullable: false)), table_schema_to_flow_schema(new Table('t', [ - new Column('id', Type::getType('integer'), [ + new Column('id', 'integer', [ 'notnull' => true, 'platformOptions' => ['charset' => null, 'collation' => null], ]), diff --git a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/Values/Schema/TypesMapTest.php b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/Values/Schema/TypesMapTest.php index 02e14f5af1..a98a03ec8a 100644 --- a/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/Values/Schema/TypesMapTest.php +++ b/src/adapter/etl-adapter-doctrine/tests/Flow/ETL/Adapter/Doctrine/Tests/Unit/Values/Schema/TypesMapTest.php @@ -4,26 +4,7 @@ namespace Flow\ETL\Adapter\Doctrine\Tests\Unit\Values\Schema; -use Doctrine\DBAL\Types\BigIntType; -use Doctrine\DBAL\Types\BlobType; -use Doctrine\DBAL\Types\BooleanType as DoctrineBooleanType; -use Doctrine\DBAL\Types\DateImmutableType; -use Doctrine\DBAL\Types\DateTimeImmutableType; -use Doctrine\DBAL\Types\DateTimeType as DoctrineDateTimeType; -use Doctrine\DBAL\Types\DateTimeTzImmutableType; -use Doctrine\DBAL\Types\DateTimeTzType; -use Doctrine\DBAL\Types\DateType as DoctrineDateType; -use Doctrine\DBAL\Types\DecimalType; -use Doctrine\DBAL\Types\FloatType as DoctrineFloatType; -use Doctrine\DBAL\Types\GuidType; -use Doctrine\DBAL\Types\IntegerType as DoctrineIntegerType; -use Doctrine\DBAL\Types\JsonType as DbalJsonType; -use Doctrine\DBAL\Types\SmallFloatType; -use Doctrine\DBAL\Types\SmallIntType; -use Doctrine\DBAL\Types\StringType as DoctrineStringType; -use Doctrine\DBAL\Types\TextType; -use Doctrine\DBAL\Types\TimeImmutableType; -use Doctrine\DBAL\Types\TimeType as DoctrineTimeType; +use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\Values\Schema\TypesMap; use Flow\ETL\Foundation\Exception\InvalidArgumentException; use Flow\Types\Type\Logical\DateTimeType; @@ -48,7 +29,6 @@ use PHPUnit\Framework\TestCase; use stdClass; -use function array_keys; use function Flow\ETL\DSL\int_schema; use function Flow\ETL\DSL\schema; use function Flow\ETL\DSL\string_schema; @@ -80,23 +60,23 @@ public function test_complete_flow_to_dbal_type_conversion_workflow(): void } } - public function test_constructor_validates_dbal_type_class_names(): void + public function test_constructor_accepts_a_dbal_type_name_registered_only_on_a_connection(): void { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('"InvalidClass" is not a valid Doctrine DBAL type.'); - - new TypesMap([ - StringType::class => 'InvalidClass', - ]); + static::assertSame( + 'custom_type', + new TypesMap([StringType::class => 'custom_type'])->toDbalType(StringType::class), + ); } - public function test_constructor_validates_dbal_type_with_non_dbal_type(): void + public function test_constructor_refuses_an_empty_dbal_type_name(): void { $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('"stdClass" is not a valid Doctrine DBAL type.'); + $this->expectExceptionMessage( + 'Doctrine DBAL type name for "' . StringType::class . '" must be a non-empty string.', + ); new TypesMap([ - StringType::class => stdClass::class, + StringType::class => '', ]); } @@ -106,7 +86,7 @@ public function test_constructor_validates_flow_type_class_names(): void $this->expectExceptionMessage('"InvalidClass" is not a valid type.'); new TypesMap([ - 'InvalidClass' => DoctrineStringType::class, + 'InvalidClass' => Types::STRING, ]); } @@ -116,15 +96,15 @@ public function test_constructor_validates_flow_type_with_non_string_key(): void $this->expectExceptionMessage('"stdClass" is not a valid type.'); new TypesMap([ - stdClass::class => DoctrineStringType::class, + stdClass::class => Types::STRING, ]); } public function test_constructor_with_custom_map_uses_provided_mappings(): void { $customMap = [ - StringType::class => TextType::class, - IntegerType::class => BigIntType::class, + StringType::class => Types::TEXT, + IntegerType::class => Types::BIGINT, ]; $typesMap = new TypesMap($customMap); @@ -132,8 +112,8 @@ public function test_constructor_with_custom_map_uses_provided_mappings(): void $stringResult = $typesMap->toDbalType(StringType::class); $integerResult = $typesMap->toDbalType(IntegerType::class); - static::assertSame(TextType::class, $stringResult); - static::assertSame(BigIntType::class, $integerResult); + static::assertSame(Types::TEXT, $stringResult); + static::assertSame(Types::BIGINT, $integerResult); } public function test_constructor_with_empty_map_uses_default_flow_types(): void @@ -142,7 +122,7 @@ public function test_constructor_with_empty_map_uses_default_flow_types(): void $result = $typesMap->toDbalType(StringType::class); - static::assertSame(DoctrineStringType::class, $result); + static::assertSame(Types::STRING, $result); } public function test_constructor_with_mixed_valid_and_invalid_types(): void @@ -151,22 +131,22 @@ public function test_constructor_with_mixed_valid_and_invalid_types(): void $this->expectExceptionMessage('"InvalidFlowType" is not a valid type.'); new TypesMap([ - StringType::class => TextType::class, - 'InvalidFlowType' => DoctrineStringType::class, + StringType::class => Types::TEXT, + 'InvalidFlowType' => Types::STRING, ]); } public function test_custom_mapping_overrides_default_behavior(): void { $customMap = [ - StringType::class => TextType::class, - IntegerType::class => BigIntType::class, + StringType::class => Types::TEXT, + IntegerType::class => Types::BIGINT, ]; $typesMap = new TypesMap($customMap); - static::assertSame(TextType::class, $typesMap->toDbalType(StringType::class)); - static::assertSame(BigIntType::class, $typesMap->toDbalType(IntegerType::class)); + static::assertSame(Types::TEXT, $typesMap->toDbalType(StringType::class)); + static::assertSame(Types::BIGINT, $typesMap->toDbalType(IntegerType::class)); $this->expectException(BaseInvalidArgumentException::class); $this->expectExceptionMessage('"' . BooleanType::class . '" is not a valid type.'); @@ -177,26 +157,26 @@ public function test_custom_mapping_overrides_default_behavior(): void public function test_default_dbal_types_constant_mapping(): void { $expectedMappings = [ - DoctrineStringType::class => StringType::class, - TextType::class => StringType::class, - DoctrineIntegerType::class => IntegerType::class, - BigIntType::class => IntegerType::class, - SmallIntType::class => IntegerType::class, - DoctrineFloatType::class => FloatType::class, - SmallFloatType::class => FloatType::class, - DoctrineBooleanType::class => BooleanType::class, - DoctrineDateType::class => DateType::class, - DateImmutableType::class => DateType::class, - TimeImmutableType::class => TimeType::class, - DoctrineTimeType::class => TimeType::class, - DateTimeImmutableType::class => DateTimeType::class, - DateTimeTzImmutableType::class => DateTimeType::class, - DateTimeTzType::class => DateTimeType::class, - DoctrineDateTimeType::class => DateTimeType::class, - GuidType::class => UuidType::class, - DbalJsonType::class => JsonType::class, - BlobType::class => StringType::class, - DecimalType::class => FloatType::class, + Types::STRING => StringType::class, + Types::TEXT => StringType::class, + Types::INTEGER => IntegerType::class, + Types::BIGINT => IntegerType::class, + Types::SMALLINT => IntegerType::class, + Types::FLOAT => FloatType::class, + Types::SMALLFLOAT => FloatType::class, + Types::BOOLEAN => BooleanType::class, + 'date' => DateType::class, + Types::DATE_IMMUTABLE => DateType::class, + Types::TIME_IMMUTABLE => TimeType::class, + 'time' => TimeType::class, + Types::DATETIME_IMMUTABLE => DateTimeType::class, + Types::DATETIMETZ_IMMUTABLE => DateTimeType::class, + 'datetimetz' => DateTimeType::class, + 'datetime' => DateTimeType::class, + Types::GUID => UuidType::class, + Types::JSON => JsonType::class, + Types::BLOB => StringType::class, + Types::DECIMAL => FloatType::class, ]; static::assertSame($expectedMappings, TypesMap::DBAL_TYPES); @@ -205,24 +185,24 @@ public function test_default_dbal_types_constant_mapping(): void public function test_default_flow_types_constant_mapping(): void { $expectedMappings = [ - StringType::class => DoctrineStringType::class, - IntegerType::class => DoctrineIntegerType::class, - FloatType::class => DoctrineFloatType::class, - BooleanType::class => DoctrineBooleanType::class, - DateType::class => DateImmutableType::class, - TimeType::class => TimeImmutableType::class, - DateTimeType::class => DateTimeImmutableType::class, - UuidType::class => GuidType::class, - TimeZoneType::class => DoctrineStringType::class, - JsonType::class => DbalJsonType::class, - XMLType::class => DoctrineStringType::class, - XMLElementType::class => DoctrineStringType::class, - HTMLType::class => DoctrineStringType::class, - HTMLElementType::class => DoctrineStringType::class, - EnumType::class => DoctrineStringType::class, - ListType::class => DbalJsonType::class, - MapType::class => DbalJsonType::class, - StructureType::class => DbalJsonType::class, + StringType::class => Types::STRING, + IntegerType::class => Types::INTEGER, + FloatType::class => Types::FLOAT, + BooleanType::class => Types::BOOLEAN, + DateType::class => Types::DATE_IMMUTABLE, + TimeType::class => Types::TIME_IMMUTABLE, + DateTimeType::class => Types::DATETIME_IMMUTABLE, + UuidType::class => Types::GUID, + TimeZoneType::class => Types::STRING, + JsonType::class => Types::JSON, + XMLType::class => Types::STRING, + XMLElementType::class => Types::STRING, + HTMLType::class => Types::STRING, + HTMLElementType::class => Types::STRING, + EnumType::class => Types::STRING, + ListType::class => Types::JSON, + MapType::class => Types::JSON, + StructureType::class => Types::JSON, ]; static::assertSame($expectedMappings, TypesMap::FLOW_TYPES); @@ -231,18 +211,18 @@ public function test_default_flow_types_constant_mapping(): void public function test_edge_case_with_single_mapping(): void { $typesMap = new TypesMap([ - StringType::class => TextType::class, + StringType::class => Types::TEXT, ]); $result = $typesMap->toDbalType(StringType::class); - static::assertSame(TextType::class, $result); + static::assertSame(Types::TEXT, $result); } public function test_to_dbal_type_throws_exception_for_unknown_flow_type(): void { $typesMap = new TypesMap([ - StringType::class => DoctrineStringType::class, + StringType::class => Types::STRING, ]); $this->expectException(BaseInvalidArgumentException::class); @@ -254,12 +234,12 @@ public function test_to_dbal_type_throws_exception_for_unknown_flow_type(): void public function test_to_dbal_type_with_custom_mapping(): void { $typesMap = new TypesMap([ - StringType::class => TextType::class, + StringType::class => Types::TEXT, ]); $result = $typesMap->toDbalType(StringType::class); - static::assertSame(TextType::class, $result); + static::assertSame(Types::TEXT, $result); } public function test_to_dbal_type_with_valid_flow_type(): void @@ -268,7 +248,7 @@ public function test_to_dbal_type_with_valid_flow_type(): void $result = $typesMap->toDbalType(StringType::class); - static::assertSame(DoctrineStringType::class, $result); + static::assertSame(Types::STRING, $result); } public function test_to_flow_type_throws_exception_for_unknown_dbal_type(): void @@ -285,17 +265,17 @@ public function test_to_flow_type_with_extended_dbal_types(): void { $typesMap = new TypesMap([]); - $textResult = $typesMap->toFlowType(TextType::class); - $bigIntResult = $typesMap->toFlowType(BigIntType::class); - $smallIntResult = $typesMap->toFlowType(SmallIntType::class); - $smallFloatResult = $typesMap->toFlowType(SmallFloatType::class); - $dateImmutableResult = $typesMap->toFlowType(DateImmutableType::class); - $timeImmutableResult = $typesMap->toFlowType(TimeImmutableType::class); - $dateTimeImmutableResult = $typesMap->toFlowType(DateTimeImmutableType::class); - $dateTimeTzImmutableResult = $typesMap->toFlowType(DateTimeTzImmutableType::class); - $guidResult = $typesMap->toFlowType(GuidType::class); - $blobResult = $typesMap->toFlowType(BlobType::class); - $decimalResult = $typesMap->toFlowType(DecimalType::class); + $textResult = $typesMap->toFlowType(Types::TEXT); + $bigIntResult = $typesMap->toFlowType(Types::BIGINT); + $smallIntResult = $typesMap->toFlowType(Types::SMALLINT); + $smallFloatResult = $typesMap->toFlowType(Types::SMALLFLOAT); + $dateImmutableResult = $typesMap->toFlowType(Types::DATE_IMMUTABLE); + $timeImmutableResult = $typesMap->toFlowType(Types::TIME_IMMUTABLE); + $dateTimeImmutableResult = $typesMap->toFlowType(Types::DATETIME_IMMUTABLE); + $dateTimeTzImmutableResult = $typesMap->toFlowType(Types::DATETIMETZ_IMMUTABLE); + $guidResult = $typesMap->toFlowType(Types::GUID); + $blobResult = $typesMap->toFlowType(Types::BLOB); + $decimalResult = $typesMap->toFlowType(Types::DECIMAL); static::assertInstanceOf(StringType::class, $textResult); static::assertInstanceOf(IntegerType::class, $bigIntResult); @@ -314,7 +294,7 @@ public function test_to_flow_type_with_valid_dbal_type(): void { $typesMap = new TypesMap([]); - $result = $typesMap->toFlowType(DoctrineStringType::class); + $result = $typesMap->toFlowType(Types::STRING); static::assertInstanceOf(StringType::class, $result); } @@ -323,14 +303,14 @@ public function test_to_flow_type_with_various_dbal_types(): void { $typesMap = new TypesMap([]); - $stringResult = $typesMap->toFlowType(DoctrineStringType::class); - $integerResult = $typesMap->toFlowType(DoctrineIntegerType::class); - $floatResult = $typesMap->toFlowType(DoctrineFloatType::class); - $booleanResult = $typesMap->toFlowType(DoctrineBooleanType::class); - $dateResult = $typesMap->toFlowType(DoctrineDateType::class); - $timeResult = $typesMap->toFlowType(DoctrineTimeType::class); - $dateTimeResult = $typesMap->toFlowType(DoctrineDateTimeType::class); - $jsonResult = $typesMap->toFlowType(DbalJsonType::class); + $stringResult = $typesMap->toFlowType(Types::STRING); + $integerResult = $typesMap->toFlowType(Types::INTEGER); + $floatResult = $typesMap->toFlowType(Types::FLOAT); + $booleanResult = $typesMap->toFlowType(Types::BOOLEAN); + $dateResult = $typesMap->toFlowType('date'); + $timeResult = $typesMap->toFlowType('time'); + $dateTimeResult = $typesMap->toFlowType('datetime'); + $jsonResult = $typesMap->toFlowType(Types::JSON); static::assertInstanceOf(StringType::class, $stringResult); static::assertInstanceOf(IntegerType::class, $integerResult); @@ -345,27 +325,20 @@ public function test_to_flow_type_with_various_dbal_types(): void public function test_type_map_preserves_mapping_order(): void { $customMap = [ - StringType::class => TextType::class, - IntegerType::class => BigIntType::class, + StringType::class => Types::TEXT, + IntegerType::class => Types::BIGINT, ]; $typesMap = new TypesMap($customMap); - static::assertSame(TextType::class, $typesMap->toDbalType(StringType::class)); - static::assertSame(BigIntType::class, $typesMap->toDbalType(IntegerType::class)); + static::assertSame(Types::TEXT, $typesMap->toDbalType(StringType::class)); + static::assertSame(Types::BIGINT, $typesMap->toDbalType(IntegerType::class)); } public function test_flow_schema_types_maps_schema_definitions_to_dbal_types(): void { - $types = (new TypesMap([]))->flowSchemaTypes(schema( - int_schema('id'), - string_schema('name'), - xml_schema('body'), - )); - - static::assertSame(['id', 'name', 'body'], array_keys($types)); - static::assertInstanceOf(DoctrineIntegerType::class, $types['id']); - static::assertInstanceOf(DoctrineStringType::class, $types['name']); - static::assertInstanceOf(DoctrineStringType::class, $types['body']); + $types = new TypesMap([])->flowSchemaTypes(schema(int_schema('id'), string_schema('name'), xml_schema('body'))); + + static::assertSame(['id' => Types::INTEGER, 'name' => Types::STRING, 'body' => Types::STRING], $types); } } diff --git a/src/adapter/etl-adapter-excel/composer.json b/src/adapter/etl-adapter-excel/composer.json index a2c226515c..b83289bbf5 100644 --- a/src/adapter/etl-adapter-excel/composer.json +++ b/src/adapter/etl-adapter-excel/composer.json @@ -12,7 +12,7 @@ "adapter" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "ext-xmlreader": "*", "ext-zip": "*", "flow-php/etl": "self.version", diff --git a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/Functions/IsValidExcelSheetName.php b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/Functions/IsValidExcelSheetName.php index 1319a470a3..d6d02e08c8 100644 --- a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/Functions/IsValidExcelSheetName.php +++ b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/Functions/IsValidExcelSheetName.php @@ -85,17 +85,17 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), $this->sheetName->returns()); + return new Nullability()->any(type_boolean(), $this->sheetName->returns()); } public function eval(Rows $rows, Backend $backend): Column { $results = []; - foreach ((new Parameter($this->sheetName))->asStrings($rows, $backend) as $sheetName) { + foreach (new Parameter($this->sheetName)->asStrings($rows, $backend) as $sheetName) { $results[] = $sheetName === null ? null : SheetNameAssertion::isValid($sheetName); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/ExcelExtractor.php b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/ExcelExtractor.php index f77d844224..6dfde3844c 100644 --- a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/ExcelExtractor.php +++ b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/ExcelExtractor.php @@ -153,7 +153,7 @@ public function extract(Backend $backend, Criteria $criteria): Generator $this->sampled = null; $fileColumns = $this->fileColumns->columns(); - yield from (new FileSplitReader( + yield from new FileSplitReader( new FileRead($this->files, $fileColumns, $schema, $this->batchSize()), new ExcelFileBatches( new WorkbookReader($this->readOptions, new ExcelFormatDetector($this->files->filesystem)), @@ -169,7 +169,7 @@ public function extract(Backend $backend, Criteria $criteria): Generator $this->schema === null ? $this->inference : null, ), $this->corruptedRecordsLoader, - ))->extract($backend, $criteria); + )->extract($backend, $criteria); } public function reader(): FileSplitReader @@ -243,7 +243,7 @@ private function describe(): Schema ); try { - $inferred = (new SchemaInferrer($this->inference))->infer($sniffer, $this->inferenceProgress); + $inferred = new SchemaInferrer($this->inference)->infer($sniffer, $this->inferenceProgress); $derived = $this->derived->learn($inferred->schema, $sniffer->header()->source ?? ''); $this->sampledUnits = $inferred->units; $this->sampledFiles = count($sources); diff --git a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/Sheet/SheetCells.php b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/Sheet/SheetCells.php index 6d9f45cbc0..092661df01 100644 --- a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/Sheet/SheetCells.php +++ b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/Sheet/SheetCells.php @@ -63,7 +63,7 @@ public function rows(): Generator private function values(): Generator { if ($this->sheet instanceof XlsxSheet) { - yield from (new XlsxSheetRows($this->sheet))->values(); + yield from new XlsxSheetRows($this->sheet)->values(); return; } diff --git a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/Sheet/XlsxSheetRows.php b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/Sheet/XlsxSheetRows.php index 0a3fc830c1..db0b30a719 100644 --- a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/Sheet/XlsxSheetRows.php +++ b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/Sheet/XlsxSheetRows.php @@ -58,15 +58,15 @@ public function __construct(Sheet $sheet) // OpenSpout keeps the sheet's XML part and its formatter on private RowIterator properties alone $rows = $sheet->getRowIterator(); - $this->file = type_string()->assert((new ReflectionProperty(RowIterator::class, 'filePath'))->getValue($rows)); - $this->part = type_string()->assert((new ReflectionProperty( + $this->file = type_string()->assert(new ReflectionProperty(RowIterator::class, 'filePath')->getValue($rows)); + $this->part = type_string()->assert(new ReflectionProperty( RowIterator::class, 'sheetDataXMLFilePath', - ))->getValue($rows)); - $this->formatter = type_instance_of(CellValueFormatter::class)->assert((new ReflectionProperty( + )->getValue($rows)); + $this->formatter = type_instance_of(CellValueFormatter::class)->assert(new ReflectionProperty( RowIterator::class, 'cellValueFormatter', - ))->getValue($rows)); + )->getValue($rows)); } /** diff --git a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/WorkbookReader.php b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/WorkbookReader.php index b05aad0453..3091c17958 100644 --- a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/WorkbookReader.php +++ b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Extractor/WorkbookReader.php @@ -75,7 +75,7 @@ public function open(Path $path): OpenSheet return new OpenSheet( $reader, - (new SheetCells($sheet, $this->options->withHeader))->rows(), + new SheetCells($sheet, $this->options->withHeader)->rows(), new RecordDecoder( withHeader: $this->options->withHeader, emptyToNull: $this->options->convertEmptyToNull, diff --git a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Loader/ExcelEncoder.php b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Loader/ExcelEncoder.php index 72dcdc17cf..117bfb5d96 100644 --- a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Loader/ExcelEncoder.php +++ b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Loader/ExcelEncoder.php @@ -59,7 +59,7 @@ public function column(Type $type, Column $column): array } if ($bare instanceof DateTimeType || $bare instanceof DateType || $bare instanceof TimeType) { - $values = (new PhysicalFor())->physical($bare); + $values = new PhysicalFor()->physical($bare); $cells = []; // @mago-ignore analysis:mixed-assignment @@ -81,7 +81,7 @@ public function column(Type $type, Column $column): array } if ($bare instanceof EnumType) { - $values = (new PhysicalFor())->physical($bare); + $values = new PhysicalFor()->physical($bare); $cells = []; // @mago-ignore analysis:mixed-assignment diff --git a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Loader/ExcelLoader.php b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Loader/ExcelLoader.php index 15594f01ba..6058aa2ccf 100644 --- a/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Loader/ExcelLoader.php +++ b/src/adapter/etl-adapter-excel/src/Flow/ETL/Adapter/Excel/IO/Loader/ExcelLoader.php @@ -118,10 +118,10 @@ public function __construct(Path $path, Filesystem $filesystem = new NativeLocal public static function fromDescription(#[SensitiveParameter] array $data, Rebuild $rebuild): static { - $loader = (new self( + $loader = new self( Path::fromArray(type_array()->assert($data['path'] ?? null)), $rebuild->of($data['filesystem'] ?? null, ConfiguredFilesystem::class)->filesystem(), - )) + ) ->saveMode(type_enum(SaveMode::class)->assert(constant( SaveMode::class . '::' . type_string()->assert($data['save_mode'] ?? null), ))) @@ -238,7 +238,7 @@ public function partitioning(): Partitioning public function inTask(Part $task): static { - $loader = (new self($this->path, $this->filesystem)) + $loader = new self($this->path, $this->filesystem) ->saveMode($this->saveMode) ->withDateFormat($this->dateFormat) ->withDateTimeFormat($this->dateTimeFormat) @@ -459,8 +459,8 @@ private function temporalStyle(Definition $definition): ?Style { return match ($definition->type()::class) { DateTimeType::class - => $this->formatStyles[$this->dateTimeFormat] ??= (new Style())->withFormat($this->dateTimeFormat), - DateType::class => $this->formatStyles[$this->dateFormat] ??= (new Style())->withFormat($this->dateFormat), + => $this->formatStyles[$this->dateTimeFormat] ??= new Style()->withFormat($this->dateTimeFormat), + DateType::class => $this->formatStyles[$this->dateFormat] ??= new Style()->withFormat($this->dateFormat), default => null, }; } diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Context/DescribableFixtures.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Context/DescribableFixtures.php index 4443ec5bdc..397e478e3e 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Context/DescribableFixtures.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Context/DescribableFixtures.php @@ -48,7 +48,7 @@ public static function all(): array self::workbook(), null, ETLDescribableFixtures::inferredColumns(), - (new SchemaInference(filesToSniff: 3, unionByName: true))->everyRow(), + new SchemaInference(filesToSniff: 3, unionByName: true)->everyRow(), ), WorkbookReader::class => self::workbook(...), ]; diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Context/ExcelFixtureContext.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Context/ExcelFixtureContext.php index fe2b62f9b3..6f85a119ed 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Context/ExcelFixtureContext.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Context/ExcelFixtureContext.php @@ -37,7 +37,7 @@ final class ExcelFixtureContext { public static function infer(ExcelSniffer $sniffer, SchemaInference $inference = new SchemaInference()): Schema { - return (new SchemaInferrer($inference))->infer($sniffer, new VoidProgress())->schema; + return new SchemaInferrer($inference)->infer($sniffer, new VoidProgress())->schema; } /** @@ -65,7 +65,7 @@ public static function globSources(string $glob, Filesystem $filesystem = new Na { $sources = []; - foreach ((new FileListing($filesystem))->list(path(self::file($glob)), new OnlyFiles()) as $status) { + foreach (new FileListing($filesystem)->list(path(self::file($glob)), new OnlyFiles()) as $status) { $sources[] = new SourceFile($status->path, $status->size); } @@ -128,7 +128,7 @@ public static function sniffer( public static function openSheetCells(string $fixture, bool $withHeader): OpenSheetCells { - $reader = (new ExcelFormatDetector(new NativeLocalFilesystem()))->detect(self::path($fixture)) + $reader = new ExcelFormatDetector(new NativeLocalFilesystem())->detect(self::path($fixture)) === ExcelReader::ODS ? new OdsReader() : new XlsxReader(); @@ -137,7 +137,7 @@ public static function openSheetCells(string $fixture, bool $withHeader): OpenSh return new OpenSheetCells( $reader, - new SheetCells((new SheetsManager($reader->getSheetIterator()))->first(), $withHeader), + new SheetCells(new SheetsManager($reader->getSheetIterator())->first(), $withHeader), ); } diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Fixtures/generate.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Fixtures/generate.php index 7a01864f9c..667a3e5c5f 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Fixtures/generate.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Fixtures/generate.php @@ -55,8 +55,8 @@ function write_ods(string $file, array $rows): void write(new OdsWriter(), $file, $rows); } -$dateStyle = (new Style())->withFormat('yyyy-mm-dd'); -$dateTimeStyle = (new Style())->withFormat('yyyy-mm-dd hh:mm:ss'); +$dateStyle = new Style()->withFormat('yyyy-mm-dd'); +$dateTimeStyle = new Style()->withFormat('yyyy-mm-dd hh:mm:ss'); write_xlsx($dir . '/header_only.xlsx', [['id', 'name']]); write_ods($dir . '/header_only.ods', [['id', 'name']]); diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/ExcelExtractorTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/ExcelExtractorTest.php index a0003af3e4..afbbfdef8f 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/ExcelExtractorTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/ExcelExtractorTest.php @@ -1106,7 +1106,7 @@ public function test_extract_split_stops_on_the_stop_signal(): void $generator = FlowTestCase::extracted( $extractor, flow_context()->backend(), - (new Criteria())->withSplit($extractor->splits(new Criteria(), 1)[0]), + new Criteria()->withSplit($extractor->splits(new Criteria(), 1)[0]), ); $totalRows = 0; @@ -1173,7 +1173,7 @@ public function test_a_pushed_path_filter_prunes_the_files_splits_are_cut_from() static::assertEquals( [new FileSplit($extractor->source(), 0, null)], - $extractor->splits((new Criteria())->withPathFilter(new RejectingFilter()), 1), + $extractor->splits(new Criteria()->withPathFilter(new RejectingFilter()), 1), ); } diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/ExcelFormatDetectorTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/ExcelFormatDetectorTest.php index da8b035b62..7006f64c26 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/ExcelFormatDetectorTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/ExcelFormatDetectorTest.php @@ -20,14 +20,14 @@ public function test_a_zip_signed_file_that_cannot_be_opened_is_an_unsupported_f $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Unsupported file format: n/a'); - (new ExcelFormatDetector(native_local_filesystem()))->detect(ExcelFixtureContext::path('corrupt_zip')); + new ExcelFormatDetector(native_local_filesystem())->detect(ExcelFixtureContext::path('corrupt_zip')); } public function test_closes_the_stream_it_sniffed(): void { $filesystem = new CountingFilesystem(native_local_filesystem()); - (new ExcelFormatDetector($filesystem))->detect(ExcelFixtureContext::path('sniff/a')); + new ExcelFormatDetector($filesystem)->detect(ExcelFixtureContext::path('sniff/a')); static::assertSame(1, $filesystem->readFromCalls); static::assertSame(1, $filesystem->closedStreams()); @@ -37,7 +37,7 @@ public function test_detects_ods_from_the_zip_mimetype(): void { static::assertSame( ExcelReader::ODS, - (new ExcelFormatDetector(native_local_filesystem()))->detect(ExcelFixtureContext::path('fixture_as_ods')), + new ExcelFormatDetector(native_local_filesystem())->detect(ExcelFixtureContext::path('fixture_as_ods')), ); } @@ -45,7 +45,7 @@ public function test_detects_the_legacy_xls_signature_as_xlsx(): void { static::assertSame( ExcelReader::XLSX, - (new ExcelFormatDetector(native_local_filesystem()))->detect(ExcelFixtureContext::path('xls_signature')), + new ExcelFormatDetector(native_local_filesystem())->detect(ExcelFixtureContext::path('xls_signature')), ); } @@ -53,7 +53,7 @@ public function test_detects_xlsx_from_the_zip_signature(): void { static::assertSame( ExcelReader::XLSX, - (new ExcelFormatDetector(native_local_filesystem()))->detect(ExcelFixtureContext::path('fixture_as_xlsx')), + new ExcelFormatDetector(native_local_filesystem())->detect(ExcelFixtureContext::path('fixture_as_xlsx')), ); } @@ -62,6 +62,6 @@ public function test_refuses_an_unknown_format(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Unsupported file format: n/a'); - (new ExcelFormatDetector(native_local_filesystem()))->detect(ExcelFixtureContext::path('empty_file')); + new ExcelFormatDetector(native_local_filesystem())->detect(ExcelFixtureContext::path('empty_file')); } } diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/Sheet/OpenSheetTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/Sheet/OpenSheetTest.php index 980cca0668..43750558ac 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/Sheet/OpenSheetTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/Sheet/OpenSheetTest.php @@ -22,7 +22,7 @@ public function test_it_carries_the_cells_and_the_decoder_of_one_handle(): void $open = new OpenSheet( $reader, - (new SheetCells((new SheetsManager($reader->getSheetIterator()))->first(), true))->rows(), + new SheetCells(new SheetsManager($reader->getSheetIterator())->first(), true)->rows(), $decoder = new RecordDecoder(withHeader: true, emptyToNull: true), ); @@ -37,11 +37,11 @@ public function test_closing_it_closes_the_reader_it_was_given(): void $reader = new XlsxReader(); $reader->open(ExcelFixtureContext::path('fixture.xlsx')->path()); - (new OpenSheet( + new OpenSheet( $reader, - (new SheetCells((new SheetsManager($reader->getSheetIterator()))->first(), true))->rows(), + new SheetCells(new SheetsManager($reader->getSheetIterator())->first(), true)->rows(), new RecordDecoder(withHeader: true, emptyToNull: true), - ))->close(); + )->close(); $this->expectException(ReaderNotOpenedException::class); $this->expectExceptionMessage('Reader should be opened first.'); diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/Sheet/XlsxSheetRowsTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/Sheet/XlsxSheetRowsTest.php index 0f82cb7b36..ca723da007 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/Sheet/XlsxSheetRowsTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/Sheet/XlsxSheetRowsTest.php @@ -105,7 +105,7 @@ public function test_a_crafted_sheet_reads_as_openspout_reads_it(string $sheetXm foreach ($reader->getSheetIterator() as $sheet) { static::assertSame( serialize(OpenSpoutRows::of($sheet)), - serialize(iterator_to_array((new XlsxSheetRows($sheet))->values(), false)), + serialize(iterator_to_array(new XlsxSheetRows($sheet)->values(), false)), ); break; @@ -126,7 +126,7 @@ public function test_a_dimension_wins_over_the_spans_of_a_row(): void try { foreach ($reader->getSheetIterator() as $sheet) { - static::assertSame([['', 1]], iterator_to_array((new XlsxSheetRows($sheet))->values(), false)); + static::assertSame([['', 1]], iterator_to_array(new XlsxSheetRows($sheet)->values(), false)); break; } @@ -153,7 +153,7 @@ public function test_a_malformed_sheet_is_refused_with_the_libxml_error(): void $this->expectException(XMLProcessingException::class); $this->expectExceptionMessage('Opening and ending tag mismatch: c line 1 and row'); - iterator_to_array((new XlsxSheetRows($sheet))->values(), false); + iterator_to_array(new XlsxSheetRows($sheet)->values(), false); } } finally { $reader->close(); @@ -180,7 +180,7 @@ public function test_a_sheet_openspout_refuses_is_refused_with_its_exception(str $this->expectException($expected); - iterator_to_array((new XlsxSheetRows($sheet))->values(), false); + iterator_to_array(new XlsxSheetRows($sheet)->values(), false); } } finally { $reader->close(); @@ -199,7 +199,7 @@ public function test_spans_without_a_colon_pad_nothing(): void try { foreach ($reader->getSheetIterator() as $sheet) { - static::assertSame([['', 1]], iterator_to_array((new XlsxSheetRows($sheet))->values(), false)); + static::assertSame([['', 1]], iterator_to_array(new XlsxSheetRows($sheet)->values(), false)); break; } @@ -218,7 +218,7 @@ public function test_every_sheet_reads_as_openspout_reads_it(string $file): void foreach ($reader->getSheetIterator() as $sheet) { static::assertSame( serialize(OpenSpoutRows::of($sheet)), - serialize(iterator_to_array((new XlsxSheetRows($sheet))->values(), false)), + serialize(iterator_to_array(new XlsxSheetRows($sheet)->values(), false)), ); } } finally { diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/WorkbookReaderTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/WorkbookReaderTest.php index d0f65b92db..2c3131300a 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/WorkbookReaderTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Extractor/WorkbookReaderTest.php @@ -42,14 +42,14 @@ public function test_sheet_is_a_new_object_every_time(): void public function test_a_workbook_reader_over_the_local_filesystem_describes_and_rebuilds_equal(): void { $reader = new WorkbookReader( - (new ExcelReadOptions())->withHeader(false), + new ExcelReadOptions()->withHeader(false), new ExcelFormatDetector(new NativeLocalFilesystem()), ); $description = $reader->describe(); static::assertNotNull($description); static::assertFalse(type_array()->assert($description->data['options'])['with_header']); - static::assertEquals($reader, (new Rebuild())->object( + static::assertEquals($reader, new Rebuild()->object( Description::fromArray($description->normalize()), WorkbookReader::class, )); @@ -58,7 +58,7 @@ public function test_a_workbook_reader_over_the_local_filesystem_describes_and_r public function test_a_workbook_reader_over_a_memory_filesystem_does_not_describe(): void { static::assertNull( - (new WorkbookReader(new ExcelReadOptions(), new ExcelFormatDetector(memory_filesystem())))->describe(), + new WorkbookReader(new ExcelReadOptions(), new ExcelFormatDetector(memory_filesystem()))->describe(), ); } @@ -66,7 +66,7 @@ public function test_a_workbook_reader_declares_the_extensions_a_workbook_is_rea { static::assertSame( ['dom', 'filter', 'xmlreader', 'zip'], - (new WorkbookReader(new ExcelReadOptions(), new ExcelFormatDetector(new NativeLocalFilesystem()))) + new WorkbookReader(new ExcelReadOptions(), new ExcelFormatDetector(new NativeLocalFilesystem())) ->describe() ?->extensions(), ); diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/FileFormatContractTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/FileFormatContractTest.php index 1417066b09..6b0d0fe308 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/FileFormatContractTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/FileFormatContractTest.php @@ -38,103 +38,103 @@ public static function formats(): Generator #[DataProvider('formats')] public function test_overwrite_replaces_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->overwriteReplacesWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->overwriteReplacesWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_append_keeps_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->appendKeepsWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->appendKeepsWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_ignore_leaves_an_existing_destination_untouched(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->ignoreLeavesAnExistingDestinationUntouched($format); + new FileFormatContract($this->cacheDir)->ignoreLeavesAnExistingDestinationUntouched($format); } #[DataProvider('formats')] public function test_exception_if_exists_refuses_an_existing_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->exceptionIfExistsRefusesAnExistingDestination($format); + new FileFormatContract($this->cacheDir)->exceptionIfExistsRefusesAnExistingDestination($format); } #[DataProvider('formats')] public function test_a_batch_of_zero_rows_creates_no_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aBatchOfZeroRowsCreatesNoFile($format); + new FileFormatContract($this->cacheDir)->aBatchOfZeroRowsCreatesNoFile($format); } #[DataProvider('formats')] public function test_a_write_that_ends_reports_its_file_operations(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aWriteThatEndsReportsItsFileOperations($format); + new FileFormatContract($this->cacheDir)->aWriteThatEndsReportsItsFileOperations($format); } #[DataProvider('formats')] public function test_a_partitioned_write_reads_back_every_partition(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPartitionedWriteReadsBackEveryPartition($format); + new FileFormatContract($this->cacheDir)->aPartitionedWriteReadsBackEveryPartition($format); } #[DataProvider('formats')] public function test_a_loader_in_a_task_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderInATaskSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->aLoaderInATaskSurvivesDescribe($format); } #[DataProvider('formats')] public function test_an_extractor_reader_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorReaderSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->anExtractorReaderSurvivesDescribe($format); } #[DataProvider('formats')] public function test_the_splits_read_every_row_once(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theSplitsReadEveryRowOnce($format); + new FileFormatContract($this->cacheDir)->theSplitsReadEveryRowOnce($format); } #[DataProvider('formats')] public function test_metadata_columns_name_the_source_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->metadataColumnsNameTheSourceFile($format); + new FileFormatContract($this->cacheDir)->metadataColumnsNameTheSourceFile($format); } #[DataProvider('formats')] public function test_the_batch_size_bounds_every_batch(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theBatchSizeBoundsEveryBatch($format); + new FileFormatContract($this->cacheDir)->theBatchSizeBoundsEveryBatch($format); } #[DataProvider('formats')] public function test_refresh_lists_the_files_written_after_a_read(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->refreshListsTheFilesWrittenAfterARead($format); + new FileFormatContract($this->cacheDir)->refreshListsTheFilesWrittenAfterARead($format); } #[DataProvider('formats')] public function test_a_failed_run_leaves_no_file_at_the_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aFailedRunLeavesNoFileAtTheDestination($format); + new FileFormatContract($this->cacheDir)->aFailedRunLeavesNoFileAtTheDestination($format); } #[DataProvider('formats')] public function test_an_extractor_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_a_loader_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_a_pushed_filter_returns_what_the_filter_node_returns(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPushedFilterReturnsWhatTheFilterNodeReturns( + new FileFormatContract($this->cacheDir)->aPushedFilterReturnsWhatTheFilterNodeReturns( $format, ref('id')->notEquals(lit('b')), ); diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Inference/ExcelSnifferTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Inference/ExcelSnifferTest.php index 27c6f0bcef..9d50c3ffe9 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Inference/ExcelSnifferTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Integration/IO/Inference/ExcelSnifferTest.php @@ -346,7 +346,7 @@ public function test_a_file_no_sniff_reached_declares_unknown_rows(): void static::assertEquals( Cardinality::unknown(), - (new SampledUnits([$sniffer->sniff(0, 20_480, new VoidProgress())]))->exactRows($sniffer->units()), + new SampledUnits([$sniffer->sniff(0, 20_480, new VoidProgress())])->exactRows($sniffer->units()), ); } @@ -356,10 +356,10 @@ public function test_sniffs_that_read_every_sheet_declare_exact_rows(): void static::assertEquals( Cardinality::exact(20), - (new SampledUnits([ + new SampledUnits([ $sniffer->sniff(0, 20_480, new VoidProgress()), $sniffer->sniff(1, 20_480, new VoidProgress()), - ]))->exactRows($sniffer->units()), + ])->exactRows($sniffer->units()), ); } @@ -414,7 +414,7 @@ public function test_bytes_are_the_listed_size(): void public function test_unbounded_inference_is_independent_of_execution_order(): void { - $inference = (new SchemaInference(unionByName: true))->everyRow()->everySource(); + $inference = new SchemaInference(unionByName: true)->everyRow()->everySource(); static::assertEquals( ExcelFixtureContext::infer(ExcelFixtureContext::globSniffer('sniff/*'), $inference), diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/DescribableRoundTripTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/DescribableRoundTripTest.php index 0781acaf1a..f500c70dfd 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/DescribableRoundTripTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/DescribableRoundTripTest.php @@ -6,7 +6,6 @@ use Flow\ETL\Adapter\Excel\Tests\Context\DescribableFixtures; use Flow\ETL\Foundation\Describe\Describable; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Foundation\Exception\RuntimeException; use Flow\ETL\Tests\Context\DescribeRoundTrip; use Flow\ETL\Tests\Context\ExtractorClasses; @@ -58,11 +57,7 @@ public function test_a_rebuilt_describable_equals_the_described_one(string $clas $this->expectException(RuntimeException::class); } - try { - $describable = DescribableFixtures::all()[$class](); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $describable = DescribableFixtures::all()[$class](); if (in_array($class, DescribableFixtures::undescribable(), true)) { static::assertNull($describable->describe()); diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/Functions/IsValidExcelSheetNameTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/Functions/IsValidExcelSheetNameTest.php index 3f43299e42..4edfa66c0d 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/Functions/IsValidExcelSheetNameTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/Functions/IsValidExcelSheetNameTest.php @@ -23,7 +23,7 @@ final class IsValidExcelSheetNameTest extends FlowTestCase #[TestWith(['Sheet?Name'])] public function test_invalid_excel_sheet_name(string $invalidNames): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( is_valid_excel_sheet_name($invalidNames), [], schema(), @@ -34,7 +34,7 @@ public function test_invalid_excel_sheet_name(string $invalidNames): void #[TestWith(['Excel Sheet'])] public function test_valid_excel_sheet_name(string $sheetName): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( is_valid_excel_sheet_name(ref('sheet_name')), ['sheet_name' => $sheetName], schema(str_schema('sheet_name')), diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/ExcelFileBatchesTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/ExcelFileBatchesTest.php index 8f8e51e234..49cb9d3d78 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/ExcelFileBatchesTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/ExcelFileBatchesTest.php @@ -76,7 +76,7 @@ public function test_close_releases_the_sampled_sheets_the_read_never_took(): vo $sniffer = ExcelFixtureContext::globSniffer('diverging_header/*.xlsx'); ExcelFixtureContext::infer($sniffer); - (new ExcelFileBatches(ExcelFixtureContext::reader(), $sniffer, null))->close(); + new ExcelFileBatches(ExcelFixtureContext::reader(), $sniffer, null)->close(); static::assertSame([], ExcelFixtureContext::leakedSharedStringsFoldersSince($before)); } @@ -89,11 +89,11 @@ public function test_a_sheet_whose_header_diverges_is_refused_and_closed(): void $sniffer->close(); try { - iterator_to_array((new ExcelFileBatches( + iterator_to_array(new ExcelFileBatches( ExcelFixtureContext::reader(), null, new InferredColumns($schema, [], new SchemaInference(), 'a.xlsx'), - ))->batches( + )->batches( FileReadMother::of($schema, null, 2), new Criteria(), ExcelFixtureContext::source('diverging_header/b.xlsx'), diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/ExcelFormatDetectorTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/ExcelFormatDetectorTest.php index 4a1f1923fb..3da3f8436d 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/ExcelFormatDetectorTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/ExcelFormatDetectorTest.php @@ -21,7 +21,7 @@ public function test_detects_by_extension(string $file, ExcelReader $expected): { $filesystem = new CountingFilesystem(native_local_filesystem()); - static::assertSame($expected, (new ExcelFormatDetector($filesystem))->detect(path('/does/not/exist/' . $file))); + static::assertSame($expected, new ExcelFormatDetector($filesystem)->detect(path('/does/not/exist/' . $file))); static::assertSame(0, $filesystem->readFromCalls); } @@ -29,6 +29,6 @@ public function test_the_filesystem_it_detects_through_is_exposed(): void { $filesystem = native_local_filesystem(); - static::assertSame($filesystem, (new ExcelFormatDetector($filesystem))->filesystem()); + static::assertSame($filesystem, new ExcelFormatDetector($filesystem)->filesystem()); } } diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/ExcelReadOptionsTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/ExcelReadOptionsTest.php index f4b50a4f4e..65bad32fc7 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/ExcelReadOptionsTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/ExcelReadOptionsTest.php @@ -35,7 +35,7 @@ public function test_an_invalid_sheet_name_is_refused_by_the_wither_too(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Sheet name must be a valid Excel sheet name'); - (new ExcelReadOptions())->withSheetName('This is veeeeeery long excel sheet name, longer than 32 characters'); + new ExcelReadOptions()->withSheetName('This is veeeeeery long excel sheet name, longer than 32 characters'); } public function test_each_wither_changes_one_knob_and_keeps_the_rest(): void @@ -56,7 +56,7 @@ public function test_withers_compose_without_losing_earlier_knobs(): void { static::assertEquals( new ExcelReadOptions(false, false, 'Sheet2', ExcelReader::XLSX), - (new ExcelReadOptions()) + new ExcelReadOptions() ->withHeader(false) ->withConvertEmptyToNull(false) ->withSheetName('Sheet2') @@ -66,7 +66,7 @@ public function test_withers_compose_without_losing_earlier_knobs(): void public function test_normalize_round_trips_with_and_without_a_format(): void { - $xlsx = (new ExcelReadOptions(withHeader: false, sheetName: 'Data'))->withFormat(ExcelReader::XLSX); + $xlsx = new ExcelReadOptions(withHeader: false, sheetName: 'Data')->withFormat(ExcelReader::XLSX); static::assertSame( [ @@ -79,10 +79,7 @@ public function test_normalize_round_trips_with_and_without_a_format(): void $xlsx->normalize(), ); static::assertEquals($xlsx, ExcelReadOptions::fromArray($xlsx->normalize())); - static::assertNull((new ExcelReadOptions())->normalize()['format']); - static::assertEquals( - new ExcelReadOptions(), - ExcelReadOptions::fromArray((new ExcelReadOptions())->normalize()), - ); + static::assertNull(new ExcelReadOptions()->normalize()['format']); + static::assertEquals(new ExcelReadOptions(), ExcelReadOptions::fromArray(new ExcelReadOptions()->normalize())); } } diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php index fe5ccb4f1e..797dff6368 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php @@ -31,7 +31,7 @@ public static function extractors(): Generator #[DataProvider('extractors')] public function test_an_extractor_carries_the_metadata_setter_only_when_it_declares_metadata(string $class): void { - if ((new ReflectionClass($class))->implementsInterface(MetadataColumnsExtractor::class)) { + if (new ReflectionClass($class)->implementsInterface(MetadataColumnsExtractor::class)) { MetadataColumnsContract::declares($class); return; diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/Sheet/SheetCellsTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/Sheet/SheetCellsTest.php index e37984b22c..b7a913c6b7 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/Sheet/SheetCellsTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Extractor/Sheet/SheetCellsTest.php @@ -14,17 +14,14 @@ final class SheetCellsTest extends FlowTestCase { public function test_a_sheet_with_no_rows_yields_nothing(): void { - static::assertSame([], iterator_to_array((new SheetCells(new FakeSheet([]), true))->rows(), false)); + static::assertSame([], iterator_to_array(new SheetCells(new FakeSheet([]), true)->rows(), false)); } public function test_widens_a_short_row_to_the_previous_width(): void { static::assertSame( [['a', 'b', 'c'], [1, 2, 3], [4, 5, null]], - iterator_to_array( - (new SheetCells(new FakeSheet([['a', 'b', 'c'], [1, 2, 3], [4, 5]]), true))->rows(), - false, - ), + iterator_to_array(new SheetCells(new FakeSheet([['a', 'b', 'c'], [1, 2, 3], [4, 5]]), true)->rows(), false), ); } @@ -32,7 +29,7 @@ public function test_a_row_wider_than_the_previous_one_is_not_truncated(): void { static::assertSame( [['a', 'b'], [1, 2], [3, 4, 5]], - iterator_to_array((new SheetCells(new FakeSheet([['a', 'b'], [1, 2], [3, 4, 5]]), true))->rows(), false), + iterator_to_array(new SheetCells(new FakeSheet([['a', 'b'], [1, 2], [3, 4, 5]]), true)->rows(), false), ); } } diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Inference/CellTypeNarrowerTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Inference/CellTypeNarrowerTest.php index 084e555394..2e8af0f038 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Inference/CellTypeNarrowerTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Inference/CellTypeNarrowerTest.php @@ -23,7 +23,7 @@ public function test_text_narrows_to_types_a_cell_cannot_hold(string $value, str { static::assertSame( $expected, - (new CellTypeNarrower(InferredTypes::default())) + new CellTypeNarrower(InferredTypes::default()) ->narrow($value) ->toString(), ); @@ -37,7 +37,7 @@ public function test_text_stays_text_where_a_cell_type_exists(string $value): vo { static::assertSame( 'string', - (new CellTypeNarrower(InferredTypes::default())) + new CellTypeNarrower(InferredTypes::default()) ->narrow($value) ->toString(), ); diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Inference/WorkbookSheetSampleTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Inference/WorkbookSheetSampleTest.php index f8d1e7dd9e..4e11cf093e 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Inference/WorkbookSheetSampleTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Inference/WorkbookSheetSampleTest.php @@ -42,7 +42,7 @@ public function test_a_sample_never_iterated_is_not_whole(): void { $sheet = ExcelFixtureContext::sheet('fixture.xlsx'); - static::assertFalse((new WorkbookSheetSample($sheet, $sheet->sample()))->wholeSheet()); + static::assertFalse(new WorkbookSheetSample($sheet, $sheet->sample())->wholeSheet()); $sheet->close(); } diff --git a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Loader/ExcelEncoderTest.php b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Loader/ExcelEncoderTest.php index baecb01671..cfdba91516 100644 --- a/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Loader/ExcelEncoderTest.php +++ b/src/adapter/etl-adapter-excel/tests/Flow/ETL/Adapter/Excel/Tests/Unit/IO/Loader/ExcelEncoderTest.php @@ -14,7 +14,6 @@ use Flow\ETL\Tests\Fixtures\Enum\BasicEnum; use Flow\ETL\Tests\FlowTestCase; use Flow\Types\Value\Uuid; -use PHPUnit\Framework\Attributes\RequiresPhp; use function Flow\ETL\DSL\array_to_rows; use function Flow\ETL\DSL\bool_schema; @@ -50,7 +49,7 @@ public function test_encodes_scalars_as_a_flat_cell_list_in_value_order(): void { static::assertSame( [[1, 'Norbert', 1.5, true]], - (new ExcelEncoder())->encode(array_to_rows( + new ExcelEncoder()->encode(array_to_rows( [['id' => 1, 'name' => 'Norbert', 'p' => 1.5, 'a' => true]], schema(int_schema('id'), str_schema('name'), float_schema('p'), bool_schema('a')), )), @@ -64,7 +63,7 @@ public function test_encodes_dates_and_datetimes_as_cell_values_and_intervals_wi static::assertEquals( [[$date, $dateTime, '01:30']], - (new ExcelEncoder(timeFormat: '%H:%I'))->encode(array_to_rows( + new ExcelEncoder(timeFormat: '%H:%I')->encode(array_to_rows( [['d' => $date, 'dt' => $dateTime, 't' => new DateInterval('PT1H30M')]], schema(date_schema('d'), datetime_schema('dt'), time_schema('t')), )), @@ -75,7 +74,7 @@ public function test_encodes_time_with_the_default_time_format(): void { static::assertSame( [['14:30:45']], - (new ExcelEncoder())->encode(array_to_rows([[ + new ExcelEncoder()->encode(array_to_rows([[ 't' => new DateInterval('PT14H30M45S'), ]], schema(time_schema('t')))), ); @@ -85,7 +84,7 @@ public function test_encodes_backed_enum_as_its_backing_value(): void { static::assertSame( [['1']], - (new ExcelEncoder())->encode(array_to_rows([[ + new ExcelEncoder()->encode(array_to_rows([[ 'e' => BackedIntEnum::one, ]], schema(enum_schema('e', BackedIntEnum::class)))), ); @@ -95,7 +94,7 @@ public function test_encodes_a_pure_enum_as_its_case_name(): void { static::assertSame( [['three']], - (new ExcelEncoder())->encode(array_to_rows([[ + new ExcelEncoder()->encode(array_to_rows([[ 'e' => BasicEnum::three, ]], schema(enum_schema('e', BasicEnum::class)))), ); @@ -108,7 +107,7 @@ public function test_encodes_an_xml_document_as_its_serialized_root(): void static::assertSame( [['1']], - (new ExcelEncoder())->encode(array_to_rows([['x' => $document]], schema(xml_schema('x')))), + new ExcelEncoder()->encode(array_to_rows([['x' => $document]], schema(xml_schema('x')))), ); } @@ -116,7 +115,7 @@ public function test_encodes_containers_as_json(): void { static::assertSame( [['["a","b"]', '{"x":1}', '{"city":"Krakow"}']], - (new ExcelEncoder())->encode(array_to_rows( + new ExcelEncoder()->encode(array_to_rows( [['tags' => ['a', 'b'], 'm' => ['x' => 1], 'addr' => ['city' => 'Krakow']]], schema( list_schema('tags', type_list(type_string())), @@ -131,7 +130,7 @@ public function test_encodes_a_timezone_as_its_iana_name(): void { static::assertSame( [['Europe/Warsaw']], - (new ExcelEncoder())->encode(array_to_rows([[ + new ExcelEncoder()->encode(array_to_rows([[ 'tz' => new DateTimeZone('Europe/Warsaw'), ]], schema(time_zone_schema('tz')))), ); @@ -141,7 +140,7 @@ public function test_encodes_uuid_as_string(): void { static::assertSame( [['f47ac10b-58cc-4372-a567-0e02b2c3d479']], - (new ExcelEncoder())->encode(array_to_rows([[ + new ExcelEncoder()->encode(array_to_rows([[ 'id' => new Uuid('f47ac10b-58cc-4372-a567-0e02b2c3d479'), ]], schema(uuid_schema('id')))), ); @@ -151,7 +150,7 @@ public function test_encodes_null_values_as_null_cells(): void { static::assertSame( [[null, null]], - (new ExcelEncoder())->encode(array_to_rows( + new ExcelEncoder()->encode(array_to_rows( [['id' => null, 'd' => null]], schema(int_schema('id', nullable: true), date_schema('d', nullable: true)), )), @@ -165,20 +164,18 @@ public function test_encodes_an_xml_element_as_its_markup(): void static::assertSame( [['x']], - (new ExcelEncoder())->encode(array_to_rows([[ + new ExcelEncoder()->encode(array_to_rows([[ 'e' => $document->getElementsByTagName('a')->item(0), ]], schema(xml_element_schema('e')))), ); } - #[RequiresPhp('>= 8.4.0')] public function test_encodes_html_and_html_elements_as_their_markup(): void { - // @mago-ignore analysis:unavailable-method $document = HTMLDocument::createFromString('

hi

', LIBXML_NOERROR); $element = $document->querySelector('p'); - $cells = (new ExcelEncoder())->encode(array_to_rows( + $cells = new ExcelEncoder()->encode(array_to_rows( [['h' => $document, 'e' => $element]], schema(html_schema('h'), html_element_schema('e')), ))[0]; @@ -190,7 +187,7 @@ public function test_encodes_html_and_html_elements_as_their_markup(): void public function test_encodes_a_datetime_column_with_nulls_as_datetimes_and_null_cells(): void { - $cells = (new ExcelEncoder())->encode(array_to_rows([ + $cells = new ExcelEncoder()->encode(array_to_rows([ ['at' => new DateTimeImmutable('2026-01-02 03:04:05 UTC')], ['at' => null], ], schema(datetime_schema('at', nullable: true)))); @@ -204,7 +201,7 @@ public function test_encodes_a_json_column_as_its_text(): void { static::assertSame( [['{"a":1}']], - (new ExcelEncoder())->encode(array_to_rows([['j' => '{"a":1}']], schema(json_schema('j')))), + new ExcelEncoder()->encode(array_to_rows([['j' => '{"a":1}']], schema(json_schema('j')))), ); } @@ -212,7 +209,7 @@ public function test_encodes_nested_datetimes_as_text_and_keeps_float_fractions( { static::assertSame( [['["2026-01-02T03:04:05+00:00"]', '{"a":1.0}']], - (new ExcelEncoder())->encode(array_to_rows( + new ExcelEncoder()->encode(array_to_rows( [['l' => [new DateTimeImmutable('2026-01-02 03:04:05 UTC')], 'm' => ['a' => 1.0]]], schema( list_schema('l', type_list(type_datetime())), diff --git a/src/adapter/etl-adapter-google-sheet/composer.json b/src/adapter/etl-adapter-google-sheet/composer.json index 9b6bca271a..0a1514ad54 100644 --- a/src/adapter/etl-adapter-google-sheet/composer.json +++ b/src/adapter/etl-adapter-google-sheet/composer.json @@ -12,7 +12,7 @@ "adapter" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/etl": "self.version", "google/apiclient": "^2.13" }, diff --git a/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/IO/Extractor/GoogleSheetExtractor.php b/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/IO/Extractor/GoogleSheetExtractor.php index b709723abf..57381f096b 100644 --- a/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/IO/Extractor/GoogleSheetExtractor.php +++ b/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/IO/Extractor/GoogleSheetExtractor.php @@ -119,7 +119,7 @@ public function extract(Backend $backend, Criteria $criteria): Generator ); // only THIS call's sample can serve the read; a memo hit means no rows were fetched here $sampledNow = $this->schema === null && $this->derivedSchema === null; - $base = $this->schema ?? ($this->derivedSchema ??= (new SchemaInferrer($this->inference))->infer( + $base = $this->schema ?? ($this->derivedSchema ??= new SchemaInferrer($this->inference)->infer( $sniffer, $this->inferenceProgress, )->schema); @@ -180,7 +180,7 @@ public function schema(): Schema $this->readOptions->typer($this->inference->candidates()), ); $sampledNow = $this->schema === null && $this->derivedSchema === null; - $base = $this->schema ?? ($this->derivedSchema ??= (new SchemaInferrer($this->inference))->infer( + $base = $this->schema ?? ($this->derivedSchema ??= new SchemaInferrer($this->inference)->infer( $sniffer, $this->inferenceProgress, )->schema); diff --git a/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/functions.php b/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/functions.php index 1f8dfa41b8..2dcd1ea4b5 100644 --- a/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/functions.php +++ b/src/adapter/etl-adapter-google-sheet/src/Flow/ETL/Adapter/GoogleSheet/functions.php @@ -38,7 +38,7 @@ function from_google_sheet( $sheets = new Sheets($client); } - return (new GoogleSheetExtractor($sheets, $spreadsheet_id, new Columns($sheet_name, 'A', 'Z'))) + return new GoogleSheetExtractor($sheets, $spreadsheet_id, new Columns($sheet_name, 'A', 'Z')) ->withHeader($with_header) ->withRowsPerPage($rows_per_page) ->withOptions($options); @@ -74,11 +74,11 @@ function from_google_sheet_columns( $sheets = new Sheets($client); } - return (new GoogleSheetExtractor( + return new GoogleSheetExtractor( $sheets, $spreadsheet_id, new Columns($sheet_name, $start_range_column, $end_range_column), - )) + ) ->withHeader($with_header) ->withRowsPerPage($rows_per_page) ->withOptions($options); diff --git a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Context/GoogleSheetFixtureContext.php b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Context/GoogleSheetFixtureContext.php index 70da4767cc..ed20df78c9 100644 --- a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Context/GoogleSheetFixtureContext.php +++ b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Context/GoogleSheetFixtureContext.php @@ -42,7 +42,7 @@ public static function inferFrom( SchemaInference $inference, GoogleSheetReadOptions $options = new GoogleSheetReadOptions(), ): Schema { - return (new SchemaInferrer($inference))->infer( + return new SchemaInferrer($inference)->infer( new GoogleSheetSniffer($reader, $inference->sampleSize, $options->typer($inference->candidates())), new VoidProgress(), )->schema; @@ -67,7 +67,7 @@ public static function sniffer( return new GoogleSheetSniffer( self::reader(self::service($rowCount, $values), $options), $rowBudget, - $options->typer((new SchemaInference())->candidates()), + $options->typer(new SchemaInference()->candidates()), ); } diff --git a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Integration/IO/Extractor/GoogleSheetExtractorTypedColumnsTest.php b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Integration/IO/Extractor/GoogleSheetExtractorTypedColumnsTest.php index 4d9b62d570..7e49cf13a9 100644 --- a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Integration/IO/Extractor/GoogleSheetExtractorTypedColumnsTest.php +++ b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Integration/IO/Extractor/GoogleSheetExtractorTypedColumnsTest.php @@ -25,7 +25,7 @@ final class GoogleSheetExtractorTypedColumnsTest extends FlowTestCase public function test_appends_spread_sheet_id_and_sheet_name_to_the_schema_when_metadata_columns_are_enabled(): void { $extractor = from_google_sheet( - (new GoogleSheetsContext())->sheets(__DIR__ . '/../../../Fixtures/batch.json'), + new GoogleSheetsContext()->sheets(__DIR__ . '/../../../Fixtures/batch.json'), '1234567890', 'Sheet', ) @@ -55,7 +55,7 @@ public function test_appends_spread_sheet_id_and_sheet_name_to_the_schema_when_m public function test_infers_typed_rows(): void { $extractor = from_google_sheet( - (new GoogleSheetsContext())->sheetsOfGrid( + new GoogleSheetsContext()->sheetsOfGrid( __DIR__ . '/../../../Fixtures/spreadsheet-large-grid.json', __DIR__ . '/../../../Fixtures/sample-typed.json', __DIR__ . '/../../../Fixtures/batch-typed.json', diff --git a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/IO/Extractor/GoogleSheetReadOptionsTest.php b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/IO/Extractor/GoogleSheetReadOptionsTest.php index 4559e34dcd..ab936ba206 100644 --- a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/IO/Extractor/GoogleSheetReadOptionsTest.php +++ b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/IO/Extractor/GoogleSheetReadOptionsTest.php @@ -24,7 +24,7 @@ public function test_defaults(): void public function test_with_header_changes_only_the_header_flag(): void { - $options = (new GoogleSheetReadOptions())->withHeader(false); + $options = new GoogleSheetReadOptions()->withHeader(false); static::assertFalse($options->withHeader); static::assertFalse($options->missingColumnsAsNull); @@ -34,7 +34,7 @@ public function test_with_header_changes_only_the_header_flag(): void public function test_with_missing_columns_as_null_changes_only_that_flag(): void { - $options = (new GoogleSheetReadOptions())->withMissingColumnsAsNull(true); + $options = new GoogleSheetReadOptions()->withMissingColumnsAsNull(true); static::assertTrue($options->withHeader); static::assertTrue($options->missingColumnsAsNull); @@ -44,7 +44,7 @@ public function test_with_missing_columns_as_null_changes_only_that_flag(): void public function test_with_empty_to_null_changes_only_that_flag(): void { - $options = (new GoogleSheetReadOptions())->withEmptyToNull(false); + $options = new GoogleSheetReadOptions()->withEmptyToNull(false); static::assertTrue($options->withHeader); static::assertFalse($options->missingColumnsAsNull); @@ -54,7 +54,7 @@ public function test_with_empty_to_null_changes_only_that_flag(): void public function test_with_options_changes_only_the_options(): void { - $options = (new GoogleSheetReadOptions())->withOptions(['valueRenderOption' => 'UNFORMATTED_VALUE']); + $options = new GoogleSheetReadOptions()->withOptions(['valueRenderOption' => 'UNFORMATTED_VALUE']); static::assertTrue($options->withHeader); static::assertFalse($options->missingColumnsAsNull); @@ -71,7 +71,7 @@ public function test_decoder_is_a_fresh_instance_per_call(): void public function test_decoder_carries_the_empty_to_null_flag(): void { - $decoder = (new GoogleSheetReadOptions()) + $decoder = new GoogleSheetReadOptions() ->withEmptyToNull(false) ->decoder(); $decoder->decode(['a']); @@ -81,7 +81,7 @@ public function test_decoder_carries_the_empty_to_null_flag(): void public function test_decoder_carries_the_missing_columns_as_null_flag(): void { - $decoder = (new GoogleSheetReadOptions()) + $decoder = new GoogleSheetReadOptions() ->withMissingColumnsAsNull(true) ->decoder(); $decoder->decode(['a', 'b']); @@ -93,7 +93,7 @@ public function test_typer_runs_the_string_ladder_under_the_default_render_optio { static::assertInstanceOf( StringTypeNarrower::class, - (new GoogleSheetReadOptions())->typer(InferredTypes::default()), + new GoogleSheetReadOptions()->typer(InferredTypes::default()), ); } @@ -101,7 +101,7 @@ public function test_typer_uses_the_value_type_under_any_other_render_option(): { static::assertInstanceOf( InstanceOfTypeNarrower::class, - (new GoogleSheetReadOptions(options: ['valueRenderOption' => 'UNFORMATTED_VALUE']))->typer( + new GoogleSheetReadOptions(options: ['valueRenderOption' => 'UNFORMATTED_VALUE'])->typer( InferredTypes::default(), ), ); @@ -109,7 +109,7 @@ public function test_typer_uses_the_value_type_under_any_other_render_option(): public function test_decoder_carries_the_header_flag(): void { - $decoder = (new GoogleSheetReadOptions()) + $decoder = new GoogleSheetReadOptions() ->withHeader(false) ->decoder(); $decoder->decode([['1']]); diff --git a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php index 293630f993..65703ba52d 100644 --- a/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php +++ b/src/adapter/etl-adapter-google-sheet/tests/Flow/ETL/Adapter/GoogleSheet/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php @@ -31,7 +31,7 @@ public static function extractors(): Generator #[DataProvider('extractors')] public function test_an_extractor_carries_the_metadata_setter_only_when_it_declares_metadata(string $class): void { - if ((new ReflectionClass($class))->implementsInterface(MetadataColumnsExtractor::class)) { + if (new ReflectionClass($class)->implementsInterface(MetadataColumnsExtractor::class)) { MetadataColumnsContract::declares($class); return; diff --git a/src/adapter/etl-adapter-http/composer.json b/src/adapter/etl-adapter-http/composer.json index 2b4fb50d1b..4c7f848cd5 100644 --- a/src/adapter/etl-adapter-http/composer.json +++ b/src/adapter/etl-adapter-http/composer.json @@ -10,7 +10,7 @@ "http" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "ext-dom": "*", "ext-json": "*", "flow-php/array-dot": "self.version", diff --git a/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/HttpDecoder.php b/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/HttpDecoder.php index 42aa32d096..96cfa3f158 100644 --- a/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/HttpDecoder.php +++ b/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/HttpDecoder.php @@ -132,6 +132,6 @@ private function decodeXml(string $content): array ))); } - return (new XMLConverter())->toArray($document); + return new XMLConverter()->toArray($document); } } diff --git a/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/Pagination/RequestOption.php b/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/Pagination/RequestOption.php index 62a707ae2f..b01c226f53 100644 --- a/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/Pagination/RequestOption.php +++ b/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/Pagination/RequestOption.php @@ -57,7 +57,7 @@ public function apply(RequestInterface $base, mixed $value): RequestInterface InjectInto::QueryParam => $this->applyQueryParam($base, $value), InjectInto::Header => $base->withHeader($this->name, (string) $value), InjectInto::BodyPath => $this->applyBodyPath($base, $value), - InjectInto::ReplaceUri => $this->removeSensitiveHeaders($base, (new RelativeUriResolver())->resolve( + InjectInto::ReplaceUri => $this->removeSensitiveHeaders($base, new RelativeUriResolver()->resolve( $base->getUri(), (string) $value, )), diff --git a/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/PsrHttpClientDynamicExtractor.php b/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/PsrHttpClientDynamicExtractor.php index d6c7a61ce0..5076214585 100644 --- a/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/PsrHttpClientDynamicExtractor.php +++ b/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/PsrHttpClientDynamicExtractor.php @@ -63,7 +63,7 @@ public function extract(Backend $backend, Criteria $criteria): Generator ($this->postRequest)($nextRequest, $response); } - $signal = yield (new RowsBuilder($this->schema(), $backend)) + $signal = yield new RowsBuilder($this->schema(), $backend) ->appendRows($decoder->decode([new HttpExchange($nextRequest, $response)])) ->finish(); diff --git a/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/PsrHttpClientPaginatedExtractor.php b/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/PsrHttpClientPaginatedExtractor.php index 7e62285268..d33cc5febf 100644 --- a/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/PsrHttpClientPaginatedExtractor.php +++ b/src/adapter/etl-adapter-http/src/Flow/ETL/Adapter/Http/IO/Extractor/PsrHttpClientPaginatedExtractor.php @@ -66,7 +66,7 @@ public function extract(Backend $backend, Criteria $criteria): Generator ($this->postRequest)($request, $response); } - $signal = yield (new RowsBuilder($this->schema(), $backend)) + $signal = yield new RowsBuilder($this->schema(), $backend) ->appendRows($decoder->decode([new HttpExchange($request, $response)])) ->finish(); diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Double/NumberedRequestFactory.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Double/NumberedRequestFactory.php index 9b19df8a56..c3bbf7d95b 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Double/NumberedRequestFactory.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Double/NumberedRequestFactory.php @@ -21,7 +21,7 @@ public function __construct( public function create(?ResponseInterface $previousResponse = null): ?RequestInterface { return $this->created < $this->requests - ? (new Psr17Factory())->createRequest('GET', $this->baseUri . ++$this->created) + ? new Psr17Factory()->createRequest('GET', $this->baseUri . ++$this->created) : null; } } diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Integration/IO/Extractor/PsrHttpClientDynamicExtractorTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Integration/IO/Extractor/PsrHttpClientDynamicExtractorTest.php index a58294cbbf..8ca56fde00 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Integration/IO/Extractor/PsrHttpClientDynamicExtractorTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Integration/IO/Extractor/PsrHttpClientDynamicExtractorTest.php @@ -160,7 +160,7 @@ public function test_schema_typed_response_body_via_with_schema(): void public function create(?ResponseInterface $previousResponse = null): ?RequestInterface { return $previousResponse === null - ? (new Psr17Factory())->createRequest('GET', 'https://api.github.com/orgs/flow-php') + ? new Psr17Factory()->createRequest('GET', 'https://api.github.com/orgs/flow-php') : null; } }) diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Mother/PaginationMother.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Mother/PaginationMother.php index 7d11ba889f..f63a96d2b7 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Mother/PaginationMother.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Mother/PaginationMother.php @@ -17,7 +17,7 @@ public static function request( string $method = 'GET', string $uri = 'https://api.example.com/items', ): RequestInterface { - return (new Psr17Factory())->createRequest($method, $uri); + return new Psr17Factory()->createRequest($method, $uri); } /** diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/HttpDecoderTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/HttpDecoderTest.php index 0553bd8830..390bbaee83 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/HttpDecoderTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/HttpDecoderTest.php @@ -79,21 +79,21 @@ public function test_a_row_carries_the_response_body_as_raw_text( ResponseInterface $response, ?string $expected, ): void { - $exchange = new HttpExchange((new Psr17Factory())->createRequest('GET', 'https://api.example.com'), $response); + $exchange = new HttpExchange(new Psr17Factory()->createRequest('GET', 'https://api.example.com'), $response); - static::assertSame($expected, (new HttpDecoder())->decode([$exchange])[0]['response_body']); + static::assertSame($expected, new HttpDecoder()->decode([$exchange])[0]['response_body']); } public function test_decodes_full_row_values(): void { - $request = (new Psr17Factory())->createRequest('GET', 'https://api.github.com/orgs/flow-php'); + $request = new Psr17Factory()->createRequest('GET', 'https://api.github.com/orgs/flow-php'); $response = new Response( status: 201, headers: ['Server' => 'GitHub.com', 'Content-Type' => 'application/json'], body: json_encode(['id' => 1], JSON_THROW_ON_ERROR), ); - $values = (new HttpDecoder())->decode([new HttpExchange($request, $response)])[0]; + $values = new HttpDecoder()->decode([new HttpExchange($request, $response)])[0]; static::assertSame('{"id":1}', $values['response_body']); static::assertSame( @@ -114,15 +114,15 @@ public function test_decodes_full_row_values(): void #[DataProvider('structured_bodies')] public function test_pagination_reads_a_structured_body(ResponseInterface $response, array $expected): void { - static::assertSame($expected, (new HttpDecoder())->structuredBody($response)); + static::assertSame($expected, new HttpDecoder()->structuredBody($response)); } public function test_a_row_carries_an_undecodable_body_as_text(): void { static::assertSame( 'not json {', - (new HttpDecoder())->decode([new HttpExchange( - (new Psr17Factory())->createRequest('GET', 'https://api.example.com'), + new HttpDecoder()->decode([new HttpExchange( + new Psr17Factory()->createRequest('GET', 'https://api.example.com'), new Response(503, ['Content-Type' => 'application/json'], 'not json {'), )])[0]['response_body'], ); @@ -133,6 +133,6 @@ public function test_invalid_json_body_throws_runtime_exception(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('status 503'); - (new HttpDecoder())->structuredBody(new Response(503, ['Content-Type' => 'application/json'], 'not json {')); + new HttpDecoder()->structuredBody(new Response(503, ['Content-Type' => 'application/json'], 'not json {')); } } diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php index e2db9a8852..2107bfa8ec 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php @@ -31,7 +31,7 @@ public static function extractors(): Generator #[DataProvider('extractors')] public function test_an_extractor_carries_the_metadata_setter_only_when_it_declares_metadata(string $class): void { - if ((new ReflectionClass($class))->implementsInterface(MetadataColumnsExtractor::class)) { + if (new ReflectionClass($class)->implementsInterface(MetadataColumnsExtractor::class)) { MetadataColumnsContract::declares($class); return; diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/LinkHeaderParserTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/LinkHeaderParserTest.php index 8d6ed4725b..283b18479e 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/LinkHeaderParserTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/LinkHeaderParserTest.php @@ -11,12 +11,12 @@ final class LinkHeaderParserTest extends FlowTestCase { public function test_malformed_header_yields_no_match(): void { - static::assertNull((new LinkHeaderParser())->next(['this is not a link header'], 'next')); + static::assertNull(new LinkHeaderParser()->next(['this is not a link header'], 'next')); } public function test_missing_rel_returns_null(): void { - static::assertNull((new LinkHeaderParser())->next( + static::assertNull(new LinkHeaderParser()->next( ['; rel="prev"'], 'next', )); @@ -24,7 +24,7 @@ public function test_missing_rel_returns_null(): void public function test_multiple_headers(): void { - static::assertSame('https://api.example.com/items?page=2', (new LinkHeaderParser())->next( + static::assertSame('https://api.example.com/items?page=2', new LinkHeaderParser()->next( [ '; rel="last"', '; rel="next"', @@ -35,14 +35,14 @@ public function test_multiple_headers(): void public function test_multiple_links_in_one_header(): void { - static::assertSame('https://api.example.com/items?page=3', (new LinkHeaderParser())->next([ + static::assertSame('https://api.example.com/items?page=3', new LinkHeaderParser()->next([ '; rel="prev", ; rel="next", ; rel="last"', ], 'next')); } public function test_space_separated_rel_types(): void { - static::assertSame('https://api.example.com/items?page=2', (new LinkHeaderParser())->next( + static::assertSame('https://api.example.com/items?page=2', new LinkHeaderParser()->next( ['; rel="next page"'], 'next', )); @@ -50,7 +50,7 @@ public function test_space_separated_rel_types(): void public function test_unquoted_rel(): void { - static::assertSame('https://api.example.com/items?page=2', (new LinkHeaderParser())->next( + static::assertSame('https://api.example.com/items?page=2', new LinkHeaderParser()->next( ['; rel=next'], 'next', )); diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/PageStateTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/PageStateTest.php index e08c35f103..52513a9690 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/PageStateTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/PageStateTest.php @@ -11,7 +11,7 @@ final class PageStateTest extends FlowTestCase { public function test_advance_increments_pages_and_accumulates_results(): void { - $state = (new PageState()) + $state = new PageState() ->advance(25) ->advance(25); diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/PaginatorTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/PaginatorTest.php index 05835031c7..94c6be18d6 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/PaginatorTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/PaginatorTest.php @@ -21,7 +21,7 @@ public function test_continues_on_client_error_when_disabled(): void $paginator = new Paginator(new FixedStrategy($next), new NeverStop(), stopOnClientError: false); $paginator->initialRequest($base); - $next = $paginator->nextRequest($base, new DecodedResponse([], (new Psr17Factory())->createResponse(500))); + $next = $paginator->nextRequest($base, new DecodedResponse([], new Psr17Factory()->createResponse(500))); static::assertNotNull($next); static::assertSame('https://api.example.com/items?page=2', (string) $next->getUri()); @@ -47,7 +47,7 @@ public function test_stops_on_client_error_by_default(): void static::assertNull($paginator->nextRequest( $base, - new DecodedResponse([], (new Psr17Factory())->createResponse(500)), + new DecodedResponse([], new Psr17Factory()->createResponse(500)), )); } } diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/RelativeUriResolverTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/RelativeUriResolverTest.php index 047b5a4244..7ed670dde5 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/RelativeUriResolverTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/RelativeUriResolverTest.php @@ -40,6 +40,6 @@ public static function references(): array #[DataProvider('references')] public function test_resolution(string $base, string $reference, string $expected): void { - static::assertSame($expected, (string) (new RelativeUriResolver())->resolve(new Uri($base), $reference)); + static::assertSame($expected, (string) new RelativeUriResolver()->resolve(new Uri($base), $reference)); } } diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/RequestComparatorTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/RequestComparatorTest.php index 9aa119d317..f8b3c0bb68 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/RequestComparatorTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/RequestComparatorTest.php @@ -20,14 +20,14 @@ public function test_differs_when_body_differs(): void ->createRequest('POST', 'https://api.example.com/search') ->withBody($factory->createStream('{"cursor":"b"}')); - static::assertFalse((new RequestComparator())->equals($left, $right)); + static::assertFalse(new RequestComparator()->equals($left, $right)); } public function test_differs_when_uri_differs(): void { $factory = new Psr17Factory(); - static::assertFalse((new RequestComparator())->equals( + static::assertFalse(new RequestComparator()->equals( $factory->createRequest('GET', 'https://api.example.com/items?page=1'), $factory->createRequest('GET', 'https://api.example.com/items?page=2'), )); @@ -37,7 +37,7 @@ public function test_equal_when_method_uri_and_body_match(): void { $factory = new Psr17Factory(); - static::assertTrue((new RequestComparator())->equals( + static::assertTrue(new RequestComparator()->equals( $factory->createRequest('GET', 'https://api.example.com/items?page=1'), $factory->createRequest('GET', 'https://api.example.com/items?page=1'), )); diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/RequestOptionTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/RequestOptionTest.php index 5ed60792d8..6992dde893 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/RequestOptionTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/RequestOptionTest.php @@ -32,7 +32,7 @@ public function test_body_path_sets_cursor_on_json_post_body(): void public function test_header_replaces_value(): void { - $request = (new Psr17Factory()) + $request = new Psr17Factory() ->createRequest('GET', 'https://api.example.com/items') ->withHeader('X-Cursor', 'old'); @@ -41,7 +41,7 @@ public function test_header_replaces_value(): void public function test_query_param_merges_and_keeps_other_params(): void { - $request = (new Psr17Factory())->createRequest('GET', 'https://api.example.com/items?per_page=50'); + $request = new Psr17Factory()->createRequest('GET', 'https://api.example.com/items?per_page=50'); $query = []; parse_str(RequestOption::queryParam('page')->apply($request, 2)->getUri()->getQuery(), $query); @@ -51,7 +51,7 @@ public function test_query_param_merges_and_keeps_other_params(): void public function test_query_param_overrides_same_name(): void { - $request = (new Psr17Factory())->createRequest('GET', 'https://api.example.com/items?page=1&per_page=50'); + $request = new Psr17Factory()->createRequest('GET', 'https://api.example.com/items?page=1&per_page=50'); $query = []; parse_str(RequestOption::queryParam('page')->apply($request, 7)->getUri()->getQuery(), $query); @@ -61,7 +61,7 @@ public function test_query_param_overrides_same_name(): void public function test_replace_uri_keeps_sensitive_headers_on_same_host(): void { - $request = (new Psr17Factory()) + $request = new Psr17Factory() ->createRequest('GET', 'https://api.example.com/items?page=1') ->withHeader('Authorization', 'Bearer secret') ->withHeader('Cookie', 'session=abc'); @@ -74,7 +74,7 @@ public function test_replace_uri_keeps_sensitive_headers_on_same_host(): void public function test_replace_uri_removes_sensitive_headers_on_cross_host(): void { - $request = (new Psr17Factory()) + $request = new Psr17Factory() ->createRequest('GET', 'https://api.example.com/items?page=1') ->withHeader('Authorization', 'Bearer secret') ->withHeader('Proxy-Authorization', 'Basic secret') @@ -92,7 +92,7 @@ public function test_replace_uri_removes_sensitive_headers_on_cross_host(): void public function test_replace_uri_on_cross_host_without_sensitive_headers(): void { - $request = (new Psr17Factory())->createRequest('GET', 'https://api.example.com/items?page=1'); + $request = new Psr17Factory()->createRequest('GET', 'https://api.example.com/items?page=1'); $result = RequestOption::replaceUri()->apply($request, 'https://other.example.org/items?page=2'); @@ -103,7 +103,7 @@ public function test_replace_uri_on_cross_host_without_sensitive_headers(): void public function test_replace_uri_removes_custom_sensitive_headers_on_cross_host(): void { - $request = (new Psr17Factory()) + $request = new Psr17Factory() ->createRequest('GET', 'https://api.example.com/items?page=1') ->withHeader('Authorization', 'Bearer secret') ->withHeader('X-Tenant-Secret', 'key') @@ -121,7 +121,7 @@ public function test_replace_uri_removes_custom_sensitive_headers_on_cross_host( public function test_replace_uri_keeps_a_header_taken_out_of_the_sensitive_headers_on_cross_host(): void { - $request = (new Psr17Factory()) + $request = new Psr17Factory() ->createRequest('GET', 'https://api.example.com/items?page=1') ->withHeader('Authorization', 'Bearer secret') ->withHeader('Cookie', 'session=abc'); @@ -136,7 +136,7 @@ public function test_replace_uri_keeps_a_header_taken_out_of_the_sensitive_heade public function test_replace_uri_removes_every_default_sensitive_header_on_cross_host(): void { - $request = (new Psr17Factory())->createRequest('GET', 'https://api.example.com/items?page=1'); + $request = new Psr17Factory()->createRequest('GET', 'https://api.example.com/items?page=1'); foreach (SensitiveHeaders::toArray() as $header) { $request = $request->withHeader($header, 'secret'); @@ -150,7 +150,7 @@ public function test_replace_uri_removes_every_default_sensitive_header_on_cross public function test_replace_uri_keeps_custom_sensitive_headers_on_same_host(): void { - $request = (new Psr17Factory()) + $request = new Psr17Factory() ->createRequest('GET', 'https://api.example.com/items?page=1') ->withHeader('X-Api-Key', 'key'); @@ -161,7 +161,7 @@ public function test_replace_uri_keeps_custom_sensitive_headers_on_same_host(): public function test_replace_uri_removes_sensitive_headers_on_scheme_downgrade(): void { - $request = (new Psr17Factory()) + $request = new Psr17Factory() ->createRequest('GET', 'https://api.example.com/items?page=1') ->withHeader('Authorization', 'Bearer secret') ->withHeader('Cookie', 'session=abc'); @@ -175,7 +175,7 @@ public function test_replace_uri_removes_sensitive_headers_on_scheme_downgrade() public function test_replace_uri_keeps_sensitive_headers_on_scheme_upgrade(): void { - $request = (new Psr17Factory()) + $request = new Psr17Factory() ->createRequest('GET', 'http://api.example.com/items?page=1') ->withHeader('Authorization', 'Bearer secret') ->withHeader('Cookie', 'session=abc'); @@ -189,7 +189,7 @@ public function test_replace_uri_keeps_sensitive_headers_on_scheme_upgrade(): vo public function test_replace_uri_resolves_relative_reference_against_base(): void { - $request = (new Psr17Factory())->createRequest('GET', 'https://api.example.com/v2/items?page=1'); + $request = new Psr17Factory()->createRequest('GET', 'https://api.example.com/v2/items?page=1'); static::assertSame( 'https://api.example.com/v2/items?page=2', diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/EmptyPathTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/EmptyPathTest.php index d9119de9da..4a6ec713c0 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/EmptyPathTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/EmptyPathTest.php @@ -13,7 +13,7 @@ final class EmptyPathTest extends FlowTestCase { public function test_empty_array_stops(): void { - static::assertTrue((new EmptyPath('data'))->shouldStop( + static::assertTrue(new EmptyPath('data')->shouldStop( PaginationMother::decoded(['data' => []]), new PageState(), )); @@ -21,14 +21,14 @@ public function test_empty_array_stops(): void public function test_missing_path_stops(): void { - static::assertTrue((new EmptyPath('data'))->shouldStop(PaginationMother::decoded([ + static::assertTrue(new EmptyPath('data')->shouldStop(PaginationMother::decoded([ 'meta' => 1, ]), new PageState())); } public function test_non_empty_array_does_not_stop(): void { - static::assertFalse((new EmptyPath('data'))->shouldStop(PaginationMother::decoded(['data' => [ + static::assertFalse(new EmptyPath('data')->shouldStop(PaginationMother::decoded(['data' => [ 1, 2, ]]), new PageState())); diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/EmptyResponseBodyTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/EmptyResponseBodyTest.php index 4fa881bbd0..34f402c2d4 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/EmptyResponseBodyTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/EmptyResponseBodyTest.php @@ -13,12 +13,12 @@ final class EmptyResponseBodyTest extends FlowTestCase { public function test_empty_body_stops(): void { - static::assertTrue((new EmptyResponseBody())->shouldStop(PaginationMother::decoded([]), new PageState())); + static::assertTrue(new EmptyResponseBody()->shouldStop(PaginationMother::decoded([]), new PageState())); } public function test_non_empty_body_does_not_stop(): void { - static::assertFalse((new EmptyResponseBody())->shouldStop(PaginationMother::decoded(['data' => [ + static::assertFalse(new EmptyResponseBody()->shouldStop(PaginationMother::decoded(['data' => [ 1, ]]), new PageState())); } diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/FlagFalseTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/FlagFalseTest.php index db33c675be..05fdaacce8 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/FlagFalseTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/FlagFalseTest.php @@ -13,21 +13,21 @@ final class FlagFalseTest extends FlowTestCase { public function test_flag_false_stops(): void { - static::assertTrue((new FlagFalse('has_more'))->shouldStop(PaginationMother::decoded([ + static::assertTrue(new FlagFalse('has_more')->shouldStop(PaginationMother::decoded([ 'has_more' => false, ]), new PageState())); } public function test_flag_true_does_not_stop(): void { - static::assertFalse((new FlagFalse('has_more'))->shouldStop(PaginationMother::decoded([ + static::assertFalse(new FlagFalse('has_more')->shouldStop(PaginationMother::decoded([ 'has_more' => true, ]), new PageState())); } public function test_missing_flag_does_not_stop(): void { - static::assertFalse((new FlagFalse('has_more'))->shouldStop( + static::assertFalse(new FlagFalse('has_more')->shouldStop( PaginationMother::decoded(['data' => []]), new PageState(), )); diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/FlagTrueTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/FlagTrueTest.php index e1087bec1b..4302964d90 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/FlagTrueTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/FlagTrueTest.php @@ -13,21 +13,21 @@ final class FlagTrueTest extends FlowTestCase { public function test_flag_false_does_not_stop(): void { - static::assertFalse((new FlagTrue('is_last'))->shouldStop(PaginationMother::decoded([ + static::assertFalse(new FlagTrue('is_last')->shouldStop(PaginationMother::decoded([ 'is_last' => false, ]), new PageState())); } public function test_flag_true_stops(): void { - static::assertTrue((new FlagTrue('is_last'))->shouldStop(PaginationMother::decoded([ + static::assertTrue(new FlagTrue('is_last')->shouldStop(PaginationMother::decoded([ 'is_last' => true, ]), new PageState())); } public function test_missing_flag_does_not_stop(): void { - static::assertFalse((new FlagTrue('is_last'))->shouldStop( + static::assertFalse(new FlagTrue('is_last')->shouldStop( PaginationMother::decoded(['data' => []]), new PageState(), )); diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/MaxPagesTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/MaxPagesTest.php index 87a6309d88..32ca443349 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/MaxPagesTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/MaxPagesTest.php @@ -13,17 +13,11 @@ final class MaxPagesTest extends FlowTestCase { public function test_below_limit_does_not_stop(): void { - static::assertFalse((new MaxPages(3))->shouldStop( - PaginationMother::decoded([]), - new PageState(pagesFetched: 2), - )); + static::assertFalse(new MaxPages(3)->shouldStop(PaginationMother::decoded([]), new PageState(pagesFetched: 2))); } public function test_reaching_limit_stops(): void { - static::assertTrue((new MaxPages(3))->shouldStop( - PaginationMother::decoded([]), - new PageState(pagesFetched: 3), - )); + static::assertTrue(new MaxPages(3)->shouldStop(PaginationMother::decoded([]), new PageState(pagesFetched: 3))); } } diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/MaxResultsTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/MaxResultsTest.php index 74c2d804b5..2866aae068 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/MaxResultsTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/MaxResultsTest.php @@ -13,7 +13,7 @@ final class MaxResultsTest extends FlowTestCase { public function test_below_limit_does_not_stop(): void { - static::assertFalse((new MaxResults(100))->shouldStop( + static::assertFalse(new MaxResults(100)->shouldStop( PaginationMother::decoded([]), new PageState(resultsFetched: 90), )); @@ -21,7 +21,7 @@ public function test_below_limit_does_not_stop(): void public function test_reaching_limit_stops(): void { - static::assertTrue((new MaxResults(100))->shouldStop( + static::assertTrue(new MaxResults(100)->shouldStop( PaginationMother::decoded([]), new PageState(resultsFetched: 120), )); diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/NeverStopTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/NeverStopTest.php index 47fc6f7cbb..a051b3a926 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/NeverStopTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/NeverStopTest.php @@ -13,7 +13,7 @@ final class NeverStopTest extends FlowTestCase { public function test_never_stops(): void { - static::assertFalse((new NeverStop())->shouldStop( + static::assertFalse(new NeverStop()->shouldStop( PaginationMother::decoded([]), new PageState(pagesFetched: 999, resultsFetched: 999), )); diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/PathMissingTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/PathMissingTest.php index 2a19df95f4..06056c342d 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/PathMissingTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/PathMissingTest.php @@ -13,14 +13,14 @@ final class PathMissingTest extends FlowTestCase { public function test_empty_string_token_stops(): void { - static::assertTrue((new PathMissing('meta.next'))->shouldStop(PaginationMother::decoded(['meta' => [ + static::assertTrue(new PathMissing('meta.next')->shouldStop(PaginationMother::decoded(['meta' => [ 'next' => '', ]]), new PageState())); } public function test_missing_path_stops(): void { - static::assertTrue((new PathMissing('meta.next'))->shouldStop( + static::assertTrue(new PathMissing('meta.next')->shouldStop( PaginationMother::decoded(['meta' => []]), new PageState(), )); @@ -28,14 +28,14 @@ public function test_missing_path_stops(): void public function test_null_token_stops(): void { - static::assertTrue((new PathMissing('meta.next'))->shouldStop(PaginationMother::decoded(['meta' => [ + static::assertTrue(new PathMissing('meta.next')->shouldStop(PaginationMother::decoded(['meta' => [ 'next' => null, ]]), new PageState())); } public function test_present_token_does_not_stop(): void { - static::assertFalse((new PathMissing('meta.next'))->shouldStop(PaginationMother::decoded(['meta' => [ + static::assertFalse(new PathMissing('meta.next')->shouldStop(PaginationMother::decoded(['meta' => [ 'next' => 'abc', ]]), new PageState())); } diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/TotalReachedTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/TotalReachedTest.php index d767aa88b1..7110fda2ae 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/TotalReachedTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/StopWhen/TotalReachedTest.php @@ -13,7 +13,7 @@ final class TotalReachedTest extends FlowTestCase { public function test_below_total_does_not_stop(): void { - static::assertFalse((new TotalReached('meta.total'))->shouldStop( + static::assertFalse(new TotalReached('meta.total')->shouldStop( PaginationMother::decoded(['meta' => ['total' => 100]]), new PageState(pagesFetched: 2, resultsFetched: 40), )); @@ -21,7 +21,7 @@ public function test_below_total_does_not_stop(): void public function test_missing_total_does_not_stop(): void { - static::assertFalse((new TotalReached('meta.total'))->shouldStop( + static::assertFalse(new TotalReached('meta.total')->shouldStop( PaginationMother::decoded(['meta' => []]), new PageState(pagesFetched: 9, resultsFetched: 900), )); @@ -29,7 +29,7 @@ public function test_missing_total_does_not_stop(): void public function test_reaching_total_stops(): void { - static::assertTrue((new TotalReached('meta.total'))->shouldStop( + static::assertTrue(new TotalReached('meta.total')->shouldStop( PaginationMother::decoded(['meta' => ['total' => 100]]), new PageState(pagesFetched: 5, resultsFetched: 100), )); diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/Strategy/LinkHeaderTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/Strategy/LinkHeaderTest.php index 89635bb6f7..ad3b5693ef 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/Strategy/LinkHeaderTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/Strategy/LinkHeaderTest.php @@ -14,7 +14,7 @@ final class LinkHeaderTest extends FlowTestCase { public function test_missing_rel_stops(): void { - static::assertNull((new LinkHeader())->nextRequest( + static::assertNull(new LinkHeader()->nextRequest( PaginationMother::request('GET', 'https://api.example.com/items'), PaginationMother::decoded(['data' => [1]], [ 'Link' => '; rel="prev"', @@ -27,7 +27,7 @@ public function test_next_request_follows_link_header(): void { static::assertSame( 'https://api.example.com/items?page=2', - (new LinkHeader()) + new LinkHeader() ->nextRequest( PaginationMother::request('GET', 'https://api.example.com/items'), PaginationMother::decoded(['data' => [1]], [ @@ -42,7 +42,7 @@ public function test_next_request_follows_link_header(): void public function test_next_request_removes_custom_sensitive_headers_on_cross_host(): void { - $result = (new LinkHeader('next', [...SensitiveHeaders::toArray(), 'X-Tenant-Secret']))->nextRequest( + $result = new LinkHeader('next', [...SensitiveHeaders::toArray(), 'X-Tenant-Secret'])->nextRequest( PaginationMother::request('GET', 'https://api.example.com/items') ->withHeader('Authorization', 'Bearer secret') ->withHeader('X-Tenant-Secret', 'key'), diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/Strategy/NextUrlFromBodyTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/Strategy/NextUrlFromBodyTest.php index 8ec163f420..8c76c5bc03 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/Strategy/NextUrlFromBodyTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/Strategy/NextUrlFromBodyTest.php @@ -14,7 +14,7 @@ final class NextUrlFromBodyTest extends FlowTestCase { public function test_missing_url_stops(): void { - static::assertNull((new NextUrlFromBody('@odata\.nextLink'))->nextRequest( + static::assertNull(new NextUrlFromBody('@odata\.nextLink')->nextRequest( PaginationMother::request(), PaginationMother::decoded(['value' => [1]]), new PageState(pagesFetched: 1), @@ -25,7 +25,7 @@ public function test_next_request_replaces_uri_with_body_url(): void { static::assertSame( 'https://api.example.com/items?page=2', - (new NextUrlFromBody('@odata\.nextLink')) + new NextUrlFromBody('@odata\.nextLink') ->nextRequest( PaginationMother::request('GET', 'https://api.example.com/items?page=1'), PaginationMother::decoded(['@odata.nextLink' => 'https://api.example.com/items?page=2']), @@ -38,10 +38,10 @@ public function test_next_request_replaces_uri_with_body_url(): void public function test_next_request_removes_custom_sensitive_headers_on_cross_host(): void { - $result = (new NextUrlFromBody('@odata\\.nextLink', [ + $result = new NextUrlFromBody('@odata\\.nextLink', [ ...SensitiveHeaders::toArray(), 'X-Tenant-Secret', - ]))->nextRequest( + ])->nextRequest( PaginationMother::request('GET', 'https://api.example.com/items?page=1') ->withHeader('Authorization', 'Bearer secret') ->withHeader('X-Tenant-Secret', 'key'), diff --git a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/Strategy/OffsetLimitTest.php b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/Strategy/OffsetLimitTest.php index 00ac909ae9..cf81ee30e9 100644 --- a/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/Strategy/OffsetLimitTest.php +++ b/src/adapter/etl-adapter-http/tests/Flow/ETL/Adapter/Http/Tests/Unit/IO/Extractor/Pagination/Strategy/OffsetLimitTest.php @@ -16,11 +16,11 @@ public function test_counts_limit_per_page(): void { static::assertSame( 25, - (new OffsetLimit( + new OffsetLimit( RequestOption::queryParam('offset'), RequestOption::queryParam('limit'), 25, - ))->countResults(PaginationMother::decoded(['data' => [1]])), + )->countResults(PaginationMother::decoded(['data' => [1]])), ); } diff --git a/src/adapter/etl-adapter-json/composer.json b/src/adapter/etl-adapter-json/composer.json index 8d768ba467..8e0023d205 100644 --- a/src/adapter/etl-adapter-json/composer.json +++ b/src/adapter/etl-adapter-json/composer.json @@ -11,7 +11,7 @@ "adapter" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "ext-json": "*", "flow-php/etl": "self.version", "flow-php/filesystem": "self.version", diff --git a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/IO/Extractor/JsonExtractor.php b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/IO/Extractor/JsonExtractor.php index fdf75d8874..9ed804c8c0 100644 --- a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/IO/Extractor/JsonExtractor.php +++ b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/IO/Extractor/JsonExtractor.php @@ -192,7 +192,7 @@ private function describe(): Schema $derived = $this->derived->schema(); if ($derived === null) { - $inferred = (new SchemaInferrer($this->inference))->infer( + $inferred = new SchemaInferrer($this->inference)->infer( new JsonSniffer( new JsonFileReader($this->filesystem, $this->format, $this->pointer, $this->pointerToColumnName), $this->files->of(new Criteria()), diff --git a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/IO/Extractor/JsonFileReader.php b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/IO/Extractor/JsonFileReader.php index 178b2fc1ed..a795dae2ef 100644 --- a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/IO/Extractor/JsonFileReader.php +++ b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/IO/Extractor/JsonFileReader.php @@ -134,16 +134,16 @@ public function documentItems(SourceStream $stream): Generator } if ($this->pointer !== null) { - yield from (new Items($this->chunks($stream, $first), $this->options))->getIterator(); + yield from new Items($this->chunks($stream, $first), $this->options)->getIterator(); return; } - yield from (new JsonArrayElements())->of( + yield from new JsonArrayElements()->of( $stream, $first, fn(int $skip): LimitIterator => new LimitIterator( - (new Items($this->chunks($stream, $first), $this->options))->getIterator(), + new Items($this->chunks($stream, $first), $this->options)->getIterator(), $skip, ), ); diff --git a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/IO/Loader/JsonLoader.php b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/IO/Loader/JsonLoader.php index a40c70e28b..d3f6b33cee 100644 --- a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/IO/Loader/JsonLoader.php +++ b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/IO/Loader/JsonLoader.php @@ -80,13 +80,13 @@ public function __construct( public static function fromDescription(#[SensitiveParameter] array $data, Rebuild $rebuild): static { - $loader = (new self( + $loader = new self( Path::fromArray(type_array()->assert($data['path'] ?? null)), $rebuild->of($data['filesystem'] ?? null, ConfiguredFilesystem::class)->filesystem(), type_enum(JsonFraming::class)->assert(constant( JsonFraming::class . '::' . type_string()->assert($data['framing'] ?? null), )), - )) + ) ->saveMode(type_enum(SaveMode::class)->assert(constant( SaveMode::class . '::' . type_string()->assert($data['save_mode'] ?? null), ))) @@ -167,7 +167,7 @@ public function partitioning(): Partitioning public function inTask(Part $task): static { - $loader = (new self($this->path, $this->filesystem, $this->framing, $this->extension)) + $loader = new self($this->path, $this->filesystem, $this->framing, $this->extension) ->saveMode($this->saveMode) ->withFlags($this->flags) ->withDateFormat($this->dateFormat) diff --git a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/functions.php b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/functions.php index 45878176eb..8e6d571671 100644 --- a/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/functions.php +++ b/src/adapter/etl-adapter-json/src/Flow/ETL/Adapter/JSON/functions.php @@ -78,7 +78,7 @@ function to_json( bool $put_rows_in_new_lines = false, Filesystem $filesystem = new NativeLocalFilesystem(), ): JsonLoader { - return (new JsonLoader(is_string($path) ? path_real($path) : $path, $filesystem)) + return new JsonLoader(is_string($path) ? path_real($path) : $path, $filesystem) ->withFlags($flags) ->withDateTimeFormat($date_time_format) ->withRowsInNewLines($put_rows_in_new_lines); @@ -112,7 +112,7 @@ function schema_from_json_schema( ?RequestFactoryInterface $request_factory = null, Filesystem $filesystem = new NativeLocalFilesystem(), ): Schema { - return (new SchemaConverter(new ReferenceResolver($client, $request_factory, $filesystem)))->toFlowSchema( + return new SchemaConverter(new ReferenceResolver($client, $request_factory, $filesystem))->toFlowSchema( $json_schema, ); } @@ -125,5 +125,5 @@ function schema_from_json_schema( #[DocumentationDSL(module: Module::JSON, type: Type::HELPER)] function schema_to_json_schema(Schema $schema): array { - return (new SchemaConverter())->toJsonSchema($schema); + return new SchemaConverter()->toJsonSchema($schema); } diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Context/DescribableFixtures.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Context/DescribableFixtures.php index d37c523bc3..c801f02ef6 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Context/DescribableFixtures.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Context/DescribableFixtures.php @@ -34,7 +34,7 @@ public static function all(): array JsonFileBatches::class => static fn(): Describable => new JsonFileBatches( ETLDescribableFixtures::mountedFilesystem(), self::jsonReader(), - inference: (new SchemaInference(500, unionByName: true))->everySource(), + inference: new SchemaInference(500, unionByName: true)->everySource(), ), JsonFileReader::class => self::jsonReader(...), JsonLoader::class => static fn(): Describable => new JsonLoader( diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Context/JsonFixtureContext.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Context/JsonFixtureContext.php index ca5f145f8b..c3d0e0de57 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Context/JsonFixtureContext.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Context/JsonFixtureContext.php @@ -56,7 +56,7 @@ public static function globSources(string $glob, Filesystem $filesystem = new Na { $sources = []; - foreach ((new FileListing($filesystem))->list(path(self::path($glob)), new OnlyFiles()) as $status) { + foreach (new FileListing($filesystem)->list(path(self::path($glob)), new OnlyFiles()) as $status) { $sources[] = new SourceFile($status->path, $status->size); } @@ -97,7 +97,7 @@ public static function format(string $fixture): JsonFraming */ public static function infer(string $fixture, SchemaInference $inference = new SchemaInference()): Schema { - return (new SchemaInferrer($inference))->infer(self::sniffer(self::format($fixture), [self::source( + return new SchemaInferrer($inference)->infer(self::sniffer(self::format($fixture), [self::source( $fixture, )]), new VoidProgress())->schema; } @@ -128,7 +128,7 @@ public static function open( Filesystem $filesystem = new NativeLocalFilesystem(), ?string $pointer = null, ): JsonOpenSource { - return (new JsonFileBatches($filesystem, self::reader($format, $filesystem, pointer: $pointer)))->open($source); + return new JsonFileBatches($filesystem, self::reader($format, $filesystem, pointer: $pointer))->open($source); } /** diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonExtractorTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonExtractorTest.php index 0d35613cb3..98c14eacfa 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonExtractorTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonExtractorTest.php @@ -96,11 +96,11 @@ public function test_an_empty_array_lines_document_reads_no_rows(): void [], iterator_to_array( FlowTestCase::extracted( - (new JsonExtractor( + new JsonExtractor( path('memory://framing/empty.json'), MemoryFiles::with(['memory://framing/empty.json' => "[\n\n]"]), JsonFraming::ArrayLines, - ))->withSchema(schema(int_schema('id'))), + )->withSchema(schema(int_schema('id'))), flow_context(config())->backend(), new Criteria(), ), @@ -932,7 +932,7 @@ public function test_extract_split_stops_on_the_stop_signal(): void $generator = FlowTestCase::extracted( $extractor, flow_context()->backend(), - (new Criteria())->withSplit($extractor->splits(new Criteria(), 1)[0]), + new Criteria()->withSplit($extractor->splits(new Criteria(), 1)[0]), ); $totalRows = 0; @@ -974,7 +974,7 @@ public function test_a_pushed_path_filter_prunes_the_files_splits_are_cut_from() static::assertEquals( [new FileSplit($extractor->source(), 0, null)], - $extractor->splits((new Criteria())->withPathFilter(new RejectingFilter()), 1), + $extractor->splits(new Criteria()->withPathFilter(new RejectingFilter()), 1), ); } } diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonFileBatchesTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonFileBatchesTest.php index 244f0331c8..df9ecdeb4f 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonFileBatchesTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonFileBatchesTest.php @@ -143,11 +143,11 @@ public function test_a_flow_php_of_another_abi_is_refused_before_the_file_is_ope $filesystem = new CountingFilesystem(new NativeLocalFilesystem()); try { - (new JsonFileBatches( + new JsonFileBatches( $filesystem, JsonFixtureContext::reader(JsonFraming::Lines, $filesystem), extension: new FlowPhpExtension(true, FlowPhpExtension::ABI + 1, '0.46.0'), - ))->open(JsonFixtureContext::source('five_rows.jsonl')); + )->open(JsonFixtureContext::source('five_rows.jsonl')); static::fail('a skewed flow_php must be refused'); } catch (RuntimeException $e) { static::assertStringContainsString('does not match flow-php/etl', $e->getMessage()); @@ -158,11 +158,11 @@ public function test_a_flow_php_of_another_abi_is_refused_before_the_file_is_ope public function test_without_flow_php_a_file_is_read_by_the_php_lane_whatever_is_loaded(): void { - $open = (new JsonFileBatches( + $open = new JsonFileBatches( new NativeLocalFilesystem(), JsonFixtureContext::reader(JsonFraming::Lines, new NativeLocalFilesystem()), extension: new FlowPhpExtension(false, null), - ))->open(JsonFixtureContext::source('five_rows.jsonl')); + )->open(JsonFixtureContext::source('five_rows.jsonl')); static::assertInstanceOf(Generator::class, $open->batches(schema(int_schema('id')), 2, new PhpBackend())); $open->close(); diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonFileReaderTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonFileReaderTest.php index 0f152f75bf..d7b31ff34c 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonFileReaderTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonFileReaderTest.php @@ -271,7 +271,7 @@ public function test_a_reader_over_the_local_filesystem_describes_and_rebuilds_e ['format' => 'Lines', 'pointer' => '/items', 'pointer_to_column_name' => true], array_slice($description->data, 1), ); - static::assertEquals($reader, (new Rebuild())->object( + static::assertEquals($reader, new Rebuild()->object( Description::fromArray($description->normalize()), JsonFileReader::class, )); @@ -279,26 +279,24 @@ public function test_a_reader_over_the_local_filesystem_describes_and_rebuilds_e public function test_a_reader_over_a_memory_filesystem_does_not_describe(): void { - static::assertNull((new JsonFileReader(memory_filesystem(), JsonFraming::Array, null, false))->describe()); + static::assertNull(new JsonFileReader(memory_filesystem(), JsonFraming::Array, null, false)->describe()); } public function test_the_reader_declares_json(): void { static::assertSame( ['json'], - (new JsonFileReader(new NativeLocalFilesystem(), JsonFraming::Array, null, false)) - ->describe() - ?->extensions(), + new JsonFileReader(new NativeLocalFilesystem(), JsonFraming::Array, null, false)->describe()?->extensions(), ); } public function test_points_into_when_a_pointer_is_set(): void { static::assertTrue( - (new JsonFileReader(new NativeLocalFilesystem(), JsonFraming::Array, '/items', false))->pointsInto(), + new JsonFileReader(new NativeLocalFilesystem(), JsonFraming::Array, '/items', false)->pointsInto(), ); static::assertFalse( - (new JsonFileReader(new NativeLocalFilesystem(), JsonFraming::Array, null, false))->pointsInto(), + new JsonFileReader(new NativeLocalFilesystem(), JsonFraming::Array, null, false)->pointsInto(), ); } @@ -310,7 +308,7 @@ public function test_a_window_narrows_only_lines_and_never_the_split_of_a_whole_ static::assertSame($split, $lines->window($split)); static::assertNull($lines->window(null)); static::assertNull($lines->window(new FileSplit(path('file:///a.jsonl'), 0, null))); - static::assertNull((new JsonFileReader(new NativeLocalFilesystem(), JsonFraming::Array, null, false))->window( + static::assertNull(new JsonFileReader(new NativeLocalFilesystem(), JsonFraming::Array, null, false)->window( $split, )); } diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonLinesExtractorTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonLinesExtractorTest.php index dc68db30b3..1c0bfd5eb5 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonLinesExtractorTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonLinesExtractorTest.php @@ -850,7 +850,7 @@ public function test_extract_split_stops_on_the_stop_signal(): void $generator = FlowTestCase::extracted( $extractor, flow_context()->backend(), - (new Criteria())->withSplit($extractor->splits(new Criteria(), 1)[0]), + new Criteria()->withSplit($extractor->splits(new Criteria(), 1)[0]), ); $totalRows = 0; @@ -905,7 +905,7 @@ public function test_a_pushed_path_filter_prunes_the_files_splits_are_cut_from() static::assertEquals( [new FileSplit($extractor->source(), 0, null)], - $extractor->splits((new Criteria())->withPathFilter(new RejectingFilter()), 1), + $extractor->splits(new Criteria()->withPathFilter(new RejectingFilter()), 1), ); } diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonSplitReadTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonSplitReadTest.php index 81803e436c..bcfb7590c6 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonSplitReadTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/JsonSplitReadTest.php @@ -76,7 +76,7 @@ public function test_the_lines_reader_reads_a_file_by_windows_as_it_reads_it_who foreach (FlowTestCase::extracted( DescribeRoundTrip::rebuilt($extractor->reader()), flow_context()->backend(), - (new Criteria())->withSplit(type_instance_of(FileSplit::class)->assert($split)), + new Criteria()->withSplit(type_instance_of(FileSplit::class)->assert($split)), ) as $batch) { $rows = [...$rows, ...$batch->toArray()]; } diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/PhpJsonOpenSourceTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/PhpJsonOpenSourceTest.php index 7829473fa5..fdb08811f7 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/PhpJsonOpenSourceTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/PhpJsonOpenSourceTest.php @@ -25,10 +25,11 @@ final class PhpJsonOpenSourceTest extends FlowTestCase public function test_batches_are_sized_and_the_tail_is_shorter(): void { $batches = iterator_to_array( - (new PhpJsonOpenSource( - JsonFixtureContext::reader(), - JsonFixtureContext::source('five_rows.json'), - ))->batches(schema(int_schema('id')), 2, new PhpBackend()), + new PhpJsonOpenSource(JsonFixtureContext::reader(), JsonFixtureContext::source('five_rows.json'))->batches( + schema(int_schema('id')), + 2, + new PhpBackend(), + ), false, ); @@ -43,10 +44,10 @@ public function test_batches_are_sized_and_the_tail_is_shorter(): void public function test_under_a_declared_schema_a_refused_element_is_a_corrupted_record_numbered_in_the_document(): void { - $batches = (new PhpJsonOpenSource( + $batches = new PhpJsonOpenSource( JsonFixtureContext::reader(JsonFraming::Array), JsonFixtureContext::source('misfit.json'), - ))->batches(schema(int_schema('id')), 2, new PhpBackend()); + )->batches(schema(int_schema('id')), 2, new PhpBackend()); $rows = $batches->current(); @@ -65,10 +66,10 @@ public function test_under_a_declared_schema_a_refused_element_is_a_corrupted_re public function test_batches_close_the_stream_when_abandoned(JsonFraming $format, string $fixture): void { $counting = new CountingFilesystem(new NativeLocalFilesystem()); - $batches = (new PhpJsonOpenSource( + $batches = new PhpJsonOpenSource( JsonFixtureContext::reader($format, $counting), JsonFixtureContext::source($fixture), - ))->batches(schema(int_schema('id')), 2, new PhpBackend()); + )->batches(schema(int_schema('id')), 2, new PhpBackend()); $rows = $batches->current(); @@ -92,10 +93,10 @@ public function test_batches_never_yield_an_empty_batch(JsonFraming $format, str static::assertSame( [], iterator_to_array( - (new PhpJsonOpenSource( + new PhpJsonOpenSource( JsonFixtureContext::reader($format, $counting), JsonFixtureContext::source($fixture), - ))->batches(schema(int_schema('id')), 2, new PhpBackend()), + )->batches(schema(int_schema('id')), 2, new PhpBackend()), false, ), ); diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/RustJsonOpenSourceTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/RustJsonOpenSourceTest.php index b23f6fd648..f4358cbe65 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/RustJsonOpenSourceTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Extractor/RustJsonOpenSourceTest.php @@ -157,7 +157,7 @@ public function test_a_window_past_the_first_byte_names_a_refused_line_by_offset $reader = JsonFixtureContext::reader(JsonFraming::Lines, $filesystem); $native = JsonFixtureContext::outcome( - (new JsonFileBatches($filesystem, $reader))->open($source, $split), + new JsonFileBatches($filesystem, $reader)->open($source, $split), schema(int_schema('id')), 2, ); diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/FileFormatContractTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/FileFormatContractTest.php index 8f9e888b2c..6e7daba505 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/FileFormatContractTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/FileFormatContractTest.php @@ -36,109 +36,109 @@ public static function formats(): Generator #[DataProvider('formats')] public function test_overwrite_replaces_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->overwriteReplacesWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->overwriteReplacesWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_append_keeps_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->appendKeepsWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->appendKeepsWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_ignore_leaves_an_existing_destination_untouched(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->ignoreLeavesAnExistingDestinationUntouched($format); + new FileFormatContract($this->cacheDir)->ignoreLeavesAnExistingDestinationUntouched($format); } #[DataProvider('formats')] public function test_exception_if_exists_refuses_an_existing_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->exceptionIfExistsRefusesAnExistingDestination($format); + new FileFormatContract($this->cacheDir)->exceptionIfExistsRefusesAnExistingDestination($format); } #[DataProvider('formats')] public function test_a_batch_of_zero_rows_creates_no_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aBatchOfZeroRowsCreatesNoFile($format); + new FileFormatContract($this->cacheDir)->aBatchOfZeroRowsCreatesNoFile($format); } #[DataProvider('formats')] public function test_a_write_that_ends_reports_its_file_operations(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aWriteThatEndsReportsItsFileOperations($format); + new FileFormatContract($this->cacheDir)->aWriteThatEndsReportsItsFileOperations($format); } #[DataProvider('formats')] public function test_a_partitioned_write_reads_back_every_partition(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPartitionedWriteReadsBackEveryPartition($format); + new FileFormatContract($this->cacheDir)->aPartitionedWriteReadsBackEveryPartition($format); } #[DataProvider('formats')] public function test_a_loader_in_a_task_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderInATaskSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->aLoaderInATaskSurvivesDescribe($format); } #[DataProvider('formats')] public function test_an_extractor_reader_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorReaderSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->anExtractorReaderSurvivesDescribe($format); } #[DataProvider('formats')] public function test_the_splits_read_every_row_once(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theSplitsReadEveryRowOnce($format); + new FileFormatContract($this->cacheDir)->theSplitsReadEveryRowOnce($format); } #[DataProvider('formats')] public function test_metadata_columns_name_the_source_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->metadataColumnsNameTheSourceFile($format); + new FileFormatContract($this->cacheDir)->metadataColumnsNameTheSourceFile($format); } #[DataProvider('formats')] public function test_the_batch_size_bounds_every_batch(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theBatchSizeBoundsEveryBatch($format); + new FileFormatContract($this->cacheDir)->theBatchSizeBoundsEveryBatch($format); } #[DataProvider('formats')] public function test_refresh_lists_the_files_written_after_a_read(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->refreshListsTheFilesWrittenAfterARead($format); + new FileFormatContract($this->cacheDir)->refreshListsTheFilesWrittenAfterARead($format); } #[DataProvider('formats')] public function test_a_failed_run_leaves_no_file_at_the_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aFailedRunLeavesNoFileAtTheDestination($format); + new FileFormatContract($this->cacheDir)->aFailedRunLeavesNoFileAtTheDestination($format); } #[DataProvider('formats')] public function test_an_extractor_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_a_loader_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_reads_back_through_the_same_filesystem_instance(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->readsBackThroughTheSameFilesystemInstance($format); + new FileFormatContract($this->cacheDir)->readsBackThroughTheSameFilesystemInstance($format); } #[DataProvider('formats')] public function test_a_pushed_filter_returns_what_the_filter_node_returns(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPushedFilterReturnsWhatTheFilterNodeReturns( + new FileFormatContract($this->cacheDir)->aPushedFilterReturnsWhatTheFilterNodeReturns( $format, ref('id')->notEquals(lit('b')), ); diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Inference/JsonSnifferTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Inference/JsonSnifferTest.php index feaec80cac..a0525af5f4 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Inference/JsonSnifferTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Integration/IO/Inference/JsonSnifferTest.php @@ -201,10 +201,10 @@ public function test_unbounded_inference_is_independent_of_execution_order( JsonFraming $format, array $fixtures, ): void { - $inference = (new SchemaInference(unionByName: true))->everyRow()->everySource(); + $inference = new SchemaInference(unionByName: true)->everyRow()->everySource(); static::assertEquals( - (new SchemaInferrer($inference))->infer( + new SchemaInferrer($inference)->infer( JsonFixtureContext::sniffer($format, JsonFixtureContext::sources(...$fixtures)), new VoidProgress(), )->schema, diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/DescribableRoundTripTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/DescribableRoundTripTest.php index d19716616b..3deecaec08 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/DescribableRoundTripTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/DescribableRoundTripTest.php @@ -6,7 +6,6 @@ use Flow\ETL\Adapter\JSON\Tests\Context\DescribableFixtures; use Flow\ETL\Foundation\Describe\Describable; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Foundation\Exception\RuntimeException; use Flow\ETL\Tests\Context\DescribeRoundTrip; use Flow\ETL\Tests\Context\ExtractorClasses; @@ -58,11 +57,7 @@ public function test_a_rebuilt_describable_equals_the_described_one(string $clas $this->expectException(RuntimeException::class); } - try { - $describable = DescribableFixtures::all()[$class](); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $describable = DescribableFixtures::all()[$class](); if (in_array($class, DescribableFixtures::undescribable(), true)) { static::assertNull($describable->describe()); diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonArrayElementsTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonArrayElementsTest.php index 0ffc8f1cfd..e39993b407 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonArrayElementsTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonArrayElementsTest.php @@ -74,7 +74,7 @@ public function test_yields_or_refuses_exactly_what_json_machine_does(string $do }; try { - $actual = iterator_to_array((new JsonArrayElements(4))->of($stream, $stream->read(5, 0), $fallback)); + $actual = iterator_to_array(new JsonArrayElements(4)->of($stream, $stream->read(5, 0), $fallback)); } catch (Throwable $exception) { $actual = $exception::class; } diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonFileBatchesTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonFileBatchesTest.php index 075d020c0a..f448f0c466 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonFileBatchesTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonFileBatchesTest.php @@ -30,10 +30,10 @@ final class JsonFileBatchesTest extends FlowTestCase public function test_a_document_yields_its_rows_consumes_no_offset_and_closes_its_stream(): void { $filesystem = new CountingFilesystem(MemoryFiles::with(['memory://a.json' => '[{"id":1},{"id":2},{"id":3}]'])); - $file = (new JsonFileBatches( + $file = new JsonFileBatches( $filesystem, new JsonFileReader($filesystem, JsonFraming::Array, null, false), - ))->batches( + )->batches( FileReadMother::of(schema(int_schema('id')), null, 2), new Criteria(), new SourceFile(path('memory://a.json')), @@ -65,10 +65,10 @@ public function test_lines_yield_one_row_per_line(): void $rows instanceof Rows ? $rows->toArray() : [$rows->getMessage()] ), iterator_to_array( - (new JsonFileBatches( + new JsonFileBatches( $filesystem, new JsonFileReader($filesystem, JsonFraming::Lines, null, false), - ))->batches( + )->batches( FileReadMother::of(schema(int_schema('id')), null, 10), new Criteria(), new SourceFile(path('memory://a.jsonl')), diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonLineResyncTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonLineResyncTest.php index 7b8d3d54e6..d90f57c38f 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonLineResyncTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonLineResyncTest.php @@ -37,7 +37,7 @@ public static function stream(string $content): SourceStream #[TestWith([17, null])] public function test_after_is_the_first_line_start_at_or_after_the_offset(int $from, ?int $expected): void { - static::assertSame($expected, (new JsonLineResync())->after( + static::assertSame($expected, new JsonLineResync()->after( self::stream("{\"a\":1}\n{\"b\":2}\n{\"c\"}"), $from, )); @@ -45,12 +45,12 @@ public function test_after_is_the_first_line_start_at_or_after_the_offset(int $f public function test_an_empty_stream_has_no_line_start(): void { - static::assertNull((new JsonLineResync())->after(self::stream(''), 0)); + static::assertNull(new JsonLineResync()->after(self::stream(''), 0)); } public function test_crlf_lines_resync_after_the_newline(): void { - static::assertSame(9, (new JsonLineResync())->after(self::stream("{\"a\":1}\r\n{\"b\":2}\r\n"), 3)); + static::assertSame(9, new JsonLineResync()->after(self::stream("{\"a\":1}\r\n{\"b\":2}\r\n"), 3)); } public function test_neighbouring_windows_cut_at_after_share_every_boundary_and_cover_the_file(): void @@ -61,7 +61,7 @@ public function test_neighbouring_windows_cut_at_after_share_every_boundary_and_ $read = ''; foreach ([[0, 5], [5, 5], [10, 5], [15, 5], [20, 5], [25, 5], [30, 5], [35, null]] as [$start, $length]) { - $read .= (new FileSplit(path('memory://lines.jsonl'), $start, $length)) + $read .= new FileSplit(path('memory://lines.jsonl'), $start, $length) ->window( $stream, $resync->after($stream, $start), diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonReadProgressTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonReadProgressTest.php index c65e1f7298..7781a088ba 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonReadProgressTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/JsonReadProgressTest.php @@ -11,7 +11,7 @@ final class JsonReadProgressTest extends FlowTestCase { public function test_it_starts_at_zero(): void { - static::assertSame(0, (new JsonReadProgress())->total()); + static::assertSame(0, new JsonReadProgress()->total()); } public function test_it_sums_what_was_added(): void diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php index b4c86bb291..e2797c0b56 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php @@ -31,7 +31,7 @@ public static function extractors(): Generator #[DataProvider('extractors')] public function test_an_extractor_carries_the_metadata_setter_only_when_it_declares_metadata(string $class): void { - if ((new ReflectionClass($class))->implementsInterface(MetadataColumnsExtractor::class)) { + if (new ReflectionClass($class)->implementsInterface(MetadataColumnsExtractor::class)) { MetadataColumnsContract::declares($class); return; diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Loader/JsonFileWriterTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Loader/JsonFileWriterTest.php index ef043c4637..0383931df0 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Loader/JsonFileWriterTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Loader/JsonFileWriterTest.php @@ -41,7 +41,7 @@ public function test_close_without_a_write_appends_nothing(JsonFraming $framing) { $stream = new StringDestinationStream(path('memory://out.json')); - (new JsonFileWriter($stream, JsonEncoderMother::php(), $framing))->close(); + new JsonFileWriter($stream, JsonEncoderMother::php(), $framing)->close(); static::assertSame('', $stream->content()); } diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Loader/JsonLoaderTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Loader/JsonLoaderTest.php index af681f8ea5..ab4d6f80d8 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Loader/JsonLoaderTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Loader/JsonLoaderTest.php @@ -55,7 +55,7 @@ final class JsonLoaderTest extends FlowTestCase public function test_setting_content_type_on_path(): void { static::assertEquals( - (new JsonLoader(path(__DIR__ . '/file.json'))) + new JsonLoader(path(__DIR__ . '/file.json')) ->destination() ->getOption(Option::CONTENT_TYPE), ContentType::JSON, @@ -308,7 +308,7 @@ public function test_a_writer_writes_with_the_options_of_the_loader(): void { $stream = new StringDestinationStream(path('memory://out.json')); $schema = schema(datetime_schema('at'), date_schema('on')); - $writer = (new JsonLoader(path('memory://out.json'), memory_filesystem())) + $writer = new JsonLoader(path('memory://out.json'), memory_filesystem()) ->withFlags(JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES) ->withDateTimeFormat('d/m/Y H:i') ->withDateFormat('Y/m/d') @@ -326,7 +326,7 @@ public function test_a_writer_writes_with_the_options_of_the_loader(): void public function test_a_flag_the_native_writer_does_not_render_is_written_through_php(): void { $stream = new StringDestinationStream(path('memory://out.json')); - $writer = (new JsonLoader(path('memory://out.json'), memory_filesystem(), JsonFraming::Lines)) + $writer = new JsonLoader(path('memory://out.json'), memory_filesystem(), JsonFraming::Lines) ->withFlags(JSON_THROW_ON_ERROR | JSON_HEX_TAG) ->writer($stream, schema(str_schema('tag')), new PhpBackend()); @@ -341,12 +341,12 @@ public function test_a_flow_php_of_another_abi_is_refused(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('does not match flow-php/etl'); - (new JsonLoader( + new JsonLoader( path('memory://out.json'), memory_filesystem(), JsonFraming::Array, new FlowPhpExtension(true, FlowPhpExtension::ABI + 1, '0.46.0'), - ))->writer(new StringDestinationStream(path('memory://out.json')), schema(int_schema('id')), new PhpBackend()); + )->writer(new StringDestinationStream(path('memory://out.json')), schema(int_schema('id')), new PhpBackend()); } public function test_in_task_keeps_the_lane_override(): void @@ -354,12 +354,12 @@ public function test_in_task_keeps_the_lane_override(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('does not match flow-php/etl'); - (new JsonLoader( + new JsonLoader( path('memory://out.json'), memory_filesystem(), JsonFraming::Array, new FlowPhpExtension(true, FlowPhpExtension::ABI + 1, '0.46.0'), - )) + ) ->inTask(new Part(0, 1, '1a2b3c4d5e6f7a8b', false)) ->writer( new StringDestinationStream(path('memory://other.json')), diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Loader/PhpJsonEncoderTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Loader/PhpJsonEncoderTest.php index acc4449f2a..fd8fa17415 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Loader/PhpJsonEncoderTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Loader/PhpJsonEncoderTest.php @@ -16,7 +16,6 @@ use Flow\Types\Value\Uuid; use Generator; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\Attributes\TestWith; use function array_map; @@ -196,16 +195,15 @@ public function test_encode_renders_a_column_by_its_type( array $values, string $expected, ): void { - static::assertSame($expected, (new PhpJsonEncoder())->encode( + static::assertSame($expected, new PhpJsonEncoder()->encode( array_to_rows(array_map(static fn(mixed $value): array => ['a' => $value], $values), schema($definition)), '|', )); } - #[RequiresPhp('>= 8.4.0')] public function test_encode_renders_html_as_its_markup(): void { - static::assertSame('{"doc":"<\/head>

a<\/p><\/body><\/html>","el":"

a<\/p>"}', (new PhpJsonEncoder())->encode( + static::assertSame('{"doc":"<\/head>

a<\/p><\/body><\/html>","el":"

a<\/p>"}', new PhpJsonEncoder()->encode( array_to_rows( [['doc' => '

a

', 'el' => '

a

']], schema(html_schema('doc'), html_element_schema('el')), @@ -218,7 +216,7 @@ public function test_encode_writes_one_object_per_row_in_schema_order(): void { static::assertSame('{"id":1,"name":"Alice","active":true,"score":9.5,"missing":null}' . "\n" - . '{"id":2,"name":"Bob","active":false,"score":1,"missing":"x"}', (new PhpJsonEncoder())->encode( + . '{"id":2,"name":"Bob","active":false,"score":1,"missing":"x"}', new PhpJsonEncoder()->encode( array_to_rows( [ ['name' => 'Alice', 'id' => 1, 'active' => true, 'score' => 9.5, 'missing' => null], @@ -238,7 +236,7 @@ public function test_encode_writes_one_object_per_row_in_schema_order(): void public function test_a_row_of_columns_named_0_and_1_is_an_object(): void { - static::assertSame('{"0":"a","1":"b"}', (new PhpJsonEncoder())->encode( + static::assertSame('{"0":"a","1":"b"}', new PhpJsonEncoder()->encode( array_to_rows([['0' => 'a', '1' => 'b']], schema(str_schema('0'), str_schema('1'))), ',', )); @@ -246,7 +244,7 @@ public function test_a_row_of_columns_named_0_and_1_is_an_object(): void public function test_encode_of_an_empty_batch_is_empty(): void { - static::assertSame('', (new PhpJsonEncoder())->encode(array_to_rows([], schema(int_schema('a'))), ',')); + static::assertSame('', new PhpJsonEncoder()->encode(array_to_rows([], schema(int_schema('a'))), ',')); } #[TestWith([JSON_THROW_ON_ERROR, '{"a":"a\/\u017c","f":1}'])] @@ -256,7 +254,7 @@ public function test_encode_of_an_empty_batch_is_empty(): void #[TestWith([JSON_PRETTY_PRINT, "{\n \"a\": \"a\\/\\u017c\",\n \"f\": 1\n}"])] public function test_encode_applies_the_flags(int $flags, string $expected): void { - static::assertSame($expected, (new PhpJsonEncoder($flags))->encode( + static::assertSame($expected, new PhpJsonEncoder($flags)->encode( array_to_rows([['a' => 'a/ż', 'f' => 1.0]], schema(str_schema('a'), float_schema('f'))), ',', )); @@ -264,11 +262,11 @@ public function test_encode_applies_the_flags(int $flags, string $expected): voi public function test_encode_uses_the_configured_formats_at_every_depth(): void { - static::assertSame('{"at":"01\/10\/2023 12:02","on":"2023\/10\/01","l":["01\/10\/2023 12:02"]}', (new PhpJsonEncoder( + static::assertSame('{"at":"01\/10\/2023 12:02","on":"2023\/10\/01","l":["01\/10\/2023 12:02"]}', new PhpJsonEncoder( JSON_THROW_ON_ERROR, 'd/m/Y H:i', 'Y/m/d', - ))->encode( + )->encode( array_to_rows( [[ 'at' => new DateTimeImmutable('2023-10-01 12:02:01 UTC'), @@ -308,7 +306,7 @@ public function test_a_not_finite_float_is_refused(int $flags): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Failed to encode JSON: Inf and NaN cannot be JSON encoded'); - (new PhpJsonEncoder($flags))->encode(array_to_rows([['f' => NAN]], schema(float_schema('f'))), ','); + new PhpJsonEncoder($flags)->encode(array_to_rows([['f' => NAN]], schema(float_schema('f'))), ','); } public function test_malformed_utf8_is_refused(): void @@ -318,7 +316,7 @@ public function test_malformed_utf8_is_refused(): void 'Failed to encode JSON: Malformed UTF-8 characters, possibly incorrectly encoded', ); - (new PhpJsonEncoder())->encode(array_to_rows([['s' => "\xff"]], schema(str_schema('s'))), ','); + new PhpJsonEncoder()->encode(array_to_rows([['s' => "\xff"]], schema(str_schema('s'))), ','); } public function test_fragments_are_the_json_text_of_every_cell(): void diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Schema/JsonSchema/ReferenceResolverTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Schema/JsonSchema/ReferenceResolverTest.php index cd5386a648..202da4b295 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Schema/JsonSchema/ReferenceResolverTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Schema/JsonSchema/ReferenceResolverTest.php @@ -21,7 +21,7 @@ final class ReferenceResolverTest extends FlowTestCase { public function test_load_from_path(): void { - $loaded = (new ReferenceResolver())->load(path(__DIR__ . '/../../../../Fixtures/json-schema/address.json')); + $loaded = new ReferenceResolver()->load(path(__DIR__ . '/../../../../Fixtures/json-schema/address.json')); static::assertSame('object', $loaded->schema['type']); static::assertSame($loaded->schema, $loaded->document); @@ -42,7 +42,7 @@ public function test_load_honors_document_id_as_base_uri(): void ), ); - $loaded = (new ReferenceResolver($client, new Psr17Factory()))->load('https://cdn.example.com/root.json'); + $loaded = new ReferenceResolver($client, new Psr17Factory())->load('https://cdn.example.com/root.json'); static::assertSame('https://example.com/schemas/root.json', $loaded->baseUri); } @@ -52,12 +52,12 @@ public function test_resolve_anchor_reference_is_not_supported(): void $this->expectException(UnsupportedKeywordException::class); $this->expectExceptionMessage('JSON Schema keyword "$anchor"'); - (new ReferenceResolver())->resolve('#address', '', ['$defs' => []]); + new ReferenceResolver()->resolve('#address', '', ['$defs' => []]); } public function test_resolve_deep_pointer_with_escaped_segments(): void { - $resolved = (new ReferenceResolver())->resolve('#/$defs/paths/~1users~1id/schema', '', [ + $resolved = new ReferenceResolver()->resolve('#/$defs/paths/~1users~1id/schema', '', [ '$defs' => ['paths' => ['/users/id' => ['schema' => ['type' => 'string']]]], ]); @@ -92,7 +92,7 @@ public function test_resolve_internal_pointer_via_defs(): void { $document = ['$defs' => ['money' => ['type' => 'object']]]; - $resolved = (new ReferenceResolver())->resolve('#/$defs/money', 'file://schemas/root.json', $document); + $resolved = new ReferenceResolver()->resolve('#/$defs/money', 'file://schemas/root.json', $document); static::assertSame(['type' => 'object'], $resolved->schema); static::assertSame($document, $resolved->document); @@ -102,7 +102,7 @@ public function test_resolve_internal_pointer_via_defs(): void public function test_resolve_internal_pointer_via_legacy_definitions(): void { - $resolved = (new ReferenceResolver())->resolve('#/definitions/status', '', [ + $resolved = new ReferenceResolver()->resolve('#/definitions/status', '', [ 'definitions' => ['status' => ['type' => 'string']], ]); @@ -114,7 +114,7 @@ public function test_resolve_pointer_to_missing_segment_throws_exception(): void $this->expectException(UnresolvableReferenceException::class); $this->expectExceptionMessage('pointer segment "missing" does not exist'); - (new ReferenceResolver())->resolve('#/$defs/missing', '', ['$defs' => []]); + new ReferenceResolver()->resolve('#/$defs/missing', '', ['$defs' => []]); } public function test_resolve_pointer_to_scalar_throws_exception(): void @@ -122,7 +122,7 @@ public function test_resolve_pointer_to_scalar_throws_exception(): void $this->expectException(UnresolvableReferenceException::class); $this->expectExceptionMessage('reference target is not a schema object'); - (new ReferenceResolver())->resolve('#/$defs/name', '', ['$defs' => ['name' => 'scalar']]); + new ReferenceResolver()->resolve('#/$defs/name', '', ['$defs' => ['name' => 'scalar']]); } public function test_resolve_relative_file_reference(): void @@ -164,7 +164,7 @@ public function test_resolve_relative_reference_without_base_uri_throws_exceptio $this->expectException(UnresolvableReferenceException::class); $this->expectExceptionMessage('relative reference cannot be resolved without a base URI'); - (new ReferenceResolver())->resolve('address.json#/properties/street', '', []); + new ReferenceResolver()->resolve('address.json#/properties/street', '', []); } public function test_resolve_remote_reference(): void @@ -180,7 +180,7 @@ public function test_resolve_remote_reference(): void ), ); - $resolved = (new ReferenceResolver($client, new Psr17Factory()))->resolve( + $resolved = new ReferenceResolver($client, new Psr17Factory())->resolve( 'https://example.com/common.json#/$defs/status', '', [], @@ -204,7 +204,7 @@ public function test_resolve_remote_reference_relative_to_remote_base_uri(): voi ), ); - $resolved = (new ReferenceResolver($client, new Psr17Factory()))->resolve( + $resolved = new ReferenceResolver($client, new Psr17Factory())->resolve( 'common.json#/$defs/status', 'https://example.com/schemas/root.json', [], @@ -222,7 +222,7 @@ public function test_resolve_remote_reference_returning_invalid_json_throws_exce $this->expectException(UnresolvableReferenceException::class); $this->expectExceptionMessage('is not a valid JSON object'); - (new ReferenceResolver($client, new Psr17Factory()))->resolve( + new ReferenceResolver($client, new Psr17Factory())->resolve( 'https://example.com/common.json#/$defs/status', '', [], @@ -237,7 +237,7 @@ public function test_resolve_remote_reference_returning_non_200_status_throws_ex $this->expectException(UnresolvableReferenceException::class); $this->expectExceptionMessage('returned status code 404'); - (new ReferenceResolver($client, new Psr17Factory()))->resolve( + new ReferenceResolver($client, new Psr17Factory())->resolve( 'https://example.com/common.json#/$defs/status', '', [], @@ -251,7 +251,7 @@ public function test_resolve_remote_reference_without_client_throws_exception(): 'resolving remote references requires a PSR-18 http client and a PSR-17 request factory', ); - (new ReferenceResolver())->resolve('https://example.com/common.json#/$defs/status', '', []); + new ReferenceResolver()->resolve('https://example.com/common.json#/$defs/status', '', []); } public function test_resolve_whole_document_reference_without_pointer(): void @@ -259,7 +259,7 @@ public function test_resolve_whole_document_reference_without_pointer(): void $client = new Client(); $client->addResponse(new Response(200, [], (string) json_encode(['type' => 'object']))); - $resolved = (new ReferenceResolver($client, new Psr17Factory()))->resolve( + $resolved = new ReferenceResolver($client, new Psr17Factory())->resolve( 'https://example.com/common.json', '', [], diff --git a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Schema/SchemaConverterTest.php b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Schema/SchemaConverterTest.php index 1c233f6542..ff3fc8476e 100644 --- a/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Schema/SchemaConverterTest.php +++ b/src/adapter/etl-adapter-json/tests/Flow/ETL/Adapter/JSON/Tests/Unit/IO/Schema/SchemaConverterTest.php @@ -53,7 +53,7 @@ public function test_to_flow_all_of_merges_object_schemas(): void { static::assertEquals( schema(structure_schema('profile', type_structure(['name' => type_string(), 'age' => type_integer()]))), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['profile'], 'properties' => [ @@ -81,7 +81,7 @@ public function test_to_flow_all_of_with_conflicting_types_throws_exception(): v $this->expectException(UnsupportedKeywordException::class); $this->expectExceptionMessage('JSON Schema keyword "allOf" at path "value"'); - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'properties' => [ 'value' => ['allOf' => [['type' => 'string'], ['type' => 'integer']]], @@ -93,7 +93,7 @@ public function test_to_flow_any_of_with_heterogeneous_members_is_refused(): voi { $this->expectException(UnsupportedUnionTypeException::class); - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['value'], 'properties' => [ @@ -106,7 +106,7 @@ public function test_to_flow_any_of_with_null_member_becomes_nullable(): void { static::assertEquals( schema(str_schema('value', true)), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['value'], 'properties' => [ @@ -120,7 +120,7 @@ public function test_to_flow_any_of_with_only_null_members_becomes_null_definiti { static::assertEquals( schema(null_schema('value')), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'properties' => [ 'value' => ['anyOf' => [['type' => 'null']]], @@ -133,7 +133,7 @@ public function test_to_flow_array_without_items_becomes_json(): void { static::assertEquals( schema(json_schema('values')), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['values'], 'properties' => [ @@ -147,7 +147,7 @@ public function test_to_flow_basic_types(): void { static::assertEquals( schema(int_schema('id'), str_schema('name'), float_schema('price'), bool_schema('active')), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['id', 'name', 'price', 'active'], 'properties' => [ @@ -165,7 +165,7 @@ public function test_to_flow_circular_reference_throws_exception(): void $this->expectException(CircularReferenceException::class); $this->expectExceptionMessage('Circular reference detected: "#/$defs/node"'); - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'properties' => [ 'node' => ['$ref' => '#/$defs/node'], @@ -183,7 +183,7 @@ public function test_to_flow_const_becomes_scalar_with_enum_metadata(): void { static::assertEquals( schema(str_schema('status', metadata: Metadata::with(JsonSchemaMetadata::ENUM->value, ['fixed']))), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['status'], 'properties' => [ @@ -198,7 +198,7 @@ public function test_to_flow_boolean_false_property_schema_throws_exception(): v $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('JSON Schema "false" at path "nothing" rejects all values'); - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'properties' => [ 'nothing' => false, @@ -210,7 +210,7 @@ public function test_to_flow_boolean_true_property_schema_becomes_json_with_any_ { static::assertEquals( schema(json_schema('anything', true, Metadata::with(JsonSchemaMetadata::ANY->value, true))), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'properties' => [ 'anything' => true, @@ -226,7 +226,7 @@ public function test_to_flow_boolean_true_property_schema_inside_nested_structur 'name' => type_string(), 'payload' => type_json(), ]))), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['profile'], 'properties' => [ @@ -247,7 +247,7 @@ public function test_to_flow_empty_property_schema_becomes_json_with_any_marker( { static::assertEquals( schema(json_schema('anything', true, Metadata::with(JsonSchemaMetadata::ANY->value, true))), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'properties' => [ 'anything' => [], @@ -260,7 +260,7 @@ public function test_to_flow_enum_with_heterogeneous_values_is_refused(): void { $this->expectException(UnsupportedUnionTypeException::class); - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['value'], 'properties' => [ @@ -273,7 +273,7 @@ public function test_to_flow_enum_with_homogeneous_values_becomes_scalar(): void { static::assertEquals( schema(str_schema('status', metadata: Metadata::with(JsonSchemaMetadata::ENUM->value, ['on', 'off']))), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['status'], 'properties' => [ @@ -288,7 +288,7 @@ public function test_to_flow_enum_with_non_scalar_values_throws_exception(): voi $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('JSON Schema "enum" at path "value" must contain only scalar or null values'); - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'properties' => [ 'value' => ['enum' => [['nested' => 'array']]], @@ -300,7 +300,7 @@ public function test_to_flow_enum_with_null_value_becomes_nullable(): void { static::assertEquals( schema(str_schema('status', true, Metadata::with(JsonSchemaMetadata::ENUM->value, ['on', 'off']))), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['status'], 'properties' => [ @@ -314,7 +314,7 @@ public function test_to_flow_free_form_object_becomes_json(): void { static::assertEquals( schema(json_schema('attributes')), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['attributes'], 'properties' => [ @@ -331,7 +331,7 @@ public function test_to_flow_internal_reference_via_defs(): void 'amount' => type_float(), 'currency' => structure_element('currency', type_string(), optional: true), ]))), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['money'], 'properties' => [ @@ -355,7 +355,7 @@ public function test_to_flow_internal_reference_via_legacy_definitions(): void { static::assertEquals( schema(str_schema('status')), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['status'], 'properties' => [ @@ -373,7 +373,7 @@ public function test_to_flow_invalid_json_string_throws_exception(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('JSON Schema document is not valid JSON'); - (new SchemaConverter())->toFlowSchema('{invalid'); + new SchemaConverter()->toFlowSchema('{invalid'); } public function test_to_flow_nested_structures_lists_and_maps(): void @@ -387,7 +387,7 @@ public function test_to_flow_nested_structures_lists_and_maps(): void 'quantity' => structure_element('quantity', type_integer(), optional: true), ])), )), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['orders'], 'properties' => [ @@ -413,7 +413,7 @@ public function test_to_flow_nested_union_inside_structure_is_refused(): void $this->expectException(UnsupportedUnionTypeException::class); $this->expectExceptionMessage('Column "config" cannot hold elements of type "integer|string"'); - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['config'], 'properties' => [ @@ -433,7 +433,7 @@ public function test_to_flow_items_any_of_is_refused(): void $this->expectException(UnsupportedUnionTypeException::class); $this->expectExceptionMessage('Column "tags" cannot hold elements of type "integer|string"'); - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['tags'], 'properties' => [ @@ -446,7 +446,7 @@ public function test_to_flow_items_nullable_type_is_an_optional_element(): void { static::assertSame( 'list', - (new SchemaConverter()) + new SchemaConverter() ->toFlowSchema([ 'type' => 'object', 'required' => ['tags'], @@ -467,7 +467,7 @@ public function test_to_flow_object_and_array_type_union_becomes_json(): void { static::assertEquals( schema(json_schema('document')), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['document'], 'properties' => [ @@ -484,7 +484,7 @@ public function test_to_flow_prefix_items_becomes_json_with_metadata(): void ['type' => 'string'], ['type' => 'integer'], ]))), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['pair'], 'properties' => [ @@ -496,7 +496,7 @@ public function test_to_flow_prefix_items_becomes_json_with_metadata(): void public function test_to_flow_property_annotations_are_stored_in_metadata(): void { - $flowSchema = (new SchemaConverter())->toFlowSchema([ + $flowSchema = new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['name'], 'properties' => [ @@ -546,7 +546,7 @@ public function test_to_flow_path_document_with_cross_file_references(): void true, ), ), - (new SchemaConverter())->toFlowSchema(path(__DIR__ . '/../../../Fixtures/json-schema/person.json')), + new SchemaConverter()->toFlowSchema(path(__DIR__ . '/../../../Fixtures/json-schema/person.json')), ); } @@ -554,7 +554,7 @@ public function test_to_flow_property_not_in_required_becomes_nullable(): void { static::assertEquals( schema(int_schema('id'), str_schema('note', true)), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['id'], 'properties' => [ @@ -569,7 +569,7 @@ public function test_to_flow_raw_json_string_document(): void { static::assertEquals( schema(int_schema('id')), - (new SchemaConverter())->toFlowSchema( + new SchemaConverter()->toFlowSchema( '{"type":"object","required":["id"],"properties":{"id":{"type":"integer"}}}', ), ); @@ -580,7 +580,7 @@ public function test_to_flow_remote_reference_without_client_throws_exception(): $this->expectException(UnresolvableReferenceException::class); $this->expectExceptionMessage('resolving remote references requires a PSR-18 http client'); - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'properties' => [ 'remote' => ['$ref' => 'https://example.com/schema.json#/$defs/x'], @@ -593,7 +593,7 @@ public function test_to_flow_root_without_object_type_throws_exception(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('JSON Schema root must have type "object"'); - (new SchemaConverter())->toFlowSchema(['type' => 'array', 'items' => ['type' => 'string']]); + new SchemaConverter()->toFlowSchema(['type' => 'array', 'items' => ['type' => 'string']]); } public function test_to_flow_root_without_properties_throws_exception(): void @@ -601,7 +601,7 @@ public function test_to_flow_root_without_properties_throws_exception(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('JSON Schema root must have "properties"'); - (new SchemaConverter())->toFlowSchema(['type' => 'object']); + new SchemaConverter()->toFlowSchema(['type' => 'object']); } public function test_to_flow_string_formats(): void @@ -614,7 +614,7 @@ public function test_to_flow_string_formats(): void uuid_schema('uuid'), str_schema('email', metadata: Metadata::with(JsonSchemaMetadata::FORMAT->value, 'email')), ), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['created_date', 'created_at', 'created_time', 'uuid', 'email'], 'properties' => [ @@ -632,7 +632,7 @@ public function test_to_flow_type_list_with_null_becomes_nullable(): void { static::assertEquals( schema(float_schema('score', true)), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['score'], 'properties' => [ @@ -646,7 +646,7 @@ public function test_to_flow_type_list_with_null_and_multiple_types_is_refused() { $this->expectException(UnsupportedUnionTypeException::class); - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['value'], 'properties' => [ @@ -659,7 +659,7 @@ public function test_to_flow_type_null_becomes_null_definition(): void { static::assertEquals( schema(null_schema('nothing')), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'properties' => [ 'nothing' => ['type' => 'null'], @@ -673,7 +673,7 @@ public function test_to_flow_unknown_type_throws_exception(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Unsupported JSON Schema type "money" at path "value"'); - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'properties' => [ 'value' => ['type' => 'money'], @@ -699,7 +699,7 @@ public function test_to_flow_unsupported_keywords_throw_exception(string $keywor $this->expectException(UnsupportedKeywordException::class); $this->expectExceptionMessage(sprintf('JSON Schema keyword "%s" at path "value"', $keyword)); - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'properties' => [ 'value' => ['type' => 'string', $keyword => []], @@ -748,7 +748,7 @@ public function test_to_json_schema_interleaved_structure_lists_required_fields_ ], 'required' => ['s'], ], - (new SchemaConverter())->toJsonSchema(schema(structure_schema('s', type_structure([ + new SchemaConverter()->toJsonSchema(schema(structure_schema('s', type_structure([ 'z' => type_integer(), 'a' => structure_element('a', type_string(), optional: true), 'b' => type_string(), @@ -790,7 +790,7 @@ public function test_to_json_schema_any_marked_definition_becomes_boolean_true_s 'type' => 'object', 'properties' => ['anything' => true], ], - (new SchemaConverter())->toJsonSchema(schema(json_schema( + new SchemaConverter()->toJsonSchema(schema(json_schema( 'anything', true, Metadata::with(JsonSchemaMetadata::ANY->value, true), @@ -806,7 +806,7 @@ public function test_to_json_schema_any_marked_definition_with_annotations_keeps 'type' => 'object', 'properties' => ['anything' => ['description' => 'accepts anything']], ], - (new SchemaConverter())->toJsonSchema(schema(json_schema( + new SchemaConverter()->toJsonSchema(schema(json_schema( 'anything', true, Metadata::with(JsonSchemaMetadata::ANY->value, true)->add( @@ -822,7 +822,7 @@ public function test_to_json_schema_empty_schema_throws_exception(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Cannot convert empty Flow schema to JSON Schema'); - (new SchemaConverter())->toJsonSchema(schema()); + new SchemaConverter()->toJsonSchema(schema()); } public function test_to_json_schema_basic_types_and_required(): void @@ -839,7 +839,7 @@ public function test_to_json_schema_basic_types_and_required(): void ], 'required' => ['id', 'price', 'active'], ], - (new SchemaConverter())->toJsonSchema(schema( + new SchemaConverter()->toJsonSchema(schema( int_schema('id'), str_schema('name', true), float_schema('price'), @@ -861,7 +861,7 @@ public function test_to_json_schema_enum_definitions(): void ], 'required' => ['string_enum', 'int_enum', 'unit_enum'], ], - (new SchemaConverter())->toJsonSchema(schema( + new SchemaConverter()->toJsonSchema(schema( enum_schema('string_enum', BackedStringEnum::class), enum_schema('int_enum', BackedIntEnum::class), enum_schema('unit_enum', BasicEnum::class), @@ -878,7 +878,7 @@ public function test_to_json_schema_list_of_mixed_omits_items(): void 'properties' => ['values' => ['type' => 'array']], 'required' => ['values'], ], - (new SchemaConverter())->toJsonSchema(schema(list_schema('values', type_list(type_mixed())))), + new SchemaConverter()->toJsonSchema(schema(list_schema('values', type_list(type_mixed())))), ); } @@ -896,7 +896,7 @@ public function test_to_json_schema_logical_string_types_use_formats(): void ], 'required' => ['created_date', 'created_at', 'created_time', 'uuid'], ], - (new SchemaConverter())->toJsonSchema(schema( + new SchemaConverter()->toJsonSchema(schema( date_schema('created_date'), datetime_schema('created_at'), time_schema('created_time'), @@ -914,7 +914,7 @@ public function test_to_json_schema_map_of_mixed_omits_additional_properties(): 'properties' => ['attributes' => ['type' => 'object']], 'required' => ['attributes'], ], - (new SchemaConverter())->toJsonSchema(schema(map_schema('attributes', type_map( + new SchemaConverter()->toJsonSchema(schema(map_schema('attributes', type_map( type_string(), type_mixed(), )))), @@ -926,7 +926,7 @@ public function test_to_json_schema_map_with_non_string_keys_throws_exception(): $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Only maps with string keys can be converted to JSON Schema'); - (new SchemaConverter())->toJsonSchema(schema(map_schema('lookup', type_map(type_integer(), type_string())))); + new SchemaConverter()->toJsonSchema(schema(map_schema('lookup', type_map(type_integer(), type_string())))); } public function test_to_json_schema_metadata_is_reemitted_as_keywords(): void @@ -945,7 +945,7 @@ public function test_to_json_schema_metadata_is_reemitted_as_keywords(): void ], 'required' => ['name'], ], - (new SchemaConverter())->toJsonSchema(schema(str_schema('name', metadata: Metadata::empty()->add( + new SchemaConverter()->toJsonSchema(schema(str_schema('name', metadata: Metadata::empty()->add( JsonSchemaMetadata::DESCRIPTION->value, 'Full name', )->add(JsonSchemaMetadata::PATTERN->value, '^[a-z]+$')->add(JsonSchemaMetadata::FORMAT->value, 'email')))), @@ -960,7 +960,7 @@ public function test_to_json_schema_null_definition(): void 'type' => 'object', 'properties' => ['nothing' => ['type' => 'null']], ], - (new SchemaConverter())->toJsonSchema(schema(null_schema('nothing'))), + new SchemaConverter()->toJsonSchema(schema(null_schema('nothing'))), ); } @@ -975,7 +975,7 @@ public function test_to_json_schema_prefix_items_metadata_restores_tuple(): void ], 'required' => ['pair'], ], - (new SchemaConverter())->toJsonSchema(schema(json_schema('pair', metadata: Metadata::with( + new SchemaConverter()->toJsonSchema(schema(json_schema('pair', metadata: Metadata::with( JsonSchemaMetadata::PREFIX_ITEMS->value, [['type' => 'string'], ['type' => 'integer']], )))), @@ -1000,7 +1000,7 @@ public function test_to_json_schema_structure_with_optional_elements(): void ], 'required' => ['address'], ], - (new SchemaConverter())->toJsonSchema(schema(structure_schema('address', type_structure([ + new SchemaConverter()->toJsonSchema(schema(structure_schema('address', type_structure([ 'street' => type_string(), 'zip' => structure_element('zip', type_optional(type_string()), optional: true), ])))), @@ -1014,7 +1014,7 @@ public function test_to_flow_nullable_structure_member_uses_optional_type(): voi 'name' => type_string(), 'age' => type_optional(type_integer()), ]))), - (new SchemaConverter())->toFlowSchema([ + new SchemaConverter()->toFlowSchema([ 'type' => 'object', 'required' => ['profile'], 'properties' => [ diff --git a/src/adapter/etl-adapter-logger/composer.json b/src/adapter/etl-adapter-logger/composer.json index 12eb254f9f..5ee970173e 100644 --- a/src/adapter/etl-adapter-logger/composer.json +++ b/src/adapter/etl-adapter-logger/composer.json @@ -11,7 +11,7 @@ "psr" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/etl": "self.version", "psr/log": "^2.0 || ^3.0" }, diff --git a/src/adapter/etl-adapter-logger/tests/Flow/ETL/Adapter/Logger/Tests/Unit/DescribableRoundTripTest.php b/src/adapter/etl-adapter-logger/tests/Flow/ETL/Adapter/Logger/Tests/Unit/DescribableRoundTripTest.php index ee81499f9d..f4fdd9e288 100644 --- a/src/adapter/etl-adapter-logger/tests/Flow/ETL/Adapter/Logger/Tests/Unit/DescribableRoundTripTest.php +++ b/src/adapter/etl-adapter-logger/tests/Flow/ETL/Adapter/Logger/Tests/Unit/DescribableRoundTripTest.php @@ -6,7 +6,6 @@ use Flow\ETL\Adapter\Logger\Tests\Context\DescribableFixtures; use Flow\ETL\Foundation\Describe\Describable; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Foundation\Exception\RuntimeException; use Flow\ETL\Tests\Context\DescribeRoundTrip; use Flow\ETL\Tests\Context\ExtractorClasses; @@ -58,11 +57,7 @@ public function test_a_rebuilt_describable_equals_the_described_one(string $clas $this->expectException(RuntimeException::class); } - try { - $describable = DescribableFixtures::all()[$class](); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $describable = DescribableFixtures::all()[$class](); if (in_array($class, DescribableFixtures::undescribable(), true)) { static::assertNull($describable->describe()); diff --git a/src/adapter/etl-adapter-logger/tests/Flow/ETL/Adapter/Logger/Tests/Unit/IO/Loader/PsrLoggerLoaderTest.php b/src/adapter/etl-adapter-logger/tests/Flow/ETL/Adapter/Logger/Tests/Unit/IO/Loader/PsrLoggerLoaderTest.php index a571e5ad14..bbaa795a0a 100644 --- a/src/adapter/etl-adapter-logger/tests/Flow/ETL/Adapter/Logger/Tests/Unit/IO/Loader/PsrLoggerLoaderTest.php +++ b/src/adapter/etl-adapter-logger/tests/Flow/ETL/Adapter/Logger/Tests/Unit/IO/Loader/PsrLoggerLoaderTest.php @@ -39,7 +39,7 @@ public function test_a_json_column_is_logged_as_an_array(): void { $logger = new TestLogger(); - (new PsrLoggerLoader($logger, 'row log'))->load(array_to_rows([['payload' => Json::fromArray([ + new PsrLoggerLoader($logger, 'row log')->load(array_to_rows([['payload' => Json::fromArray([ 'a' => 1, ])]], schema(json_schema('payload'))), flow_context(config())->backend()); diff --git a/src/adapter/etl-adapter-parquet/composer.json b/src/adapter/etl-adapter-parquet/composer.json index 68dd7cc670..b983529cfd 100644 --- a/src/adapter/etl-adapter-parquet/composer.json +++ b/src/adapter/etl-adapter-parquet/composer.json @@ -11,7 +11,7 @@ "adapter" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "ext-json": "*", "flow-php/etl": "self.version", "flow-php/parquet": "self.version" diff --git a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/ConfiguredParquetEngine.php b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/ConfiguredParquetEngine.php index 3081af3cbb..96a04fa3f3 100644 --- a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/ConfiguredParquetEngine.php +++ b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/ConfiguredParquetEngine.php @@ -43,7 +43,7 @@ public static function fromDescription(#[SensitiveParameter] array $data, Rebuil { $class = type_string()->assert($data['engine'] ?? null); - if (!is_a($class, ParquetEngine::class, true) || (new ReflectionClass($class))->isAbstract()) { + if (!is_a($class, ParquetEngine::class, true) || new ReflectionClass($class)->isAbstract()) { throw InvalidArgumentException::because('%s is not a concrete ParquetEngine', $class); } @@ -54,7 +54,7 @@ public static function fromDescription(#[SensitiveParameter] array $data, Rebuil public function describe(): ?Description { $configuration = $this->engine->normalize(); - $module = (new ReflectionClass($this->engine))->getExtensionName(); + $module = new ReflectionClass($this->engine)->getExtensionName(); return ( $configuration === null diff --git a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/ParquetExtractor.php b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/ParquetExtractor.php index 8257ac626d..34dd10bba0 100644 --- a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/ParquetExtractor.php +++ b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/ParquetExtractor.php @@ -247,10 +247,8 @@ public function partitionTypes(PartitionTypes $types): static public function prunes(ScalarFunction $conjunct): bool { return ( - (new FilterTranslator())->translate( - [$conjunct], - $this->fileColumns->columns()->withoutTail($this->schema()), - ) !== [] + new FilterTranslator()->translate([$conjunct], $this->fileColumns->columns()->withoutTail($this->schema())) + !== [] ); } diff --git a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/ParquetFileBatches.php b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/ParquetFileBatches.php index d606f593d6..21980769df 100644 --- a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/ParquetFileBatches.php +++ b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/ParquetFileBatches.php @@ -108,18 +108,18 @@ public function batches( ReadWindow $window, ): Generator { if ($this->translatedFor !== $criteria) { - $this->conjuncts = (new FilterTranslator())->translate($criteria->conjuncts, $body); + $this->conjuncts = new FilterTranslator()->translate($criteria->conjuncts, $body); $this->translatedFor = $criteria; } $split = $criteria->split; - $file = $this->firstFile?->forSource($source) ?? (new ParquetSourceFileOpener( + $file = $this->firstFile?->forSource($source) ?? new ParquetSourceFileOpener( $read->files->filesystem, $this->engine, $this->options, $this->schemaConverter, $this->columns, - ))->open($source); + )->open($source); $this->firstFile = null; $opened = null; @@ -166,7 +166,7 @@ public function batches( // a conjunct over partition columns is one value per file, so TRUE for the file is TRUE for every row if ( $partitionOnly - && (new ScalarFunctionFilter($conjunct, $partitions, $backend))->accept( + && new ScalarFunctionFilter($conjunct, $partitions, $backend)->accept( new FileStatus($source->path, true), ) ) { diff --git a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/PhpParquetOpenSource.php b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/PhpParquetOpenSource.php index 3424e06d4e..5919d162d4 100644 --- a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/PhpParquetOpenSource.php +++ b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/PhpParquetOpenSource.php @@ -73,7 +73,7 @@ public function batches(Schema $schema, int $batchSize, ReadPlan $plan, Backend $logical[$definition->name()] = $fileType === null || $comparator->equals(type_bare($fileType), type_bare($definition->type())) ? null - : (new PhysicalFor())->physical($fileType); + : new PhysicalFor()->physical($fileType); } $rows = diff --git a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/Pushdown/FilterTranslator.php b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/Pushdown/FilterTranslator.php index f8211a0fe3..5ae4b7c6ae 100644 --- a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/Pushdown/FilterTranslator.php +++ b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Extractor/Pushdown/FilterTranslator.php @@ -78,7 +78,7 @@ public function translate(array $conjuncts, Schema $body): array if ($parquet !== null) { $translated[$position] = new TranslatedConjunct( $parquet, - array_values((new ReferencedColumns())->in($conjunct)->names()), + array_values(new ReferencedColumns()->in($conjunct)->names()), !$this->listsNull($conjunct), array_values(array_unique($this->nanSensitiveColumns($parquet, $body))), ); @@ -355,7 +355,7 @@ private function literal(Type $column, Type $literal, mixed $value, bool $orderi => $value instanceof DateTimeInterface ? $value : null, $column::class !== $literal::class, $ordering && $column instanceof UuidType, - !(new ComparableValues())->equalByPhysical($column), + !new ComparableValues()->equalByPhysical($column), => null, $value instanceof Uuid => $value->toString(), is_bool($value), diff --git a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Loader/ParquetLoader.php b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Loader/ParquetLoader.php index 22a3159791..3683e059fe 100644 --- a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Loader/ParquetLoader.php +++ b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Loader/ParquetLoader.php @@ -83,10 +83,10 @@ public function __construct(Path $path, Filesystem $filesystem = new NativeLocal public static function fromDescription(#[SensitiveParameter] array $data, Rebuild $rebuild): static { - $loader = (new self( + $loader = new self( Path::fromArray(type_array()->assert($data['path'] ?? null)), $rebuild->of($data['filesystem'] ?? null, ConfiguredFilesystem::class)->filesystem(), - )) + ) ->saveMode(type_enum(SaveMode::class)->assert(constant( SaveMode::class . '::' . type_string()->assert($data['save_mode'] ?? null), ))) @@ -141,7 +141,7 @@ public function describe(): ?Description ...ConfiguredParquetEngine::EXTENSIONS, ...match (true) { $this->engine === null => FlowPhpExtension::detect()->available() ? ['flow_php'] : $codecs, - is_string((new ReflectionClass($this->engine))->getExtensionName()) => [], + is_string(new ReflectionClass($this->engine)->getExtensionName()) => [], default => $codecs, }, ], @@ -191,7 +191,7 @@ public function partitioning(): Partitioning public function inTask(Part $task): static { - $loader = (new self($this->path, $this->filesystem)) + $loader = new self($this->path, $this->filesystem) ->saveMode($this->saveMode) ->withCompressions($this->compressions) ->withEngine($this->engine) diff --git a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Loader/ParquetSchemaConformance.php b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Loader/ParquetSchemaConformance.php index 932edc767c..4fdb90d242 100644 --- a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Loader/ParquetSchemaConformance.php +++ b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/IO/Loader/ParquetSchemaConformance.php @@ -25,7 +25,7 @@ public function __construct(ParquetSchema $schema) { $definitions = []; - foreach ((new SchemaConverter()) + foreach (new SchemaConverter() ->toFlowSchema($schema) ->definitions() as $definition) { $definitions[$definition->name()] = $definition; diff --git a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/functions.php b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/functions.php index a0f2545c4e..b931a19399 100644 --- a/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/functions.php +++ b/src/adapter/etl-adapter-parquet/src/Flow/ETL/Adapter/Parquet/functions.php @@ -24,7 +24,6 @@ use function count; use function Flow\Filesystem\DSL\path_real; -use function Flow\Parquet\empty_generator as parquet_empty_generator; use function is_string; /** @@ -43,7 +42,7 @@ function from_parquet( ?ParquetEngine $engine = null, Filesystem $filesystem = new NativeLocalFilesystem(), ): ParquetExtractor { - $loader = (new ParquetExtractor(is_string($path) ? path_real($path) : $path, $filesystem)) + $loader = new ParquetExtractor(is_string($path) ? path_real($path) : $path, $filesystem) ->withOptions($options) ->withByteOrder($byte_order) ->withEngine($engine); @@ -71,7 +70,7 @@ function to_parquet( ?ParquetEngine $engine = null, Filesystem $filesystem = new NativeLocalFilesystem(), ): ParquetLoader { - $loader = (new ParquetLoader(is_string($path) ? path_real($path) : $path, $filesystem)) + $loader = new ParquetLoader(is_string($path) ? path_real($path) : $path, $filesystem) ->withCompressions($compressions) ->withEngine($engine); @@ -101,23 +100,14 @@ function array_to_generator(array $data): Generator } } -/** - * @deprecated use Flow\Parquet\empty_generator() instead - */ -#[DocumentationDSL(module: Module::PARQUET, type: DSLType::HELPER)] -function empty_generator(): Generator -{ - return parquet_empty_generator(); -} - #[DocumentationDSL(module: Module::PARQUET, type: DSLType::HELPER)] function schema_to_parquet(Schema $schema): ParquetSchema { - return (new SchemaConverter())->toParquetSchema($schema); + return new SchemaConverter()->toParquetSchema($schema); } #[DocumentationDSL(module: Module::PARQUET, type: DSLType::HELPER)] function schema_from_parquet(ParquetSchema $schema): Schema { - return (new SchemaConverter())->toFlowSchema($schema); + return new SchemaConverter()->toFlowSchema($schema); } diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Context/ParquetFilesContext.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Context/ParquetFilesContext.php index bbde7ed426..e4a6b22fd7 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Context/ParquetFilesContext.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Context/ParquetFilesContext.php @@ -68,7 +68,7 @@ public static function plan( ?int $limit = null, ?ParquetFilter $filter = null, ): ReadPlan { - $file = (new Reader())->readStream($filesystem->readFrom(path($uri))); + $file = new Reader()->readStream($filesystem->readFrom(path($uri))); return ReadPlan::forFilter( $file->reader()->footer(), @@ -86,7 +86,7 @@ public static function columnNames(Filesystem $filesystem, string $uri): array { return array_map( static fn(Column $column): string => $column->name(), - (new Reader()) + new Reader() ->readStream($filesystem->readFrom(path($uri))) ->schema() ->columns(), @@ -99,7 +99,7 @@ public static function columnNames(Filesystem $filesystem, string $uri): array public static function values(Filesystem $filesystem, string $uri): array { return iterator_to_array( - (new Reader()) + new Reader() ->readStream($filesystem->readFrom(path($uri))) ->values(), false, @@ -238,9 +238,9 @@ public static function scores( public static function writtenThroughTheLoader(Rows $rows): array { $filesystem = memory_filesystem(); - $parquetSchema = (new SchemaConverter())->toParquetSchema($rows->schema()); + $parquetSchema = new SchemaConverter()->toParquetSchema($rows->schema()); $writer = new ParquetFileWriter( - (new PhpParquetEngine())->openForWrite( + new PhpParquetEngine()->openForWrite( $filesystem->writeTo(path('memory://loader.parquet')), $parquetSchema, Compressions::SNAPPY, @@ -261,7 +261,7 @@ public static function writtenThroughTheLoader(Rows $rows): array public static function phpEngineValues(Filesystem $filesystem, string $uri): array { return iterator_to_array( - (new Reader(engine: new PhpParquetEngine())) + new Reader(engine: new PhpParquetEngine()) ->readStream($filesystem->readFrom(path($uri))) ->values(), false, @@ -270,10 +270,10 @@ public static function phpEngineValues(Filesystem $filesystem, string $uri): arr public static function nativeWriter(Filesystem $filesystem, string $uri, FlowSchema $schema): RustParquetFileWriter { - $parquetSchema = (new SchemaConverter())->toParquetSchema($schema); + $parquetSchema = new SchemaConverter()->toParquetSchema($schema); return new RustParquetFileWriter( - (new FlowPhpParquetEngine())->openForWrite( + new FlowPhpParquetEngine()->openForWrite( $filesystem->writeTo(path($uri)), $parquetSchema, Compressions::SNAPPY, diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Context/PushdownParityContext.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Context/PushdownParityContext.php index 158c850cef..c8348dc719 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Context/PushdownParityContext.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Context/PushdownParityContext.php @@ -88,9 +88,9 @@ public static function write(Filesystem $filesystem): void 'd92' => $id + 0.25, 'd182' => $id + 0.25, 'tenth' => $id + 0.1, - 'day' => (new DateTimeImmutable('2024-01-01'))->modify(sprintf('+%d days', $id)), - 'ts_us' => (new DateTimeImmutable('2024-01-01 00:00:00.123456'))->modify(sprintf('+%d hours', $id)), - 'ts_ns' => (new DateTimeImmutable('2024-01-01 00:00:00.123456'))->modify(sprintf('+%d hours', $id)), + 'day' => new DateTimeImmutable('2024-01-01')->modify(sprintf('+%d days', $id)), + 'ts_us' => new DateTimeImmutable('2024-01-01 00:00:00.123456')->modify(sprintf('+%d hours', $id)), + 'ts_ns' => new DateTimeImmutable('2024-01-01 00:00:00.123456')->modify(sprintf('+%d hours', $id)), 'uuid' => sprintf('00000000-0000-4000-8000-%012d', $id), ]; diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/IO/Extractor/ParquetExtractorTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/IO/Extractor/ParquetExtractorTest.php index 245d2d4460..f9707d3007 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/IO/Extractor/ParquetExtractorTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/IO/Extractor/ParquetExtractorTest.php @@ -795,10 +795,10 @@ public function test_union_by_name_reads_every_file_under_one_schema(): void public function test_one_extractor_read_twice_interleaved_gives_each_read_every_row_and_closes_every_stream(): void { $filesystem = new RecordingFilesystem(native_local_filesystem()); - [$first, $second] = ExtractedRows::interleaved((new ParquetExtractor( + [$first, $second] = ExtractedRows::interleaved(new ParquetExtractor( path_real(__DIR__ . '/../../../Fixtures/Pagination/*.parquet'), $filesystem, - ))->withBatchSize(7)); + )->withBatchSize(7)); static::assertGreaterThan(0, $first->count()); static::assertSame($first->toArray(), $second->toArray()); @@ -953,7 +953,7 @@ public function test_extract_split_stops_on_the_stop_signal(): void $generator = FlowTestCase::extracted( $extractor, flow_context()->backend(), - (new Criteria())->withSplit($extractor->splits(new Criteria(), 100_000)[0]), + new Criteria()->withSplit($extractor->splits(new Criteria(), 100_000)[0]), ); $totalRows = 0; @@ -972,7 +972,7 @@ public function test_extract_split_stops_on_the_stop_signal_of_a_whole_source_sp $generator = FlowTestCase::extracted( from_parquet('memory://split/a.parquet', filesystem: $filesystem)->withBatchSize(1), flow_context()->backend(), - (new Criteria())->withSplit(new FileSplit(path('memory://split/a.parquet'), 0, null)), + new Criteria()->withSplit(new FileSplit(path('memory://split/a.parquet'), 0, null)), ); $totalRows = 0; @@ -995,7 +995,7 @@ public function test_extract_split_reads_no_more_than_the_limit(): void foreach (FlowTestCase::extracted( $extractor, flow_context()->backend(), - (new Criteria(25))->withSplit($extractor->splits(new Criteria(), 100_000)[0]), + new Criteria(25)->withSplit($extractor->splits(new Criteria(), 100_000)[0]), ) as $rows) { $total += $rows->count(); } @@ -1062,7 +1062,7 @@ public function test_a_pushed_path_filter_prunes_the_files_splits_are_cut_from() static::assertEquals( [new FileSplit($extractor->source(), 0, null)], - $extractor->splits((new Criteria())->withPathFilter(new RejectingFilter()), 1), + $extractor->splits(new Criteria()->withPathFilter(new RejectingFilter()), 1), ); } diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/IO/FileFormatContractTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/IO/FileFormatContractTest.php index 303fbd3bf6..50a2a2e58e 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/IO/FileFormatContractTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/IO/FileFormatContractTest.php @@ -30,109 +30,109 @@ public static function formats(): Generator #[DataProvider('formats')] public function test_overwrite_replaces_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->overwriteReplacesWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->overwriteReplacesWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_append_keeps_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->appendKeepsWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->appendKeepsWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_ignore_leaves_an_existing_destination_untouched(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->ignoreLeavesAnExistingDestinationUntouched($format); + new FileFormatContract($this->cacheDir)->ignoreLeavesAnExistingDestinationUntouched($format); } #[DataProvider('formats')] public function test_exception_if_exists_refuses_an_existing_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->exceptionIfExistsRefusesAnExistingDestination($format); + new FileFormatContract($this->cacheDir)->exceptionIfExistsRefusesAnExistingDestination($format); } #[DataProvider('formats')] public function test_a_batch_of_zero_rows_creates_no_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aBatchOfZeroRowsCreatesNoFile($format); + new FileFormatContract($this->cacheDir)->aBatchOfZeroRowsCreatesNoFile($format); } #[DataProvider('formats')] public function test_a_write_that_ends_reports_its_file_operations(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aWriteThatEndsReportsItsFileOperations($format); + new FileFormatContract($this->cacheDir)->aWriteThatEndsReportsItsFileOperations($format); } #[DataProvider('formats')] public function test_a_partitioned_write_reads_back_every_partition(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPartitionedWriteReadsBackEveryPartition($format); + new FileFormatContract($this->cacheDir)->aPartitionedWriteReadsBackEveryPartition($format); } #[DataProvider('formats')] public function test_a_loader_in_a_task_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderInATaskSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->aLoaderInATaskSurvivesDescribe($format); } #[DataProvider('formats')] public function test_an_extractor_reader_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorReaderSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->anExtractorReaderSurvivesDescribe($format); } #[DataProvider('formats')] public function test_the_splits_read_every_row_once(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theSplitsReadEveryRowOnce($format); + new FileFormatContract($this->cacheDir)->theSplitsReadEveryRowOnce($format); } #[DataProvider('formats')] public function test_metadata_columns_name_the_source_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->metadataColumnsNameTheSourceFile($format); + new FileFormatContract($this->cacheDir)->metadataColumnsNameTheSourceFile($format); } #[DataProvider('formats')] public function test_the_batch_size_bounds_every_batch(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theBatchSizeBoundsEveryBatch($format); + new FileFormatContract($this->cacheDir)->theBatchSizeBoundsEveryBatch($format); } #[DataProvider('formats')] public function test_refresh_lists_the_files_written_after_a_read(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->refreshListsTheFilesWrittenAfterARead($format); + new FileFormatContract($this->cacheDir)->refreshListsTheFilesWrittenAfterARead($format); } #[DataProvider('formats')] public function test_a_failed_run_leaves_no_file_at_the_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aFailedRunLeavesNoFileAtTheDestination($format); + new FileFormatContract($this->cacheDir)->aFailedRunLeavesNoFileAtTheDestination($format); } #[DataProvider('formats')] public function test_an_extractor_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_a_loader_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_reads_back_through_the_same_filesystem_instance(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->readsBackThroughTheSameFilesystemInstance($format); + new FileFormatContract($this->cacheDir)->readsBackThroughTheSameFilesystemInstance($format); } #[DataProvider('formats')] public function test_a_pushed_filter_returns_what_the_filter_node_returns(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPushedFilterReturnsWhatTheFilterNodeReturns( + new FileFormatContract($this->cacheDir)->aPushedFilterReturnsWhatTheFilterNodeReturns( $format, ref('id')->notEquals(lit('b')), ); diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/PaginationTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/PaginationTest.php index bde49b242c..d87d176c1e 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/PaginationTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/PaginationTest.php @@ -90,7 +90,7 @@ public function test_reading_file_from_given_offset(): void foreach (FlowTestCase::extracted( from_parquet(path_real(__DIR__ . '/../Fixtures/orders_1k.parquet')), flow_context(config())->backend(), - new Criteria(offset: (new Reader()) + new Criteria(offset: new Reader() ->read(__DIR__ . '/../Fixtures/orders_1k.parquet') ->metadata() ->rowsNumber() - 100), diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/ParquetTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/ParquetTest.php index 0716123441..e0e923ec17 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/ParquetTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/ParquetTest.php @@ -465,7 +465,7 @@ public function test_a_given_engine_is_honoured_with_both_extensions_loaded(): v ->read(from_rows(array_to_rows([['name' => "\xff\xfe"]], schema(str_schema('name'))))) ->write(to_parquet( $path, - options: (new Options())->set(Option::VALIDATE_DATA, false), + options: new Options()->set(Option::VALIDATE_DATA, false), engine: new PhpParquetEngine(), filesystem: $memory, )) diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/PushdownParityTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/PushdownParityTest.php index 49b6494295..a98e32b2d3 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/PushdownParityTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Integration/PushdownParityTest.php @@ -175,7 +175,7 @@ public function test_a_date_literal_on_a_timestamp_column_read_in_a_non_utc_zone $writer->writeBatch(array_map( static fn(int $id): array => [ 'id' => $id, - 'at' => (new DateTimeImmutable('2024-01-01 20:00:00'))->modify(sprintf('+%d hours', $id)), + 'at' => new DateTimeImmutable('2024-01-01 20:00:00')->modify(sprintf('+%d hours', $id)), ], range(0, 8), )); diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/DescribableRoundTripTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/DescribableRoundTripTest.php index 032ce5e0d9..45832fb3dd 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/DescribableRoundTripTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/DescribableRoundTripTest.php @@ -6,7 +6,6 @@ use Flow\ETL\Adapter\Parquet\Tests\Context\DescribableFixtures; use Flow\ETL\Foundation\Describe\Describable; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Foundation\Exception\RuntimeException; use Flow\ETL\Tests\Context\DescribeRoundTrip; use Flow\ETL\Tests\Context\ExtractorClasses; @@ -58,11 +57,7 @@ public function test_a_rebuilt_describable_equals_the_described_one(string $clas $this->expectException(RuntimeException::class); } - try { - $describable = DescribableFixtures::all()[$class](); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $describable = DescribableFixtures::all()[$class](); if (in_array($class, DescribableFixtures::undescribable(), true)) { static::assertNull($describable->describe()); diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/EmptyGeneratorTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/EmptyGeneratorTest.php deleted file mode 100644 index b3100e5151..0000000000 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/EmptyGeneratorTest.php +++ /dev/null @@ -1,19 +0,0 @@ -set(Option::PAGE_SIZE_BYTES, 7)); - $description = (new ConfiguredParquetEngine($engine))->describe(); + $description = new ConfiguredParquetEngine($engine)->describe(); static::assertNotNull($description); static::assertFalse($description->sensitive()); static::assertSame(PhpParquetEngine::class, $description->data['engine']); static::assertEquals( $engine, - (new Rebuild())->of($description->normalize(), ConfiguredParquetEngine::class)->engine(), + new Rebuild()->of($description->normalize(), ConfiguredParquetEngine::class)->engine(), ); } @@ -40,13 +40,13 @@ public function test_an_engine_round_trips_without_secrecy(): void public function test_an_arrow_engine_round_trips(): void { $engine = new RustParquetEngine(Options::default()->set(Option::PAGE_SIZE_BYTES, 7)); - $description = (new ConfiguredParquetEngine($engine))->describe(); + $description = new ConfiguredParquetEngine($engine)->describe(); static::assertNotNull($description); static::assertSame(RustParquetEngine::class, $description->data['engine']); static::assertSame( $engine->normalize(), - (new Rebuild()) + new Rebuild() ->of($description->normalize(), ConfiguredParquetEngine::class) ->engine() ->normalize(), @@ -57,13 +57,13 @@ public function test_an_arrow_engine_round_trips(): void public function test_a_flow_php_engine_round_trips(): void { $engine = new FlowPhpParquetEngine(Options::default()->set(Option::PAGE_SIZE_BYTES, 7)); - $description = (new ConfiguredParquetEngine($engine))->describe(); + $description = new ConfiguredParquetEngine($engine)->describe(); static::assertNotNull($description); static::assertSame(FlowPhpParquetEngine::class, $description->data['engine']); static::assertSame( $engine->normalize(), - (new Rebuild()) + new Rebuild() ->of($description->normalize(), ConfiguredParquetEngine::class) ->engine() ->normalize(), @@ -75,7 +75,7 @@ public function test_a_flow_php_engine_declares_flow_php_and_no_codec(): void { static::assertSame( ['bcmath', 'flow_php', 'json', 'zlib'], - (new ConfiguredParquetEngine(new FlowPhpParquetEngine()))->describe()?->extensions(), + new ConfiguredParquetEngine(new FlowPhpParquetEngine())->describe()?->extensions(), ); } @@ -84,13 +84,13 @@ public function test_an_arrow_engine_declares_arrow_and_no_codec(): void { static::assertSame( ['arrow', 'bcmath', 'json', 'zlib'], - (new ConfiguredParquetEngine(new RustParquetEngine()))->describe()?->extensions(), + new ConfiguredParquetEngine(new RustParquetEngine())->describe()?->extensions(), ); } public function test_an_engine_without_a_normal_form_does_not_describe(): void { - static::assertNull((new ConfiguredParquetEngine(new RefusingParquetEngine()))->describe()); + static::assertNull(new ConfiguredParquetEngine(new RefusingParquetEngine())->describe()); } public function test_a_class_that_is_not_an_engine_is_refused(): void @@ -111,6 +111,6 @@ public function test_an_engine_declares_the_parquet_extensions_and_the_codecs_lo ]; sort($expected); - static::assertSame($expected, (new ConfiguredParquetEngine(new PhpParquetEngine()))->describe()?->extensions()); + static::assertSame($expected, new ConfiguredParquetEngine(new PhpParquetEngine())->describe()?->extensions()); } } diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php index 38472e90ec..e0dcc41306 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php @@ -31,7 +31,7 @@ public static function extractors(): Generator #[DataProvider('extractors')] public function test_an_extractor_carries_the_metadata_setter_only_when_it_declares_metadata(string $class): void { - if ((new ReflectionClass($class))->implementsInterface(MetadataColumnsExtractor::class)) { + if (new ReflectionClass($class)->implementsInterface(MetadataColumnsExtractor::class)) { MetadataColumnsContract::declares($class); return; diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/ParquetExtractorTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/ParquetExtractorTest.php index 3775771832..cb60b19d3f 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/ParquetExtractorTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/ParquetExtractorTest.php @@ -172,7 +172,7 @@ public function test_a_count_over_a_plain_read_reads_the_number_from_the_footer( static::assertEquals( from_rows(array_to_rows([['count' => 25]], schema(int_schema('count')))), - (new CountFromStatistics()) + new CountFromStatistics() ->apply( df() ->read(from_parquet(path('memory://count/file.parquet'), filesystem: $memory)) diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/ParquetFileBatchesTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/ParquetFileBatchesTest.php index fcd81e84aa..c4b2e025f9 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/ParquetFileBatchesTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/ParquetFileBatchesTest.php @@ -49,7 +49,7 @@ public function test_an_offset_that_covers_the_file_skips_it_and_yields_its_row_ ['id' => 1], ['id' => 2], ], schema(int_schema('id')))]); - $file = (new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null))->batches( + $file = new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null)->batches( FileReadMother::of( schema(int_schema('id', nullable: true)), FileColumnsContext::discovering(names: []), @@ -75,7 +75,7 @@ public function test_an_offset_inside_the_file_starts_the_read_there_and_yields_ ['id' => 3], ], schema(int_schema('id')))]); $batches = iterator_to_array( - (new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null))->batches( + new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null)->batches( FileReadMother::of( schema(int_schema('id', nullable: true)), FileColumnsContext::discovering(names: []), @@ -114,13 +114,7 @@ public function test_the_kept_first_file_is_read_instead_of_opened_again(): void $kept = $opener->open(new SourceFile(path('memory://a.parquet'))); $opened = $filesystem->readFromCalls; - iterator_to_array((new ParquetFileBatches( - new PhpParquetEngine(), - Options::default(), - [], - null, - $kept, - ))->batches( + iterator_to_array(new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null, $kept)->batches( FileReadMother::of( schema(int_schema('id', nullable: true)), FileColumnsContext::discovering(names: []), @@ -155,13 +149,13 @@ public function test_a_kept_first_file_of_another_path_is_closed_and_the_file_op static::assertSame( [['id' => 2]], - ParquetFilesContext::rows((new ParquetFileBatches( + ParquetFilesContext::rows(new ParquetFileBatches( new PhpParquetEngine(), Options::default(), [], null, $opener->open(new SourceFile(path('memory://a.parquet'))), - ))->batches( + )->batches( FileReadMother::of( schema(int_schema('id', nullable: true)), FileColumnsContext::discovering(names: []), @@ -192,13 +186,13 @@ public function test_close_releases_a_kept_first_file_the_read_never_reached(): [], ); - (new ParquetFileBatches( + new ParquetFileBatches( new PhpParquetEngine(), Options::default(), [], null, $opener->open(new SourceFile(path('memory://a.parquet'))), - ))->close(); + )->close(); static::assertSame($filesystem->readFromCalls, $filesystem->closedStreams()); } @@ -211,12 +205,12 @@ public function test_a_file_that_diverges_from_the_derived_schema_is_refused_and ]], schema(str_schema('name')))]); try { - iterator_to_array((new ParquetFileBatches( + iterator_to_array(new ParquetFileBatches( new PhpParquetEngine(), Options::default(), [], new DerivedSchema(schema(int_schema('id', nullable: true)), 'memory://a.parquet'), - ))->batches( + )->batches( FileReadMother::of( schema(int_schema('id')), FileColumnsContext::discovering(names: []), @@ -242,12 +236,12 @@ public function test_a_body_predicate_skips_the_row_groups_it_proves_cannot_matc static::assertSame( 3, - ParquetFilesContext::rowCount((new ParquetFileBatches( + ParquetFilesContext::rowCount(new ParquetFileBatches( new PhpParquetEngine(), Options::default(), [], null, - ))->batches( + )->batches( FileReadMother::of( schema(int_schema('id', nullable: true), str_schema('name', nullable: true)), FileColumnsContext::discovering(names: []), @@ -271,12 +265,12 @@ public function test_a_conjunct_the_file_answers_exactly_is_left_out_of_the_yiel static::assertEquals( Filter::bind($schema, ref('name')->endsWith(lit('1'))), - ParquetFilesContext::yieldedFilter((new ParquetFileBatches( + ParquetFilesContext::yieldedFilter(new ParquetFileBatches( new PhpParquetEngine(), Options::default(), [], null, - ))->batches( + )->batches( FileReadMother::of($schema, FileColumnsContext::discovering(names: []), 10, $filesystem), new Criteria(conjuncts: [ref('id')->greaterThan(lit(5)), ref('name')->endsWith(lit('1'))]), new SourceFile(path('memory://groups.parquet')), @@ -293,12 +287,12 @@ public function test_no_filter_is_yielded_when_the_file_answers_no_conjunct_exac ParquetFilesContext::rowGroups($filesystem, 'memory://groups.parquet', 9, 3); $schema = schema(int_schema('id', nullable: true), str_schema('name', nullable: true)); - static::assertNull(ParquetFilesContext::yieldedFilter((new ParquetFileBatches( + static::assertNull(ParquetFilesContext::yieldedFilter(new ParquetFileBatches( new PhpParquetEngine(), Options::default(), [], null, - ))->batches( + )->batches( FileReadMother::of($schema, FileColumnsContext::discovering(names: []), 10, $filesystem), new Criteria(conjuncts: [ref('name')->endsWith(lit('1'))]), new SourceFile(path('memory://groups.parquet')), @@ -316,12 +310,12 @@ public function test_an_is_in_holding_null_stays_in_the_yielded_filter(): void static::assertEquals( Filter::bind($schema, not(ref('id')->isIn(lit([1, null])))), - ParquetFilesContext::yieldedFilter((new ParquetFileBatches( + ParquetFilesContext::yieldedFilter(new ParquetFileBatches( new PhpParquetEngine(), Options::default(), [], null, - ))->batches( + )->batches( FileReadMother::of($schema, FileColumnsContext::discovering(names: []), 10, $filesystem), new Criteria(conjuncts: [ref('id')->greaterThan(lit(5)), not(ref('id')->isIn(lit([1, null])))]), new SourceFile(path('memory://groups.parquet')), @@ -340,12 +334,12 @@ public function test_a_greater_than_on_a_float_column_proven_free_of_nan_is_answ static::assertEquals( Filter::bind($schema), - ParquetFilesContext::yieldedFilter((new ParquetFileBatches( + ParquetFilesContext::yieldedFilter(new ParquetFileBatches( new PhpParquetEngine(), Options::default(), [], null, - ))->batches( + )->batches( FileReadMother::of($schema, FileColumnsContext::discovering(names: []), 10, $filesystem), new Criteria(conjuncts: [ref('score')->greaterThan(lit(2.0))]), new SourceFile(path('memory://scores.parquet')), @@ -362,7 +356,7 @@ public function test_a_greater_than_on_a_float_column_holding_nan_is_neither_pru ParquetFilesContext::scores($filesystem, 'memory://scores.parquet', [1.0, 2.0, NAN, 4.0, 5.0, 6.0]); $schema = schema(int_schema('id', nullable: true), float_schema('score', nullable: true)); $batches = iterator_to_array( - (new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null))->batches( + new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null)->batches( FileReadMother::of($schema, FileColumnsContext::discovering(names: []), 10, $filesystem), new Criteria(conjuncts: [ref('score')->greaterThan(lit(100.0)), ref('id')->greaterThanEqual(lit(0))]), new SourceFile(path('memory://scores.parquet')), @@ -393,12 +387,12 @@ public function test_a_greater_than_on_a_float_column_without_statistics_stays_i static::assertEquals( Filter::bind($schema, ref('score')->greaterThan(lit(2.0))), - ParquetFilesContext::yieldedFilter((new ParquetFileBatches( + ParquetFilesContext::yieldedFilter(new ParquetFileBatches( new PhpParquetEngine(), Options::default(), [], null, - ))->batches( + )->batches( FileReadMother::of($schema, FileColumnsContext::discovering(names: []), 10, $filesystem), new Criteria(conjuncts: [ref('score')->greaterThan(lit(2.0)), ref('id')->greaterThanEqual(lit(0))]), new SourceFile(path('memory://scores.parquet')), @@ -417,12 +411,12 @@ public function test_a_less_than_on_a_float_column_holding_nan_is_answered_exact static::assertEquals( Filter::bind($schema), - ParquetFilesContext::yieldedFilter((new ParquetFileBatches( + ParquetFilesContext::yieldedFilter(new ParquetFileBatches( new PhpParquetEngine(), Options::default(), [], null, - ))->batches( + )->batches( FileReadMother::of($schema, FileColumnsContext::discovering(names: []), 10, $filesystem), new Criteria(conjuncts: [ref('score')->lessThan(lit(3.0))]), new SourceFile(path('memory://scores.parquet')), @@ -438,7 +432,7 @@ public function test_the_conjunct_on_a_column_the_file_stores_as_another_type_is $filesystem = memory_filesystem(); ParquetFilesContext::unsignedInt64($filesystem, 'memory://uint64.parquet', ['9', '10', '100']); // the body reads the UINT_64 leaf as a string, ordered by bytes: '10' and '100' are below '2', numerically none is - $file = (new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null))->batches( + $file = new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null)->batches( FileReadMother::of( schema(str_schema('big', nullable: true)), FileColumnsContext::discovering(names: []), @@ -462,12 +456,12 @@ public function test_equality_on_a_column_absent_from_the_file_reads_no_row(): v static::assertSame( 0, - ParquetFilesContext::rowCount((new ParquetFileBatches( + ParquetFilesContext::rowCount(new ParquetFileBatches( new PhpParquetEngine(), Options::default(), [], null, - ))->batches( + )->batches( FileReadMother::of( schema( int_schema('id', nullable: true), @@ -498,12 +492,12 @@ public function test_is_null_on_a_column_absent_from_the_file_reads_every_row(): static::assertSame( 9, - ParquetFilesContext::rowCount((new ParquetFileBatches( + ParquetFilesContext::rowCount(new ParquetFileBatches( new PhpParquetEngine(), Options::default(), [], null, - ))->batches( + )->batches( FileReadMother::of( schema( int_schema('id', nullable: true), @@ -532,7 +526,7 @@ public function test_beside_an_exact_conjunct_a_file_whose_groups_are_all_pruned $filesystem = memory_filesystem(); ParquetFilesContext::rowGroups($filesystem, 'memory://groups.parquet', 9, 3); $batches = iterator_to_array( - (new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null))->batches( + new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null)->batches( FileReadMother::of( schema(int_schema('id', nullable: true), str_schema('name', nullable: true)), FileColumnsContext::discovering(names: []), @@ -557,7 +551,7 @@ public function test_beside_exact_conjuncts_the_offset_and_the_limit_count_match $filesystem = memory_filesystem(); ParquetFilesContext::rowGroups($filesystem, 'memory://groups.parquet', 9, 3); $batches = iterator_to_array( - (new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null))->batches( + new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null)->batches( FileReadMother::of( schema(int_schema('id', nullable: true), str_schema('name', nullable: true)), FileColumnsContext::discovering(names: []), @@ -585,7 +579,7 @@ public function test_a_partition_conjunct_true_for_the_file_is_answered_so_the_f $filesystem = memory_filesystem(); ParquetFilesContext::rowGroups($filesystem, 'memory://t/year=2024/groups.parquet', 9, 3); $batches = iterator_to_array( - (new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null))->batches( + new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null)->batches( FileReadMother::of( schema( int_schema('id', nullable: true), @@ -622,7 +616,7 @@ public function test_a_partition_conjunct_false_for_the_file_stays_in_the_yielde $filesystem = memory_filesystem(); ParquetFilesContext::rowGroups($filesystem, 'memory://t/year=2024/groups.parquet', 9, 3); $batches = iterator_to_array( - (new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null))->batches( + new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null)->batches( FileReadMother::of( schema( int_schema('id', nullable: true), @@ -662,7 +656,7 @@ public function test_beside_a_residual_conjunct_the_offset_and_the_limit_are_lef $filesystem = memory_filesystem(); ParquetFilesContext::rowGroups($filesystem, 'memory://groups.parquet', 9, 3); $batches = iterator_to_array( - (new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null))->batches( + new ParquetFileBatches(new PhpParquetEngine(), Options::default(), [], null)->batches( FileReadMother::of( schema(int_schema('id', nullable: true), str_schema('name', nullable: true)), FileColumnsContext::discovering(names: []), diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/ParquetSourceFileOpenerTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/ParquetSourceFileOpenerTest.php index 6feea8d93e..38fa283335 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/ParquetSourceFileOpenerTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/ParquetSourceFileOpenerTest.php @@ -23,13 +23,13 @@ final class ParquetSourceFileOpenerTest extends FlowTestCase { public function test_opens_the_file_narrowed_to_the_requested_columns(): void { - $file = (new ParquetSourceFileOpener( + $file = new ParquetSourceFileOpener( new NativeLocalFilesystem(), new PhpParquetEngine(), Options::default(), new SchemaConverter(), ['id'], - ))->open(new SourceFile(ParquetSourceFileContext::fixture())); + )->open(new SourceFile(ParquetSourceFileContext::fixture())); static::assertEquals(schema(int_schema('id')), $file->schema()); @@ -41,13 +41,13 @@ public function test_a_stream_the_engine_refuses_is_closed(): void $filesystem = new CountingFilesystem(new NativeLocalFilesystem()); try { - (new ParquetSourceFileOpener( + new ParquetSourceFileOpener( $filesystem, new RefusingParquetEngine(), Options::default(), new SchemaConverter(), [], - ))->open(new SourceFile(ParquetSourceFileContext::fixture())); + )->open(new SourceFile(ParquetSourceFileContext::fixture())); static::fail('the engine must refuse the stream'); } catch (RuntimeException) { static::assertSame(1, $filesystem->readFromCalls); diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/PhpParquetOpenSourceTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/PhpParquetOpenSourceTest.php index efac907ff9..0570ad4af3 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/PhpParquetOpenSourceTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/PhpParquetOpenSourceTest.php @@ -55,9 +55,9 @@ public function test_a_planned_window_crosses_row_groups(int $offset, ?int $limi $read = []; - foreach (ParquetFilesContext::rows((new PhpParquetOpenSource((new Reader( + foreach (ParquetFilesContext::rows(new PhpParquetOpenSource(new Reader( engine: new PhpParquetEngine(), - ))->readStream($filesystem->readFrom(path('memory://groups.parquet')))))->batches( + )->readStream($filesystem->readFrom(path('memory://groups.parquet'))))->batches( schema(int_schema('id')), 3, ParquetFilesContext::plan($filesystem, 'memory://groups.parquet', $offset, $limit), @@ -79,9 +79,9 @@ public function test_an_empty_schema_yields_the_rows_of_the_window(int $offset, $counted = 0; - foreach (ParquetFilesContext::rows((new PhpParquetOpenSource((new Reader( + foreach (ParquetFilesContext::rows(new PhpParquetOpenSource(new Reader( engine: new PhpParquetEngine(), - ))->readStream($filesystem->readFrom(path('memory://groups.parquet')))))->batches( + )->readStream($filesystem->readFrom(path('memory://groups.parquet'))))->batches( schema(), 3, ParquetFilesContext::plan($filesystem, 'memory://groups.parquet', $offset, $limit), @@ -102,9 +102,9 @@ public function test_an_empty_schema_yields_the_rows_the_row_filter_keeps(): voi $counted = 0; - foreach (ParquetFilesContext::rows((new PhpParquetOpenSource((new Reader( + foreach (ParquetFilesContext::rows(new PhpParquetOpenSource(new Reader( engine: new PhpParquetEngine(), - ))->readStream($filesystem->readFrom(path('memory://groups.parquet')))))->batches( + )->readStream($filesystem->readFrom(path('memory://groups.parquet'))))->batches( schema(), 100, ParquetFilesContext::plan( @@ -146,9 +146,9 @@ public function test_columns_declared_as_the_file_types_them_read_as_their_value static::assertEquals( $rows->toArray(), - ParquetFilesContext::rows((new PhpParquetOpenSource((new Reader( + ParquetFilesContext::rows(new PhpParquetOpenSource(new Reader( engine: new PhpParquetEngine(), - ))->readStream($filesystem->readFrom(path('memory://typed.parquet')))))->batches( + )->readStream($filesystem->readFrom(path('memory://typed.parquet'))))->batches( $rows->schema(), 100, ParquetFilesContext::plan($filesystem, 'memory://typed.parquet'), @@ -169,9 +169,9 @@ public function test_a_column_declared_as_another_type_is_cast_from_the_file_val static::assertSame( array_to_rows([['ats' => [$at]]], $declared)->toArray(), - ParquetFilesContext::rows((new PhpParquetOpenSource((new Reader( + ParquetFilesContext::rows(new PhpParquetOpenSource(new Reader( engine: new PhpParquetEngine(), - ))->readStream($filesystem->readFrom(path('memory://typed.parquet')))))->batches( + )->readStream($filesystem->readFrom(path('memory://typed.parquet'))))->batches( $declared, 100, ParquetFilesContext::plan($filesystem, 'memory://typed.parquet'), @@ -184,9 +184,9 @@ public function test_batches_hold_the_schema_columns(): void { $filesystem = memory_filesystem(); ParquetFilesContext::rowGroups($filesystem, 'memory://groups.parquet', 10, 4); - $source = new PhpParquetOpenSource((new Reader( + $source = new PhpParquetOpenSource(new Reader( engine: new PhpParquetEngine(), - ))->readStream($filesystem->readFrom(path('memory://groups.parquet')))); + )->readStream($filesystem->readFrom(path('memory://groups.parquet')))); $names = []; @@ -213,9 +213,9 @@ public function test_a_column_the_file_lacks_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Parquet file has no column "missing"'); - iterator_to_array((new PhpParquetOpenSource((new Reader( + iterator_to_array(new PhpParquetOpenSource(new Reader( engine: new PhpParquetEngine(), - ))->readStream($filesystem->readFrom(path('memory://groups.parquet')))))->batches( + )->readStream($filesystem->readFrom(path('memory://groups.parquet'))))->batches( schema(int_schema('missing')), 10, ParquetFilesContext::plan($filesystem, 'memory://groups.parquet'), @@ -231,9 +231,9 @@ public function test_a_batch_size_below_one_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Parquet batch size must be greater than 0'); - iterator_to_array((new PhpParquetOpenSource((new Reader( + iterator_to_array(new PhpParquetOpenSource(new Reader( engine: new PhpParquetEngine(), - ))->readStream($filesystem->readFrom(path('memory://groups.parquet')))))->batches( + )->readStream($filesystem->readFrom(path('memory://groups.parquet'))))->batches( schema(int_schema('id')), 0, ParquetFilesContext::plan($filesystem, 'memory://groups.parquet'), diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/Pushdown/FilterTranslatorTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/Pushdown/FilterTranslatorTest.php index 2993b7f7da..40c9fd07d8 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/Pushdown/FilterTranslatorTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/Pushdown/FilterTranslatorTest.php @@ -129,7 +129,7 @@ public static function translated(): Generator #[DataProvider('translated')] public function test_a_pushable_conjunct_is_translated(ScalarFunction $function, Filter $expected): void { - $translated = (new FilterTranslator())->translate([$function], BodySchemaMother::everyLeafType()); + $translated = new FilterTranslator()->translate([$function], BodySchemaMother::everyLeafType()); static::assertCount(1, $translated); static::assertEquals($expected, $translated[0]->filter); @@ -170,7 +170,7 @@ public static function refused(): Generator #[DataProvider('refused')] public function test_a_conjunct_that_cannot_be_pushed_is_refused(ScalarFunction $function): void { - static::assertSame([], (new FilterTranslator())->translate([$function], BodySchemaMother::everyLeafType())); + static::assertSame([], new FilterTranslator()->translate([$function], BodySchemaMother::everyLeafType())); } public static function throwingInPhp(): Generator @@ -188,7 +188,7 @@ public static function throwingInPhp(): Generator public function test_a_pushed_conjunct_runs_before_the_kept_ones_so_one_that_can_throw_in_php_is_never_translated( ScalarFunction $function, ): void { - static::assertSame([], (new FilterTranslator())->translate([$function], BodySchemaMother::everyLeafType())); + static::assertSame([], new FilterTranslator()->translate([$function], BodySchemaMother::everyLeafType())); } public static function inexact(): Generator @@ -202,7 +202,7 @@ public static function inexact(): Generator public function test_a_conjunct_whose_filter_keeps_more_rows_is_translated_as_inexact( ScalarFunction $function, ): void { - static::assertFalse((new FilterTranslator())->translate( + static::assertFalse(new FilterTranslator()->translate( [$function], BodySchemaMother::everyLeafType(), )[0]->exact); @@ -210,7 +210,7 @@ public function test_a_conjunct_whose_filter_keeps_more_rows_is_translated_as_in public function test_a_conjunct_without_an_is_in_holding_null_is_translated_as_exact(): void { - static::assertTrue((new FilterTranslator())->translate([ref('id')->isIn(lit([ + static::assertTrue(new FilterTranslator()->translate([ref('id')->isIn(lit([ 1, 2, ]))], BodySchemaMother::everyLeafType())[0]->exact); @@ -243,13 +243,13 @@ public function test_the_float_columns_ordered_with_greater_than_are_nan_sensiti ): void { static::assertSame( $columns, - (new FilterTranslator())->translate([$function], BodySchemaMother::everyLeafType())[0]->nanSensitiveColumns, + new FilterTranslator()->translate([$function], BodySchemaMother::everyLeafType())[0]->nanSensitiveColumns, ); } public function test_every_conjunct_is_translated_on_its_own(): void { - $translated = (new FilterTranslator())->translate([ + $translated = new FilterTranslator()->translate([ ref('id')->greaterThan(lit(1)), ref('name')->endsWith(lit('a')), ref('name')->equals(lit('b'))->or(ref('price')->lessThan(lit(2.0))), diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/Pushdown/TranslatedConjunctTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/Pushdown/TranslatedConjunctTest.php index c0193d5a58..c0095422f9 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/Pushdown/TranslatedConjunctTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/Pushdown/TranslatedConjunctTest.php @@ -18,7 +18,7 @@ final class TranslatedConjunctTest extends FlowTestCase { public function test_a_file_storing_every_column_as_the_body_types_it_is_read_as_is(): void { - static::assertTrue((new TranslatedConjunct(parquet_column('id')->equals(1), ['id', 'name'], true, []))->readsAs( + static::assertTrue(new TranslatedConjunct(parquet_column('id')->equals(1), ['id', 'name'], true, [])->readsAs( schema(int_schema('id'), str_schema('name')), schema(int_schema('id', nullable: true), str_schema('name', nullable: true)), )); @@ -26,12 +26,12 @@ public function test_a_file_storing_every_column_as_the_body_types_it_is_read_as public function test_a_column_the_file_stores_as_another_type_is_not_read_as_is(): void { - static::assertFalse((new TranslatedConjunct( + static::assertFalse(new TranslatedConjunct( parquet_column('big')->lessThan('2'), ['id', 'big'], true, [], - ))->readsAs( + )->readsAs( schema(int_schema('id'), definition_from_type('big', type_numeric_string())), schema(int_schema('id'), str_schema('big')), )); @@ -39,11 +39,9 @@ public function test_a_column_the_file_stores_as_another_type_is_not_read_as_is( public function test_a_column_absent_from_the_file_is_read_as_is(): void { - static::assertTrue((new TranslatedConjunct( - parquet_column('missing')->isNull(), - ['missing'], - true, - [], - ))->readsAs(schema(int_schema('id')), schema(int_schema('id'), str_schema('missing', nullable: true)))); + static::assertTrue(new TranslatedConjunct(parquet_column('missing')->isNull(), ['missing'], true, [])->readsAs( + schema(int_schema('id')), + schema(int_schema('id'), str_schema('missing', nullable: true)), + )); } } diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/RustParquetOpenSourceTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/RustParquetOpenSourceTest.php index 8cc3c54512..b9b697e7d9 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/RustParquetOpenSourceTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Extractor/RustParquetOpenSourceTest.php @@ -42,9 +42,9 @@ public function test_a_planned_window_crosses_row_groups(int $offset, ?int $limi $read = []; - foreach ((new RustParquetOpenSource(new FlowPhpParquetFileReader($filesystem->readFrom(path( + foreach (new RustParquetOpenSource(new FlowPhpParquetFileReader($filesystem->readFrom(path( 'memory://groups.parquet', - )))))->batches( + ))))->batches( schema(int_schema('id')), 3, ParquetFilesContext::plan($filesystem, 'memory://groups.parquet', $offset, $limit), @@ -66,9 +66,9 @@ public function test_an_empty_schema_yields_the_rows_of_the_window(int $offset, $counted = 0; - foreach (ParquetFilesContext::rows((new RustParquetOpenSource(new FlowPhpParquetFileReader($filesystem->readFrom(path( + foreach (ParquetFilesContext::rows(new RustParquetOpenSource(new FlowPhpParquetFileReader($filesystem->readFrom(path( 'memory://groups.parquet', - )))))->batches( + ))))->batches( schema(), 3, ParquetFilesContext::plan($filesystem, 'memory://groups.parquet', $offset, $limit), @@ -89,9 +89,9 @@ public function test_an_empty_schema_yields_the_rows_the_row_filter_keeps(): voi $counted = 0; - foreach (ParquetFilesContext::rows((new RustParquetOpenSource(new FlowPhpParquetFileReader($filesystem->readFrom(path( + foreach (ParquetFilesContext::rows(new RustParquetOpenSource(new FlowPhpParquetFileReader($filesystem->readFrom(path( 'memory://groups.parquet', - )))))->batches( + ))))->batches( schema(), 100, ParquetFilesContext::plan( @@ -171,9 +171,9 @@ public function test_close_before_batches_is_harmless(): void $filesystem = memory_filesystem(); ParquetFilesContext::rowGroups($filesystem, 'memory://groups.parquet', 10, 4); - (new RustParquetOpenSource(new FlowPhpParquetFileReader($filesystem->readFrom(path( + new RustParquetOpenSource(new FlowPhpParquetFileReader($filesystem->readFrom(path( 'memory://groups.parquet', - )))))->close(); + ))))->close(); $this->expectNotToPerformAssertions(); } diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetFileWriterFactoryTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetFileWriterFactoryTest.php index b10d3f99e3..c22a74b0bf 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetFileWriterFactoryTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetFileWriterFactoryTest.php @@ -116,13 +116,13 @@ public function test_the_first_writer_fixes_the_schema_every_stream_is_written_u public function test_a_declared_schema_is_the_written_one(): void { $filesystem = memory_filesystem(); - $writer = (new ParquetFileWriterFactory( + $writer = new ParquetFileWriterFactory( schema(int_schema('id', nullable: true), str_schema('note', nullable: true)), new SchemaConverter(), Compressions::UNCOMPRESSED, Options::default(), new PhpParquetEngine(), - ))->writer($filesystem->writeTo(path('memory://a.parquet')), schema(int_schema('id')), new PhpBackend()); + )->writer($filesystem->writeTo(path('memory://a.parquet')), schema(int_schema('id')), new PhpBackend()); $writer->write(array_to_rows([['id' => 1]], schema(int_schema('id')))); $writer->close(); @@ -153,13 +153,13 @@ public function test_a_default_engine_writes_a_file_php_reads(?ParquetEngine $en { $filesystem = memory_filesystem(); $schema = schema(int_schema('id')); - $writer = (new ParquetFileWriterFactory( + $writer = new ParquetFileWriterFactory( $schema, new SchemaConverter(), Compressions::GZIP, Options::default(), $engine, - ))->writer($filesystem->writeTo(path('memory://out.parquet')), $schema, new PhpBackend()); + )->writer($filesystem->writeTo(path('memory://out.parquet')), $schema, new PhpBackend()); $writer->write(array_to_rows([['id' => 1], ['id' => 2]], $schema)); $writer->close(); @@ -177,13 +177,13 @@ public function test_a_default_engine_writes_a_file_php_reads(?ParquetEngine $en #[DataProvider('lanes')] public function test_the_engine_decides_which_lane_writes(Closure $engine, string $lane): void { - static::assertInstanceOf($lane, (new ParquetFileWriterFactory( + static::assertInstanceOf($lane, new ParquetFileWriterFactory( schema(int_schema('id')), new SchemaConverter(), Compressions::SNAPPY, Options::default(), $engine(), - ))->writer( + )->writer( memory_filesystem()->writeTo(path('memory://out.parquet')), schema(int_schema('id')), new PhpBackend(), @@ -195,13 +195,13 @@ public function test_any_other_engine_writes_the_file(): void $filesystem = memory_filesystem(); $schema = schema(int_schema('id')); $engine = new RecordingParquetEngine(); - $writer = (new ParquetFileWriterFactory( + $writer = new ParquetFileWriterFactory( $schema, new SchemaConverter(), Compressions::SNAPPY, Options::default(), $engine, - ))->writer($filesystem->writeTo(path('memory://out.parquet')), $schema, new PhpBackend()); + )->writer($filesystem->writeTo(path('memory://out.parquet')), $schema, new PhpBackend()); $writer->write(array_to_rows([['id' => 1], ['id' => 2]], $schema)); $writer->close(); @@ -218,14 +218,14 @@ public function test_a_flow_php_of_another_abi_is_refused(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('does not match flow-php/etl'); - (new ParquetFileWriterFactory( + new ParquetFileWriterFactory( schema(int_schema('id')), new SchemaConverter(), Compressions::SNAPPY, Options::default(), new PhpParquetEngine(), new FlowPhpExtension(true, FlowPhpExtension::ABI + 1, '0.46.0'), - ))->writer( + )->writer( memory_filesystem()->writeTo(path('memory://out.parquet')), schema(int_schema('id')), new PhpBackend(), diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetFileWriterTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetFileWriterTest.php index fed75d1eb1..9127ea2f96 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetFileWriterTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetFileWriterTest.php @@ -115,9 +115,9 @@ public function test_written_batches_read_back_equal(): void { $filesystem = memory_filesystem(); $schema = schema(int_schema('id'), str_schema('name', nullable: true)); - $parquetSchema = (new SchemaConverter())->toParquetSchema($schema); + $parquetSchema = new SchemaConverter()->toParquetSchema($schema); $writer = new ParquetFileWriter( - (new PhpParquetEngine())->openForWrite( + new PhpParquetEngine()->openForWrite( $filesystem->writeTo(path('memory://out.parquet')), $parquetSchema, Compressions::SNAPPY, @@ -140,9 +140,9 @@ public function test_written_batches_read_back_equal(): void public function test_a_column_of_another_stored_type_is_conformed_before_it_is_written(): void { $filesystem = memory_filesystem(); - $parquetSchema = (new SchemaConverter())->toParquetSchema(schema(int_schema('id', nullable: true))); + $parquetSchema = new SchemaConverter()->toParquetSchema(schema(int_schema('id', nullable: true))); $writer = new ParquetFileWriter( - (new PhpParquetEngine())->openForWrite( + new PhpParquetEngine()->openForWrite( $filesystem->writeTo(path('memory://out.parquet')), $parquetSchema, Compressions::SNAPPY, diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetLoaderTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetLoaderTest.php index d9be62da94..e368009842 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetLoaderTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetLoaderTest.php @@ -82,7 +82,7 @@ public function test_a_batch_without_rows_writes_no_file(): void public function test_setting_content_type_on_path(): void { static::assertEquals( - (new ParquetLoader(path(__DIR__ . '/file.parquet'))) + new ParquetLoader(path(__DIR__ . '/file.parquet')) ->destination() ->getOption(Option::CONTENT_TYPE), ContentType::PARQUET, diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetSchemaConformanceTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetSchemaConformanceTest.php index b6debd6af8..daceb26466 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetSchemaConformanceTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/ParquetSchemaConformanceTest.php @@ -30,10 +30,10 @@ final class ParquetSchemaConformanceTest extends FlowTestCase { public function test_a_column_of_another_type_is_cast_to_the_writer_type(): void { - $conformed = (new ParquetSchemaConformance((new SchemaConverter())->toParquetSchema(schema( + $conformed = new ParquetSchemaConformance(new SchemaConverter()->toParquetSchema(schema( str_schema('id'), str_schema('name'), - ))))->conform( + )))->conform( array_to_rows( [['id' => 1, 'name' => 'a'], ['id' => 2, 'name' => 'b']], schema(int_schema('id'), str_schema('name')), @@ -47,9 +47,9 @@ public function test_a_column_of_another_type_is_cast_to_the_writer_type(): void public function test_a_date_is_cast_to_a_datetime(): void { - $conformed = (new ParquetSchemaConformance((new SchemaConverter())->toParquetSchema(schema(datetime_schema( + $conformed = new ParquetSchemaConformance(new SchemaConverter()->toParquetSchema(schema(datetime_schema( 'at', - )))))->conform(array_to_rows([[ + ))))->conform(array_to_rows([[ 'at' => new DateTimeImmutable('2026-09-01'), ]], schema(date_schema('at'))), new AdaptiveBackend()); @@ -59,9 +59,9 @@ public function test_a_date_is_cast_to_a_datetime(): void public function test_a_null_typed_column_is_cast_to_a_string_column(): void { - $conformed = (new ParquetSchemaConformance((new SchemaConverter())->toParquetSchema(schema(null_schema( + $conformed = new ParquetSchemaConformance(new SchemaConverter()->toParquetSchema(schema(null_schema( 'nothing', - )))))->conform(array_to_rows([['nothing' => null]], schema(null_schema('nothing'))), new AdaptiveBackend()); + ))))->conform(array_to_rows([['nothing' => null]], schema(null_schema('nothing'))), new AdaptiveBackend()); static::assertEquals(schema(str_schema('nothing', nullable: true)), $conformed->schema()); static::assertSame([null], $conformed->column('nothing')->values()); @@ -71,10 +71,10 @@ public function test_a_matching_column_is_passed_on_as_it_is(): void { $rows = array_to_rows([['id' => 1, 'name' => 'a']], schema(int_schema('id'), str_schema('name'))); - $conformed = (new ParquetSchemaConformance((new SchemaConverter())->toParquetSchema(schema( + $conformed = new ParquetSchemaConformance(new SchemaConverter()->toParquetSchema(schema( str_schema('id'), str_schema('name'), - ))))->conform($rows, new AdaptiveBackend()); + )))->conform($rows, new AdaptiveBackend()); static::assertSame($rows->column('name'), $conformed->column('name')); } @@ -90,27 +90,27 @@ public function test_a_zoned_datetime_column_is_passed_on_as_it_is(): void 'history' => [new DateTimeImmutable('2026-09-01 11:00:00 UTC')], ]], $schema); - static::assertSame($rows, (new ParquetSchemaConformance((new SchemaConverter())->toParquetSchema( + static::assertSame($rows, new ParquetSchemaConformance(new SchemaConverter()->toParquetSchema( $schema, - )))->conform($rows, new AdaptiveBackend())); + ))->conform($rows, new AdaptiveBackend())); } public function test_rows_matching_the_writer_schema_are_passed_on_as_they_are(): void { $rows = array_to_rows([['id' => 1]], schema(int_schema('id'))); - static::assertSame($rows, (new ParquetSchemaConformance((new SchemaConverter())->toParquetSchema(schema(int_schema( + static::assertSame($rows, new ParquetSchemaConformance(new SchemaConverter()->toParquetSchema(schema(int_schema( 'id', - )))))->conform($rows, new AdaptiveBackend())); + ))))->conform($rows, new AdaptiveBackend())); } public function test_a_column_the_writer_does_not_know_is_passed_on_as_it_is(): void { $rows = array_to_rows([['id' => 1, 'extra' => 'x']], schema(int_schema('id'), str_schema('extra'))); - static::assertSame($rows, (new ParquetSchemaConformance((new SchemaConverter())->toParquetSchema(schema(int_schema( + static::assertSame($rows, new ParquetSchemaConformance(new SchemaConverter()->toParquetSchema(schema(int_schema( 'id', - )))))->conform($rows, new AdaptiveBackend())); + ))))->conform($rows, new AdaptiveBackend())); } public function test_a_datetime_zone_is_not_stored(): void diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/RustParquetFileWriterTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/RustParquetFileWriterTest.php index 4eedc9b237..abd0231736 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/RustParquetFileWriterTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/IO/Loader/RustParquetFileWriterTest.php @@ -65,9 +65,9 @@ public function test_an_exception_append_throws_surfaces_as_itself(): void { $filesystem = memory_filesystem(); $schema = schema(int_schema('id')); - $parquetSchema = (new SchemaConverter())->toParquetSchema($schema); + $parquetSchema = new SchemaConverter()->toParquetSchema($schema); $writer = new RustParquetFileWriter( - (new FlowPhpParquetEngine())->openForWrite( + new FlowPhpParquetEngine()->openForWrite( new FailingAppendDestinationStream($filesystem->writeTo(path('memory://out.parquet'))), $parquetSchema, Compressions::SNAPPY, diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/Values/Schema/FlowToParquetSchemaTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/Values/Schema/FlowToParquetSchemaTest.php index dc14f7e724..f80c6a4fbd 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/Values/Schema/FlowToParquetSchemaTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/Values/Schema/FlowToParquetSchemaTest.php @@ -64,7 +64,7 @@ public function test_convert_etl_entries_to_parquet_fields(): void ParquetSchema\Repetition::REQUIRED, ), ), - (new SchemaConverter())->toParquetSchema(schema( + new SchemaConverter()->toParquetSchema(schema( integer_schema('integer'), bool_schema('boolean'), string_schema('string'), @@ -94,7 +94,7 @@ public function test_converting_structure_with_optional_elements_throws(): void 'Parquet schema does not support structure optional elements, given: structure{a: string, b?: string}', ); - (new SchemaConverter())->toParquetSchema(schema(structure_schema('structure', type_structure([ + new SchemaConverter()->toParquetSchema(schema(structure_schema('structure', type_structure([ 'a' => type_string(), 'b' => structure_element('b', type_string(), optional: true), ])))); @@ -107,7 +107,7 @@ public function test_converting_structure_with_an_interleaved_optional_element_t 'Parquet schema does not support structure optional elements, given: structure{b?: string, a: string}', ); - (new SchemaConverter())->toParquetSchema(schema(structure_schema('structure', type_structure([ + new SchemaConverter()->toParquetSchema(schema(structure_schema('structure', type_structure([ 'b' => structure_element('b', type_string(), optional: true), 'a' => type_string(), ])))); @@ -120,7 +120,7 @@ public function test_converting_nested_structure_with_optional_elements_throws() 'Parquet schema does not support structure optional elements, given: structure{b: string, c?: string}', ); - (new SchemaConverter())->toParquetSchema(schema(structure_schema('structure', type_structure([ + new SchemaConverter()->toParquetSchema(schema(structure_schema('structure', type_structure([ 'a' => type_structure(['b' => type_string(), 'c' => structure_element('c', type_string(), optional: true)]), ])))); } @@ -129,7 +129,7 @@ public function test_a_numeric_string_column_is_written_as_a_string(): void { static::assertEquals( ParquetSchema::with(FlatColumn::string('id')), - (new SchemaConverter())->toParquetSchema(schema(definition_from_type('id', type_numeric_string(), true))), + new SchemaConverter()->toParquetSchema(schema(definition_from_type('id', type_numeric_string(), true))), ); } } diff --git a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/Values/Schema/ParquetToFlowSchemaTest.php b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/Values/Schema/ParquetToFlowSchemaTest.php index 22f88e7f70..6c40dfb42a 100644 --- a/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/Values/Schema/ParquetToFlowSchemaTest.php +++ b/src/adapter/etl-adapter-parquet/tests/Flow/ETL/Adapter/Parquet/Tests/Unit/Values/Schema/ParquetToFlowSchemaTest.php @@ -136,7 +136,7 @@ public function test_converting_struct_to_flow_schema(): void public function test_uint64_columns_are_numeric_strings(): void { - $flowSchema = (new SchemaConverter())->toFlowSchema(Schema::with( + $flowSchema = new SchemaConverter()->toFlowSchema(Schema::with( new FlatColumn('converted', PhysicalType::INT64, ConvertedType::UINT_64, repetition: Repetition::REQUIRED), new FlatColumn('logical', PhysicalType::INT64, logicalType: LogicalType::integer(64, false)), new FlatColumn('uint32', PhysicalType::INT32, ConvertedType::UINT_32), @@ -149,13 +149,13 @@ public function test_uint64_columns_are_numeric_strings(): void static::assertTrue(type_equals(type_integer(), $flowSchema->get('uint32')->type())); static::assertTrue(type_equals( type_optional(type_numeric_string()), - (new SchemaConverter())->parquetToFlowType( + new SchemaConverter()->parquetToFlowType( new FlatColumn('u', PhysicalType::INT64, logicalType: LogicalType::integer(64, false)), ), )); static::assertTrue(type_equals( type_numeric_string(), - (new SchemaConverter())->parquetToFlowType( + new SchemaConverter()->parquetToFlowType( new FlatColumn('u', PhysicalType::INT64, ConvertedType::UINT_64, repetition: Repetition::REQUIRED), ), )); diff --git a/src/adapter/etl-adapter-postgresql/composer.json b/src/adapter/etl-adapter-postgresql/composer.json index 27ab387bdc..6731991878 100644 --- a/src/adapter/etl-adapter-postgresql/composer.json +++ b/src/adapter/etl-adapter-postgresql/composer.json @@ -11,7 +11,7 @@ "extractor" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/etl": "self.version", "flow-php/postgresql": "self.version" }, diff --git a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/PostgreSqlCursorExtractor.php b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/PostgreSqlCursorExtractor.php index 84a7a17f4a..7ba010c94f 100644 --- a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/PostgreSqlCursorExtractor.php +++ b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/PostgreSqlCursorExtractor.php @@ -123,7 +123,7 @@ public function extract(Backend $backend, Criteria $criteria): Generator $cursor->free(); - $rows = (new RowsBuilder($schema, $backend)) + $rows = new RowsBuilder($schema, $backend) ->appendRows($rawBatch) ->finish(); @@ -182,7 +182,7 @@ public function schema(): Schema } try { - return $this->derivedSchema ??= (new ResultSchema())->of( + return $this->derivedSchema ??= new ResultSchema()->of( $this->client, $this->read ??= ReadQuery::of($this->query, self::class), $this->parameters, @@ -197,7 +197,7 @@ public function schema(): Schema public function statistics(): Statistics { - return $this->statistics ??= new Statistics(rows: (new ExplainedRows())->of( + return $this->statistics ??= new Statistics(rows: new ExplainedRows()->of( $this->client, $this->query, $this->parameters, diff --git a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/PostgreSqlKeySetExtractor.php b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/PostgreSqlKeySetExtractor.php index d2247b70d1..e3bd8b1336 100644 --- a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/PostgreSqlKeySetExtractor.php +++ b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/PostgreSqlKeySetExtractor.php @@ -115,7 +115,7 @@ public function extract(Backend $backend, Criteria $criteria): Generator $page = KeySetPage::of($this->keySet, $fetched, $size, $expected); if ($page->rows !== []) { - $rows = (new RowsBuilder($schema, $backend)) + $rows = new RowsBuilder($schema, $backend) ->appendRows($page->rows) ->finish(); @@ -153,7 +153,7 @@ public function schema(): Schema } try { - return $this->derivedSchema ??= (new ResultSchema())->of( + return $this->derivedSchema ??= new ResultSchema()->of( $this->client, $this->read ??= ReadQuery::of($this->query, self::class), $this->parameters, @@ -168,7 +168,7 @@ public function schema(): Schema public function statistics(): Statistics { - return $this->statistics ??= new Statistics(rows: (new ExplainedRows())->of( + return $this->statistics ??= new Statistics(rows: new ExplainedRows()->of( $this->client, $this->query, $this->parameters, diff --git a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/PostgreSqlLimitOffsetExtractor.php b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/PostgreSqlLimitOffsetExtractor.php index 27cd78d801..4bfdfb255c 100644 --- a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/PostgreSqlLimitOffsetExtractor.php +++ b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/PostgreSqlLimitOffsetExtractor.php @@ -112,7 +112,7 @@ public function extract(Backend $backend, Criteria $criteria): Generator return; } - $rows = (new RowsBuilder($schema, $backend)) + $rows = new RowsBuilder($schema, $backend) ->appendRows($rawBatch) ->finish(); @@ -147,7 +147,7 @@ public function schema(): Schema } try { - return $this->derivedSchema ??= (new ResultSchema())->of( + return $this->derivedSchema ??= new ResultSchema()->of( $this->client, $this->read ??= ReadQuery::of($this->query, self::class), $this->parameters, @@ -162,7 +162,7 @@ public function schema(): Schema public function statistics(): Statistics { - return $this->statistics ??= new Statistics(rows: (new ExplainedRows())->of( + return $this->statistics ??= new Statistics(rows: new ExplainedRows()->of( $this->client, $this->query, $this->parameters, diff --git a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/ReadQuery.php b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/ReadQuery.php index 8652fe7326..b0e8706ea0 100644 --- a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/ReadQuery.php +++ b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Extractor/ReadQuery.php @@ -123,7 +123,7 @@ public function keySetNullCheck(KeySet $keySet): string $copy->mergeFrom($this->select->raw()); return select(literal(1)) - ->from(new DerivedTable((new Node())->setSelectStmt($copy), '_flow_keyset_nulls')) + ->from(new DerivedTable(new Node()->setSelectStmt($copy), '_flow_keyset_nulls')) ->where(or_(...$conditions)) ->limit(1) ->toSql(); diff --git a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/HTMLConverter.php b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/HTMLConverter.php index 3e6d34020a..8193b66f1e 100644 --- a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/HTMLConverter.php +++ b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/HTMLConverter.php @@ -28,7 +28,6 @@ public function toDatabase(mixed $value): ?string } if ($value instanceof HTMLDocument) { - // @mago-ignore analysis:unavailable-method return $value->saveHTML() ?: null; } diff --git a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/QueryBuilder/DeleteQueryBuilder.php b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/QueryBuilder/DeleteQueryBuilder.php index 8855e8bb74..c08f71da23 100644 --- a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/QueryBuilder/DeleteQueryBuilder.php +++ b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/QueryBuilder/DeleteQueryBuilder.php @@ -52,7 +52,7 @@ public function build(array $value, Schema $schema, DeleteOptions $options): arr $conditions[] = eq(col($key), param($paramIndex++)); $params[] = $this->typesMap->map( $key, - $schema->get((new UnresolvedReference($key))->name())->type(), + $schema->get(new UnresolvedReference($key)->name())->type(), $value[$key], ); } diff --git a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/QueryBuilder/InsertQueryBuilder.php b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/QueryBuilder/InsertQueryBuilder.php index be9b3873ed..f2e817a8c4 100644 --- a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/QueryBuilder/InsertQueryBuilder.php +++ b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/QueryBuilder/InsertQueryBuilder.php @@ -64,7 +64,7 @@ public function build( $columnConverters = []; foreach ($names as $column) { - $types[$column] = $schema->get((new UnresolvedReference($column))->name())->type(); + $types[$column] = $schema->get(new UnresolvedReference($column)->name())->type(); } for ($i = 0; $i < $count; $i++) { diff --git a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/QueryBuilder/UpdateQueryBuilder.php b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/QueryBuilder/UpdateQueryBuilder.php index 522f299a87..5891be307c 100644 --- a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/QueryBuilder/UpdateQueryBuilder.php +++ b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/IO/Loader/QueryBuilder/UpdateQueryBuilder.php @@ -54,7 +54,7 @@ public function build(array $value, Schema $schema, UpdateOptions $options): arr $assignments[$column] = param($paramIndex++); $params[] = $this->typesMap->map( $column, - $schema->get((new UnresolvedReference($column))->name())->type(), + $schema->get(new UnresolvedReference($column)->name())->type(), $columnValue, ); } @@ -73,7 +73,7 @@ public function build(array $value, Schema $schema, UpdateOptions $options): arr $conditions[] = eq(col($key), param($paramIndex++)); $params[] = $this->typesMap->map( $key, - $schema->get((new UnresolvedReference($key))->name())->type(), + $schema->get(new UnresolvedReference($key)->name())->type(), $value[$key], ); } diff --git a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/Values/Schema/SchemaConverter.php b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/Values/Schema/SchemaConverter.php index b5ec539bc0..a0b196ba32 100644 --- a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/Values/Schema/SchemaConverter.php +++ b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/Values/Schema/SchemaConverter.php @@ -77,14 +77,14 @@ public function toPostgreSqlTable( ); } - return (new Table( + return new Table( schema: $databaseSchema, name: $tableName, columns: $columns, primaryKey: $this->primaryKey($schema), indexes: $this->indexes($schema), uniqueConstraints: $this->uniqueConstraints($schema), - ))->withOptions($options ?? new TableOptions()); + )->withOptions($options ?? new TableOptions()); } /** diff --git a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/functions.php b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/functions.php index 8b465de7c2..af7965ce2a 100644 --- a/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/functions.php +++ b/src/adapter/etl-adapter-postgresql/src/Flow/ETL/Adapter/PostgreSql/functions.php @@ -175,7 +175,7 @@ function to_pgsql_schema_table( ?TypesMap $typesMap = null, ?TableOptions $options = null, ): Table { - return (new SchemaConverter($typesMap))->toPostgreSqlTable($schema, $tableName, $databaseSchema, $options); + return new SchemaConverter($typesMap)->toPostgreSqlTable($schema, $tableName, $databaseSchema, $options); } /** @@ -184,7 +184,7 @@ function to_pgsql_schema_table( #[DocumentationDSL(module: Module::POSTGRESQL, type: DSLType::HELPER)] function pgsql_table_to_flow_schema(Table $table, ?TypesMap $typesMap = null): Schema { - return (new SchemaConverter($typesMap))->toFlowSchema($table); + return new SchemaConverter($typesMap)->toFlowSchema($table); } #[DocumentationDSL(module: Module::POSTGRESQL, type: DSLType::HELPER)] diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/DescribableRoundTripTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/DescribableRoundTripTest.php index a04f918d85..0509e9b53c 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/DescribableRoundTripTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/DescribableRoundTripTest.php @@ -6,7 +6,6 @@ use Flow\ETL\Adapter\PostgreSql\Tests\Context\DescribableFixtures; use Flow\ETL\Foundation\Describe\Describable; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Foundation\Exception\RuntimeException; use Flow\ETL\Tests\Context\DescribeRoundTrip; use Flow\ETL\Tests\Context\ExtractorClasses; @@ -58,11 +57,7 @@ public function test_a_rebuilt_describable_equals_the_described_one(string $clas $this->expectException(RuntimeException::class); } - try { - $describable = DescribableFixtures::all()[$class](); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $describable = DescribableFixtures::all()[$class](); if (in_array($class, DescribableFixtures::undescribable(), true)) { static::assertNull($describable->describe()); diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/ExplainedRowsTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/ExplainedRowsTest.php index 089a68be35..bfa23ff2e8 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/ExplainedRowsTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/ExplainedRowsTest.php @@ -16,7 +16,7 @@ public function test_a_maximum_above_the_estimate_only_bounds_it(): void { static::assertEquals( new Cardinality(atMost: 50, estimate: 7, relativeError: Cardinality::DEFAULT_RELATIVE_ERROR), - (new ExplainedRows())->of((new SpyClient())->willExplain(7), 'SELECT 1', maximum: 50), + new ExplainedRows()->of(new SpyClient()->willExplain(7), 'SELECT 1', maximum: 50), ); } @@ -24,15 +24,15 @@ public function test_a_maximum_below_the_estimate_caps_it(): void { static::assertEquals( new Cardinality(atMost: 5, estimate: 5, relativeError: Cardinality::DEFAULT_RELATIVE_ERROR), - (new ExplainedRows())->of((new SpyClient())->willExplain(7), 'SELECT 1', maximum: 5), + new ExplainedRows()->of(new SpyClient()->willExplain(7), 'SELECT 1', maximum: 5), ); } public function test_the_plan_is_asked_for_an_estimate_only(): void { - $client = (new SpyClient())->willExplain(7); + $client = new SpyClient()->willExplain(7); - static::assertEquals(Cardinality::approximately(7), (new ExplainedRows())->of($client, 'SELECT $1', [3])); + static::assertEquals(Cardinality::approximately(7), new ExplainedRows()->of($client, 'SELECT $1', [3])); static::assertEquals( [['sql' => 'SELECT $1', 'parameters' => [3], 'config' => ExplainConfig::forEstimate()]], $client->explained, diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php index 78ff994f30..4f7a3fa577 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php @@ -31,7 +31,7 @@ public static function extractors(): Generator #[DataProvider('extractors')] public function test_an_extractor_carries_the_metadata_setter_only_when_it_declares_metadata(string $class): void { - if ((new ReflectionClass($class))->implementsInterface(MetadataColumnsExtractor::class)) { + if (new ReflectionClass($class)->implementsInterface(MetadataColumnsExtractor::class)) { MetadataColumnsContract::declares($class); return; diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/PostgreSqlCursorExtractorTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/PostgreSqlCursorExtractorTest.php index e6246c6443..b0b1a78ee8 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/PostgreSqlCursorExtractorTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/PostgreSqlCursorExtractorTest.php @@ -33,7 +33,7 @@ final class PostgreSqlCursorExtractorTest extends FlowTestCase { public function test_a_close_failure_never_replaces_the_read_failure(): void { - $client = (new SpyClient(transactionNestingLevel: 1)) + $client = new SpyClient(transactionNestingLevel: 1) ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor([['id' => 'abc']])) ->willFailExecute(2, QueryException::executionFailed('CLOSE c', PostgreSqlError::fromDiagnostics( @@ -51,7 +51,7 @@ public function test_a_close_failure_never_replaces_the_read_failure(): void public function test_a_declare_that_fails_inside_a_callers_transaction_closes_nothing(): void { - $client = (new SpyClient(transactionNestingLevel: 1)) + $client = new SpyClient(transactionNestingLevel: 1) ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willFailExecute(1, QueryException::executionFailed('DECLARE c', PostgreSqlError::fromDiagnostics( '42P01', @@ -73,7 +73,7 @@ public function test_a_declare_that_fails_inside_a_callers_transaction_closes_no public function test_a_failed_declare_rolls_back_its_own_transaction_and_rethrows_it(): void { $failure = QueryException::executionFailed('DECLARE c', PostgreSqlError::fromDiagnostics('42P01', 'x')); - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willFailExecute(1, $failure); @@ -92,7 +92,7 @@ public function test_a_failed_declare_rolls_back_its_own_transaction_and_rethrow public function test_a_failed_read_inside_a_callers_transaction_closes_its_cursor(): void { - $client = (new SpyClient(transactionNestingLevel: 1)) + $client = new SpyClient(transactionNestingLevel: 1) ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor([['id' => 'abc']])); @@ -112,7 +112,7 @@ public function test_a_failed_read_inside_a_callers_transaction_closes_its_curso public function test_a_failed_read_rolls_back_its_own_transaction_instead_of_committing(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor([['id' => 'abc']])); @@ -129,7 +129,7 @@ public function test_a_failed_read_rolls_back_its_own_transaction_instead_of_com public function test_a_failing_read_probes_once(): void { - $client = (new SpyClient())->willRefuseDescribe(QueryException::executionFailed( + $client = new SpyClient()->willRefuseDescribe(QueryException::executionFailed( 'SELECT id FROM t ORDER BY id', PostgreSqlError::unknown('boom'), )); @@ -163,7 +163,7 @@ public function test_a_non_select_statement_is_refused_before_any_round_trip(): public function test_a_rollback_failure_never_replaces_the_read_failure(): void { $failure = QueryException::executionFailed('DECLARE c', PostgreSqlError::fromDiagnostics('42P01', 'x')); - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willFailExecute(1, $failure) ->willFailRollBack(new RuntimeException('connection lost')); @@ -192,10 +192,7 @@ public function test_a_declared_schema_wins_over_the_probe(): void { static::assertEquals( schema(int_schema('id')), - from_pgsql_cursor( - (new SpyClient())->willDescribe(ColumnMother::of(['other' => 'text'])), - 'SELECT id FROM t', - ) + from_pgsql_cursor(new SpyClient()->willDescribe(ColumnMother::of(['other' => 'text'])), 'SELECT id FROM t') ->withSchema(schema(int_schema('id'))) ->schema(), ); @@ -203,7 +200,7 @@ public function test_a_declared_schema_wins_over_the_probe(): void public function test_cursor_loop_breaks_immediately_when_empty_result(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor()); @@ -219,7 +216,7 @@ public function test_cursor_loop_breaks_immediately_when_empty_result(): void public function test_cursor_loop_breaks_when_rows_less_than_batch_size(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor([['id' => '1'], ['id' => '2']])); @@ -229,7 +226,7 @@ public function test_cursor_loop_breaks_when_rows_less_than_batch_size(): void public function test_cursor_loop_fetches_multiple_batches_when_needed(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor([['id' => '1'], ['id' => '2']]), new StubCursor([['id' => '3']])); @@ -239,7 +236,7 @@ public function test_cursor_loop_fetches_multiple_batches_when_needed(): void public function test_cursor_loop_with_exact_batch_size_multiple_does_extra_fetch(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor([['id' => '1'], ['id' => '2']]), new StubCursor()); @@ -249,7 +246,7 @@ public function test_cursor_loop_with_exact_batch_size_multiple_does_extra_fetch public function test_extract_declares_and_closes_its_own_cursor_in_its_own_transaction(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor([['id' => '1']])); @@ -265,7 +262,7 @@ public function test_extract_declares_and_closes_its_own_cursor_in_its_own_trans public function test_extract_joins_a_callers_transaction_instead_of_opening_its_own(): void { - $client = (new SpyClient(transactionNestingLevel: 1)) + $client = new SpyClient(transactionNestingLevel: 1) ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor([['id' => '1']])); @@ -284,7 +281,7 @@ public function test_extract_joins_a_callers_transaction_instead_of_opening_its_ public function test_extract_casts_an_array_column_through_the_derived_schema(): void { - static::assertSame(['a', 'b'], iterator_to_array(from_pgsql_cursor((new SpyClient()) + static::assertSame(['a', 'b'], iterator_to_array(from_pgsql_cursor(new SpyClient() ->willDescribe(ColumnMother::of(['tags' => '_text'])) ->willReturnCursors(new StubCursor([['tags' => [ 'a', @@ -294,7 +291,7 @@ public function test_extract_casts_an_array_column_through_the_derived_schema(): public function test_extract_casts_through_the_derived_schema(): void { - $rows = iterator_to_array(from_pgsql_cursor((new SpyClient()) + $rows = iterator_to_array(from_pgsql_cursor(new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8', 'amount' => 'numeric'])) ->willReturnCursors(new StubCursor([[ 'id' => '1', @@ -307,7 +304,7 @@ public function test_extract_casts_through_the_derived_schema(): void public function test_extract_derives_the_schema_once_and_reuses_it_across_batches(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor([['id' => '1'], ['id' => '2']]), new StubCursor([['id' => '3']])); @@ -325,7 +322,7 @@ public function test_extract_derives_the_schema_once_and_reuses_it_across_batche public function test_extract_refuses_to_read_when_the_schema_cannot_be_derived(): void { - $client = (new SpyClient())->willDescribe(ColumnMother::of(['location' => 'point'])); + $client = new SpyClient()->willDescribe(ColumnMother::of(['location' => 'point'])); $this->expectException(SchemaNotDerivableException::class); $this->expectExceptionMessage('column "location" has PostgreSQL type "point", which Flow has no type for'); @@ -342,7 +339,7 @@ public function test_extract_refuses_to_read_when_the_schema_cannot_be_derived() public function test_pushed_limit_issues_no_query_once_satisfied(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors( new StubCursor(array_map(static fn(int $id): array => ['id' => (string) $id], range(1, 1000))), @@ -362,7 +359,7 @@ public function test_pushed_limit_issues_no_query_once_satisfied(): void public function test_schema_is_derived_from_result_metadata(): void { $schema = from_pgsql_cursor( - (new SpyClient())->willDescribe(ColumnMother::of(['id' => 'int8', 'label' => 'text'])), + new SpyClient()->willDescribe(ColumnMother::of(['id' => 'int8', 'label' => 'text'])), 'SELECT id, label FROM t', )->schema(); @@ -372,7 +369,7 @@ public function test_schema_is_derived_from_result_metadata(): void public function test_the_derived_schema_is_memoised(): void { - $client = (new SpyClient())->willDescribe(ColumnMother::of(['id' => 'int8'])); + $client = new SpyClient()->willDescribe(ColumnMother::of(['id' => 'int8'])); $extractor = from_pgsql_cursor($client, 'SELECT id FROM t'); $extractor->schema(); @@ -448,7 +445,7 @@ public function test_is_repeatable(): void public function test_statistics_are_the_planner_estimate_without_analyze(): void { - $client = (new SpyClient())->willExplain(42); + $client = new SpyClient()->willExplain(42); static::assertEquals( Cardinality::approximately(42), @@ -462,7 +459,7 @@ public function test_statistics_are_the_planner_estimate_without_analyze(): void public function test_statistics_are_explained_once(): void { - $client = (new SpyClient())->willExplain(42); + $client = new SpyClient()->willExplain(42); $extractor = from_pgsql_cursor($client, 'SELECT * FROM t WHERE id > $1', [1]); static::assertSame($extractor->statistics(), $extractor->statistics()); @@ -472,7 +469,7 @@ public function test_statistics_are_explained_once(): void public function test_a_maximum_bounds_and_caps_the_estimate_and_a_new_one_drops_the_statistics(): void { $extractor = from_pgsql_cursor( - (new SpyClient())->willExplain(42), + new SpyClient()->willExplain(42), 'SELECT * FROM t WHERE id > $1', [1], )->withMaximum(10); @@ -492,7 +489,7 @@ public function test_a_maximum_bounds_and_caps_the_estimate_and_a_new_one_drops_ public function test_extract_builds_through_the_config_backend(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor([['id' => '1']]), new StubCursor()); $backend = new SpyBackend(); diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/PostgreSqlKeySetExtractorTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/PostgreSqlKeySetExtractorTest.php index c06e65bdaa..910e4201f1 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/PostgreSqlKeySetExtractorTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/PostgreSqlKeySetExtractorTest.php @@ -99,7 +99,7 @@ public static function null_keys(): Generator public function test_a_failing_read_probes_once(): void { - $client = (new SpyClient())->willRefuseDescribe(QueryException::executionFailed( + $client = new SpyClient()->willRefuseDescribe(QueryException::executionFailed( 'SELECT id FROM t ORDER BY id', PostgreSqlError::unknown('boom'), )); @@ -142,7 +142,7 @@ public function test_a_non_select_statement_is_refused_before_any_round_trip(): public function test_every_page_sends_the_same_sql_with_new_parameters(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors( new StubCursor([['id' => '1'], ['id' => '2'], ['id' => '3']]), @@ -197,7 +197,7 @@ public function test_a_declared_schema_wins_over_the_probe(): void static::assertEquals( schema(int_schema('id')), from_pgsql_key_set( - (new SpyClient())->willDescribe(ColumnMother::of(['other' => 'text'])), + new SpyClient()->willDescribe(ColumnMother::of(['other' => 'text'])), 'SELECT id FROM t', pgsql_pagination_key_set(pgsql_pagination_key_asc('id')), ) @@ -209,7 +209,7 @@ public function test_a_declared_schema_wins_over_the_probe(): void public function test_extract_casts_through_the_derived_schema(): void { $rows = iterator_to_array(from_pgsql_key_set( - (new SpyClient()) + new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8', 'amount' => 'numeric'])) ->willReturnCursors(new StubCursor([['id' => '1', 'amount' => '10.5']]), new StubCursor()), 'SELECT id, amount FROM t', @@ -222,7 +222,7 @@ public function test_extract_casts_through_the_derived_schema(): void public function test_extract_derives_the_schema_once_and_reuses_it_across_batches(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors( new StubCursor([['id' => '1'], ['id' => '2'], ['id' => '3']]), @@ -245,7 +245,7 @@ public function test_extract_derives_the_schema_once_and_reuses_it_across_batche public function test_extract_refuses_to_read_when_the_schema_cannot_be_derived(): void { - $client = (new SpyClient())->willDescribe(ColumnMother::of(['location' => 'point'])); + $client = new SpyClient()->willDescribe(ColumnMother::of(['location' => 'point'])); $this->expectException(SchemaNotDerivableException::class); $this->expectExceptionMessage('column "location" has PostgreSQL type "point", which Flow has no type for'); @@ -264,7 +264,7 @@ public function test_extract_refuses_to_read_when_the_schema_cannot_be_derived() public function test_schema_is_derived_from_result_metadata(): void { $schema = from_pgsql_key_set( - (new SpyClient())->willDescribe(ColumnMother::of(['id' => 'int8', 'label' => 'text'])), + new SpyClient()->willDescribe(ColumnMother::of(['id' => 'int8', 'label' => 'text'])), 'SELECT id, label FROM t', pgsql_pagination_key_set(pgsql_pagination_key_asc('id')), )->schema(); @@ -275,7 +275,7 @@ public function test_schema_is_derived_from_result_metadata(): void public function test_the_derived_schema_is_memoised(): void { - $client = (new SpyClient())->willDescribe(ColumnMother::of(['id' => 'int8'])); + $client = new SpyClient()->willDescribe(ColumnMother::of(['id' => 'int8'])); $extractor = from_pgsql_key_set( $client, 'SELECT id FROM t', @@ -371,7 +371,7 @@ public function test_with_batch_size_validates_positive_value(): void public function test_pushed_limit_issues_no_query_once_satisfied(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors( new StubCursor(array_map(static fn(int $id): array => ['id' => (string) $id], range(1, 1001))), @@ -400,7 +400,7 @@ public function test_is_repeatable(): void public function test_statistics_are_the_planner_estimate_without_analyze(): void { - $client = (new SpyClient())->willExplain(42); + $client = new SpyClient()->willExplain(42); static::assertEquals( Cardinality::approximately(42), @@ -419,7 +419,7 @@ public function test_statistics_are_the_planner_estimate_without_analyze(): void public function test_statistics_are_explained_once(): void { - $client = (new SpyClient())->willExplain(42); + $client = new SpyClient()->willExplain(42); $extractor = from_pgsql_key_set( $client, 'SELECT * FROM t WHERE id > $1', @@ -434,7 +434,7 @@ public function test_statistics_are_explained_once(): void public function test_a_maximum_bounds_and_caps_the_estimate_and_a_new_one_drops_the_statistics(): void { $extractor = from_pgsql_key_set( - (new SpyClient())->willExplain(42), + new SpyClient()->willExplain(42), 'SELECT * FROM t WHERE id > $1', pgsql_pagination_key_set(pgsql_pagination_key_asc('id')), [1], @@ -455,7 +455,7 @@ public function test_a_maximum_bounds_and_caps_the_estimate_and_a_new_one_drops_ public function test_extract_builds_through_the_config_backend(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor([['id' => '1']]), new StubCursor()); $backend = new SpyBackend(); @@ -592,7 +592,7 @@ public function test_exact_multiple_ends_without_an_empty_page(): void #[DataProvider('null_checks')] public function test_null_check_runs_before_the_first_page(string $query, KeySet $keySet, string $nullCheck): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8', 'created_at' => 'int8'])) ->willReturnCursors( new StubCursor([ @@ -615,7 +615,7 @@ public function test_null_check_runs_before_the_first_page(string $query, KeySet public function test_null_key_throws_before_any_page(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willFindNullKey(); diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/PostgreSqlLimitOffsetExtractorTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/PostgreSqlLimitOffsetExtractorTest.php index 30d435c834..4485dbb6cb 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/PostgreSqlLimitOffsetExtractorTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/PostgreSqlLimitOffsetExtractorTest.php @@ -32,7 +32,7 @@ final class PostgreSqlLimitOffsetExtractorTest extends FlowTestCase { public function test_a_failing_read_probes_once(): void { - $client = (new SpyClient())->willRefuseDescribe(QueryException::executionFailed( + $client = new SpyClient()->willRefuseDescribe(QueryException::executionFailed( 'SELECT id FROM t ORDER BY id', PostgreSqlError::unknown('boom'), )); @@ -97,7 +97,7 @@ public function test_an_empty_page_is_not_yielded(): void [5], array_map( static fn(Rows $rows): int => $rows->count(), - iterator_to_array(from_pgsql_limit_offset((new SpyClient()) + iterator_to_array(from_pgsql_limit_offset(new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor([ ['id' => '1'], @@ -126,7 +126,7 @@ public function test_a_declared_schema_wins_over_the_probe(): void static::assertEquals( schema(int_schema('id')), from_pgsql_limit_offset( - (new SpyClient())->willDescribe(ColumnMother::of(['other' => 'text'])), + new SpyClient()->willDescribe(ColumnMother::of(['other' => 'text'])), 'SELECT id FROM t ORDER BY id', ) ->withSchema(schema(int_schema('id'))) @@ -136,7 +136,7 @@ public function test_a_declared_schema_wins_over_the_probe(): void public function test_every_page_sends_the_same_sql_with_new_parameters(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willCountTotal(3) ->willReturnCursors(new StubCursor([['id' => '1'], ['id' => '2']]), new StubCursor([['id' => '3']])); @@ -157,7 +157,7 @@ public function test_every_page_sends_the_same_sql_with_new_parameters(): void public function test_extract_casts_through_the_derived_schema(): void { - $rows = iterator_to_array(from_pgsql_limit_offset((new SpyClient()) + $rows = iterator_to_array(from_pgsql_limit_offset(new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8', 'amount' => 'numeric'])) ->willCountTotal(1) ->willReturnCursors(new StubCursor([[ @@ -171,7 +171,7 @@ public function test_extract_casts_through_the_derived_schema(): void public function test_extract_derives_the_schema_once_and_reuses_it_across_batches(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willCountTotal(3) ->willReturnCursors(new StubCursor([['id' => '1'], ['id' => '2']]), new StubCursor([['id' => '3']])); @@ -188,7 +188,7 @@ public function test_extract_derives_the_schema_once_and_reuses_it_across_batche public function test_extract_refuses_to_read_when_the_schema_cannot_be_derived(): void { - $client = (new SpyClient())->willDescribe(ColumnMother::of(['location' => 'point'])); + $client = new SpyClient()->willDescribe(ColumnMother::of(['location' => 'point'])); $this->expectException(SchemaNotDerivableException::class); $this->expectExceptionMessage('column "location" has PostgreSQL type "point", which Flow has no type for'); @@ -208,7 +208,7 @@ public function test_extract_refuses_to_read_when_the_schema_cannot_be_derived() public function test_schema_is_derived_from_result_metadata(): void { $schema = from_pgsql_limit_offset( - (new SpyClient())->willDescribe(ColumnMother::of(['id' => 'int8', 'label' => 'text'])), + new SpyClient()->willDescribe(ColumnMother::of(['id' => 'int8', 'label' => 'text'])), 'SELECT id, label FROM t ORDER BY id', )->schema(); @@ -218,7 +218,7 @@ public function test_schema_is_derived_from_result_metadata(): void public function test_the_derived_schema_is_memoised(): void { - $client = (new SpyClient())->willDescribe(ColumnMother::of(['id' => 'int8'])); + $client = new SpyClient()->willDescribe(ColumnMother::of(['id' => 'int8'])); $extractor = from_pgsql_limit_offset($client, 'SELECT id FROM t ORDER BY id'); $extractor->schema(); @@ -292,7 +292,7 @@ public function test_with_batch_size_validates_positive_value(): void public function test_pushed_limit_skips_the_count_query(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willCountTotal(1000) ->willReturnCursors(new StubCursor([['id' => '1'], ['id' => '2']]), new StubCursor([['id' => '3']])); @@ -308,7 +308,7 @@ public function test_pushed_limit_skips_the_count_query(): void public function test_stops_issuing_pages_when_a_page_comes_back_short(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willReturnCursors(new StubCursor([['id' => '1'], ['id' => '2']]), new StubCursor([['id' => '3']])); @@ -327,7 +327,7 @@ public function test_is_repeatable(): void public function test_statistics_are_the_planner_estimate_without_analyze(): void { - $client = (new SpyClient())->willExplain(42); + $client = new SpyClient()->willExplain(42); static::assertEquals( Cardinality::approximately(42), @@ -341,7 +341,7 @@ public function test_statistics_are_the_planner_estimate_without_analyze(): void public function test_statistics_are_explained_once(): void { - $client = (new SpyClient())->willExplain(42); + $client = new SpyClient()->willExplain(42); $extractor = from_pgsql_limit_offset($client, 'SELECT * FROM t WHERE id > $1', [1]); static::assertSame($extractor->statistics(), $extractor->statistics()); @@ -351,7 +351,7 @@ public function test_statistics_are_explained_once(): void public function test_a_maximum_bounds_and_caps_the_estimate_and_a_new_one_drops_the_statistics(): void { $extractor = from_pgsql_limit_offset( - (new SpyClient())->willExplain(42), + new SpyClient()->willExplain(42), 'SELECT * FROM t WHERE id > $1', [1], )->withMaximum(10); @@ -371,7 +371,7 @@ public function test_a_maximum_bounds_and_caps_the_estimate_and_a_new_one_drops_ public function test_extract_builds_through_the_config_backend(): void { - $client = (new SpyClient()) + $client = new SpyClient() ->willDescribe(ColumnMother::of(['id' => 'int8'])) ->willCountTotal(1) ->willReturnCursors(new StubCursor([['id' => '1']])); diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/ResultSchemaTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/ResultSchemaTest.php index a122e15008..6444a8bb08 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/ResultSchemaTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Extractor/ResultSchemaTest.php @@ -100,9 +100,9 @@ protected function setUp(): void public function test_every_mapped_postgresql_type_becomes_a_nullable_definition(string $type): void { static::assertTrue( - (new ResultSchema()) + new ResultSchema() ->of( - (new SpyClient())->willDescribe(ColumnMother::of(['value' => $type])), + new SpyClient()->willDescribe(ColumnMother::of(['value' => $type])), ReadQuery::of('SELECT value FROM t', self::class), [], self::class, @@ -121,8 +121,8 @@ public function test_an_unmapped_postgresql_type_is_refused(string $type): void $type, )); - (new ResultSchema())->of( - (new SpyClient())->willDescribe(ColumnMother::of(['value' => $type])), + new ResultSchema()->of( + new SpyClient()->willDescribe(ColumnMother::of(['value' => $type])), ReadQuery::of('SELECT value FROM t', self::class), [], self::class, @@ -134,9 +134,9 @@ public function test_a_multi_dimensional_array_column_is_typed_one_dimensional() // The element type admits null because a pg array may hold SQL NULLs. static::assertEquals( type_list(type_optional(type_integer())), - (new ResultSchema()) + new ResultSchema() ->of( - (new SpyClient())->willDescribe(ColumnMother::of(['tags' => '_int4'])), + new SpyClient()->willDescribe(ColumnMother::of(['tags' => '_int4'])), ReadQuery::of('SELECT tags FROM t', self::class), [], self::class, @@ -154,8 +154,8 @@ public function test_a_refused_probe_becomes_a_schema_not_derivable_exception(): ); try { - (new ResultSchema())->of( - (new SpyClient())->willRefuseDescribe($refused), + new ResultSchema()->of( + new SpyClient()->willRefuseDescribe($refused), ReadQuery::of('SELECT 1;;', self::class), [], self::class, @@ -176,15 +176,15 @@ public function test_a_refused_probe_becomes_a_schema_not_derivable_exception(): public function test_a_rethrown_database_error_inside_an_open_transaction_rolls_back_to_the_savepoint(): void { - $client = (new SpyClient( + $client = new SpyClient( transactionNestingLevel: 1, - ))->willRefuseDescribe(QueryException::executionFailed('SELECT id FROM t', PostgreSqlError::fromDiagnostics( + )->willRefuseDescribe(QueryException::executionFailed('SELECT id FROM t', PostgreSqlError::fromDiagnostics( '42P01', 'relation "t" does not exist', ))); try { - (new ResultSchema())->of($client, ReadQuery::of('SELECT id FROM t', self::class), [], self::class); + new ResultSchema()->of($client, ReadQuery::of('SELECT id FROM t', self::class), [], self::class); } catch (QueryException) { } @@ -197,8 +197,8 @@ public function test_a_query_naming_a_missing_object_rethrows_the_database_error $refused = QueryException::executionFailed('SELECT id FROM t', PostgreSqlError::fromDiagnostics($state, 'x')); try { - (new ResultSchema())->of( - (new SpyClient())->willRefuseDescribe($refused), + new ResultSchema()->of( + new SpyClient()->willRefuseDescribe($refused), ReadQuery::of('SELECT id FROM t', self::class), [], self::class, @@ -211,13 +211,13 @@ public function test_a_query_naming_a_missing_object_rethrows_the_database_error public function test_a_refused_probe_inside_an_open_transaction_rolls_back_to_the_savepoint(): void { - $client = (new SpyClient(transactionNestingLevel: 1))->willRefuseDescribe(QueryException::executionFailed( + $client = new SpyClient(transactionNestingLevel: 1)->willRefuseDescribe(QueryException::executionFailed( 'SELECT 1;;', PostgreSqlError::unknown('syntax error'), )); try { - (new ResultSchema())->of($client, ReadQuery::of('SELECT 1;;', self::class), [], self::class); + new ResultSchema()->of($client, ReadQuery::of('SELECT 1;;', self::class), [], self::class); } catch (SchemaNotDerivableException) { } @@ -226,27 +226,27 @@ public function test_a_refused_probe_inside_an_open_transaction_rolls_back_to_th public function test_a_savepoint_wraps_the_probe_inside_an_open_transaction(): void { - $nested = (new SpyClient(transactionNestingLevel: 1))->willDescribe(ColumnMother::of(['id' => 'int8'])); - (new ResultSchema())->of($nested, ReadQuery::of('SELECT id FROM t', self::class), [], self::class); + $nested = new SpyClient(transactionNestingLevel: 1)->willDescribe(ColumnMother::of(['id' => 'int8'])); + new ResultSchema()->of($nested, ReadQuery::of('SELECT id FROM t', self::class), [], self::class); // Rolled back, not committed: the probe is a read-only LIMIT 0, so discarding the savepoint // is equivalent and closes every failure path with one unconditional finally. static::assertSame(['beginTransaction', 'describe', 'rollBack'], $nested->calls); - $topLevel = (new SpyClient())->willDescribe(ColumnMother::of(['id' => 'int8'])); - (new ResultSchema())->of($topLevel, ReadQuery::of('SELECT id FROM t', self::class), [], self::class); + $topLevel = new SpyClient()->willDescribe(ColumnMother::of(['id' => 'int8'])); + new ResultSchema()->of($topLevel, ReadQuery::of('SELECT id FROM t', self::class), [], self::class); static::assertSame(['describe'], $topLevel->calls); } public function test_a_savepoint_is_released_when_describe_throws_something_other_than_a_query_exception(): void { - $client = (new SpyClient(transactionNestingLevel: 1))->willThrowFromDescribe( + $client = new SpyClient(transactionNestingLevel: 1)->willThrowFromDescribe( new RuntimeException('parser blew up'), ); try { - (new ResultSchema())->of($client, ReadQuery::of('SELECT id FROM t', self::class), [], self::class); + new ResultSchema()->of($client, ReadQuery::of('SELECT id FROM t', self::class), [], self::class); static::fail('the throwable should propagate'); } catch (RuntimeException $e) { static::assertSame('parser blew up', $e->getMessage()); @@ -257,8 +257,8 @@ public function test_a_savepoint_is_released_when_describe_throws_something_othe public function test_duplicate_output_names_collapse_last_wins(): void { - $schema = (new ResultSchema())->of( - (new SpyClient())->willDescribe([ColumnMother::pair('a', 'int8'), ColumnMother::pair('a', 'text')]), + $schema = new ResultSchema()->of( + new SpyClient()->willDescribe([ColumnMother::pair('a', 'int8'), ColumnMother::pair('a', 'text')]), ReadQuery::of('SELECT id AS a, label AS a FROM t', self::class), [], self::class, @@ -270,9 +270,9 @@ public function test_duplicate_output_names_collapse_last_wins(): void public function test_the_probe_never_receives_the_callers_values(): void { - $client = (new SpyClient())->willDescribe(ColumnMother::of(['id' => 'int8'])); + $client = new SpyClient()->willDescribe(ColumnMother::of(['id' => 'int8'])); - (new ResultSchema())->of( + new ResultSchema()->of( $client, ReadQuery::of('SELECT id FROM t WHERE id > $1', self::class), [42], diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/HTMLConverterTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/HTMLConverterTest.php index ac5dc1b18f..7181dc0b4c 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/HTMLConverterTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/HTMLConverterTest.php @@ -10,8 +10,6 @@ use Flow\PostgreSql\Client\Types\ValueType; use PHPUnit\Framework\TestCase; -use function class_exists; - final class HTMLConverterTest extends TestCase { public function test_delegates_string_to_next_converter(): void @@ -23,13 +21,8 @@ public function test_delegates_string_to_next_converter(): void public function test_html_document_returns_html_string(): void { - if (!class_exists(HTMLDocument::class)) { - static::markTestSkipped('Dom\HTMLDocument requires PHP 8.4+'); - } - $converter = new HTMLConverter(); - // @mago-ignore analysis:unavailable-method $doc = HTMLDocument::createFromString('

Hello

'); $result = $converter->toDatabase($doc); @@ -39,13 +32,8 @@ public function test_html_document_returns_html_string(): void public function test_html_element_returns_html_string(): void { - if (!class_exists(HTMLDocument::class)) { - static::markTestSkipped('Dom\HTMLDocument requires PHP 8.4+'); - } - $converter = new HTMLConverter(); - // @mago-ignore analysis:unavailable-method $doc = HTMLDocument::createFromString('

Hello

'); $element = $doc->getElementById('test'); diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/PostgreSqlEncoderTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/PostgreSqlEncoderTest.php index 20b07b8ae7..d54c31f55c 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/PostgreSqlEncoderTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/PostgreSqlEncoderTest.php @@ -22,7 +22,7 @@ public function test_encode_returns_each_row_as_its_value_map(): void { static::assertSame( [['id' => 1, 'name' => 'Norbert'], ['id' => 2, 'name' => null]], - (new PostgreSqlEncoder())->encode(array_to_rows( + new PostgreSqlEncoder()->encode(array_to_rows( [['id' => 1, 'name' => 'Norbert'], ['id' => 2, 'name' => null]], schema(int_schema('id'), str_schema('name', nullable: true)), )), @@ -33,7 +33,7 @@ public function test_encode_returns_the_original_value_maps(): void { static::assertSame( [['id' => 1, 'active' => true], ['id' => 2, 'active' => false]], - (new PostgreSqlEncoder())->encode(array_to_rows( + new PostgreSqlEncoder()->encode(array_to_rows( [['id' => 1, 'active' => true], ['id' => 2, 'active' => false]], schema(int_schema('id'), bool_schema('active')), )), @@ -42,14 +42,14 @@ public function test_encode_returns_the_original_value_maps(): void public function test_encode_of_an_empty_batch_returns_empty(): void { - static::assertSame([], (new PostgreSqlEncoder())->encode(array_to_rows([], schema(int_schema('id'))))); + static::assertSame([], new PostgreSqlEncoder()->encode(array_to_rows([], schema(int_schema('id'))))); } public function test_columns_returns_every_columns_values_in_schema_order(): void { static::assertSame( ['id' => [1, 2], 'name' => ['a', null]], - (new PostgreSqlEncoder())->columns(array_to_rows( + new PostgreSqlEncoder()->columns(array_to_rows( [['id' => 1, 'name' => 'a'], ['id' => 2, 'name' => null]], schema(int_schema('id'), str_schema('name', nullable: true)), )), @@ -63,7 +63,7 @@ public function test_columns_render_markup_from_the_physicals(): void static::assertSame( ['x' => [''], 'e' => ['']], - (new PostgreSqlEncoder())->columns(array_to_rows( + new PostgreSqlEncoder()->columns(array_to_rows( [['x' => $document, 'e' => $document->getElementsByTagName('a')->item(0)]], schema(xml_schema('x'), xml_element_schema('e')), )), diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/PostgreSqlLoaderTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/PostgreSqlLoaderTest.php index 9ed14f8be1..bf17222304 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/PostgreSqlLoaderTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/PostgreSqlLoaderTest.php @@ -27,7 +27,7 @@ final class PostgreSqlLoaderTest extends TestCase { public function test_its_collection_is_the_table(): void { - static::assertSame('contacts', (new PostgreSqlLoader(new SpyClient(), 'contacts'))->collection()); + static::assertSame('contacts', new PostgreSqlLoader(new SpyClient(), 'contacts')->collection()); } public function test_load_delete_requires_delete_options(): void @@ -93,19 +93,19 @@ public function test_a_chunked_insert_joins_a_callers_transaction(): void $client = new SpyClient(transactionNestingLevel: 1); // 70 columns x 1000 rows: 936 rows fit under the cap, so the INSERT is two statements - (new PostgreSqlLoader($client, 'wide'))->load(WideRowsMother::of(70, 1000), flow_context()->backend()); + new PostgreSqlLoader($client, 'wide')->load(WideRowsMother::of(70, 1000), flow_context()->backend()); static::assertSame(['execute', 'execute'], $client->calls); } public function test_a_failing_chunk_rolls_back_the_transaction_the_loader_opened(): void { - $client = (new SpyClient())->willFailExecute(2, new LogicException('second statement failed')); + $client = new SpyClient()->willFailExecute(2, new LogicException('second statement failed')); $thrown = null; try { - (new PostgreSqlLoader($client, 'wide'))->load(WideRowsMother::of(70, 1000), flow_context()->backend()); + new PostgreSqlLoader($client, 'wide')->load(WideRowsMother::of(70, 1000), flow_context()->backend()); } catch (LogicException $e) { $thrown = $e; } @@ -118,14 +118,14 @@ public function test_a_chunked_insert_commits_the_transaction_the_loader_opened( { $client = new SpyClient(); - (new PostgreSqlLoader($client, 'wide'))->load(WideRowsMother::of(70, 1000), flow_context()->backend()); + new PostgreSqlLoader($client, 'wide')->load(WideRowsMother::of(70, 1000), flow_context()->backend()); static::assertSame(['beginTransaction', 'execute', 'execute', 'commit'], $client->calls); } public function test_a_failing_chunk_leaves_the_callers_transaction_to_the_caller(): void { - $client = (new SpyClient(transactionNestingLevel: 1))->willFailExecute( + $client = new SpyClient(transactionNestingLevel: 1)->willFailExecute( 2, new LogicException('second statement failed'), ); @@ -133,7 +133,7 @@ public function test_a_failing_chunk_leaves_the_callers_transaction_to_the_calle $thrown = null; try { - (new PostgreSqlLoader($client, 'wide'))->load(WideRowsMother::of(70, 1000), flow_context()->backend()); + new PostgreSqlLoader($client, 'wide')->load(WideRowsMother::of(70, 1000), flow_context()->backend()); } catch (LogicException $e) { $thrown = $e; } @@ -147,7 +147,7 @@ public function test_an_insert_that_exactly_fits_is_one_statement_without_a_tran $client = new SpyClient(); // 70 columns x 936 rows = 65 520 parameters, the most one statement can carry - (new PostgreSqlLoader($client, 'wide'))->load(WideRowsMother::of(70, 936), flow_context()->backend()); + new PostgreSqlLoader($client, 'wide')->load(WideRowsMother::of(70, 936), flow_context()->backend()); static::assertSame(['execute'], $client->calls); } diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/PostgreSqlTransactionTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/PostgreSqlTransactionTest.php index dd53725218..cfd41941a7 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/PostgreSqlTransactionTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/PostgreSqlTransactionTest.php @@ -21,7 +21,7 @@ public function test_begin_opens_a_transaction_without_setting_an_isolation_leve $client->expects(self::once())->method('beginTransaction'); $client->expects(self::never())->method('execute'); - (new PostgreSqlTransaction($client))->begin(); + new PostgreSqlTransaction($client)->begin(); } public function test_begin_sets_the_isolation_level_inside_the_transaction(): void @@ -37,7 +37,7 @@ public function test_begin_sets_the_isolation_level_inside_the_transaction(): vo )) ->willReturn(0); - (new PostgreSqlTransaction($client)) + new PostgreSqlTransaction($client) ->withIsolationLevel(IsolationLevel::SERIALIZABLE) ->begin(); } @@ -52,7 +52,7 @@ public function test_a_failing_isolation_level_closes_the_transaction_begin_open $this->expectExceptionObject($failure); - (new PostgreSqlTransaction($client)) + new PostgreSqlTransaction($client) ->withIsolationLevel(IsolationLevel::SERIALIZABLE) ->begin(); } @@ -62,7 +62,7 @@ public function test_commit_commits(): void $client = $this->createMock(Client::class); $client->expects(self::once())->method('commit'); - (new PostgreSqlTransaction($client))->commit(); + new PostgreSqlTransaction($client)->commit(); } public function test_rollback_rolls_back_and_suppresses_its_own_failure(): void @@ -70,7 +70,7 @@ public function test_rollback_rolls_back_and_suppresses_its_own_failure(): void $client = $this->createMock(Client::class); $client->expects(self::once())->method('rollBack')->willThrowException(new RuntimeException('rollback failed')); - (new PostgreSqlTransaction($client))->rollback(new RuntimeException('load failed')); + new PostgreSqlTransaction($client)->rollback(new RuntimeException('load failed')); } public function test_with_isolation_level_returns_a_new_instance(): void diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/QueryBuilder/InsertQueryBuilderTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/QueryBuilder/InsertQueryBuilderTest.php index 5be6ac64c5..07e1c686e8 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/QueryBuilder/InsertQueryBuilderTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/IO/Loader/QueryBuilder/InsertQueryBuilderTest.php @@ -20,7 +20,7 @@ final class InsertQueryBuilderTest extends TestCase { public function test_build_converts_each_value_with_its_columns_converter(): void { - [$_query, $params] = (new InsertQueryBuilder('users', new TypesMap()))->build( + [$_query, $params] = new InsertQueryBuilder('users', new TypesMap())->build( ['id' => [1, 2], 'name' => ['Alice', 'Bob'], 'active' => [true, false]], 2, schema(int_schema('id'), str_schema('name'), bool_schema('active')), @@ -32,7 +32,7 @@ public function test_build_converts_each_value_with_its_columns_converter(): voi public function test_build_simple_insert(): void { - [$query, $params] = (new InsertQueryBuilder('users', new TypesMap()))->build( + [$query, $params] = new InsertQueryBuilder('users', new TypesMap())->build( ['id' => [1, 2], 'name' => ['Alice', 'Bob']], 2, schema(int_schema('id'), str_schema('name')), @@ -47,7 +47,7 @@ public function test_build_simple_insert(): void public function test_build_with_null_values(): void { - [$_query, $params] = (new InsertQueryBuilder('users', new TypesMap()))->build( + [$_query, $params] = new InsertQueryBuilder('users', new TypesMap())->build( ['id' => [1], 'name' => [null]], 1, schema(int_schema('id'), str_schema('name', nullable: true)), @@ -59,7 +59,7 @@ public function test_build_with_null_values(): void public function test_build_with_skip_conflicts(): void { - [$query, $_params] = (new InsertQueryBuilder('users', new TypesMap()))->build( + [$query, $_params] = new InsertQueryBuilder('users', new TypesMap())->build( ['id' => [1], 'name' => ['Alice']], 1, schema(int_schema('id'), str_schema('name')), @@ -72,7 +72,7 @@ public function test_build_with_skip_conflicts(): void public function test_build_with_upsert_on_columns(): void { - [$query, $_params] = (new InsertQueryBuilder('users', new TypesMap()))->build( + [$query, $_params] = new InsertQueryBuilder('users', new TypesMap())->build( ['id' => [1], 'name' => ['Alice']], 1, schema(int_schema('id'), str_schema('name')), @@ -87,7 +87,7 @@ public function test_build_with_upsert_on_columns(): void public function test_build_with_upsert_on_constraint(): void { - [$query, $_params] = (new InsertQueryBuilder('users', new TypesMap()))->build( + [$query, $_params] = new InsertQueryBuilder('users', new TypesMap())->build( ['id' => [1], 'name' => ['Alice']], 1, schema(int_schema('id'), str_schema('name')), @@ -105,7 +105,7 @@ public function test_build_refuses_a_column_of_another_length(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Column "name" holds 1 values, the insert 2 rows'); - (new InsertQueryBuilder('users', new TypesMap()))->build( + new InsertQueryBuilder('users', new TypesMap())->build( ['id' => [1, 2], 'name' => ['Alice']], 2, schema(int_schema('id'), str_schema('name')), diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/Values/Schema/SchemaConverterTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/Values/Schema/SchemaConverterTest.php index f18787e69d..2a0eb837e1 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/Values/Schema/SchemaConverterTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/Values/Schema/SchemaConverterTest.php @@ -46,7 +46,7 @@ final class SchemaConverterTest extends TestCase { public function test_composite_primary_key(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema( int_schema('order_id', metadata: PostgreSqlMetadata::primaryKey('pk_order_item')), int_schema('item_id', metadata: PostgreSqlMetadata::primaryKey('pk_order_item')), @@ -62,7 +62,7 @@ public function test_composite_primary_key(): void public function test_default_value(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema(bool_schema('active', metadata: PostgreSqlMetadata::default(true))), 'flags', ); @@ -74,12 +74,12 @@ public function test_empty_schema_throws(): void { $this->expectException(RuntimeException::class); - (new SchemaConverter())->toPostgreSqlTable(schema(), 'empty'); + new SchemaConverter()->toPostgreSqlTable(schema(), 'empty'); } public function test_explicit_type_override(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema(str_schema('payload', metadata: PostgreSqlMetadata::type('jsonb'))), 'events', ); @@ -89,7 +89,7 @@ public function test_explicit_type_override(): void public function test_forward_maps_scalar_types(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema( int_schema('id'), str_schema('name'), @@ -115,7 +115,7 @@ public function test_forward_maps_scalar_types(): void public function test_generated_column(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema(int_schema('total', metadata: PostgreSqlMetadata::generated('price * quantity'))), 'line_items', ); @@ -126,7 +126,7 @@ public function test_generated_column(): void public function test_identity_column(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema(int_schema('id', metadata: PostgreSqlMetadata::identity(IdentityGeneration::BY_DEFAULT))), 'users', ); @@ -137,7 +137,7 @@ public function test_identity_column(): void public function test_length_produces_varchar(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema(str_schema('name', metadata: PostgreSqlMetadata::length(120))), 'users', ); @@ -147,7 +147,7 @@ public function test_length_produces_varchar(): void public function test_named_index(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema(str_schema('email', metadata: PostgreSqlMetadata::index('idx_email'))), 'users', ); @@ -160,7 +160,7 @@ public function test_named_index(): void public function test_index_explicit_position_overrides_schema_order(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema( int_schema('id', metadata: PostgreSqlMetadata::index('idx', 2)), datetime_schema('created_at', metadata: PostgreSqlMetadata::index('idx', 1)), @@ -175,7 +175,7 @@ public function test_index_explicit_position_overrides_schema_order(): void public function test_composite_index_without_positions_preserves_schema_order(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema( int_schema('id', metadata: PostgreSqlMetadata::index('idx')), datetime_schema('created_at', metadata: PostgreSqlMetadata::index('idx')), @@ -188,7 +188,7 @@ public function test_composite_index_without_positions_preserves_schema_order(): public function test_composite_unique_with_positions_is_ordered(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema( int_schema('warehouse', metadata: PostgreSqlMetadata::indexUnique('uq_stock', 2)), int_schema('product_id', metadata: PostgreSqlMetadata::indexUnique('uq_stock', 1)), @@ -203,7 +203,7 @@ public function test_composite_unique_with_positions_is_ordered(): void public function test_column_can_belong_to_multiple_indexes(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema( int_schema( 'id', @@ -249,7 +249,7 @@ public function test_reverse_preserves_index_column_order(): void public function test_nullability_from_definition(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema(str_schema('required', nullable: false), str_schema('optional', nullable: true)), 'records', ); @@ -260,7 +260,7 @@ public function test_nullability_from_definition(): void public function test_precision_and_scale_produce_numeric(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema(float_schema( 'amount', metadata: PostgreSqlMetadata::precision(10)->merge(PostgreSqlMetadata::scale(2)), @@ -273,7 +273,7 @@ public function test_precision_and_scale_produce_numeric(): void public function test_primary_key_forces_not_null(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema(int_schema('id', nullable: true, metadata: PostgreSqlMetadata::primaryKey())), 'users', ); @@ -294,7 +294,7 @@ public function test_reverse_maps_columns_to_flow_definitions(): void Column::create('document', ColumnType::xml()), ]); - $flowSchema = (new SchemaConverter())->toFlowSchema($table); + $flowSchema = new SchemaConverter()->toFlowSchema($table); static::assertInstanceOf(IntegerType::class, $flowSchema->get('id')->type()); static::assertInstanceOf(StringType::class, $flowSchema->get('name')->type()); @@ -313,7 +313,7 @@ public function test_reverse_preserves_length_metadata(): void ColumnType::varchar(120), )]); - $definition = (new SchemaConverter())->toFlowSchema($table)->get('name'); + $definition = new SchemaConverter()->toFlowSchema($table)->get('name'); static::assertTrue($definition->metadata()->has(PostgreSqlMetadata::LENGTH->value)); static::assertSame(120, $definition->metadata()->get(PostgreSqlMetadata::LENGTH->value)); @@ -328,7 +328,7 @@ public function test_reverse_primary_key_is_not_nullable(): void primaryKey: new PrimaryKey(['id'], 'pk_users'), ); - $definition = (new SchemaConverter())->toFlowSchema($table)->get('id'); + $definition = new SchemaConverter()->toFlowSchema($table)->get('id'); static::assertFalse($definition->isNullable()); static::assertSame('pk_users', $definition->metadata()->get(PostgreSqlMetadata::PRIMARY_KEY->value)); @@ -355,7 +355,7 @@ public function test_two_primary_keys_throw(): void { $this->expectException(RuntimeException::class); - (new SchemaConverter())->toPostgreSqlTable( + new SchemaConverter()->toPostgreSqlTable( schema( int_schema('a', metadata: PostgreSqlMetadata::primaryKey('pk_a')), int_schema('b', metadata: PostgreSqlMetadata::primaryKey('pk_b')), @@ -366,7 +366,7 @@ public function test_two_primary_keys_throw(): void public function test_unique_constraint(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema(str_schema('email', metadata: PostgreSqlMetadata::indexUnique('uq_email'))), 'users', ); @@ -379,7 +379,7 @@ public function test_unique_constraint(): void public function test_no_options_keeps_defaults(): void { - $table = (new SchemaConverter())->toPostgreSqlTable(schema(int_schema('id')), 'events'); + $table = new SchemaConverter()->toPostgreSqlTable(schema(int_schema('id')), 'events'); static::assertFalse($table->unlogged); static::assertNull($table->tablespace); @@ -393,7 +393,7 @@ public function test_no_options_keeps_defaults(): void public function test_options_collections_thread_into_table(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema(int_schema('id'), int_schema('user_id')), 'orders', 'public', @@ -415,7 +415,7 @@ public function test_options_collections_thread_into_table(): void public function test_options_thread_into_table(): void { - $table = (new SchemaConverter())->toPostgreSqlTable( + $table = new SchemaConverter()->toPostgreSqlTable( schema(int_schema('id')), 'events', 'public', diff --git a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/Values/Schema/TypesMapTest.php b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/Values/Schema/TypesMapTest.php index c6391380bd..1e8d3d6584 100644 --- a/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/Values/Schema/TypesMapTest.php +++ b/src/adapter/etl-adapter-postgresql/tests/Flow/ETL/Adapter/PostgreSql/Tests/Unit/Values/Schema/TypesMapTest.php @@ -140,22 +140,19 @@ public static function provide_unmapped_types(): Generator #[DataProvider('provide_mapped_types_with_their_flow_type')] public function test_every_mapped_postgresql_type_becomes_its_flow_type(string $pgType, Type $expected): void { - static::assertEquals($expected, (new TypesMap())->toFlowTypeWithTextFloor(column_type_from_string($pgType))); + static::assertEquals($expected, new TypesMap()->toFlowTypeWithTextFloor(column_type_from_string($pgType))); } public function test_an_unrecognised_name_is_refused_on_the_catalog_route(): void { $this->expectException(TypeMappingException::class); - (new TypesMap())->toFlowType(column_type_from_string('hstore')); + new TypesMap()->toFlowType(column_type_from_string('hstore')); } public function test_an_unrecognised_name_takes_the_text_floor_on_the_result_route(): void { - static::assertEquals( - type_string(), - (new TypesMap())->toFlowTypeWithTextFloor(column_type_from_string('hstore')), - ); + static::assertEquals(type_string(), new TypesMap()->toFlowTypeWithTextFloor(column_type_from_string('hstore'))); } #[DataProvider('provide_mapped_types_with_a_wire_value')] @@ -163,9 +160,9 @@ public function test_every_mapped_type_has_a_caster_arm(string $pgType, string $ { // Map subset of arms, not pairwise: a mapping is only legitimate while the caster produces // a value the derived schema accepts. - $flowType = (new TypesMap())->toFlowTypeWithTextFloor(column_type_from_string($pgType)); + $flowType = new TypesMap()->toFlowTypeWithTextFloor(column_type_from_string($pgType)); - static::assertTrue($flowType->isValid($flowType->cast((new ResultCaster())->cast($wireValue, $pgType)))); + static::assertTrue($flowType->isValid($flowType->cast(new ResultCaster()->cast($wireValue, $pgType)))); } #[DataProvider('provide_unmapped_types')] @@ -173,14 +170,14 @@ public function test_record_and_the_geometric_types_are_refused(string $pgType): { $this->expectException(TypeMappingException::class); - (new TypesMap())->toFlowTypeWithTextFloor(column_type_from_string($pgType)); + new TypesMap()->toFlowTypeWithTextFloor(column_type_from_string($pgType)); } public function test_an_array_of_an_unmapped_element_type_is_refused(): void { $this->expectException(TypeMappingException::class); - (new TypesMap())->toFlowTypeWithTextFloor(column_type_from_string('_point')); + new TypesMap()->toFlowTypeWithTextFloor(column_type_from_string('_point')); } public function test_an_array_type_becomes_a_list_of_its_element_type(): void @@ -206,7 +203,7 @@ public function test_an_array_type_becomes_a_list_of_its_element_type(): void #[DataProvider('provide_catalog_array_types')] public function test_an_array_column_becomes_a_list_on_the_catalog_route(string $pgType, Type $expected): void { - static::assertEquals($expected, (new TypesMap())->toFlowType(column_type_from_string($pgType))); + static::assertEquals($expected, new TypesMap()->toFlowType(column_type_from_string($pgType))); } /** @@ -244,12 +241,12 @@ public function test_value_type_refuses_an_unmapped_type(): void { $this->expectException(TypeMappingException::class); - (new TypesMap())->valueType('payload', type_array()); + new TypesMap()->valueType('payload', type_array()); } public function test_maps_boolean_type_to_bool(): void { - $result = (new TypesMap())->map('active', type_boolean(), true); + $result = new TypesMap()->map('active', type_boolean(), true); static::assertInstanceOf(TypedValue::class, $result); static::assertSame(ValueType::BOOL, $result->targetType); @@ -259,7 +256,7 @@ public function test_maps_boolean_type_to_bool(): void public function test_maps_datetime_type_to_timestamp(): void { $date = new DateTimeImmutable('2024-01-15 10:30:00'); - $result = (new TypesMap())->map('created_at', type_datetime(), $date); + $result = new TypesMap()->map('created_at', type_datetime(), $date); static::assertInstanceOf(TypedValue::class, $result); static::assertSame(ValueType::TIMESTAMP, $result->targetType); @@ -268,7 +265,7 @@ public function test_maps_datetime_type_to_timestamp(): void public function test_maps_float_type_to_float8(): void { - $result = (new TypesMap())->map('price', type_float(), 99.99); + $result = new TypesMap()->map('price', type_float(), 99.99); static::assertInstanceOf(TypedValue::class, $result); static::assertSame(ValueType::FLOAT8, $result->targetType); @@ -277,7 +274,7 @@ public function test_maps_float_type_to_float8(): void public function test_maps_integer_type_to_int8(): void { - $result = (new TypesMap())->map('count', type_integer(), 42); + $result = new TypesMap()->map('count', type_integer(), 42); static::assertInstanceOf(TypedValue::class, $result); static::assertSame(ValueType::INT8, $result->targetType); @@ -286,7 +283,7 @@ public function test_maps_integer_type_to_int8(): void public function test_maps_json_type_to_jsonb(): void { - $result = (new TypesMap())->map('data', type_json(), ['key' => 'value']); + $result = new TypesMap()->map('data', type_json(), ['key' => 'value']); static::assertInstanceOf(TypedValue::class, $result); static::assertSame(ValueType::JSONB, $result->targetType); @@ -294,7 +291,7 @@ public function test_maps_json_type_to_jsonb(): void public function test_maps_list_type_to_jsonb(): void { - $result = (new TypesMap())->map('tags', type_list(type_integer()), [1, 2, 3]); + $result = new TypesMap()->map('tags', type_list(type_integer()), [1, 2, 3]); static::assertInstanceOf(TypedValue::class, $result); static::assertSame(ValueType::JSONB, $result->targetType); @@ -303,7 +300,7 @@ public function test_maps_list_type_to_jsonb(): void public function test_maps_map_type_to_jsonb(): void { - $result = (new TypesMap())->map('metadata', type_map(type_string(), type_string()), ['key' => 'value']); + $result = new TypesMap()->map('metadata', type_map(type_string(), type_string()), ['key' => 'value']); static::assertInstanceOf(TypedValue::class, $result); static::assertSame(ValueType::JSONB, $result->targetType); @@ -312,12 +309,12 @@ public function test_maps_map_type_to_jsonb(): void public function test_maps_null_value_to_null(): void { - static::assertNull((new TypesMap())->map('name', type_string(), null)); + static::assertNull(new TypesMap()->map('name', type_string(), null)); } public function test_maps_string_type_to_text(): void { - $result = (new TypesMap())->map('name', type_string(), 'Alice'); + $result = new TypesMap()->map('name', type_string(), 'Alice'); static::assertInstanceOf(TypedValue::class, $result); static::assertSame(ValueType::TEXT, $result->targetType); @@ -326,7 +323,7 @@ public function test_maps_string_type_to_text(): void public function test_maps_structure_type_to_jsonb(): void { - $result = (new TypesMap())->map('user', type_structure(['name' => type_string(), 'age' => type_integer()]), [ + $result = new TypesMap()->map('user', type_structure(['name' => type_string(), 'age' => type_integer()]), [ 'name' => 'Alice', 'age' => 30, ]); @@ -337,7 +334,7 @@ public function test_maps_structure_type_to_jsonb(): void public function test_maps_uuid_type_to_uuid(): void { - $result = (new TypesMap())->map('id', type_uuid(), '550e8400-e29b-41d4-a716-446655440000'); + $result = new TypesMap()->map('id', type_uuid(), '550e8400-e29b-41d4-a716-446655440000'); static::assertInstanceOf(TypedValue::class, $result); static::assertSame(ValueType::UUID, $result->targetType); @@ -345,7 +342,7 @@ public function test_maps_uuid_type_to_uuid(): void public function test_maps_time_zone_type_to_text(): void { - $result = (new TypesMap())->map('tz', type_time_zone(), new DateTimeZone('Europe/Warsaw')); + $result = new TypesMap()->map('tz', type_time_zone(), new DateTimeZone('Europe/Warsaw')); static::assertInstanceOf(TypedValue::class, $result); static::assertSame(ValueType::TEXT, $result->targetType); @@ -404,6 +401,6 @@ public function test_to_flow_type_maps_varchar_to_string(): void public function test_to_flow_type_floors_an_unknown_type_name_to_string(): void { - static::assertEquals(type_string(), (new TypesMap())->toFlowTypeWithTextFloor(ColumnType::custom('hstore'))); + static::assertEquals(type_string(), new TypesMap()->toFlowTypeWithTextFloor(ColumnType::custom('hstore'))); } } diff --git a/src/adapter/etl-adapter-seal/composer.json b/src/adapter/etl-adapter-seal/composer.json index 05407c5d6b..17ed24afa8 100644 --- a/src/adapter/etl-adapter-seal/composer.json +++ b/src/adapter/etl-adapter-seal/composer.json @@ -12,7 +12,7 @@ "adapter" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "cmsig/seal": "^0.12", "flow-php/etl": "self.version" }, diff --git a/src/adapter/etl-adapter-seal/src/Flow/ETL/Adapter/Seal/IO/Loader/SealEncoder.php b/src/adapter/etl-adapter-seal/src/Flow/ETL/Adapter/Seal/IO/Loader/SealEncoder.php index 16156393b2..844a1ef3fa 100644 --- a/src/adapter/etl-adapter-seal/src/Flow/ETL/Adapter/Seal/IO/Loader/SealEncoder.php +++ b/src/adapter/etl-adapter-seal/src/Flow/ETL/Adapter/Seal/IO/Loader/SealEncoder.php @@ -121,7 +121,7 @@ public function column(Type $type, Column $column): array if ( $bare instanceof TimeType || $bare instanceof NullType - || (new PhysicalFor())->physical($bare) instanceof IdentityPhysical + || new PhysicalFor()->physical($bare) instanceof IdentityPhysical ) { return $column->physicals(); } diff --git a/src/adapter/etl-adapter-seal/src/Flow/ETL/Adapter/Seal/functions.php b/src/adapter/etl-adapter-seal/src/Flow/ETL/Adapter/Seal/functions.php index 9d44524cca..7daa74ec3e 100644 --- a/src/adapter/etl-adapter-seal/src/Flow/ETL/Adapter/Seal/functions.php +++ b/src/adapter/etl-adapter-seal/src/Flow/ETL/Adapter/Seal/functions.php @@ -29,11 +29,11 @@ function to_seal_delete(EngineInterface $engine, string $index): SealLoader #[DocumentationDSL(module: Module::SEAL, type: Type::HELPER)] function to_seal_schema(Schema $schema, string $index_name, ?string $identifier = null): SealSchema { - return (new SchemaConverter())->toSealSchema($schema, $index_name, $identifier); + return new SchemaConverter()->toSealSchema($schema, $index_name, $identifier); } #[DocumentationDSL(module: Module::SEAL, type: Type::HELPER)] function seal_schema_to_flow(SealSchema $schema): Schema { - return (new SchemaConverter())->toFlowSchema($schema); + return new SchemaConverter()->toFlowSchema($schema); } diff --git a/src/adapter/etl-adapter-seal/tests/Flow/ETL/Adapter/Seal/Tests/Integration/SealAllColumnTypesTest.php b/src/adapter/etl-adapter-seal/tests/Flow/ETL/Adapter/Seal/Tests/Integration/SealAllColumnTypesTest.php index a604857b03..36a573f487 100644 --- a/src/adapter/etl-adapter-seal/tests/Flow/ETL/Adapter/Seal/Tests/Integration/SealAllColumnTypesTest.php +++ b/src/adapter/etl-adapter-seal/tests/Flow/ETL/Adapter/Seal/Tests/Integration/SealAllColumnTypesTest.php @@ -17,7 +17,7 @@ final class SealAllColumnTypesTest extends IntegrationTestCase public function test_indexing_pipeline_loads_all_flow_entry_types(): void { $engine = $this->sealContext()->engine(to_seal_schema( - (new FakeStaticOrdersExtractor())->schema(), + new FakeStaticOrdersExtractor()->schema(), 'orders', 'index', )); diff --git a/src/adapter/etl-adapter-seal/tests/Flow/ETL/Adapter/Seal/Tests/Unit/DescribableRoundTripTest.php b/src/adapter/etl-adapter-seal/tests/Flow/ETL/Adapter/Seal/Tests/Unit/DescribableRoundTripTest.php index 95d58e3811..f36175145f 100644 --- a/src/adapter/etl-adapter-seal/tests/Flow/ETL/Adapter/Seal/Tests/Unit/DescribableRoundTripTest.php +++ b/src/adapter/etl-adapter-seal/tests/Flow/ETL/Adapter/Seal/Tests/Unit/DescribableRoundTripTest.php @@ -6,7 +6,6 @@ use Flow\ETL\Adapter\Seal\Tests\Context\DescribableFixtures; use Flow\ETL\Foundation\Describe\Describable; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Foundation\Exception\RuntimeException; use Flow\ETL\Tests\Context\DescribeRoundTrip; use Flow\ETL\Tests\Context\ExtractorClasses; @@ -58,11 +57,7 @@ public function test_a_rebuilt_describable_equals_the_described_one(string $clas $this->expectException(RuntimeException::class); } - try { - $describable = DescribableFixtures::all()[$class](); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $describable = DescribableFixtures::all()[$class](); if (in_array($class, DescribableFixtures::undescribable(), true)) { static::assertNull($describable->describe()); diff --git a/src/adapter/etl-adapter-seal/tests/Flow/ETL/Adapter/Seal/Tests/Unit/IO/Loader/SealEncoderTest.php b/src/adapter/etl-adapter-seal/tests/Flow/ETL/Adapter/Seal/Tests/Unit/IO/Loader/SealEncoderTest.php index bbeccee1d6..f9e27d96f4 100644 --- a/src/adapter/etl-adapter-seal/tests/Flow/ETL/Adapter/Seal/Tests/Unit/IO/Loader/SealEncoderTest.php +++ b/src/adapter/etl-adapter-seal/tests/Flow/ETL/Adapter/Seal/Tests/Unit/IO/Loader/SealEncoderTest.php @@ -16,7 +16,6 @@ use Flow\Types\Value\Uuid; use Generator; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RequiresPhp; use function Flow\ETL\DSL\array_to_rows; use function Flow\ETL\DSL\date_schema; @@ -94,7 +93,7 @@ public function test_encodes_values_into_documents(mixed $value, mixed $expected { static::assertSame( $expected, - (new SealEncoder())->encode(array_to_rows([[ + new SealEncoder()->encode(array_to_rows([[ 'field' => $value, ]], schema(definition_from_type('field', $type, nullable: $value === null))))[0]['field'], ); @@ -107,7 +106,7 @@ public function test_encodes_xml_document_to_string(): void static::assertSame( '1', - (new SealEncoder())->encode(array_to_rows([['xml' => $doc]], schema(xml_schema('xml'))))[0]['xml'], + new SealEncoder()->encode(array_to_rows([['xml' => $doc]], schema(xml_schema('xml'))))[0]['xml'], ); } @@ -115,7 +114,7 @@ public function test_renders_date_with_the_date_format(): void { static::assertSame( '2023-10-01', - (new SealEncoder())->encode(array_to_rows([[ + new SealEncoder()->encode(array_to_rows([[ 'date' => new DateTimeImmutable('2023-10-01 00:00:00'), ]], schema(date_schema('date'))))[0]['date'], ); @@ -125,7 +124,7 @@ public function test_produces_documents_keyed_by_column_name(): void { static::assertSame( [['id' => 1, 'name' => 'Alice'], ['id' => 2, 'name' => 'Bob']], - (new SealEncoder())->encode(array_to_rows( + new SealEncoder()->encode(array_to_rows( [['id' => 1, 'name' => 'Alice'], ['id' => 2, 'name' => 'Bob']], schema(int_schema('id'), str_schema('name')), )), @@ -139,7 +138,7 @@ public function test_encodes_an_xml_element_as_its_markup(): void static::assertSame( [['e' => '']], - (new SealEncoder())->encode(array_to_rows([[ + new SealEncoder()->encode(array_to_rows([[ 'e' => $document->getElementsByTagName('a')->item(0), ]], schema(xml_element_schema('e')))), ); @@ -149,30 +148,28 @@ public function test_encodes_a_datetime_column_with_nulls(): void { static::assertSame( [['at' => '2026-01-02T03:04:05+00:00'], ['at' => null]], - (new SealEncoder())->encode(array_to_rows([ + new SealEncoder()->encode(array_to_rows([ ['at' => new DateTimeImmutable('2026-01-02 03:04:05 UTC')], ['at' => null], ], schema(datetime_schema('at', nullable: true)))), ); } - #[RequiresPhp('>= 8.4.0')] public function test_encodes_an_html_document_as_its_markup(): void { static::assertSame( [['h' => '

a

']], - (new SealEncoder())->encode(array_to_rows([[ + new SealEncoder()->encode(array_to_rows([[ 'h' => '

a

', ]], schema(html_schema('h')))), ); } - #[RequiresPhp('>= 8.4.0')] public function test_encodes_an_html_element_with_a_parent_as_its_markup(): void { static::assertSame( [['e' => '

a

']], - (new SealEncoder())->encode(array_to_rows([[ + new SealEncoder()->encode(array_to_rows([[ 'e' => type_html_element()->cast('

a

')->firstElementChild, ]], schema(html_element_schema('e')))), ); diff --git a/src/adapter/etl-adapter-text/composer.json b/src/adapter/etl-adapter-text/composer.json index 59bce3cf8c..c16439c02e 100644 --- a/src/adapter/etl-adapter-text/composer.json +++ b/src/adapter/etl-adapter-text/composer.json @@ -11,7 +11,7 @@ "adapter" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/etl": "self.version" }, "config": { diff --git a/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/IO/Loader/TextEncoder.php b/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/IO/Loader/TextEncoder.php index 91ebce0dd7..7b611f4a77 100644 --- a/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/IO/Loader/TextEncoder.php +++ b/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/IO/Loader/TextEncoder.php @@ -55,7 +55,7 @@ public function encode(Rows $rows): string return ( implode( $this->newLineSeparator, - (new TextValues())->texts($type, $rows->column($definitions[0]->name())->physicals()), + new TextValues()->texts($type, $rows->column($definitions[0]->name())->physicals()), ) . $this->newLineSeparator ); } diff --git a/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/IO/Loader/TextLoader.php b/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/IO/Loader/TextLoader.php index a31f5243e4..0679bada9d 100644 --- a/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/IO/Loader/TextLoader.php +++ b/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/IO/Loader/TextLoader.php @@ -65,10 +65,10 @@ public function __construct(Path $path, Filesystem $filesystem = new NativeLocal public static function fromDescription(#[SensitiveParameter] array $data, Rebuild $rebuild): static { - $loader = (new self( + $loader = new self( Path::fromArray(type_array()->assert($data['path'] ?? null)), $rebuild->of($data['filesystem'] ?? null, ConfiguredFilesystem::class)->filesystem(), - )) + ) ->saveMode(type_enum(SaveMode::class)->assert(constant( SaveMode::class . '::' . type_string()->assert($data['save_mode'] ?? null), ))) @@ -140,7 +140,7 @@ public function partitioning(): Partitioning public function inTask(Part $task): static { - $loader = (new self($this->path, $this->filesystem)) + $loader = new self($this->path, $this->filesystem) ->saveMode($this->saveMode) ->withNewLineSeparator($this->newLineSeparator); diff --git a/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/functions.php b/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/functions.php index 1265381f8d..9ff5857cdc 100644 --- a/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/functions.php +++ b/src/adapter/etl-adapter-text/src/Flow/ETL/Adapter/Text/functions.php @@ -35,7 +35,7 @@ function to_text( string $new_line_separator = PHP_EOL, Filesystem $filesystem = new NativeLocalFilesystem(), ): TextLoader { - return (new TextLoader(is_string($path) ? path_real($path) : $path, $filesystem))->withNewLineSeparator( + return new TextLoader(is_string($path) ? path_real($path) : $path, $filesystem)->withNewLineSeparator( $new_line_separator, ); } diff --git a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/IO/Extractor/TextExtractorTest.php b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/IO/Extractor/TextExtractorTest.php index ff444769dd..08571a0298 100644 --- a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/IO/Extractor/TextExtractorTest.php +++ b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/IO/Extractor/TextExtractorTest.php @@ -152,7 +152,7 @@ public function test_a_limited_read_closes_its_stream(): void $filesystem = new RecordingFilesystem(native_local_filesystem()); iterator_to_array(FlowTestCase::extracted( - (new TextExtractor(path_real(__DIR__ . '/../../../Fixtures/parity_lines.txt'), $filesystem))->withBatchSize( + new TextExtractor(path_real(__DIR__ . '/../../../Fixtures/parity_lines.txt'), $filesystem)->withBatchSize( 1, ), flow_context(config())->backend(), @@ -166,7 +166,7 @@ public function test_a_stopped_read_closes_its_stream(): void { $filesystem = new RecordingFilesystem(native_local_filesystem()); $generator = FlowTestCase::extracted( - (new TextExtractor(path_real(__DIR__ . '/../../../Fixtures/parity_lines.txt'), $filesystem))->withBatchSize( + new TextExtractor(path_real(__DIR__ . '/../../../Fixtures/parity_lines.txt'), $filesystem)->withBatchSize( 1, ), flow_context(config())->backend(), @@ -303,7 +303,7 @@ public function test_extract_split_stops_on_the_stop_signal(): void $generator = FlowTestCase::extracted( $extractor, flow_context()->backend(), - (new Criteria())->withSplit($extractor->splits(new Criteria(), 1)[0]), + new Criteria()->withSplit($extractor->splits(new Criteria(), 1)[0]), ); $totalRows = 0; @@ -345,7 +345,7 @@ public function test_a_pushed_path_filter_prunes_the_files_splits_are_cut_from() static::assertEquals( [new FileSplit($extractor->source(), 0, null)], - $extractor->splits((new Criteria())->withPathFilter(new RejectingFilter()), 1), + $extractor->splits(new Criteria()->withPathFilter(new RejectingFilter()), 1), ); } } diff --git a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/IO/FileFormatContractTest.php b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/IO/FileFormatContractTest.php index c2dfb6e24b..a3346fc9ce 100644 --- a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/IO/FileFormatContractTest.php +++ b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/IO/FileFormatContractTest.php @@ -30,109 +30,109 @@ public static function formats(): Generator #[DataProvider('formats')] public function test_overwrite_replaces_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->overwriteReplacesWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->overwriteReplacesWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_append_keeps_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->appendKeepsWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->appendKeepsWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_ignore_leaves_an_existing_destination_untouched(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->ignoreLeavesAnExistingDestinationUntouched($format); + new FileFormatContract($this->cacheDir)->ignoreLeavesAnExistingDestinationUntouched($format); } #[DataProvider('formats')] public function test_exception_if_exists_refuses_an_existing_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->exceptionIfExistsRefusesAnExistingDestination($format); + new FileFormatContract($this->cacheDir)->exceptionIfExistsRefusesAnExistingDestination($format); } #[DataProvider('formats')] public function test_a_batch_of_zero_rows_creates_no_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aBatchOfZeroRowsCreatesNoFile($format); + new FileFormatContract($this->cacheDir)->aBatchOfZeroRowsCreatesNoFile($format); } #[DataProvider('formats')] public function test_a_write_that_ends_reports_its_file_operations(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aWriteThatEndsReportsItsFileOperations($format); + new FileFormatContract($this->cacheDir)->aWriteThatEndsReportsItsFileOperations($format); } #[DataProvider('formats')] public function test_a_partitioned_write_reads_back_every_partition(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPartitionedWriteReadsBackEveryPartition($format); + new FileFormatContract($this->cacheDir)->aPartitionedWriteReadsBackEveryPartition($format); } #[DataProvider('formats')] public function test_a_loader_in_a_task_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderInATaskSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->aLoaderInATaskSurvivesDescribe($format); } #[DataProvider('formats')] public function test_an_extractor_reader_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorReaderSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->anExtractorReaderSurvivesDescribe($format); } #[DataProvider('formats')] public function test_the_splits_read_every_row_once(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theSplitsReadEveryRowOnce($format); + new FileFormatContract($this->cacheDir)->theSplitsReadEveryRowOnce($format); } #[DataProvider('formats')] public function test_metadata_columns_name_the_source_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->metadataColumnsNameTheSourceFile($format); + new FileFormatContract($this->cacheDir)->metadataColumnsNameTheSourceFile($format); } #[DataProvider('formats')] public function test_the_batch_size_bounds_every_batch(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theBatchSizeBoundsEveryBatch($format); + new FileFormatContract($this->cacheDir)->theBatchSizeBoundsEveryBatch($format); } #[DataProvider('formats')] public function test_refresh_lists_the_files_written_after_a_read(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->refreshListsTheFilesWrittenAfterARead($format); + new FileFormatContract($this->cacheDir)->refreshListsTheFilesWrittenAfterARead($format); } #[DataProvider('formats')] public function test_a_failed_run_leaves_no_file_at_the_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aFailedRunLeavesNoFileAtTheDestination($format); + new FileFormatContract($this->cacheDir)->aFailedRunLeavesNoFileAtTheDestination($format); } #[DataProvider('formats')] public function test_an_extractor_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_a_loader_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_reads_back_through_the_same_filesystem_instance(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->readsBackThroughTheSameFilesystemInstance($format); + new FileFormatContract($this->cacheDir)->readsBackThroughTheSameFilesystemInstance($format); } #[DataProvider('formats')] public function test_a_pushed_filter_returns_what_the_filter_node_returns(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPushedFilterReturnsWhatTheFilterNodeReturns( + new FileFormatContract($this->cacheDir)->aPushedFilterReturnsWhatTheFilterNodeReturns( $format, ref('text')->notEquals(lit('b')), ); diff --git a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/IO/Loader/TextLoaderTest.php b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/IO/Loader/TextLoaderTest.php index 759c7ee3ab..9a5956e4a9 100644 --- a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/IO/Loader/TextLoaderTest.php +++ b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Integration/IO/Loader/TextLoaderTest.php @@ -37,7 +37,7 @@ final class TextLoaderTest extends FlowTestCase public function test_setting_content_type_on_path(): void { static::assertEquals( - (new TextLoader(path(__DIR__ . '/file.txt'))) + new TextLoader(path(__DIR__ . '/file.txt')) ->destination() ->getOption(Option::CONTENT_TYPE), ContentType::TEXT, diff --git a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/DescribableRoundTripTest.php b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/DescribableRoundTripTest.php index 5f6eeace51..295d78127f 100644 --- a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/DescribableRoundTripTest.php +++ b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/DescribableRoundTripTest.php @@ -6,7 +6,6 @@ use Flow\ETL\Adapter\Text\Tests\Context\DescribableFixtures; use Flow\ETL\Foundation\Describe\Describable; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Foundation\Exception\RuntimeException; use Flow\ETL\Tests\Context\DescribeRoundTrip; use Flow\ETL\Tests\Context\ExtractorClasses; @@ -58,11 +57,7 @@ public function test_a_rebuilt_describable_equals_the_described_one(string $clas $this->expectException(RuntimeException::class); } - try { - $describable = DescribableFixtures::all()[$class](); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $describable = DescribableFixtures::all()[$class](); if (in_array($class, DescribableFixtures::undescribable(), true)) { static::assertNull($describable->describe()); diff --git a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php index 14eeee0832..892b15ee24 100644 --- a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php +++ b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php @@ -31,7 +31,7 @@ public static function extractors(): Generator #[DataProvider('extractors')] public function test_an_extractor_carries_the_metadata_setter_only_when_it_declares_metadata(string $class): void { - if ((new ReflectionClass($class))->implementsInterface(MetadataColumnsExtractor::class)) { + if (new ReflectionClass($class)->implementsInterface(MetadataColumnsExtractor::class)) { MetadataColumnsContract::declares($class); return; diff --git a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/IO/Extractor/TextFileBatchesTest.php b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/IO/Extractor/TextFileBatchesTest.php index e6bdf03386..2fd7eff314 100644 --- a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/IO/Extractor/TextFileBatchesTest.php +++ b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/IO/Extractor/TextFileBatchesTest.php @@ -26,7 +26,7 @@ final class TextFileBatchesTest extends FlowTestCase public function test_lines_land_in_the_text_column_and_no_offset_is_consumed(): void { $filesystem = new CountingFilesystem(MemoryFiles::with(['memory://a.txt' => "a\nb\nc\n"])); - $file = (new TextFileBatches())->batches( + $file = new TextFileBatches()->batches( FileReadMother::of(schema(str_schema('text')), null, 2, $filesystem), new Criteria(), new SourceFile(path('memory://a.txt')), @@ -49,7 +49,7 @@ public function test_a_column_the_body_declares_beside_text_is_padded_with_nulls array_map( static fn(Rows $rows): array => $rows->toArray(), iterator_to_array( - (new TextFileBatches())->batches( + new TextFileBatches()->batches( FileReadMother::of( schema(str_schema('text'), str_schema('note', nullable: true)), null, diff --git a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/IO/Loader/TextEncoderTest.php b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/IO/Loader/TextEncoderTest.php index 54841e3a97..a15bc7e960 100644 --- a/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/IO/Loader/TextEncoderTest.php +++ b/src/adapter/etl-adapter-text/tests/Flow/ETL/Adapter/Text/Tests/Unit/IO/Loader/TextEncoderTest.php @@ -41,7 +41,7 @@ public function test_encode_writes_every_value_on_its_own_line_and_a_null_as_an_ { static::assertSame( "first\n\nsecond\n", - (new TextEncoder("\n"))->encode(array_to_rows([ + new TextEncoder("\n")->encode(array_to_rows([ ['text' => 'first'], ['text' => null], ['text' => 'second'], @@ -53,7 +53,7 @@ public function test_encode_writes_the_text_of_a_value_that_is_no_string(): void { static::assertSame( "0.30000000000000004\n1.0\n", - (new TextEncoder("\n"))->encode(array_to_rows([ + new TextEncoder("\n")->encode(array_to_rows([ ['price' => 0.1 + 0.2], ['price' => 1.0], ], schema(float_schema('price')))), @@ -69,14 +69,14 @@ public function test_encode_refuses_a_nested_column(Definition $definition, mixe $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Text data loader supports only scalar values, got array'); - (new TextEncoder())->encode(array_to_rows([['a' => $value]], schema($definition))); + new TextEncoder()->encode(array_to_rows([['a' => $value]], schema($definition))); } public function test_encode_ends_every_line_with_the_configured_separator(): void { static::assertSame( "first\r\nsecond\r\n", - (new TextEncoder("\r\n"))->encode(array_to_rows([ + new TextEncoder("\r\n")->encode(array_to_rows([ ['text' => 'first'], ['text' => 'second'], ], schema(str_schema('text')))), @@ -88,7 +88,7 @@ public function test_encode_throws_when_a_row_has_more_than_one_column(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Text data loader writes at most one column, the batch has 3 columns.'); - (new TextEncoder())->encode(array_to_rows( + new TextEncoder()->encode(array_to_rows( [['a' => 1, 'b' => 2, 'c' => 3], ['a' => 4, 'b' => 5, 'c' => 6]], schema(int_schema('a'), int_schema('b'), int_schema('c')), )); @@ -96,9 +96,6 @@ public function test_encode_throws_when_a_row_has_more_than_one_column(): void public function test_encode_of_an_empty_batch_with_more_than_one_column_returns_no_lines(): void { - static::assertSame( - '', - (new TextEncoder())->encode(array_to_rows([], schema(int_schema('a'), int_schema('b')))), - ); + static::assertSame('', new TextEncoder()->encode(array_to_rows([], schema(int_schema('a'), int_schema('b'))))); } } diff --git a/src/adapter/etl-adapter-xml/composer.json b/src/adapter/etl-adapter-xml/composer.json index 5ad21fee10..6d3afbb494 100644 --- a/src/adapter/etl-adapter-xml/composer.json +++ b/src/adapter/etl-adapter-xml/composer.json @@ -11,7 +11,7 @@ "adapter" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "ext-dom": "*", "ext-xml": "*", "ext-xmlreader": "*", diff --git a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/IO/Extractor/XMLNodeCursor.php b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/IO/Extractor/XMLNodeCursor.php index a0834a46ad..cd9d99fce3 100644 --- a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/IO/Extractor/XMLNodeCursor.php +++ b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/IO/Extractor/XMLNodeCursor.php @@ -99,7 +99,7 @@ public function of(SourceStream $stream, int $bufferSize): Generator $error !== false && $error->level === LIBXML_ERR_FATAL && $error->code !== self::DOCUMENT_EMPTY - && !($error->code === self::EXTRA_CONTENT && (new RootlessDocument())->matches($stream, $bufferSize)) + && !($error->code === self::EXTRA_CONTENT && new RootlessDocument()->matches($stream, $bufferSize)) ) { throw $this->failure(); } diff --git a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/IO/Loader/XMLLoader.php b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/IO/Loader/XMLLoader.php index 36e006d6e1..0da55fcd28 100644 --- a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/IO/Loader/XMLLoader.php +++ b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/IO/Loader/XMLLoader.php @@ -92,11 +92,11 @@ public function __construct( public static function fromDescription(#[SensitiveParameter] array $data, Rebuild $rebuild): static { - $loader = (new self( + $loader = new self( Path::fromArray(type_array()->assert($data['path'] ?? null)), $rebuild->of($data['xml_writer'] ?? null, XMLWriter::class), $rebuild->of($data['filesystem'] ?? null, ConfiguredFilesystem::class)->filesystem(), - )) + ) ->saveMode(type_enum(SaveMode::class)->assert(constant( SaveMode::class . '::' . type_string()->assert($data['save_mode'] ?? null), ))) @@ -191,7 +191,7 @@ public function partitioning(): Partitioning public function inTask(Part $task): static { - $loader = (new self($this->path, $this->xmlWriter, $this->filesystem)) + $loader = new self($this->path, $this->xmlWriter, $this->filesystem) ->saveMode($this->saveMode) ->withAttributePrefix($this->attributePrefix) ->withDateFormat($this->dateFormat) diff --git a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/functions.php b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/functions.php index 7112777c73..10e7cc896d 100644 --- a/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/functions.php +++ b/src/adapter/etl-adapter-xml/src/Flow/ETL/Adapter/XML/functions.php @@ -42,7 +42,7 @@ function from_xml( string $xml_node_path = '', Filesystem $filesystem = new NativeLocalFilesystem(), ): XMLParserExtractor { - return (new XMLParserExtractor(is_string($path) ? path_real($path) : $path, $filesystem))->withXMLNodePath( + return new XMLParserExtractor(is_string($path) ? path_real($path) : $path, $filesystem)->withXMLNodePath( $xml_node_path, ); } @@ -65,7 +65,7 @@ function to_xml( XMLWriter $xml_writer = new StringXMLWriter(), Filesystem $filesystem = new NativeLocalFilesystem(), ): XMLLoader { - return (new XMLLoader(is_string($path) ? path_real($path) : $path, $xml_writer, $filesystem)) + return new XMLLoader(is_string($path) ? path_real($path) : $path, $xml_writer, $filesystem) ->withRootElementName($root_element_name) ->withRowElementName($row_element_name) ->withAttributePrefix($attribute_prefix) diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Context/SerializedNodes.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Context/SerializedNodes.php index 668919a5f4..978968f6ec 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Context/SerializedNodes.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Context/SerializedNodes.php @@ -24,7 +24,7 @@ public static function of(string $xmlNodePath, string $xml, int $bufferSize = 81 return array_map( static fn(DOMDocument $document): string => (string) $document->saveXML($document->documentElement), iterator_to_array( - (new XMLNodes($xmlNodePath))->documents( + new XMLNodes($xmlNodePath)->documents( new StringSourceStream(path('memory://document.xml'), $xml), $bufferSize, ), diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Integration/IO/Extractor/XMLParserExtractorTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Integration/IO/Extractor/XMLParserExtractorTest.php index d760e06de1..c60c023a89 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Integration/IO/Extractor/XMLParserExtractorTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Integration/IO/Extractor/XMLParserExtractorTest.php @@ -409,7 +409,7 @@ public function test_is_repeatable(): void public function test_a_limited_read_closes_its_stream(): void { $filesystem = new RecordingFilesystem(native_local_filesystem()); - $extractor = (new XMLParserExtractor(path_real(__DIR__ . '/../../../Fixtures/simple_items.xml'), $filesystem)) + $extractor = new XMLParserExtractor(path_real(__DIR__ . '/../../../Fixtures/simple_items.xml'), $filesystem) ->withXMLNodePath('root/items/item') ->withBatchSize(1); @@ -476,7 +476,7 @@ public function test_a_stopped_read_closes_its_stream(): void { $filesystem = new RecordingFilesystem(native_local_filesystem()); $generator = FlowTestCase::extracted( - (new XMLParserExtractor(path_real(__DIR__ . '/../../../Fixtures/simple_items.xml'), $filesystem)) + new XMLParserExtractor(path_real(__DIR__ . '/../../../Fixtures/simple_items.xml'), $filesystem) ->withXMLNodePath('root/items/item') ->withBatchSize(1), flow_context(config())->backend(), @@ -575,7 +575,7 @@ public function test_extract_split_stops_on_the_stop_signal(): void $generator = FlowTestCase::extracted( $extractor, flow_context()->backend(), - (new Criteria())->withSplit($extractor->splits(new Criteria(), 1)[0]), + new Criteria()->withSplit($extractor->splits(new Criteria(), 1)[0]), ); $totalRows = 0; @@ -617,7 +617,7 @@ public function test_a_pushed_path_filter_prunes_the_files_splits_are_cut_from() static::assertEquals( [new FileSplit($extractor->source(), 0, null)], - $extractor->splits((new Criteria())->withPathFilter(new RejectingFilter()), 1), + $extractor->splits(new Criteria()->withPathFilter(new RejectingFilter()), 1), ); } } diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Integration/IO/FileFormatContractTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Integration/IO/FileFormatContractTest.php index 4130eac2a8..4e178b2d56 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Integration/IO/FileFormatContractTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Integration/IO/FileFormatContractTest.php @@ -34,109 +34,109 @@ public static function formats(): Generator #[DataProvider('formats')] public function test_overwrite_replaces_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->overwriteReplacesWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->overwriteReplacesWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_append_keeps_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->appendKeepsWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->appendKeepsWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_ignore_leaves_an_existing_destination_untouched(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->ignoreLeavesAnExistingDestinationUntouched($format); + new FileFormatContract($this->cacheDir)->ignoreLeavesAnExistingDestinationUntouched($format); } #[DataProvider('formats')] public function test_exception_if_exists_refuses_an_existing_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->exceptionIfExistsRefusesAnExistingDestination($format); + new FileFormatContract($this->cacheDir)->exceptionIfExistsRefusesAnExistingDestination($format); } #[DataProvider('formats')] public function test_a_batch_of_zero_rows_creates_no_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aBatchOfZeroRowsCreatesNoFile($format); + new FileFormatContract($this->cacheDir)->aBatchOfZeroRowsCreatesNoFile($format); } #[DataProvider('formats')] public function test_a_write_that_ends_reports_its_file_operations(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aWriteThatEndsReportsItsFileOperations($format); + new FileFormatContract($this->cacheDir)->aWriteThatEndsReportsItsFileOperations($format); } #[DataProvider('formats')] public function test_a_partitioned_write_reads_back_every_partition(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPartitionedWriteReadsBackEveryPartition($format); + new FileFormatContract($this->cacheDir)->aPartitionedWriteReadsBackEveryPartition($format); } #[DataProvider('formats')] public function test_a_loader_in_a_task_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderInATaskSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->aLoaderInATaskSurvivesDescribe($format); } #[DataProvider('formats')] public function test_an_extractor_reader_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorReaderSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->anExtractorReaderSurvivesDescribe($format); } #[DataProvider('formats')] public function test_the_splits_read_every_row_once(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theSplitsReadEveryRowOnce($format); + new FileFormatContract($this->cacheDir)->theSplitsReadEveryRowOnce($format); } #[DataProvider('formats')] public function test_metadata_columns_name_the_source_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->metadataColumnsNameTheSourceFile($format); + new FileFormatContract($this->cacheDir)->metadataColumnsNameTheSourceFile($format); } #[DataProvider('formats')] public function test_the_batch_size_bounds_every_batch(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theBatchSizeBoundsEveryBatch($format); + new FileFormatContract($this->cacheDir)->theBatchSizeBoundsEveryBatch($format); } #[DataProvider('formats')] public function test_refresh_lists_the_files_written_after_a_read(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->refreshListsTheFilesWrittenAfterARead($format); + new FileFormatContract($this->cacheDir)->refreshListsTheFilesWrittenAfterARead($format); } #[DataProvider('formats')] public function test_a_failed_run_leaves_no_file_at_the_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aFailedRunLeavesNoFileAtTheDestination($format); + new FileFormatContract($this->cacheDir)->aFailedRunLeavesNoFileAtTheDestination($format); } #[DataProvider('formats')] public function test_an_extractor_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_a_loader_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_reads_back_through_the_same_filesystem_instance(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->readsBackThroughTheSameFilesystemInstance($format); + new FileFormatContract($this->cacheDir)->readsBackThroughTheSameFilesystemInstance($format); } #[DataProvider('formats')] public function test_a_pushed_filter_returns_what_the_filter_node_returns(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPushedFilterReturnsWhatTheFilterNodeReturns( + new FileFormatContract($this->cacheDir)->aPushedFilterReturnsWhatTheFilterNodeReturns( $format, ref('node')->xpath('id')->domElementValue()->notEquals(lit('b')), ); diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/DescribableRoundTripTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/DescribableRoundTripTest.php index 6d0e19ee21..13cf9ed123 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/DescribableRoundTripTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/DescribableRoundTripTest.php @@ -6,7 +6,6 @@ use Flow\ETL\Adapter\XML\Tests\Context\DescribableFixtures; use Flow\ETL\Foundation\Describe\Describable; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Foundation\Exception\RuntimeException; use Flow\ETL\Tests\Context\DescribeRoundTrip; use Flow\ETL\Tests\Context\ExtractorClasses; @@ -58,11 +57,7 @@ public function test_a_rebuilt_describable_equals_the_described_one(string $clas $this->expectException(RuntimeException::class); } - try { - $describable = DescribableFixtures::all()[$class](); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $describable = DescribableFixtures::all()[$class](); if (in_array($class, DescribableFixtures::undescribable(), true)) { static::assertNull($describable->describe()); diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php index 8e42dc4845..bf051286c4 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/MetadataColumnsExtractorTest.php @@ -31,7 +31,7 @@ public static function extractors(): Generator #[DataProvider('extractors')] public function test_an_extractor_carries_the_metadata_setter_only_when_it_declares_metadata(string $class): void { - if ((new ReflectionClass($class))->implementsInterface(MetadataColumnsExtractor::class)) { + if (new ReflectionClass($class)->implementsInterface(MetadataColumnsExtractor::class)) { MetadataColumnsContract::declares($class); return; diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/RootlessDocumentTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/RootlessDocumentTest.php index 09c1bae86f..c5a16f639d 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/RootlessDocumentTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/RootlessDocumentTest.php @@ -65,7 +65,7 @@ public static function documentsWithMore(): Generator #[DataProvider('rootlessDocuments')] public function test_a_document_without_a_root_matches(string $xml, int $bufferSize): void { - static::assertTrue((new RootlessDocument())->matches( + static::assertTrue(new RootlessDocument()->matches( new StringSourceStream(path('memory://a.xml'), $xml), $bufferSize, )); @@ -77,7 +77,7 @@ public function test_a_document_without_a_root_matches(string $xml, int $bufferS #[DataProvider('documentsWithMore')] public function test_a_document_with_more_does_not_match(string $xml, int $bufferSize): void { - static::assertFalse((new RootlessDocument())->matches( + static::assertFalse(new RootlessDocument()->matches( new StringSourceStream(path('memory://a.xml'), $xml), $bufferSize, )); diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLFileBatchesTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLFileBatchesTest.php index 5c84394883..3a63ddd228 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLFileBatchesTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLFileBatchesTest.php @@ -28,7 +28,7 @@ public function test_matched_elements_land_in_the_node_column_and_no_offset_is_c $filesystem = new CountingFilesystem(MemoryFiles::with([ 'memory://a.xml' => '12', ])); - $file = (new XMLFileBatches('root/row', 8192))->batches( + $file = new XMLFileBatches('root/row', 8192)->batches( FileReadMother::of(schema(str_schema('node')), null, 10, $filesystem), new Criteria(), new SourceFile(path('memory://a.xml')), @@ -51,7 +51,7 @@ public function test_a_column_the_body_declares_beside_node_is_padded_with_nulls array_map( static fn(Rows $rows): array => $rows->toArray(), iterator_to_array( - (new XMLFileBatches('root/row', 8192))->batches( + new XMLFileBatches('root/row', 8192)->batches( FileReadMother::of( schema(str_schema('node'), str_schema('note', nullable: true)), null, diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLNodeBatchesTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLNodeBatchesTest.php index edda2aeb14..3a0964e22f 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLNodeBatchesTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLNodeBatchesTest.php @@ -27,7 +27,7 @@ final class XMLNodeBatchesTest extends FlowTestCase public function test_documents_are_rows_of_utf8_node_documents_in_batches(): void { $batches = iterator_to_array( - (new XMLNodeBatches(new XMLNodes('rows/row'), 2, 8192))->documents( + new XMLNodeBatches(new XMLNodes('rows/row'), 2, 8192)->documents( new StringSourceStream(path('memory://a.xml'), 'ż23'), schema(xml_schema('node'), str_schema('other', nullable: true)), new PhpBackend(), @@ -50,7 +50,7 @@ public function test_physicals_are_an_xml_column_of_node_document_bytes_in_batch static::assertInstanceOf(XMLDefinition::class, $node); $batches = iterator_to_array( - (new XMLNodeBatches(new XMLNodes('rows/row'), 2, 8192))->physicals( + new XMLNodeBatches(new XMLNodes('rows/row'), 2, 8192)->physicals( new StringSourceStream(path('memory://a.xml'), '23'), $node, schema($node), @@ -76,7 +76,7 @@ public function test_strings_are_rows_of_node_texts_in_batches(): void array_map( static fn(Rows $rows): array => $rows->toArray(), iterator_to_array( - (new XMLNodeBatches(new XMLNodes('rows/row'), 2, 8192))->strings( + new XMLNodeBatches(new XMLNodes('rows/row'), 2, 8192)->strings( new StringSourceStream( path('memory://a.xml'), 'ż23', diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLNodeCursorTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLNodeCursorTest.php index a7de18824d..cdc3e695fd 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLNodeCursorTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLNodeCursorTest.php @@ -30,7 +30,7 @@ public function test_stops_on_every_element_on_the_path(string $path, int $buffe { $seen = []; - foreach ((new XMLNodeCursor($path))->of( + foreach (new XMLNodeCursor($path)->of( new StringSourceStream( path('memory://a.xml'), '', @@ -50,7 +50,7 @@ public function test_a_document_without_a_root_has_no_stops(string $xml): void { static::assertSame( [], - iterator_to_array((new XMLNodeCursor('root/item'))->of( + iterator_to_array(new XMLNodeCursor('root/item')->of( new StringSourceStream(path('memory://a.xml'), $xml), 8192, )), @@ -62,7 +62,7 @@ public function test_a_malformed_document_is_refused_at_its_end(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('XML Error: Extra content at the end of the document at line 1'); - iterator_to_array((new XMLNodeCursor('root/item'))->of( + iterator_to_array(new XMLNodeCursor('root/item')->of( new StringSourceStream(path('memory://a.xml'), 'junk'), 8192, )); @@ -73,7 +73,7 @@ public function test_libxml_reports_internally_at_every_stop_and_the_callers_mod $previous = libxml_use_internal_errors(false); try { - $cursor = (new XMLNodeCursor('root/item'))->of( + $cursor = new XMLNodeCursor('root/item')->of( new StringSourceStream(path('memory://a.xml'), ''), 8192, ); @@ -94,7 +94,7 @@ public function test_an_abandoned_walk_restores_the_callers_libxml_error_mode(): $previous = libxml_use_internal_errors(false); try { - $cursor = (new XMLNodeCursor('root/item'))->of( + $cursor = new XMLNodeCursor('root/item')->of( new StringSourceStream(path('memory://a.xml'), ''), 8192, ); @@ -112,11 +112,11 @@ public function test_failure_names_the_last_libxml_error(): void $previous = libxml_use_internal_errors(true); try { - (new DOMDocument())->loadXML(''); + new DOMDocument()->loadXML(''); static::assertMatchesRegularExpression( '/^XML Error: .+ at line 1$/', - (new XMLNodeCursor('a'))->failure()->getMessage(), + new XMLNodeCursor('a')->failure()->getMessage(), ); } finally { libxml_clear_errors(); diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLNodesTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLNodesTest.php index bed7182119..320b6d229a 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLNodesTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Extractor/XMLNodesTest.php @@ -125,7 +125,7 @@ public function test_an_error_libxml_holds_from_before_does_not_fail_the_read(): $previous = libxml_use_internal_errors(true); try { - (new DOMDocument())->loadXML(''); + new DOMDocument()->loadXML(''); static::assertSame(['1'], SerializedNodes::of('root/item', '1')); } finally { @@ -140,7 +140,7 @@ public function test_the_callers_libxml_error_mode_holds_at_every_yield_and_afte $previous = libxml_use_internal_errors($internalErrors); try { - $nodes = (new XMLNodes('root/item'))->documents( + $nodes = new XMLNodes('root/item')->documents( new StringSourceStream(path('memory://a.xml'), '12'), 8192, ); @@ -160,7 +160,7 @@ public function test_an_abandoned_read_restores_the_callers_libxml_error_mode(): $previous = libxml_use_internal_errors(false); try { - $nodes = (new XMLNodes('root/item'))->documents( + $nodes = new XMLNodes('root/item')->documents( new StringSourceStream(path('memory://a.xml'), '12'), 8192, ); @@ -201,7 +201,7 @@ public function test_texts_keep_the_callers_libxml_error_mode_at_every_yield(): $previous = libxml_use_internal_errors(false); try { - $texts = (new XMLNodes('root/item'))->texts( + $texts = new XMLNodes('root/item')->texts( new StringSourceStream(path('memory://a.xml'), '12'), 8192, ); @@ -223,7 +223,7 @@ public function test_texts_refuse_a_malformed_document(): void '/^XML Error: Opening and ending tag mismatch: item line 1 and wrong at line 1$/', ); - iterator_to_array((new XMLNodes('root/item'))->texts( + iterator_to_array(new XMLNodes('root/item')->texts( new StringSourceStream(path('memory://a.xml'), '12'), 8192, )); diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLEncoderTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLEncoderTest.php index 8387903a71..ee68ed042c 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLEncoderTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLEncoderTest.php @@ -140,15 +140,15 @@ public function test_both_writers_encode_a_batch_to_the_same_bytes( ): void { $batch = array_to_rows($rows, schema(...$definitions)); - static::assertSame($expected, (new XMLEncoder(new StringXMLWriter()))->encode($batch)); - static::assertSame($expected, (new XMLEncoder(new DOMDocumentWriter()))->encode($batch)); + static::assertSame($expected, new XMLEncoder(new StringXMLWriter())->encode($batch)); + static::assertSame($expected, new XMLEncoder(new DOMDocumentWriter())->encode($batch)); } public function test_encodes_datetime_and_date_with_the_configured_formats(): void { static::assertSame( "2024-08-0101/08/2024\n", - (new XMLEncoder(new StringXMLWriter(), dateTimeFormat: 'Y-m-d', dateFormat: 'd/m/Y'))->encode(array_to_rows( + new XMLEncoder(new StringXMLWriter(), dateTimeFormat: 'Y-m-d', dateFormat: 'd/m/Y')->encode(array_to_rows( [['at' => new DateTimeImmutable('2024-08-01 10:00:00'), 'on' => new DateTimeImmutable('2024-08-01')]], schema(datetime_schema('at'), date_schema('on')), )), @@ -159,7 +159,7 @@ public function test_uses_the_configured_element_names_and_attribute_prefix(): v { static::assertSame( 'ax1' . "\n", - (new XMLEncoder( + new XMLEncoder( new StringXMLWriter(), attributePrefix: '@', listElementName: 'item', @@ -167,7 +167,7 @@ public function test_uses_the_configured_element_names_and_attribute_prefix(): v mapElementKeyName: 'k', mapElementValueName: 'v', rowElementName: 'record', - ))->encode(array_to_rows( + )->encode(array_to_rows( [['@id' => 1, 'l' => ['a'], 'm' => ['x' => 1]]], schema( int_schema('@id'), @@ -182,7 +182,7 @@ public function test_a_null_in_an_attribute_column_is_refused(): void { $this->expectException(CastingException::class); - (new XMLEncoder(new StringXMLWriter()))->encode(array_to_rows([[ + new XMLEncoder(new StringXMLWriter())->encode(array_to_rows([[ '_id' => null, ]], schema(int_schema('_id', nullable: true)))); } @@ -194,7 +194,7 @@ public function test_a_row_element_name_dom_refuses_is_refused_by_either_writer( foreach ([new StringXMLWriter(), new DOMDocumentWriter()] as $writer) { try { - (new XMLEncoder($writer, rowElementName: '1 row'))->encode($rows); + new XMLEncoder($writer, rowElementName: '1 row')->encode($rows); } catch (DOMException) { $refused++; } diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLFileWriterTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLFileWriterTest.php index 24995ac238..18bdaf4e89 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLFileWriterTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLFileWriterTest.php @@ -39,7 +39,7 @@ public function test_a_sink_that_wrote_nothing_closes_without_a_root_end(): void $filesystem = memory_filesystem(); $stream = $filesystem->writeTo(path('memory://out.xml')); - (new XMLFileWriter($stream, new XMLEncoder(new StringXMLWriter()), "\n\n", 'root'))->close(); + new XMLFileWriter($stream, new XMLEncoder(new StringXMLWriter()), "\n\n", 'root')->close(); $stream->close(); static::assertSame('', $filesystem->readFrom(path('memory://out.xml'))->content()); diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLLoaderTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLLoaderTest.php index 3348aa6167..6767294aa1 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLLoaderTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLLoaderTest.php @@ -43,7 +43,7 @@ final class XMLLoaderTest extends FlowTestCase public function test_setting_content_type_on_path(): void { static::assertEquals( - (new XMLLoader(path(__DIR__ . '/file.csv'), new DOMDocumentWriter())) + new XMLLoader(path(__DIR__ . '/file.csv'), new DOMDocumentWriter()) ->destination() ->getOption(Option::CONTENT_TYPE), ContentType::XML, @@ -170,25 +170,23 @@ public function test_a_live_filesystem_does_not_describe(): void public function test_a_custom_xml_writer_does_not_describe(): void { static::assertNull( - (new XMLLoader( - ($scratch = ReaderRoundTrip::scratch('xml-custom'))->suffix('/rows.xml'), - new class implements XMLWriter { - public function attributes(string $name, array $values): array - { - return []; - } - - public function elements(string $name, array $values): array - { - return []; - } - - public function write(XMLNode $node): string - { - return ''; - } - }, - ))->describe(), + new XMLLoader(($scratch = ReaderRoundTrip::scratch('xml-custom'))->suffix('/rows.xml'), new class implements + XMLWriter { + public function attributes(string $name, array $values): array + { + return []; + } + + public function elements(string $name, array $values): array + { + return []; + } + + public function write(XMLNode $node): string + { + return ''; + } + })->describe(), ); native_local_filesystem()->rm($scratch); diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLValueNodesTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLValueNodesTest.php index 08eebc75f0..f641cdb877 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLValueNodesTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLValueNodesTest.php @@ -98,7 +98,7 @@ public static function nodes(): Generator #[DataProvider('nodes')] public function test_of(Type $type, mixed $physical, XMLNode $expected): void { - static::assertEquals($expected, (new XMLValueNodes(new TextValues()))->of('v', $type, $physical)); + static::assertEquals($expected, new XMLValueNodes(new TextValues())->of('v', $type, $physical)); } public function test_of_uses_the_configured_names_and_prefix(): void @@ -119,7 +119,7 @@ public function test_a_member_without_the_prefix_is_a_node(): void { static::assertEquals( XMLNode::flatNode('id', '7'), - (new XMLValueNodes(new TextValues()))->member('id', type_integer(), 7), + new XMLValueNodes(new TextValues())->member('id', type_integer(), 7), ); } @@ -127,7 +127,7 @@ public function test_a_null_member_that_is_an_attribute_is_refused(): void { $this->expectException(CastingException::class); - (new XMLValueNodes(new TextValues()))->member('_id', type_optional(type_integer()), null); + new XMLValueNodes(new TextValues())->member('_id', type_optional(type_integer()), null); } public function test_a_structure_with_an_optional_element_is_refused_at_any_depth(): void @@ -160,7 +160,7 @@ public function test_types_without_optional_elements_are_accepted(): void { $this->expectNotToPerformAssertions(); - (new XMLValueNodes(new TextValues()))->refuseOptionalElements(type_list(type_structure([ + new XMLValueNodes(new TextValues())->refuseOptionalElements(type_list(type_structure([ 'a' => type_optional(type_integer()), 'm' => type_map(type_string(), type_date()), ]))); diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLWriter/DOMDocumentWriterTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLWriter/DOMDocumentWriterTest.php index 9b57dbcce0..fc4162b527 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLWriter/DOMDocumentWriterTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLWriter/DOMDocumentWriterTest.php @@ -22,25 +22,25 @@ public function test_writing_empty_child_node(): void { static::assertEquals( '', - (new DOMDocumentWriter())->write(XMLNode::nestedNode('root')->append(XMLNode::nestedNode('child'))), + new DOMDocumentWriter()->write(XMLNode::nestedNode('root')->append(XMLNode::nestedNode('child'))), ); } public function test_writing_empty_node(): void { - static::assertEquals('', (new DOMDocumentWriter())->write(XMLNode::nestedNode('root'))); + static::assertEquals('', new DOMDocumentWriter()->write(XMLNode::nestedNode('root'))); } public function test_writing_node_with_empty_string_value(): void { - static::assertEquals('', (new DOMDocumentWriter())->write(XMLNode::flatNode('root', ''))); + static::assertEquals('', new DOMDocumentWriter()->write(XMLNode::flatNode('root', ''))); } public function test_writing_xml(): void { static::assertEquals( 'valuevaluevalue', - (new DOMDocumentWriter())->write( + new DOMDocumentWriter()->write( XMLNode::nestedNode('root') ->append(XMLNode::flatNode('child', 'value')) ->append( @@ -56,7 +56,7 @@ public function test_writing_xml_with_attribute(): void { static::assertEquals( 'value', - (new DOMDocumentWriter())->write(XMLNode::flatNode('root', 'value')->appendAttribute(new XMLAttribute( + new DOMDocumentWriter()->write(XMLNode::flatNode('root', 'value')->appendAttribute(new XMLAttribute( 'attribute', 'value', ))), @@ -67,7 +67,7 @@ public function test_writing_xml_with_empty_attribute(): void { static::assertEquals( 'value', - (new DOMDocumentWriter())->write(XMLNode::flatNode('root', 'value')->appendAttribute(new XMLAttribute( + new DOMDocumentWriter()->write(XMLNode::flatNode('root', 'value')->appendAttribute(new XMLAttribute( 'attribute', '', ))), @@ -101,37 +101,34 @@ public function test_attributes_are_what_write_renders_for_an_attribute(string $ public function test_a_null_element_is_an_empty_element(): void { - static::assertSame( - ['', 'x', ''], - (new DOMDocumentWriter())->elements('v', [null, 'x', '']), - ); + static::assertSame(['', 'x', ''], new DOMDocumentWriter()->elements('v', [null, 'x', ''])); } public function test_a_null_attribute_is_refused(): void { $this->expectException(CastingException::class); - (new DOMDocumentWriter())->attributes('a', ['x', null]); + new DOMDocumentWriter()->attributes('a', ['x', null]); } public function test_no_values_give_no_elements_and_no_attributes(): void { - static::assertSame([], (new DOMDocumentWriter())->elements('v', [])); - static::assertSame([], (new DOMDocumentWriter())->attributes('a', [])); + static::assertSame([], new DOMDocumentWriter()->elements('v', [])); + static::assertSame([], new DOMDocumentWriter()->attributes('a', [])); } public function test_elements_of_a_name_dom_refuses_are_refused_with_its_exception(): void { $this->expectException(DOMException::class); - (new DOMDocumentWriter())->elements('1 bad', ['x']); + new DOMDocumentWriter()->elements('1 bad', ['x']); } public function test_attributes_of_a_name_dom_refuses_are_refused_with_its_exception(): void { $this->expectException(DOMException::class); - (new DOMDocumentWriter())->attributes('1 bad', ['x']); + new DOMDocumentWriter()->attributes('1 bad', ['x']); } public function test_describe_round_trips(): void @@ -151,7 +148,7 @@ public function test_the_writer_declares_the_xml_extensions(): void { static::assertSame( ['dom', 'xml', 'xmlreader', 'xmlwriter'], - (new DOMDocumentWriter())->describe()?->extensions(), + new DOMDocumentWriter()->describe()?->extensions(), ); } } diff --git a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLWriter/StringXMLWriterTest.php b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLWriter/StringXMLWriterTest.php index 5c693725b6..b8c7a41fae 100644 --- a/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLWriter/StringXMLWriterTest.php +++ b/src/adapter/etl-adapter-xml/tests/Flow/ETL/Adapter/XML/Tests/Unit/IO/Loader/XMLWriter/StringXMLWriterTest.php @@ -99,7 +99,7 @@ public function test_an_attribute_name_dom_refuses_is_refused_with_its_exception $this->expectException(DOMException::class); $this->expectExceptionMessage('Invalid Character Error'); - (new StringXMLWriter())->write(XMLNode::nested('row', new XMLAttribute($name, '1'))); + new StringXMLWriter()->write(XMLNode::nested('row', new XMLAttribute($name, '1'))); } #[TestWith(['order id'])] @@ -110,7 +110,7 @@ public function test_an_element_name_dom_refuses_is_refused_with_its_exception(s $this->expectException(DOMException::class); $this->expectExceptionMessage('Invalid Character Error'); - (new StringXMLWriter())->write(XMLNode::flatNode($name, '1')); + new StringXMLWriter()->write(XMLNode::flatNode($name, '1')); } public function test_a_refused_name_stays_refused(): void @@ -130,7 +130,7 @@ public function test_a_refused_name_stays_refused(): void #[DataProvider('nodes')] public function test_writes_what_dom_document_writer_writes(XMLNode $node): void { - static::assertSame((new DOMDocumentWriter())->write($node), (new StringXMLWriter())->write($node)); + static::assertSame(new DOMDocumentWriter()->write($node), new StringXMLWriter()->write($node)); } #[DataProvider('nodesOlderLibxmlWritesDifferently')] @@ -138,7 +138,7 @@ public function test_writes_what_dom_document_writer_writes_on_libxml_2_14_and_l XMLNode $node, string $xml, ): void { - static::assertSame($xml, (new StringXMLWriter())->write($node)); + static::assertSame($xml, new StringXMLWriter()->write($node)); } #[DataProviderExternal(XMLWriterValues::class, 'values')] @@ -168,34 +168,34 @@ public function test_attributes_are_what_write_renders_for_an_attribute(string $ public function test_a_null_element_is_an_empty_element(): void { - static::assertSame(['', 'x', ''], (new StringXMLWriter())->elements('v', [null, 'x', ''])); + static::assertSame(['', 'x', ''], new StringXMLWriter()->elements('v', [null, 'x', ''])); } public function test_a_null_attribute_is_refused(): void { $this->expectException(CastingException::class); - (new StringXMLWriter())->attributes('a', ['x', null]); + new StringXMLWriter()->attributes('a', ['x', null]); } public function test_no_values_give_no_elements_and_no_attributes(): void { - static::assertSame([], (new StringXMLWriter())->elements('v', [])); - static::assertSame([], (new StringXMLWriter())->attributes('a', [])); + static::assertSame([], new StringXMLWriter()->elements('v', [])); + static::assertSame([], new StringXMLWriter()->attributes('a', [])); } public function test_elements_of_a_name_dom_refuses_are_refused_with_its_exception(): void { $this->expectException(DOMException::class); - (new StringXMLWriter())->elements('1 bad', ['x']); + new StringXMLWriter()->elements('1 bad', ['x']); } public function test_attributes_of_a_name_dom_refuses_are_refused_with_its_exception(): void { $this->expectException(DOMException::class); - (new StringXMLWriter())->attributes('1 bad', ['x']); + new StringXMLWriter()->attributes('1 bad', ['x']); } public function test_describe_round_trips(): void @@ -213,9 +213,6 @@ public function test_describe_round_trips(): void public function test_the_writer_declares_the_xml_extensions(): void { - static::assertSame( - ['dom', 'xml', 'xmlreader', 'xmlwriter'], - (new StringXMLWriter())->describe()?->extensions(), - ); + static::assertSame(['dom', 'xml', 'xmlreader', 'xmlwriter'], new StringXMLWriter()->describe()?->extensions()); } } diff --git a/src/bridge/filesystem/async-aws/composer.json b/src/bridge/filesystem/async-aws/composer.json index 9f233d50c4..7bf1db390e 100644 --- a/src/bridge/filesystem/async-aws/composer.json +++ b/src/bridge/filesystem/async-aws/composer.json @@ -14,11 +14,11 @@ "cloud" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/filesystem": "self.version", "flow-php/types": "self.version", "async-aws/s3": "^2.6 || ^3.0", - "symfony/http-client": "^6.4 || ^7.4 || ^8.0" + "symfony/http-client": "^7.4 || ^8.0" }, "config": { "optimize-autoloader": true, diff --git a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3DestinationStream.php b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3DestinationStream.php index 2e4412cd80..17258748d5 100644 --- a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3DestinationStream.php +++ b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3DestinationStream.php @@ -98,7 +98,7 @@ public static function openBlank( $s3Client, $bucket, $path, - ['ContentType' => (new ContentTypeDetector())->from($path)], + ['ContentType' => new ContentTypeDetector()->from($path)], $blockFactory, $blockSize, ); @@ -132,7 +132,7 @@ public static function openCopy( $bucket, $target, [ - 'ContentType' => $sourceHead->getContentType() ?? (new ContentTypeDetector())->from($target), + 'ContentType' => $sourceHead->getContentType() ?? new ContentTypeDetector()->from($target), 'ContentEncoding' => $sourceHead->getContentEncoding(), 'CacheControl' => $sourceHead->getCacheControl(), 'ContentDisposition' => $sourceHead->getContentDisposition(), diff --git a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3SourceStream.php b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3SourceStream.php index 2deedf31b3..4557858895 100644 --- a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3SourceStream.php +++ b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/AsyncAWSS3SourceStream.php @@ -78,7 +78,7 @@ public function read(int $length, int $offset): string $response = $this->s3Client->getObject([ 'Bucket' => $this->bucket, 'Key' => ltrim($this->path->path(), '/'), - 'Range' => (new Range($offset, $length))->toString(), + 'Range' => new Range($offset, $length)->toString(), ]); return $response->getBody()->getContentAsString(); @@ -136,7 +136,7 @@ private function chunks(int $rangeLength): Generator ->getObject([ 'Bucket' => $this->bucket, 'Key' => ltrim($this->path->path(), '/'), - 'Range' => (new Range($offset, $rangeLength))->toString(), + 'Range' => new Range($offset, $rangeLength)->toString(), ]) ->getBody() ->getChunks() as $chunk) { diff --git a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/Options.php b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/Options.php index f07cc75466..ec42b86379 100644 --- a/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/Options.php +++ b/src/bridge/filesystem/async-aws/src/Flow/Filesystem/Bridge/AsyncAWS/Options.php @@ -92,7 +92,7 @@ public static function fromArray(array $data): self ); } - return (new self()) + return new self() ->withBlockFactory( new NativeLocalFileBlocksFactory( $data['block_location'], diff --git a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Integration/AsyncAWSS3DestinationStreamTest.php b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Integration/AsyncAWSS3DestinationStreamTest.php index 16cd33e74e..f221f9ff50 100644 --- a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Integration/AsyncAWSS3DestinationStreamTest.php +++ b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Integration/AsyncAWSS3DestinationStreamTest.php @@ -30,7 +30,7 @@ public function test_closing_streams_leaves_no_blocks_behind(): void $fs = aws_s3_filesystem( $this->bucket(), $this->s3Client(), - (new Options())->withBlockFactory(new NativeLocalFileBlocksFactory($blockLocation)), + new Options()->withBlockFactory(new NativeLocalFileBlocksFactory($blockLocation)), ); $fs->writeTo(path('aws-s3://never_written.txt'))->close(); diff --git a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Integration/AsyncAWSS3FilesystemFileFastPathTest.php b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Integration/AsyncAWSS3FilesystemFileFastPathTest.php index 63063c2d07..6f928ae85b 100644 --- a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Integration/AsyncAWSS3FilesystemFileFastPathTest.php +++ b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Integration/AsyncAWSS3FilesystemFileFastPathTest.php @@ -20,7 +20,7 @@ final class AsyncAWSS3FilesystemFileFastPathTest extends AsyncAWSS3TestCase public function test_list_disabled_fast_path_falls_back_to_listing_for_single_file(): void { $client = $this->recordingClient(); - $fs = aws_s3_filesystem($this->bucket(), $client, (new Options())->withFileFastPath(false)); + $fs = aws_s3_filesystem($this->bucket(), $client, new Options()->withFileFastPath(false)); $fs->writeTo(path('aws-s3://var/orders/orders.csv'))->append('a,b')->close(); diff --git a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/AsyncAWSS3FilesystemTest.php b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/AsyncAWSS3FilesystemTest.php index 149a807270..2065064f5c 100644 --- a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/AsyncAWSS3FilesystemTest.php +++ b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/AsyncAWSS3FilesystemTest.php @@ -130,7 +130,7 @@ public function test_a_filesystem_with_a_custom_block_factory_has_no_configurati aws_s3_filesystem( 'bucket', ['region' => 'eu-west-1'], - (new Options())->withBlockFactory($this->createStub(BlockFactory::class)), + new Options()->withBlockFactory($this->createStub(BlockFactory::class)), )->normalize(), ); } diff --git a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/AsyncAWSS3SourceStreamTest.php b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/AsyncAWSS3SourceStreamTest.php index 9d45a55d44..23b4f1b2b0 100644 --- a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/AsyncAWSS3SourceStreamTest.php +++ b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/AsyncAWSS3SourceStreamTest.php @@ -20,11 +20,11 @@ public function test_iterate_reads_many_chunks_from_one_ranged_request(): void $calls = []; iterator_to_array( - (new AsyncAWSS3SourceStream( + new AsyncAWSS3SourceStream( path('aws-s3://f.bin'), 'bucket', S3ClientMother::copying(20_000, $calls), - ))->iterate(8192), + )->iterate(8192), false, ); @@ -36,11 +36,11 @@ public function test_iterate_requests_one_range_per_chunk_above_the_default_rang $calls = []; iterator_to_array( - (new AsyncAWSS3SourceStream( + new AsyncAWSS3SourceStream( path('aws-s3://f.bin'), 'bucket', S3ClientMother::copying(25_000_000, $calls), - ))->iterate(10_000_000), + )->iterate(10_000_000), false, ); @@ -60,11 +60,11 @@ public function test_iterate_yields_the_content_in_pieces_of_the_requested_lengt static::assertSame( ['abc', 'def', 'gh'], iterator_to_array( - (new AsyncAWSS3SourceStream( + new AsyncAWSS3SourceStream( path('aws-s3://f.txt'), 'bucket', S3ClientMother::serving('abcdefgh'), - ))->iterate(3), + )->iterate(3), false, ), ); @@ -84,11 +84,11 @@ public function test_read_lines_conforms_to_the_source_stream_contract( ): void { static::assertSame( $expected, - iterator_to_array((new AsyncAWSS3SourceStream( + iterator_to_array(new AsyncAWSS3SourceStream( path('aws-s3://f.txt'), 'bucket', S3ClientMother::serving($content), - ))->readLines($separator, $length)), + )->readLines($separator, $length)), ); } @@ -97,11 +97,7 @@ public function test_read_lines_stops_when_a_read_returns_no_bytes(): void static::assertSame( [], iterator_to_array( - (new AsyncAWSS3SourceStream( - path('aws-s3://f.txt'), - 'bucket', - S3ClientMother::shortRead(5), - ))->readLines(), + new AsyncAWSS3SourceStream(path('aws-s3://f.txt'), 'bucket', S3ClientMother::shortRead(5))->readLines(), ), ); } diff --git a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/ConfiguredS3ClientTest.php b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/ConfiguredS3ClientTest.php index 2380b08829..a08aab833a 100644 --- a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/ConfiguredS3ClientTest.php +++ b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/ConfiguredS3ClientTest.php @@ -32,7 +32,7 @@ public function test_the_configuration_is_kept_verbatim(): void 'endpoint' => 'http://s3.test', ]; - static::assertSame($configuration, (new ConfiguredS3Client($configuration))->normalize()); + static::assertSame($configuration, new ConfiguredS3Client($configuration)->normalize()); } public function test_the_client_is_built_once(): void @@ -56,14 +56,14 @@ public function test_timeout_ends_a_call_to_a_silent_server(): void { $server = stream_socket_server('tcp://127.0.0.1:0'); static::assertNotFalse($server); - $client = (new ConfiguredS3Client([ + $client = new ConfiguredS3Client([ 'region' => 'eu-west-1', 'accessKeyId' => 'k', 'accessKeySecret' => 's', 'pathStyleEndpoint' => 'true', 'endpoint' => 'http://' . type_string()->assert(stream_socket_get_name($server, false)), 'http' => ['timeout' => 0.2, 'max_duration' => 0, 'max_retries' => 0], - ]))->client(); + ])->client(); $start = microtime(true); try { @@ -79,14 +79,14 @@ public function test_max_duration_bounds_a_call_with_its_retries(): void { $server = stream_socket_server('tcp://127.0.0.1:0'); static::assertNotFalse($server); - $client = (new ConfiguredS3Client([ + $client = new ConfiguredS3Client([ 'region' => 'eu-west-1', 'accessKeyId' => 'k', 'accessKeySecret' => 's', 'pathStyleEndpoint' => 'true', 'endpoint' => 'http://' . type_string()->assert(stream_socket_get_name($server, false)), 'http' => ['timeout' => 0.2, 'max_duration' => 0.5, 'max_retries' => 3], - ]))->client(); + ])->client(); $start = microtime(true); try { @@ -117,7 +117,7 @@ public function test_an_unknown_client_option_is_reported_by_async_aws(): void 'protocol' => 'aws-s3', 'bucket' => 'bucket', 'client' => ['regions' => ['eu-west-1'], 'http' => ['timeout' => 1]], - 'options' => (new Options())->normalize(), + 'options' => new Options()->normalize(), ])->readFrom(path('aws-s3://a.txt')); } diff --git a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/OptionsTest.php b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/OptionsTest.php index 14fb7c33a6..e0df33c426 100644 --- a/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/OptionsTest.php +++ b/src/bridge/filesystem/async-aws/tests/Flow/Filesystem/Bridge/AsyncAWS/Tests/Unit/OptionsTest.php @@ -22,7 +22,7 @@ public function test_block_factory_can_be_replaced(): void static::assertSame( $blockFactory, - (new Options()) + new Options() ->withBlockFactory($blockFactory) ->blockFactory(), ); @@ -30,7 +30,7 @@ public function test_block_factory_can_be_replaced(): void public function test_normalize_round_trips(): void { - $options = (new Options()) + $options = new Options() ->withFileFastPath(false) ->withBulkDelete(false) ->withBlockSize(6 * 1024 * 1024) @@ -63,7 +63,7 @@ public function test_the_default_part_size_round_trips(): void public function test_block_permissions_round_trip(): void { - $options = (new Options())->withBlockFactory( + $options = new Options()->withBlockFactory( new NativeLocalFileBlocksFactory(sys_get_temp_dir(), Permissions::private()), ); $normalized = $options->normalize(); @@ -76,7 +76,7 @@ public function test_block_permissions_round_trip(): void public function test_a_custom_block_factory_does_not_normalize(): void { static::assertNull( - (new Options()) + new Options() ->withBlockFactory($this->createStub(BlockFactory::class)) ->normalize(), ); @@ -96,7 +96,7 @@ public function test_copy_part_size_outside_5_mib_and_5_gb_is_rejected(int $byte $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage("Copy part size must be between 5 MiB and 5 GB, got {$bytes} bytes"); - (new Options())->withCopyPartSize($bytes); + new Options()->withCopyPartSize($bytes); } #[TestWith([5242880])] @@ -105,7 +105,7 @@ public function test_copy_part_size_at_5_mib_and_5_gb_is_accepted(int $bytes): v { static::assertSame( $bytes, - (new Options()) + new Options() ->withCopyPartSize($bytes) ->copyPartSize(), ); @@ -113,6 +113,6 @@ public function test_copy_part_size_at_5_mib_and_5_gb_is_accepted(int $bytes): v public function test_copy_part_size_defaults_to_256_mib(): void { - static::assertSame(268435456, (new Options())->normalize()['copy_part_size'] ?? null); + static::assertSame(268435456, new Options()->normalize()['copy_part_size'] ?? null); } } diff --git a/src/bridge/filesystem/azure/composer.json b/src/bridge/filesystem/azure/composer.json index 66bb9e2b2b..004b66dd1e 100644 --- a/src/bridge/filesystem/azure/composer.json +++ b/src/bridge/filesystem/azure/composer.json @@ -14,10 +14,10 @@ "cloud" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/filesystem": "self.version", "flow-php/azure-sdk": "self.version", - "symfony/http-client": "^6.4 || ^7.4 || ^8.0" + "symfony/http-client": "^7.4 || ^8.0" }, "config": { "optimize-autoloader": true, diff --git a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobFilesystem.php b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobFilesystem.php index f7f252f73c..87f8445ac2 100644 --- a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobFilesystem.php +++ b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobFilesystem.php @@ -224,7 +224,7 @@ public function mv(Path $from, Path $to): bool $service->putBlockBlobBlockList( $target, new BlockList(...$blocks), - (new PutBlockBlobBlockListOptions()) + new PutBlockBlobBlockListOptions() ->withContentType($properties->contentType()) ->withContentEncoding($properties->contentEncoding()) ->withContentLanguage($properties->contentLanguage()) diff --git a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobSourceStream.php b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobSourceStream.php index 27532b9382..9d41917f43 100644 --- a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobSourceStream.php +++ b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/AzureBlobSourceStream.php @@ -75,7 +75,7 @@ public function read(int $length, int $offset): string $offset = $offset < 0 ? ($this->size() ?? 0) + $offset : $offset; return $this->blobService - ->getBlob($this->path->path(), (new GetBlobOptions())->withRange(new Range($offset, $offset + $length - 1))) + ->getBlob($this->path->path(), new GetBlobOptions()->withRange(new Range($offset, $offset + $length - 1))) ->content(); } @@ -125,7 +125,7 @@ private function chunks(int $rangeLength): Generator $body = $this->blobService ->getBlob( $this->path->path(), - (new GetBlobOptions())->withRange(new Range($offset, $offset + $rangeLength - 1)), + new GetBlobOptions()->withRange(new Range($offset, $offset + $rangeLength - 1)), ) ->stream(); $received = 0; diff --git a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/Options.php b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/Options.php index 55de9bc978..4cb53a546c 100644 --- a/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/Options.php +++ b/src/bridge/filesystem/azure/src/Flow/Filesystem/Bridge/Azure/Options.php @@ -135,7 +135,7 @@ public static function fromArray(array $data): self ); } - $options = (new self()) + $options = new self() ->withBlockFactory( new NativeLocalFileBlocksFactory( $data['block_location'], diff --git a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobDestinationStreamTest.php b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobDestinationStreamTest.php index af216321e1..d87b4105ce 100644 --- a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobDestinationStreamTest.php +++ b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobDestinationStreamTest.php @@ -27,7 +27,7 @@ public function test_closing_empty_stream(): void public function test_writing_content_bigger_than_block_size_to_azure(): void { - $fs = azure_filesystem($this->blobService('flow-php'), (new Options())->withBlockSize(100)); + $fs = azure_filesystem($this->blobService('flow-php'), new Options()->withBlockSize(100)); $stream = $fs->writeTo(path('azure-blob://file.txt')); $stream->append($content = str_repeat('a', 200)); @@ -45,7 +45,7 @@ public function test_writing_content_bigger_than_block_size_to_azure(): void public function test_writing_content_bigger_than_block_size_is_invisible_until_close(): void { $blocks = path('azure-blob://blocks-' . bin2hex(random_bytes(4)) . '.txt'); - $fs = azure_filesystem($this->blobService('flow-php'), (new Options())->withBlockSize(100)); + $fs = azure_filesystem($this->blobService('flow-php'), new Options()->withBlockSize(100)); $stream = $fs->writeTo($blocks); $stream->append($content = str_repeat('a', 250)); diff --git a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobFilesystemFileFastPathTest.php b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobFilesystemFileFastPathTest.php index 78f4f936ce..0ff87b116c 100644 --- a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobFilesystemFileFastPathTest.php +++ b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobFilesystemFileFastPathTest.php @@ -18,7 +18,7 @@ final class AzureBlobFilesystemFileFastPathTest extends AzureBlobServiceTestCase public function test_list_disabled_fast_path_falls_back_to_listing_for_single_file(): void { $blobService = new RecordingBlobService($this->blobService('flow-php-list-opt-disabled')); - $fs = azure_filesystem($blobService, (new Options())->withFileFastPath(false)); + $fs = azure_filesystem($blobService, new Options()->withFileFastPath(false)); $fs->writeTo(path('azure-blob://orders/orders.csv'))->append('a,b')->close(); diff --git a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobFilesystemTest.php b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobFilesystemTest.php index 0776ac60c7..aaf635b951 100644 --- a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobFilesystemTest.php +++ b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Integration/AzureBlobFilesystemTest.php @@ -112,7 +112,7 @@ public function test_appending_to_existing_blob(): void public function test_appending_to_existing_block_blob_new_blocks(): void { - $fs = azure_filesystem($this->blobService('flow-php'), (new Options())->withBlockSize(1024)); + $fs = azure_filesystem($this->blobService('flow-php'), new Options()->withBlockSize(1024)); $stream = $fs->writeTo(path('azure-blob://file.txt')); $output = ''; @@ -142,7 +142,7 @@ public function test_appending_to_existing_block_blob_new_blocks(): void public function test_appending_to_existing_non_block_blob_new_blocks(): void { - $fs = azure_filesystem($this->blobService('flow-php'), (new Options())->withBlockSize(1024)); + $fs = azure_filesystem($this->blobService('flow-php'), new Options()->withBlockSize(1024)); $stream = $fs->writeTo(path('azure-blob://file.txt')); $stream->append("This is first line\n"); @@ -311,7 +311,7 @@ public function test_mv_keeps_content_type_and_metadata(int $size): void $service->putBlockBlobBlockList( 'mv_properties_source.csv', new BlockList(new Block($blockId, BlockState::UNCOMMITTED)), - (new PutBlockBlobBlockListOptions()) + new PutBlockBlobBlockListOptions() ->withContentType('text/csv') ->withMetadata(['origin' => 'probe']), ); @@ -516,7 +516,7 @@ public function test_writing_to_to_azure_from_resources(): void public function test_writing_to_to_azure_using_blocks(): void { - $fs = azure_filesystem($this->blobService('flow-php'), (new Options())->withBlockSize(1024)); + $fs = azure_filesystem($this->blobService('flow-php'), new Options()->withBlockSize(1024)); $stream = $fs->writeTo(path('azure-blob://block_blob.csv')); diff --git a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/AzureBlobSourceStreamTest.php b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/AzureBlobSourceStreamTest.php index 8f9767ca52..dba26f65bb 100644 --- a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/AzureBlobSourceStreamTest.php +++ b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/AzureBlobSourceStreamTest.php @@ -25,10 +25,10 @@ public function test_iterate_reads_many_chunks_from_one_ranged_request(): void array_map( strlen(...), iterator_to_array( - (new AzureBlobSourceStream( + new AzureBlobSourceStream( path('azure-blob://f.bin'), new InMemoryBlobService(str_repeat('x', 20_000), maxReads: 1), - ))->iterate(8192), + )->iterate(8192), false, ), ), @@ -40,9 +40,7 @@ public function test_iterate_yields_the_content_in_pieces_of_the_requested_lengt static::assertSame( ['abc', 'def', 'gh'], iterator_to_array( - (new AzureBlobSourceStream(path('azure-blob://f.txt'), new InMemoryBlobService('abcdefgh')))->iterate( - 3, - ), + new AzureBlobSourceStream(path('azure-blob://f.txt'), new InMemoryBlobService('abcdefgh'))->iterate(3), false, ), ); @@ -62,10 +60,10 @@ public function test_read_lines_conforms_to_the_source_stream_contract( ): void { static::assertSame( $expected, - iterator_to_array((new AzureBlobSourceStream( + iterator_to_array(new AzureBlobSourceStream( path('azure-blob://f.txt'), new InMemoryBlobService($content), - ))->readLines($separator, $length)), + )->readLines($separator, $length)), ); } @@ -74,7 +72,7 @@ public function test_read_lines_stops_when_a_read_returns_no_bytes(): void static::assertSame( [], iterator_to_array( - (new AzureBlobSourceStream(path('azure-blob://f.txt'), new InMemoryBlobService('', 5, 3)))->readLines(), + new AzureBlobSourceStream(path('azure-blob://f.txt'), new InMemoryBlobService('', 5, 3))->readLines(), ), ); } diff --git a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/ConfiguredBlobServiceTest.php b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/ConfiguredBlobServiceTest.php index 6de153bbd7..5ca0a8ee70 100644 --- a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/ConfiguredBlobServiceTest.php +++ b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/ConfiguredBlobServiceTest.php @@ -67,11 +67,11 @@ public function test_an_azurite_service_is_built(): void { static::assertInstanceOf( BlobServiceInterface::class, - (new ConfiguredBlobService('account', 'container', 'c2VjcmV0', ['azurite' => [ + new ConfiguredBlobService('account', 'container', 'c2VjcmV0', ['azurite' => [ 'host' => '127.0.0.1', 'port' => '10000', 'https' => false, - ]]))->blobService(), + ]])->blobService(), ); } diff --git a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/OptionsTest.php b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/OptionsTest.php index b95c3d9707..49a6df038f 100644 --- a/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/OptionsTest.php +++ b/src/bridge/filesystem/azure/tests/Flow/Filesystem/Bridge/Azure/Tests/Unit/OptionsTest.php @@ -22,7 +22,7 @@ final class OptionsTest extends TestCase { public function test_normalize_round_trips_every_option(): void { - $options = (new Options()) + $options = new Options() ->withBlockSize(1024) ->withBulkDelete(false) ->withFileFastPath(false) @@ -51,7 +51,7 @@ public function test_the_defaults_round_trip(): void public function test_block_permissions_round_trip(): void { - $options = (new Options())->withBlockFactory( + $options = new Options()->withBlockFactory( new NativeLocalFileBlocksFactory(sys_get_temp_dir(), Permissions::private()), ); $normalized = $options->normalize(); @@ -64,7 +64,7 @@ public function test_block_permissions_round_trip(): void public function test_a_custom_block_factory_does_not_normalize(): void { static::assertNull( - (new Options()) + new Options() ->withBlockFactory($this->createStub(BlockFactory::class)) ->normalize(), ); @@ -79,7 +79,7 @@ public function test_from_array_refuses_a_missing_key(): void public function test_copy_part_size_defaults_to_256_mib(): void { - static::assertSame(268435456, (new Options())->copyPartSize()); + static::assertSame(268435456, new Options()->copyPartSize()); } #[TestWith([0])] @@ -92,12 +92,12 @@ public function test_copy_part_size_outside_1_byte_to_256_mib_is_refused(int $by $bytes, )); - (new Options())->withCopyPartSize($bytes); + new Options()->withCopyPartSize($bytes); } public function test_copy_part_size_round_trips(): void { - $options = (new Options())->withCopyPartSize(5 * 1024 * 1024); + $options = new Options()->withCopyPartSize(5 * 1024 * 1024); $normalized = $options->normalize(); static::assertNotNull($normalized); @@ -107,7 +107,7 @@ public function test_copy_part_size_round_trips(): void public function test_from_array_refuses_a_configuration_without_copy_part_size(): void { - $normalized = (new Options())->normalize(); + $normalized = new Options()->normalize(); static::assertNotNull($normalized); unset($normalized['copy_part_size']); diff --git a/src/bridge/filesystem/sftp/composer.json b/src/bridge/filesystem/sftp/composer.json index 32a65dab59..4055712328 100644 --- a/src/bridge/filesystem/sftp/composer.json +++ b/src/bridge/filesystem/sftp/composer.json @@ -13,7 +13,7 @@ "storage" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/filesystem": "self.version", "flow-php/types": "self.version", "phpseclib/phpseclib": "^4.0.4" diff --git a/src/bridge/filesystem/sftp/src/Flow/Filesystem/Bridge/SFTP/Options.php b/src/bridge/filesystem/sftp/src/Flow/Filesystem/Bridge/SFTP/Options.php index 320d486cb5..e75f991a00 100644 --- a/src/bridge/filesystem/sftp/src/Flow/Filesystem/Bridge/SFTP/Options.php +++ b/src/bridge/filesystem/sftp/src/Flow/Filesystem/Bridge/SFTP/Options.php @@ -87,7 +87,7 @@ public static function fromArray(array $data): self ); } - return (new self()) + return new self() ->withBlockFactory( new NativeLocalFileBlocksFactory( $data['block_location'], diff --git a/src/bridge/filesystem/sftp/src/Flow/Filesystem/Bridge/SFTP/SFTPFilesystem.php b/src/bridge/filesystem/sftp/src/Flow/Filesystem/Bridge/SFTP/SFTPFilesystem.php index 34e52419f5..a8053dfa19 100644 --- a/src/bridge/filesystem/sftp/src/Flow/Filesystem/Bridge/SFTP/SFTPFilesystem.php +++ b/src/bridge/filesystem/sftp/src/Flow/Filesystem/Bridge/SFTP/SFTPFilesystem.php @@ -119,7 +119,7 @@ public function list(Path $path, Filter $pathFilter = new KeepAll()): Generator $root = rtrim(($path->isPattern() ? $path->staticPart() : $path)->path(), '/') ?: '/'; - foreach ((new DirectoryListing($this->client->client()))->read($root) as $entry) { + foreach (new DirectoryListing($this->client->client())->read($root) as $entry) { $entryPath = path($path->protocol() . '://' . $entry->path, $path->options()); if ($path->isPattern() && !$path->matches($entryPath)) { diff --git a/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/OptionsTest.php b/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/OptionsTest.php index 75be00a1d3..8650c6933a 100644 --- a/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/OptionsTest.php +++ b/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/OptionsTest.php @@ -50,7 +50,7 @@ public function test_normalize_round_trips(): void public function test_block_permissions_round_trip(): void { - $options = (new Options())->withBlockFactory( + $options = new Options()->withBlockFactory( new NativeLocalFileBlocksFactory(sys_get_temp_dir(), Permissions::private()), ); $normalized = $options->normalize(); diff --git a/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/SFTPBlockLifecycleTest.php b/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/SFTPBlockLifecycleTest.php index 6fc9fe1fb7..b2c1f0bbf0 100644 --- a/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/SFTPBlockLifecycleTest.php +++ b/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/SFTPBlockLifecycleTest.php @@ -25,7 +25,7 @@ public function test_uploading_a_block_over_an_unusable_session_is_reported_as_a $this->expectException(RuntimeException::class); $this->expectExceptionMessage('SFTP session is no longer usable, cannot upload a block of /upload/orders.csv'); - (new SFTPBlockLifecycle(new SFTP('localhost'), path('sftp:///upload/orders.csv'), new WriteOffset()))->filled( + new SFTPBlockLifecycle(new SFTP('localhost'), path('sftp:///upload/orders.csv'), new WriteOffset())->filled( $block, ); } diff --git a/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/SFTPPasswordTest.php b/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/SFTPPasswordTest.php index 2aec70cacc..0936c36107 100644 --- a/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/SFTPPasswordTest.php +++ b/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/SFTPPasswordTest.php @@ -11,6 +11,6 @@ final class SFTPPasswordTest extends FlowTestCase { public function test_normalize_carries_the_password(): void { - static::assertSame(['password' => 'secret'], (new SFTPPassword('secret'))->normalize()); + static::assertSame(['password' => 'secret'], new SFTPPassword('secret')->normalize()); } } diff --git a/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/SFTPPrivateKeyTest.php b/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/SFTPPrivateKeyTest.php index 17fd956612..51916f2e66 100644 --- a/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/SFTPPrivateKeyTest.php +++ b/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/SFTPPrivateKeyTest.php @@ -14,11 +14,8 @@ final class SFTPPrivateKeyTest extends FlowTestCase { public function test_normalize_carries_the_pem_and_the_passphrase(): void { - static::assertSame(['private_key' => 'pem', 'passphrase' => null], (new SFTPPrivateKey('pem'))->normalize()); - static::assertSame( - ['private_key' => 'pem', 'passphrase' => 'p'], - (new SFTPPrivateKey('pem', 'p'))->normalize(), - ); + static::assertSame(['private_key' => 'pem', 'passphrase' => null], new SFTPPrivateKey('pem')->normalize()); + static::assertSame(['private_key' => 'pem', 'passphrase' => 'p'], new SFTPPrivateKey('pem', 'p')->normalize()); } public function test_a_pem_holding_a_public_key_is_refused_at_login(): void @@ -26,7 +23,7 @@ public function test_a_pem_holding_a_public_key_is_refused_at_login(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('SFTP private key PEM does not hold a private key'); - (new SFTPPrivateKey(RSA::createKey(1024)->getPublicKey()->toString('PKCS8')))->login( + new SFTPPrivateKey(RSA::createKey(1024)->getPublicKey()->toString('PKCS8'))->login( new SFTP('localhost'), 'bob', ); diff --git a/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/WriteOffsetTest.php b/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/WriteOffsetTest.php index e2653e9924..6dbbe14821 100644 --- a/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/WriteOffsetTest.php +++ b/src/bridge/filesystem/sftp/tests/Flow/Filesystem/Bridge/SFTP/Tests/Unit/WriteOffsetTest.php @@ -25,7 +25,7 @@ public function test_advancing_by_a_negative_value_is_rejected(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Cannot advance write offset by a negative value, got: -1'); - (new WriteOffset())->advance(-1); + new WriteOffset()->advance(-1); } public function test_negative_starting_offset_is_rejected(): void diff --git a/src/bridge/mago/types/bin/worker.php b/src/bridge/mago/types/bin/worker.php index a86b276c31..6b0307b3e4 100644 --- a/src/bridge/mago/types/bin/worker.php +++ b/src/bridge/mago/types/bin/worker.php @@ -14,9 +14,9 @@ } } -(new Worker(new Extension( +new Worker(new Extension( identifier: 'flow-php/mago-types-bridge', name: 'Flow PHP Types', version: '1.0.0', analyzerPlugins: [new FlowTypesPlugin()], -)))->run(); +))->run(); diff --git a/src/bridge/mago/types/composer.json b/src/bridge/mago/types/composer.json index 14bb84947b..2172ffc5c2 100644 --- a/src/bridge/mago/types/composer.json +++ b/src/bridge/mago/types/composer.json @@ -11,7 +11,7 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "require-dev": { "carthage-software/mago": "^1.47.4" diff --git a/src/bridge/mago/types/src/Flow/Bridge/Mago/Types/TypeStructureReturnTypeProvider.php b/src/bridge/mago/types/src/Flow/Bridge/Mago/Types/TypeStructureReturnTypeProvider.php index 9570e6e0c6..fe05a9b2ec 100644 --- a/src/bridge/mago/types/src/Flow/Bridge/Mago/Types/TypeStructureReturnTypeProvider.php +++ b/src/bridge/mago/types/src/Flow/Bridge/Mago/Types/TypeStructureReturnTypeProvider.php @@ -18,6 +18,6 @@ public function getTargets(): array public function getReturnType(ReturnTypeProviderContext $context): ?Type { - return (new TypeStructureShape())->derive($context->invocation); + return new TypeStructureShape()->derive($context->invocation); } } diff --git a/src/bridge/mago/types/tests/Flow/Bridge/Mago/Types/Tests/Unit/ElementShapeTest.php b/src/bridge/mago/types/tests/Flow/Bridge/Mago/Types/Tests/Unit/ElementShapeTest.php index c053937a74..de6617e950 100644 --- a/src/bridge/mago/types/tests/Flow/Bridge/Mago/Types/Tests/Unit/ElementShapeTest.php +++ b/src/bridge/mago/types/tests/Flow/Bridge/Mago/Types/Tests/Unit/ElementShapeTest.php @@ -17,7 +17,7 @@ public function test_a_plain_flow_type_derives_a_required_member_resolved_from_i { $flowType = InvocationMother::flowType('Flow\Types\Type\Logical\DateTimeType'); - $derived = (new ElementShape())->derive(InvocationMother::item('created_at', $flowType)); + $derived = new ElementShape()->derive(InvocationMother::item('created_at', $flowType)); static::assertNotNull($derived); static::assertFalse($derived->optional); @@ -28,7 +28,7 @@ public function test_a_marker_with_literal_true_derives_an_optional_member(): vo { $member = Type::string(); - $derived = (new ElementShape())->derive(InvocationMother::item('nick', InvocationMother::marker( + $derived = new ElementShape()->derive(InvocationMother::item('nick', InvocationMother::marker( $member, Type::true(), ))); @@ -57,7 +57,7 @@ public function test_an_already_optional_item_stays_optional(): void { $item = InvocationMother::item('a', InvocationMother::flowType()); - $derived = (new ElementShape())->derive(new ArrayItem($item->key, true, $item->type)); + $derived = new ElementShape()->derive(new ArrayItem($item->key, true, $item->type)); static::assertNotNull($derived); static::assertTrue($derived->optional); @@ -65,6 +65,6 @@ public function test_an_already_optional_item_stays_optional(): void public function test_a_value_that_is_not_a_named_object_refuses_to_derive(): void { - static::assertNull((new ElementShape())->derive(InvocationMother::item('id', Type::string()))); + static::assertNull(new ElementShape()->derive(InvocationMother::item('id', Type::string()))); } } diff --git a/src/bridge/mago/types/tests/Flow/Bridge/Mago/Types/Tests/Unit/TypeStructureShapeTest.php b/src/bridge/mago/types/tests/Flow/Bridge/Mago/Types/Tests/Unit/TypeStructureShapeTest.php index 98bba11ed1..6f1435902a 100644 --- a/src/bridge/mago/types/tests/Flow/Bridge/Mago/Types/Tests/Unit/TypeStructureShapeTest.php +++ b/src/bridge/mago/types/tests/Flow/Bridge/Mago/Types/Tests/Unit/TypeStructureShapeTest.php @@ -17,7 +17,7 @@ public function test_plain_map_derives_required_keys(): void $id = InvocationMother::flowType(); $name = InvocationMother::flowType('Flow\Types\Type\Native\StringType'); - $shape = DerivedShapeContext::shape((new TypeStructureShape())->derive(InvocationMother::typeStructure(InvocationMother::sealedMap( + $shape = DerivedShapeContext::shape(new TypeStructureShape()->derive(InvocationMother::typeStructure(InvocationMother::sealedMap( InvocationMother::item('id', $id), InvocationMother::item('name', $name), )))); @@ -33,7 +33,7 @@ public function test_marker_with_literal_true_derives_an_optional_key(): void { $nick = Type::string(); - $shape = DerivedShapeContext::shape((new TypeStructureShape())->derive(InvocationMother::typeStructure(InvocationMother::sealedMap( + $shape = DerivedShapeContext::shape(new TypeStructureShape()->derive(InvocationMother::typeStructure(InvocationMother::sealedMap( InvocationMother::item('id', InvocationMother::flowType()), InvocationMother::item('nick', InvocationMother::marker($nick, Type::true())), )))); @@ -44,7 +44,7 @@ public function test_marker_with_literal_true_derives_an_optional_key(): void public function test_marker_without_flag_or_with_false_stays_required(): void { - $shape = DerivedShapeContext::shape((new TypeStructureShape())->derive(InvocationMother::typeStructure(InvocationMother::sealedMap( + $shape = DerivedShapeContext::shape(new TypeStructureShape()->derive(InvocationMother::typeStructure(InvocationMother::sealedMap( InvocationMother::item('a', InvocationMother::marker(Type::string(), null)), InvocationMother::item('b', InvocationMother::marker(Type::string(), Type::false())), InvocationMother::item('c', InvocationMother::marker(Type::string(), Type::bool())), @@ -55,7 +55,7 @@ public function test_marker_without_flag_or_with_false_stays_required(): void public function test_derived_shape_is_sealed(): void { - $keyedArray = DerivedShapeContext::keyedArray((new TypeStructureShape())->derive(InvocationMother::typeStructure(InvocationMother::sealedMap(InvocationMother::item( + $keyedArray = DerivedShapeContext::keyedArray(new TypeStructureShape()->derive(InvocationMother::typeStructure(InvocationMother::sealedMap(InvocationMother::item( 'id', InvocationMother::flowType(), ))))); @@ -66,7 +66,7 @@ public function test_derived_shape_is_sealed(): void public function test_unsealed_elements_refuse_to_derive(): void { - static::assertNull((new TypeStructureShape())->derive(InvocationMother::typeStructure(Type::array( + static::assertNull(new TypeStructureShape()->derive(InvocationMother::typeStructure(Type::array( Type::string(), Type::mixed(), )))); @@ -74,7 +74,7 @@ public function test_unsealed_elements_refuse_to_derive(): void public function test_a_value_that_is_not_a_named_object_refuses_to_derive(): void { - static::assertNull((new TypeStructureShape())->derive(InvocationMother::typeStructure(InvocationMother::sealedMap(InvocationMother::item( + static::assertNull(new TypeStructureShape()->derive(InvocationMother::typeStructure(InvocationMother::sealedMap(InvocationMother::item( 'id', Type::string(), ))))); diff --git a/src/bridge/monolog/http/composer.json b/src/bridge/monolog/http/composer.json index 6c555db8e4..44d07c2025 100644 --- a/src/bridge/monolog/http/composer.json +++ b/src/bridge/monolog/http/composer.json @@ -9,7 +9,7 @@ "bridge" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "monolog/monolog": "^3.0", "psr/http-message": "^1.0 || ^2.0" }, diff --git a/src/bridge/monolog/telemetry/composer.json b/src/bridge/monolog/telemetry/composer.json index 9ce1a86c79..5acfee56f8 100644 --- a/src/bridge/monolog/telemetry/composer.json +++ b/src/bridge/monolog/telemetry/composer.json @@ -11,7 +11,7 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/etl": "self.version", "flow-php/telemetry": "self.version", "monolog/monolog": "^3.0" diff --git a/src/bridge/openapi/specification/composer.json b/src/bridge/openapi/specification/composer.json index e309472f4e..cad98d026d 100644 --- a/src/bridge/openapi/specification/composer.json +++ b/src/bridge/openapi/specification/composer.json @@ -10,7 +10,7 @@ "schema" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "config": { "optimize-autoloader": true, diff --git a/src/bridge/openapi/specification/src/Flow/Bridge/OpenAPI/Specification/DSL/functions.php b/src/bridge/openapi/specification/src/Flow/Bridge/OpenAPI/Specification/DSL/functions.php index cb3949b785..e51f3ca2c6 100644 --- a/src/bridge/openapi/specification/src/Flow/Bridge/OpenAPI/Specification/DSL/functions.php +++ b/src/bridge/openapi/specification/src/Flow/Bridge/OpenAPI/Specification/DSL/functions.php @@ -14,7 +14,7 @@ */ function schema_to_openapi_specification(Schema $schema): array { - return (new OpenAPIConverter())->toOpenAPI($schema); + return new OpenAPIConverter()->toOpenAPI($schema); } /** @@ -24,5 +24,5 @@ function schema_to_openapi_specification(Schema $schema): array */ function schema_from_openapi_specification(array $openApiSpec): Schema { - return (new OpenAPIConverter())->fromOpenAPI($openApiSpec); + return new OpenAPIConverter()->fromOpenAPI($openApiSpec); } diff --git a/src/bridge/openapi/specification/tests/Flow/Bridge/OpenAPI/Specification/Tests/Unit/FlowToOpenAPIConverterTest.php b/src/bridge/openapi/specification/tests/Flow/Bridge/OpenAPI/Specification/Tests/Unit/FlowToOpenAPIConverterTest.php index 1f6802a260..0ad4c7508f 100644 --- a/src/bridge/openapi/specification/tests/Flow/Bridge/OpenAPI/Specification/Tests/Unit/FlowToOpenAPIConverterTest.php +++ b/src/bridge/openapi/specification/tests/Flow/Bridge/OpenAPI/Specification/Tests/Unit/FlowToOpenAPIConverterTest.php @@ -170,7 +170,7 @@ public function test_to_open_api_enum_edge_cases(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(enum_schema('single_enum', FlowTestSingleEnum::class, false))), + new OpenAPIConverter()->toOpenAPI(schema(enum_schema('single_enum', FlowTestSingleEnum::class, false))), ); } @@ -179,7 +179,7 @@ public function test_to_open_api_preserves_definition_order(): void static::assertSame( ['c', 'a', 'b'], array_keys(type_array()->assert( - (new OpenAPIConverter())->toOpenAPI(schema( + new OpenAPIConverter()->toOpenAPI(schema( str_schema('c'), str_schema('a'), str_schema('b'), @@ -201,7 +201,7 @@ public function test_to_open_api_with_array_type(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(definition_from_type('items', type_array(), false))), + new OpenAPIConverter()->toOpenAPI(schema(definition_from_type('items', type_array(), false))), ); } @@ -218,7 +218,7 @@ public function test_to_open_api_with_backed_enum(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(enum_schema('priority', FlowTestBackedEnum::class, false))), + new OpenAPIConverter()->toOpenAPI(schema(enum_schema('priority', FlowTestBackedEnum::class, false))), ); } @@ -235,7 +235,7 @@ public function test_to_open_api_with_backed_enum_different_types(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(enum_schema('int_enum', FlowTestIntBackedEnum::class, false))), + new OpenAPIConverter()->toOpenAPI(schema(enum_schema('int_enum', FlowTestIntBackedEnum::class, false))), ); } @@ -246,7 +246,7 @@ public function test_to_open_api_with_backed_enum_different_types(): void #[DataProvider('basic_types_provider')] public function test_to_open_api_with_basic_types(Definition $definition, array $expected): void { - $result = (new OpenAPIConverter())->toOpenAPI(schema($definition)); + $result = new OpenAPIConverter()->toOpenAPI(schema($definition)); static::assertSame( [ @@ -280,7 +280,7 @@ public function test_to_open_api_with_complex_schema(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema( + new OpenAPIConverter()->toOpenAPI(schema( int_schema('id', false), str_schema('name', true, Metadata::empty()->add('description', 'User name')), bool_schema('active', false, Metadata::empty()->add('example', true)), @@ -315,7 +315,7 @@ public function test_to_open_api_interleaved_structure_preserves_declaration_ord ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(structure_schema('s', type_structure([ + new OpenAPIConverter()->toOpenAPI(schema(structure_schema('s', type_structure([ 'z' => type_integer(), 'a' => structure_element('a', type_string(), optional: true), 'b' => type_string(), @@ -350,7 +350,7 @@ public function test_to_open_api_with_deeply_nested_structures(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(structure_schema( + new OpenAPIConverter()->toOpenAPI(schema(structure_schema( 'nested', type_structure([ 'level1' => type_structure([ @@ -371,7 +371,7 @@ public function test_to_open_api_with_empty_schema(): void 'type' => 'object', 'properties' => [], ], - (new OpenAPIConverter())->toOpenAPI(schema()), + new OpenAPIConverter()->toOpenAPI(schema()), ); } @@ -388,7 +388,7 @@ public function test_to_open_api_with_list_type(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(list_schema('tags', type_list(type_string()), false))), + new OpenAPIConverter()->toOpenAPI(schema(list_schema('tags', type_list(type_string()), false))), ); } @@ -405,7 +405,7 @@ public function test_to_open_api_with_map_type(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(map_schema( + new OpenAPIConverter()->toOpenAPI(schema(map_schema( 'metadata', type_map(type_string(), type_integer()), false, @@ -427,7 +427,7 @@ public function test_to_open_api_with_metadata(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'name', false, Metadata::empty()->add('description', 'User full name')->add('example', 'John Doe'), @@ -448,7 +448,7 @@ public function test_to_open_api_with_metadata_description_only(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'name', false, Metadata::empty()->add('description', 'User name'), @@ -469,11 +469,7 @@ public function test_to_open_api_with_metadata_example_only(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(int_schema( - 'age', - false, - Metadata::empty()->add('example', 25), - ))), + new OpenAPIConverter()->toOpenAPI(schema(int_schema('age', false, Metadata::empty()->add('example', 25)))), ); } @@ -489,7 +485,7 @@ public function test_to_open_api_with_metadata_other_keys(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'name', false, Metadata::empty()->add('custom_key', 'custom_value'), @@ -511,7 +507,7 @@ public function test_to_open_api_with_mixed_metadata_values(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'mixed_meta', false, Metadata::empty() @@ -535,7 +531,7 @@ public function test_to_open_api_with_multiple_definitions(): void 'price' => ['type' => 'number', 'nullable' => true], ], ], - (new OpenAPIConverter())->toOpenAPI(schema( + new OpenAPIConverter()->toOpenAPI(schema( int_schema('id', false), str_schema('name', true), bool_schema('active', false), @@ -560,7 +556,7 @@ public function test_to_open_api_with_nested_list_type(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(list_schema( + new OpenAPIConverter()->toOpenAPI(schema(list_schema( 'nested_tags', type_list(type_list(type_integer())), false, @@ -571,7 +567,7 @@ public function test_to_open_api_with_nested_list_type(): void public function test_to_open_api_with_special_field_names(): void { $properties = type_array()->assert( - (new OpenAPIConverter())->toOpenAPI(schema( + new OpenAPIConverter()->toOpenAPI(schema( str_schema('field-with-dashes', false), str_schema('field_with_underscores', false), str_schema('fieldWithCamelCase', false), @@ -595,7 +591,7 @@ public function test_to_open_api_with_special_field_names(): void #[DataProvider('special_types_provider')] public function test_to_open_api_with_special_types(Definition $definition, array $expected): void { - $result = (new OpenAPIConverter())->toOpenAPI(schema($definition)); + $result = new OpenAPIConverter()->toOpenAPI(schema($definition)); static::assertSame( [ @@ -623,7 +619,7 @@ public function test_to_open_api_with_structure_only_optional_elements(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(structure_schema( + new OpenAPIConverter()->toOpenAPI(schema(structure_schema( 'optional_only', type_structure(['optional_field' => structure_element( 'optional_field', @@ -652,7 +648,7 @@ public function test_to_open_api_with_structure_type(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(structure_schema( + new OpenAPIConverter()->toOpenAPI(schema(structure_schema( 'address', type_structure([ 'street' => type_string(), @@ -675,7 +671,7 @@ public function test_to_open_api_with_task_example_schema(): void 'active' => ['type' => 'boolean', 'nullable' => false], ], ], - (new OpenAPIConverter())->toOpenAPI(schema( + new OpenAPIConverter()->toOpenAPI(schema( int_schema('id', false), str_schema('name', true), bool_schema('active', false, Metadata::empty()->add('key', 'value')), @@ -696,7 +692,7 @@ public function test_to_open_api_with_unit_enum(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema(enum_schema('status', FlowTestUnitEnum::class, false))), + new OpenAPIConverter()->toOpenAPI(schema(enum_schema('status', FlowTestUnitEnum::class, false))), ); } diff --git a/src/bridge/openapi/specification/tests/Flow/Bridge/OpenAPI/Specification/Tests/Unit/OpenAPIMetadataIntegrationTest.php b/src/bridge/openapi/specification/tests/Flow/Bridge/OpenAPI/Specification/Tests/Unit/OpenAPIMetadataIntegrationTest.php index fbf6bc5285..a8e64bb2e0 100644 --- a/src/bridge/openapi/specification/tests/Flow/Bridge/OpenAPI/Specification/Tests/Unit/OpenAPIMetadataIntegrationTest.php +++ b/src/bridge/openapi/specification/tests/Flow/Bridge/OpenAPI/Specification/Tests/Unit/OpenAPIMetadataIntegrationTest.php @@ -65,7 +65,7 @@ public function test_complex_example_with_all_metadata_types(): void ], ], ], - (new OpenAPIConverter())->toOpenAPI(schema( + new OpenAPIConverter()->toOpenAPI(schema( int_schema( 'id', false, @@ -112,7 +112,7 @@ public function test_complex_example_with_all_metadata_types(): void public function test_converter_falls_back_to_legacy_metadata_when_openapi_not_present(): void { /** @var array $properties */ - $properties = (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + $properties = new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'name', false, Metadata::with('description', 'Legacy description')->merge(Metadata::with('example', 'Legacy example')), @@ -127,7 +127,7 @@ public function test_converter_falls_back_to_legacy_metadata_when_openapi_not_pr public function test_converter_handles_mixed_legacy_and_openapi_metadata(): void { /** @var array $properties */ - $properties = (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + $properties = new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'mixed', false, Metadata::with('description', 'Legacy description') @@ -145,7 +145,7 @@ public function test_converter_handles_mixed_legacy_and_openapi_metadata(): void public function test_converter_handles_multiple_openapi_metadata(): void { /** @var array $properties */ - $properties = (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + $properties = new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'email', false, OpenAPIMetadata::description('User email address') @@ -165,7 +165,7 @@ public function test_converter_handles_multiple_openapi_metadata(): void public function test_converter_handles_openapi_default_metadata(): void { /** @var array $properties */ - $properties = (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + $properties = new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'status', false, OpenAPIMetadata::default('active'), @@ -178,7 +178,7 @@ public function test_converter_handles_openapi_default_metadata(): void public function test_converter_handles_openapi_deprecated_metadata(): void { /** @var array $properties */ - $properties = (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + $properties = new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'old_field', false, OpenAPIMetadata::deprecated(), @@ -191,7 +191,7 @@ public function test_converter_handles_openapi_deprecated_metadata(): void public function test_converter_handles_openapi_description_metadata(): void { /** @var array $properties */ - $properties = (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + $properties = new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'name', false, OpenAPIMetadata::description('User full name'), @@ -204,7 +204,7 @@ public function test_converter_handles_openapi_description_metadata(): void public function test_converter_handles_openapi_example_metadata(): void { /** @var array $properties */ - $properties = (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + $properties = new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'email', false, OpenAPIMetadata::example('user@example.com'), @@ -237,7 +237,7 @@ public function test_converter_handles_openapi_examples_metadata(): void public function test_converter_handles_openapi_format_metadata(): void { /** @var array $properties */ - $properties = (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + $properties = new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'email', false, OpenAPIMetadata::format('email'), @@ -251,7 +251,7 @@ public function test_converter_handles_openapi_nullable_metadata_override(): voi { // non-nullable schema definition but nullable in OpenAPI - $result = (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + $result = new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'optional_field', false, OpenAPIMetadata::nullable(true), @@ -267,7 +267,7 @@ public function test_converter_handles_openapi_nullable_metadata_override(): voi public function test_converter_handles_openapi_read_only_metadata(): void { /** @var array $properties */ - $properties = (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + $properties = new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'created_at', false, OpenAPIMetadata::readOnly(), @@ -280,7 +280,7 @@ public function test_converter_handles_openapi_read_only_metadata(): void public function test_converter_handles_openapi_title_metadata(): void { /** @var array $properties */ - $properties = (new OpenAPIConverter())->toOpenAPI(schema(int_schema( + $properties = new OpenAPIConverter()->toOpenAPI(schema(int_schema( 'id', false, OpenAPIMetadata::title('User ID'), @@ -293,7 +293,7 @@ public function test_converter_handles_openapi_title_metadata(): void public function test_converter_handles_openapi_write_only_metadata(): void { /** @var array $properties */ - $properties = (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + $properties = new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'password', false, OpenAPIMetadata::writeOnly(), @@ -306,7 +306,7 @@ public function test_converter_handles_openapi_write_only_metadata(): void public function test_converter_prioritizes_openapi_metadata_over_legacy(): void { /** @var array $properties */ - $properties = (new OpenAPIConverter())->toOpenAPI(schema(str_schema( + $properties = new OpenAPIConverter()->toOpenAPI(schema(str_schema( 'name', false, Metadata::with('description', 'Legacy description') // Legacy metadata @@ -324,7 +324,7 @@ public function test_converter_prioritizes_openapi_metadata_over_legacy(): void public function test_openapi_metadata_usage_with_converter(): void { /** @var array $properties */ - $properties = (new OpenAPIConverter())->toOpenAPI(schema( + $properties = new OpenAPIConverter()->toOpenAPI(schema( str_schema( 'user_email', false, diff --git a/src/bridge/openapi/specification/tests/Flow/Bridge/OpenAPI/Specification/Tests/Unit/OpenAPIToFlowConverterTest.php b/src/bridge/openapi/specification/tests/Flow/Bridge/OpenAPI/Specification/Tests/Unit/OpenAPIToFlowConverterTest.php index 549bf59d97..13d7ded395 100644 --- a/src/bridge/openapi/specification/tests/Flow/Bridge/OpenAPI/Specification/Tests/Unit/OpenAPIToFlowConverterTest.php +++ b/src/bridge/openapi/specification/tests/Flow/Bridge/OpenAPI/Specification/Tests/Unit/OpenAPIToFlowConverterTest.php @@ -149,7 +149,7 @@ public function test_from_openapi_throws_exception_for_unsupported_type(): void public function test_from_openapi_with_array_type(): void { - $schema = (new OpenAPIConverter())->fromOpenAPI([ + $schema = new OpenAPIConverter()->fromOpenAPI([ 'type' => 'object', 'properties' => [ 'tags' => [ @@ -169,7 +169,7 @@ public function test_from_openapi_with_array_type(): void public function test_from_openapi_with_basic_types(): void { - $schema = (new OpenAPIConverter())->fromOpenAPI([ + $schema = new OpenAPIConverter()->fromOpenAPI([ 'type' => 'object', 'properties' => [ 'id' => ['type' => 'integer', 'nullable' => false], @@ -242,7 +242,7 @@ public function test_from_openapi_with_empty_properties(): void { static::assertCount( 0, - (new OpenAPIConverter())->fromOpenAPI([ + new OpenAPIConverter()->fromOpenAPI([ 'type' => 'object', 'properties' => [], ])->definitions(), @@ -251,7 +251,7 @@ public function test_from_openapi_with_empty_properties(): void public function test_from_openapi_with_metadata(): void { - $schema = (new OpenAPIConverter())->fromOpenAPI([ + $schema = new OpenAPIConverter()->fromOpenAPI([ 'type' => 'object', 'properties' => [ 'name' => [ @@ -274,7 +274,7 @@ public function test_from_openapi_with_metadata(): void public function test_from_openapi_with_nested_structure(): void { - $schema = (new OpenAPIConverter())->fromOpenAPI([ + $schema = new OpenAPIConverter()->fromOpenAPI([ 'type' => 'object', 'properties' => [ 'address' => [ @@ -297,7 +297,7 @@ public function test_from_openapi_with_nested_structure(): void public function test_from_openapi_with_object_with_additional_properties(): void { - $schema = (new OpenAPIConverter())->fromOpenAPI([ + $schema = new OpenAPIConverter()->fromOpenAPI([ 'type' => 'object', 'properties' => [ 'metadata' => [ @@ -317,7 +317,7 @@ public function test_from_openapi_with_object_with_additional_properties(): void public function test_from_openapi_with_special_string_formats(): void { - $schema = (new OpenAPIConverter())->fromOpenAPI([ + $schema = new OpenAPIConverter()->fromOpenAPI([ 'type' => 'object', 'properties' => [ 'birth_date' => ['type' => 'string', 'format' => 'date', 'nullable' => false], diff --git a/src/bridge/phpstan/types/composer.json b/src/bridge/phpstan/types/composer.json index d44492c700..df8a4ab830 100644 --- a/src/bridge/phpstan/types/composer.json +++ b/src/bridge/phpstan/types/composer.json @@ -11,7 +11,7 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/types": "self.version" }, "require-dev": { diff --git a/src/bridge/phpstan/types/src/Flow/Bridge/PHPStan/Types/StructureTypeReturnTypeExtension.php b/src/bridge/phpstan/types/src/Flow/Bridge/PHPStan/Types/StructureTypeReturnTypeExtension.php index f843419279..5aacd00e47 100644 --- a/src/bridge/phpstan/types/src/Flow/Bridge/PHPStan/Types/StructureTypeReturnTypeExtension.php +++ b/src/bridge/phpstan/types/src/Flow/Bridge/PHPStan/Types/StructureTypeReturnTypeExtension.php @@ -80,7 +80,7 @@ private function createResult(ConstantArrayType $requiredArrayType, array $marke // a structure_element() marker value: the member type is the element's template, the // optional flag comes from the call expression (the type alone cannot carry it) - if ((new ObjectType(StructureElement::class))->isSuperTypeOf($valueType)->yes()) { + if (new ObjectType(StructureElement::class)->isSuperTypeOf($valueType)->yes()) { $builder->setOffsetValueType( $key, $valueType->getTemplateType(StructureElement::class, 'T'), diff --git a/src/bridge/phpunit/postgresql/composer.json b/src/bridge/phpunit/postgresql/composer.json index 1ef6fceb96..2a549de211 100644 --- a/src/bridge/phpunit/postgresql/composer.json +++ b/src/bridge/phpunit/postgresql/composer.json @@ -13,7 +13,7 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/postgresql": "self.version", "phpunit/phpunit": "^11 || ^12 || ^13" }, diff --git a/src/bridge/phpunit/postgresql/tests/Flow/Bridge/PHPUnit/PostgreSQL/Tests/Unit/SkipTransactionRollbackTest.php b/src/bridge/phpunit/postgresql/tests/Flow/Bridge/PHPUnit/PostgreSQL/Tests/Unit/SkipTransactionRollbackTest.php index 3936d02e9c..a45eefe460 100644 --- a/src/bridge/phpunit/postgresql/tests/Flow/Bridge/PHPUnit/PostgreSQL/Tests/Unit/SkipTransactionRollbackTest.php +++ b/src/bridge/phpunit/postgresql/tests/Flow/Bridge/PHPUnit/PostgreSQL/Tests/Unit/SkipTransactionRollbackTest.php @@ -17,7 +17,7 @@ final class SkipTransactionRollbackTest extends TestCase { public function test_attribute_can_target_class(): void { - $attribute = (new ReflectionClass(SkipTransactionRollback::class))->getAttributes( + $attribute = new ReflectionClass(SkipTransactionRollback::class)->getAttributes( Attribute::class, )[0]->newInstance(); @@ -26,7 +26,7 @@ public function test_attribute_can_target_class(): void public function test_attribute_can_target_method(): void { - $attribute = (new ReflectionClass(SkipTransactionRollback::class))->getAttributes( + $attribute = new ReflectionClass(SkipTransactionRollback::class)->getAttributes( Attribute::class, )[0]->newInstance(); @@ -35,7 +35,7 @@ public function test_attribute_can_target_method(): void public function test_attribute_detected_on_class(): void { - static::assertNotEmpty((new ReflectionClass(SkippedTestCase::class))->getAttributes( + static::assertNotEmpty(new ReflectionClass(SkippedTestCase::class)->getAttributes( SkipTransactionRollback::class, )); } @@ -43,7 +43,7 @@ public function test_attribute_detected_on_class(): void public function test_attribute_detected_on_method(): void { static::assertNotEmpty( - (new ReflectionClass(SkippedMethodTestCase::class)) + new ReflectionClass(SkippedMethodTestCase::class) ->getMethod('test_something') ->getAttributes(SkipTransactionRollback::class), ); @@ -60,8 +60,6 @@ public function test_attribute_detected_on_parent_abstract_class(): void public function test_attribute_not_present_on_normal_class(): void { - static::assertEmpty((new ReflectionClass(NormalTestCase::class))->getAttributes( - SkipTransactionRollback::class, - )); + static::assertEmpty(new ReflectionClass(NormalTestCase::class)->getAttributes(SkipTransactionRollback::class)); } } diff --git a/src/bridge/phpunit/telemetry/composer.json b/src/bridge/phpunit/telemetry/composer.json index 5bbe2cf154..b402dd7c9e 100644 --- a/src/bridge/phpunit/telemetry/composer.json +++ b/src/bridge/phpunit/telemetry/composer.json @@ -14,7 +14,7 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/telemetry": "self.version", "flow-php/telemetry-otlp-bridge": "self.version", "phpunit/phpunit": "^11 || ^12 || ^13" diff --git a/src/bridge/phpunit/telemetry/tests/Flow/Bridge/PHPUnit/Telemetry/Tests/Mother/TestEventMother.php b/src/bridge/phpunit/telemetry/tests/Flow/Bridge/PHPUnit/Telemetry/Tests/Mother/TestEventMother.php index 7f863b0a83..2d1478ba3e 100644 --- a/src/bridge/phpunit/telemetry/tests/Flow/Bridge/PHPUnit/Telemetry/Tests/Mother/TestEventMother.php +++ b/src/bridge/phpunit/telemetry/tests/Flow/Bridge/PHPUnit/Telemetry/Tests/Mother/TestEventMother.php @@ -83,7 +83,7 @@ private static function createInfo(): Info MemoryUsage::fromBytes(0), ]; - $constructor = (new ReflectionClass(Info::class))->getConstructor(); + $constructor = new ReflectionClass(Info::class)->getConstructor(); if ($constructor !== null) { $parameters = $constructor->getParameters(); @@ -110,7 +110,7 @@ private static function createSnapshot(): Snapshot new GarbageCollectorStatus(0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, false, false, false, 0), ]; - $constructor = (new ReflectionClass(Snapshot::class))->getConstructor(); + $constructor = new ReflectionClass(Snapshot::class)->getConstructor(); if ($constructor !== null) { $parameters = $constructor->getParameters(); diff --git a/src/bridge/phpunit/telemetry/tests/Flow/Bridge/PHPUnit/Telemetry/Tests/Unit/PHPUnitTelemetryAttributesTest.php b/src/bridge/phpunit/telemetry/tests/Flow/Bridge/PHPUnit/Telemetry/Tests/Unit/PHPUnitTelemetryAttributesTest.php index 8abe4ba53e..ab8b5d1b83 100644 --- a/src/bridge/phpunit/telemetry/tests/Flow/Bridge/PHPUnit/Telemetry/Tests/Unit/PHPUnitTelemetryAttributesTest.php +++ b/src/bridge/phpunit/telemetry/tests/Flow/Bridge/PHPUnit/Telemetry/Tests/Unit/PHPUnitTelemetryAttributesTest.php @@ -13,7 +13,7 @@ final class PHPUnitTelemetryAttributesTest extends TestCase public function test_all_custom_keys_use_the_flow_phpunit_prefix(): void { // @mago-expect analysis:mixed-assignment - foreach ((new ReflectionClass(PHPUnitTelemetryAttributes::class))->getConstants() as $name => $value) { + foreach (new ReflectionClass(PHPUnitTelemetryAttributes::class)->getConstants() as $name => $value) { static::assertIsString($value); static::assertStringStartsWith( 'flow.phpunit.', diff --git a/src/bridge/phpunit/telemetry/tests/Flow/Bridge/PHPUnit/Telemetry/Tests/Unit/SuiteOutcomeStackTest.php b/src/bridge/phpunit/telemetry/tests/Flow/Bridge/PHPUnit/Telemetry/Tests/Unit/SuiteOutcomeStackTest.php index 34eac2e74f..15a76481ee 100644 --- a/src/bridge/phpunit/telemetry/tests/Flow/Bridge/PHPUnit/Telemetry/Tests/Unit/SuiteOutcomeStackTest.php +++ b/src/bridge/phpunit/telemetry/tests/Flow/Bridge/PHPUnit/Telemetry/Tests/Unit/SuiteOutcomeStackTest.php @@ -71,7 +71,7 @@ public function test_only_skipped_tests_make_suite_skipped(): void public function test_pop_without_open_frame_returns_null(): void { - static::assertNull((new SuiteOutcomeStack())->pop()); + static::assertNull(new SuiteOutcomeStack()->pop()); } public function test_size_reflects_open_frames(): void diff --git a/src/bridge/postgresql/valinor/composer.json b/src/bridge/postgresql/valinor/composer.json index 5eac741633..6408ca997e 100644 --- a/src/bridge/postgresql/valinor/composer.json +++ b/src/bridge/postgresql/valinor/composer.json @@ -11,7 +11,7 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "cuyz/valinor": "^2.4", "flow-php/postgresql": "self.version" }, diff --git a/src/bridge/postgresql/valinor/tests/Flow/PostgreSql/Bridge/Valinor/Tests/Unit/DSLTest.php b/src/bridge/postgresql/valinor/tests/Flow/PostgreSql/Bridge/Valinor/Tests/Unit/DSLTest.php index 681e83c433..261259f18d 100644 --- a/src/bridge/postgresql/valinor/tests/Flow/PostgreSql/Bridge/Valinor/Tests/Unit/DSLTest.php +++ b/src/bridge/postgresql/valinor/tests/Flow/PostgreSql/Bridge/Valinor/Tests/Unit/DSLTest.php @@ -29,7 +29,7 @@ public function test_valinor_builder_mapper_delegates_to_class(): void public function test_valinor_tree_mapper_delegates_to_class(): void { - $mapper = valinor_tree_mapper((new MapperBuilder())->mapper(), SimpleDto::class); + $mapper = valinor_tree_mapper(new MapperBuilder()->mapper(), SimpleDto::class); static::assertInstanceOf(ValinorTreeMapper::class, $mapper); static::assertSame( diff --git a/src/bridge/postgresql/valinor/tests/Flow/PostgreSql/Bridge/Valinor/Tests/Unit/ValinorTreeMapperTest.php b/src/bridge/postgresql/valinor/tests/Flow/PostgreSql/Bridge/Valinor/Tests/Unit/ValinorTreeMapperTest.php index 81cbccbe30..3a2f5a7f12 100644 --- a/src/bridge/postgresql/valinor/tests/Flow/PostgreSql/Bridge/Valinor/Tests/Unit/ValinorTreeMapperTest.php +++ b/src/bridge/postgresql/valinor/tests/Flow/PostgreSql/Bridge/Valinor/Tests/Unit/ValinorTreeMapperTest.php @@ -29,7 +29,7 @@ final class ValinorTreeMapperTest extends TestCase { public function test_allows_extra_columns_when_superfluous_keys_enabled(): void { - $mapper = new ValinorTreeMapper((new MapperBuilder())->allowSuperfluousKeys()->mapper(), SimpleDto::class); + $mapper = new ValinorTreeMapper(new MapperBuilder()->allowSuperfluousKeys()->mapper(), SimpleDto::class); $result = $mapper->map([ 'id' => 1, @@ -50,7 +50,7 @@ public function test_composes_with_type_mapper_for_datetime_columns(): void 'id' => type_integer(), 'createdAt' => type_datetime(), ]), - new ValinorTreeMapper((new MapperBuilder())->mapper(), WithDateTime::class), + new ValinorTreeMapper(new MapperBuilder()->mapper(), WithDateTime::class), ); $result = type_instance_of(WithDateTime::class)->assert($mapper->map([ @@ -73,7 +73,7 @@ public function test_composes_with_type_mapper_to_decode_jsonb_into_nested_objec 'city' => type_string(), ]), ]), - new ValinorTreeMapper((new MapperBuilder())->mapper(), UserWithAddress::class), + new ValinorTreeMapper(new MapperBuilder()->mapper(), UserWithAddress::class), ); $result = type_instance_of(UserWithAddress::class)->assert($mapper->map([ @@ -88,7 +88,7 @@ public function test_composes_with_type_mapper_to_decode_jsonb_into_nested_objec public function test_exception_message_includes_target_class(): void { - $mapper = new ValinorTreeMapper((new MapperBuilder())->mapper(), SimpleDto::class); + $mapper = new ValinorTreeMapper(new MapperBuilder()->mapper(), SimpleDto::class); try { $mapper->map(['id' => 1], MapperContextMother::any()); @@ -100,7 +100,7 @@ public function test_exception_message_includes_target_class(): void public function test_maps_list_of_strings(): void { - $mapper = new ValinorTreeMapper((new MapperBuilder())->mapper(), WithTags::class); + $mapper = new ValinorTreeMapper(new MapperBuilder()->mapper(), WithTags::class); $result = $mapper->map([ 'id' => 1, @@ -112,7 +112,7 @@ public function test_maps_list_of_strings(): void public function test_maps_nested_object_from_array(): void { - $mapper = new ValinorTreeMapper((new MapperBuilder())->mapper(), UserWithAddress::class); + $mapper = new ValinorTreeMapper(new MapperBuilder()->mapper(), UserWithAddress::class); $result = $mapper->map([ 'id' => 1, @@ -131,7 +131,7 @@ public function test_maps_nested_object_from_array(): void public function test_maps_nullable_property_when_value_is_null(): void { - $mapper = new ValinorTreeMapper((new MapperBuilder())->mapper(), NullableDto::class); + $mapper = new ValinorTreeMapper(new MapperBuilder()->mapper(), NullableDto::class); $result = $mapper->map([ 'id' => 1, @@ -146,7 +146,7 @@ public function test_maps_nullable_property_when_value_is_null(): void public function test_maps_row_to_simple_dto(): void { - $mapper = new ValinorTreeMapper((new MapperBuilder())->mapper(), SimpleDto::class); + $mapper = new ValinorTreeMapper(new MapperBuilder()->mapper(), SimpleDto::class); $result = $mapper->map([ 'id' => 1, @@ -162,7 +162,7 @@ public function test_maps_row_to_simple_dto(): void public function test_rejects_extra_columns_by_default(): void { - $mapper = new ValinorTreeMapper((new MapperBuilder())->mapper(), SimpleDto::class); + $mapper = new ValinorTreeMapper(new MapperBuilder()->mapper(), SimpleDto::class); $this->expectException(MappingException::class); @@ -176,7 +176,7 @@ public function test_rejects_extra_columns_by_default(): void public function test_wraps_mapping_error_as_mapping_exception_with_previous(): void { - $mapper = new ValinorTreeMapper((new MapperBuilder())->mapper(), SimpleDto::class); + $mapper = new ValinorTreeMapper(new MapperBuilder()->mapper(), SimpleDto::class); try { $mapper->map(['id' => 'not-an-int'], MapperContextMother::any()); diff --git a/src/bridge/psr18/telemetry/composer.json b/src/bridge/psr18/telemetry/composer.json index a941451b7f..8447c7b828 100644 --- a/src/bridge/psr18/telemetry/composer.json +++ b/src/bridge/psr18/telemetry/composer.json @@ -11,7 +11,7 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/telemetry": "self.version", "psr/http-client": "^1.0", "psr/http-message": "^1.0 || ^2.0" diff --git a/src/bridge/psr3/telemetry/composer.json b/src/bridge/psr3/telemetry/composer.json index f4471c738f..2a04d3a7eb 100644 --- a/src/bridge/psr3/telemetry/composer.json +++ b/src/bridge/psr3/telemetry/composer.json @@ -11,7 +11,7 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/telemetry": "self.version", "psr/log": "^2.0 || ^3.0" }, diff --git a/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Integration/TelemetryTestContext.php b/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Integration/TelemetryTestContext.php index b01929d738..2352fb55ba 100644 --- a/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Integration/TelemetryTestContext.php +++ b/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Integration/TelemetryTestContext.php @@ -26,7 +26,7 @@ public static function create( ): self { $processor = new MemoryLogProcessor(new VoidExporter()); - $logger = (new LoggerProvider($processor, new SystemClock(), new MemoryContextStorage()))->logger( + $logger = new LoggerProvider($processor, new SystemClock(), new MemoryContextStorage())->logger( $resource ?? Resource::create(['service.name' => 'psr3-test-service']), $scope, $version, diff --git a/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Unit/AttributeValueNormalizerTest.php b/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Unit/AttributeValueNormalizerTest.php index ecfa89eec7..f98f128050 100644 --- a/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Unit/AttributeValueNormalizerTest.php +++ b/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Unit/AttributeValueNormalizerTest.php @@ -33,7 +33,7 @@ public function test_normalizes_datetime_passthrough(): void public function test_normalizes_null_to_string(): void { - static::assertSame('null', (new AttributeValueNormalizer())->normalize(null)); + static::assertSame('null', new AttributeValueNormalizer()->normalize(null)); } public function test_normalizes_object_with_to_string_to_string(): void @@ -45,12 +45,12 @@ public function __toString(): string } }; - static::assertSame('rendered', (new AttributeValueNormalizer())->normalize($object)); + static::assertSame('rendered', new AttributeValueNormalizer()->normalize($object)); } public function test_normalizes_object_without_to_string_to_class_name(): void { - static::assertSame(stdClass::class, (new AttributeValueNormalizer())->normalize(new stdClass())); + static::assertSame(stdClass::class, new AttributeValueNormalizer()->normalize(new stdClass())); } public function test_normalizes_resource_to_debug_type(): void @@ -59,7 +59,7 @@ public function test_normalizes_resource_to_debug_type(): void static::assertNotFalse($resource); try { - static::assertSame('resource (stream)', (new AttributeValueNormalizer())->normalize($resource)); + static::assertSame('resource (stream)', new AttributeValueNormalizer()->normalize($resource)); } finally { fclose($resource); } @@ -79,6 +79,6 @@ public function test_normalizes_throwable_passthrough(): void { $exception = new RuntimeException('boom'); - static::assertSame($exception, (new AttributeValueNormalizer())->normalize($exception)); + static::assertSame($exception, new AttributeValueNormalizer()->normalize($exception)); } } diff --git a/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Unit/LogRecordConverterTest.php b/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Unit/LogRecordConverterTest.php index 44af575ce3..693958e054 100644 --- a/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Unit/LogRecordConverterTest.php +++ b/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Unit/LogRecordConverterTest.php @@ -30,14 +30,14 @@ public function __toString(): string } }; - $record = (new LogRecordConverter())->convert(LogLevel::INFO, $message); + $record = new LogRecordConverter()->convert(LogLevel::INFO, $message); static::assertSame('rendered body', $record->body); } public function test_context_entries_become_attributes_with_raw_keys(): void { - $record = (new LogRecordConverter())->convert(LogLevel::INFO, 'msg', [ + $record = new LogRecordConverter()->convert(LogLevel::INFO, 'msg', [ 'user_id' => 123, 'role' => 'admin', ]); @@ -48,7 +48,7 @@ public function test_context_entries_become_attributes_with_raw_keys(): void public function test_default_normalizer_handles_null_in_attributes(): void { - $record = (new LogRecordConverter(valueNormalizer: new AttributeValueNormalizer()))->convert( + $record = new LogRecordConverter(valueNormalizer: new AttributeValueNormalizer())->convert( LogLevel::INFO, 'msg', [ @@ -63,7 +63,7 @@ public function test_exception_in_context_is_routed_via_set_exception(): void { $exception = new RuntimeException('boom'); - $record = (new LogRecordConverter())->convert(LogLevel::ERROR, 'failure', [ + $record = new LogRecordConverter()->convert(LogLevel::ERROR, 'failure', [ 'exception' => $exception, ]); @@ -75,7 +75,7 @@ public function test_exception_in_context_is_routed_via_set_exception(): void public function test_interpolates_message_placeholders_from_context(): void { - $record = (new LogRecordConverter())->convert(LogLevel::INFO, 'User {user_id} performed {action}', [ + $record = new LogRecordConverter()->convert(LogLevel::INFO, 'User {user_id} performed {action}', [ 'user_id' => 123, 'action' => 'login', ]); @@ -87,7 +87,7 @@ public function test_interpolates_message_placeholders_from_context(): void public function test_interpolation_renders_arrays_and_plain_objects(): void { - $record = (new LogRecordConverter())->convert(LogLevel::INFO, 'Tags {tags} obj {obj}', [ + $record = new LogRecordConverter()->convert(LogLevel::INFO, 'Tags {tags} obj {obj}', [ 'tags' => ['a', 'b'], 'obj' => new stdClass(), ]); @@ -97,7 +97,7 @@ public function test_interpolation_renders_arrays_and_plain_objects(): void public function test_interpolation_leaves_absent_placeholders_intact(): void { - $record = (new LogRecordConverter())->convert(LogLevel::INFO, 'User {user_id} did {missing}', [ + $record = new LogRecordConverter()->convert(LogLevel::INFO, 'User {user_id} did {missing}', [ 'user_id' => 7, ]); @@ -106,7 +106,7 @@ public function test_interpolation_leaves_absent_placeholders_intact(): void public function test_interpolation_renders_datetime(): void { - $record = (new LogRecordConverter())->convert(LogLevel::INFO, 'At {when}', [ + $record = new LogRecordConverter()->convert(LogLevel::INFO, 'At {when}', [ 'when' => new DateTimeImmutable('2024-06-15 14:30:00', new DateTimeZone('UTC')), ]); @@ -115,7 +115,7 @@ public function test_interpolation_renders_datetime(): void public function test_interpolation_renders_enums(): void { - $record = (new LogRecordConverter())->convert(LogLevel::INFO, 'backed {backed} pure {pure}', [ + $record = new LogRecordConverter()->convert(LogLevel::INFO, 'backed {backed} pure {pure}', [ 'backed' => InterpolationBackedEnumFixture::Active, 'pure' => InterpolationUnitEnumFixture::First, ]); @@ -125,7 +125,7 @@ public function test_interpolation_renders_enums(): void public function test_interpolation_renders_null_as_empty_string(): void { - $record = (new LogRecordConverter())->convert(LogLevel::INFO, 'val={item}', [ + $record = new LogRecordConverter()->convert(LogLevel::INFO, 'val={item}', [ 'item' => null, ]); @@ -137,7 +137,7 @@ public function test_interpolation_renders_resource_with_type_fallback(): void $resource = fopen('php://memory', 'rb'); static::assertIsResource($resource); - $record = (new LogRecordConverter())->convert(LogLevel::INFO, 'res={res}', [ + $record = new LogRecordConverter()->convert(LogLevel::INFO, 'res={res}', [ 'res' => $resource, ]); @@ -155,7 +155,7 @@ public function __toString(): string } }; - $record = (new LogRecordConverter())->convert(LogLevel::INFO, 'value={item}', [ + $record = new LogRecordConverter()->convert(LogLevel::INFO, 'value={item}', [ 'item' => $stringable, ]); @@ -164,7 +164,7 @@ public function __toString(): string public function test_message_without_braces_is_returned_verbatim(): void { - $record = (new LogRecordConverter())->convert(LogLevel::INFO, 'no placeholders here', [ + $record = new LogRecordConverter()->convert(LogLevel::INFO, 'no placeholders here', [ 'user_id' => 5, ]); @@ -173,7 +173,7 @@ public function test_message_without_braces_is_returned_verbatim(): void public function test_non_throwable_under_exception_key_is_stored_as_attribute(): void { - $record = (new LogRecordConverter())->convert(LogLevel::ERROR, 'msg', [ + $record = new LogRecordConverter()->convert(LogLevel::ERROR, 'msg', [ 'exception' => 'not-a-throwable', ]); @@ -183,7 +183,7 @@ public function test_non_throwable_under_exception_key_is_stored_as_attribute(): public function test_normalizes_arbitrary_php_values_in_context(): void { - $record = (new LogRecordConverter())->convert(LogLevel::INFO, 'msg', [ + $record = new LogRecordConverter()->convert(LogLevel::INFO, 'msg', [ 'nullable' => null, 'object' => new stdClass(), ]); @@ -205,7 +205,7 @@ public function test_severity_mapping_uses_provided_mapper(): void LogLevel::EMERGENCY => Severity::FATAL, ]); - $record = (new LogRecordConverter($mapper))->convert(LogLevel::DEBUG, 'msg'); + $record = new LogRecordConverter($mapper)->convert(LogLevel::DEBUG, 'msg'); static::assertSame(Severity::TRACE, $record->severity); } @@ -214,6 +214,6 @@ public function test_throws_on_unknown_level(): void { $this->expectException(InvalidArgumentException::class); - (new LogRecordConverter())->convert('verbose', 'msg'); + new LogRecordConverter()->convert('verbose', 'msg'); } } diff --git a/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Unit/TelemetryLoggerTest.php b/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Unit/TelemetryLoggerTest.php index f69be34c80..b99c86127a 100644 --- a/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Unit/TelemetryLoggerTest.php +++ b/src/bridge/psr3/telemetry/tests/Flow/Bridge/Psr3/Telemetry/Tests/Unit/TelemetryLoggerTest.php @@ -47,7 +47,7 @@ protected function setUp(): void { $this->processor = new MemoryLogProcessor(new VoidExporter()); - $logger = (new LoggerProvider($this->processor, new SystemClock(), new MemoryContextStorage()))->logger( + $logger = new LoggerProvider($this->processor, new SystemClock(), new MemoryContextStorage())->logger( Resource::empty(), 'psr3-test-scope', ); @@ -72,7 +72,7 @@ public function test_critical_emits_fatal_severity(): void public function test_custom_converter_is_used(): void { $processor = new MemoryLogProcessor(new VoidExporter()); - $logger = (new LoggerProvider($processor, new SystemClock(), new MemoryContextStorage()))->logger( + $logger = new LoggerProvider($processor, new SystemClock(), new MemoryContextStorage())->logger( Resource::empty(), 'psr3-custom-scope', ); diff --git a/src/bridge/psr7/telemetry/composer.json b/src/bridge/psr7/telemetry/composer.json index 5b5702f722..292fd32d3a 100644 --- a/src/bridge/psr7/telemetry/composer.json +++ b/src/bridge/psr7/telemetry/composer.json @@ -11,7 +11,7 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/telemetry": "self.version", "psr/http-message": "^1.0 || ^2.0" }, diff --git a/src/bridge/psr7/telemetry/tests/Flow/Bridge/Psr7/Telemetry/Tests/Unit/ResponseCarrierTest.php b/src/bridge/psr7/telemetry/tests/Flow/Bridge/Psr7/Telemetry/Tests/Unit/ResponseCarrierTest.php index 9575306966..32d660575b 100644 --- a/src/bridge/psr7/telemetry/tests/Flow/Bridge/Psr7/Telemetry/Tests/Unit/ResponseCarrierTest.php +++ b/src/bridge/psr7/telemetry/tests/Flow/Bridge/Psr7/Telemetry/Tests/Unit/ResponseCarrierTest.php @@ -14,7 +14,7 @@ public function test_fluent_chaining(): void { $response = new Response(); - $modifiedResponse = (new ResponseCarrier($response)) + $modifiedResponse = new ResponseCarrier($response) ->set('X-Header-1', 'value1') ->set('X-Header-2', 'value2') ->unwrap(); diff --git a/src/bridge/symfony/console/composer.json b/src/bridge/symfony/console/composer.json index 584e4ce20e..d835ea20c6 100644 --- a/src/bridge/symfony/console/composer.json +++ b/src/bridge/symfony/console/composer.json @@ -10,8 +10,8 @@ "bridge" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", - "symfony/console": "^6.4.34 || ^7.4.6 || ^8.0.6", + "php": "~8.5.0 || ~8.6.0", + "symfony/console": "^7.4.6 || ^8.0.6", "flow-php/etl": "self.version" }, "config": { diff --git a/src/bridge/symfony/console/src/Flow/Bridge/Symfony/Console/DSL/functions.php b/src/bridge/symfony/console/src/Flow/Bridge/Symfony/Console/DSL/functions.php index 95d81e5800..b4ba2ca3e8 100644 --- a/src/bridge/symfony/console/src/Flow/Bridge/Symfony/Console/DSL/functions.php +++ b/src/bridge/symfony/console/src/Flow/Bridge/Symfony/Console/DSL/functions.php @@ -15,5 +15,5 @@ #[DocumentationDSL(module: Module::SYMFONY_CONSOLE_BRIDGE, type: DSLType::HELPER)] function console_heartbeat(OutputInterface $output, ConsoleStyle $style = ConsoleStyle::tasks): ConsoleHeartbeat { - return (new ConsoleHeartbeatFactory())->create($output, $style); + return new ConsoleHeartbeatFactory()->create($output, $style); } diff --git a/src/bridge/symfony/console/src/Flow/Bridge/Symfony/Console/StatusLineHeartbeat.php b/src/bridge/symfony/console/src/Flow/Bridge/Symfony/Console/StatusLineHeartbeat.php index d68dabc31d..13d8f2e092 100644 --- a/src/bridge/symfony/console/src/Flow/Bridge/Symfony/Console/StatusLineHeartbeat.php +++ b/src/bridge/symfony/console/src/Flow/Bridge/Symfony/Console/StatusLineHeartbeat.php @@ -75,7 +75,7 @@ public function finish(): void if ($this->output instanceof ConsoleSectionOutput) { $summary === null ? $this->output->clear() : $this->output->overwrite($summary); } else { - (new Cursor($this->output)) + new Cursor($this->output) ->moveToColumn(1) ->clearLine(); @@ -149,7 +149,7 @@ private function message(Pulse $pulse): string [implode('', $latest)], ], ); - $width = max(1, min(self::MAX_WIDTH, (new Terminal())->getWidth()) - self::INDICATOR_AND_LAST_COLUMN); + $width = max(1, min(self::MAX_WIDTH, new Terminal()->getWidth()) - self::INDICATOR_AND_LAST_COLUMN); foreach ($candidates as $candidate) { if ($this->visible($candidate) <= $width) { diff --git a/src/bridge/symfony/console/src/Flow/Bridge/Symfony/Console/TaskListHeartbeat.php b/src/bridge/symfony/console/src/Flow/Bridge/Symfony/Console/TaskListHeartbeat.php index 9873dff202..3f5b6d962d 100644 --- a/src/bridge/symfony/console/src/Flow/Bridge/Symfony/Console/TaskListHeartbeat.php +++ b/src/bridge/symfony/console/src/Flow/Bridge/Symfony/Console/TaskListHeartbeat.php @@ -74,7 +74,7 @@ public function beat(Pulse $pulse): void $this->graph?->recorded($pulse); $this->frame++; $this->last = $pulse; - $width = min(self::MAX_WIDTH, (new Terminal())->getWidth()) - 1; + $width = min(self::MAX_WIDTH, new Terminal()->getWidth()) - 1; $exact = $this->lines($pulse, $width, false); $this->short = $exact === null; @@ -107,7 +107,7 @@ public function finish(): void if (StageLine::readCompleted($last)) { $this->output->writeln(''); - $this->output->writeln($this->summary($last, min(self::MAX_WIDTH, (new Terminal())->getWidth()) - 1)); + $this->output->writeln($this->summary($last, min(self::MAX_WIDTH, new Terminal()->getWidth()) - 1)); $this->output->writeln(''); } @@ -381,7 +381,7 @@ private function subjectRoom(string $label, string $count, array $columns, int $ private function redraw(array $lines, array $done): void { $from = $this->frozenLines; - $reachable = max(1, (new Terminal())->getHeight() - 1); + $reachable = max(1, new Terminal()->getHeight() - 1); while ((count($lines) - $this->frozenLines) > $reachable && ($done[$this->frozenLines] ?? false)) { $this->frozenLines++; diff --git a/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/ConsoleHeartbeatFactoryTest.php b/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/ConsoleHeartbeatFactoryTest.php index de4a843402..f8e8d6f788 100644 --- a/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/ConsoleHeartbeatFactoryTest.php +++ b/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/ConsoleHeartbeatFactoryTest.php @@ -47,7 +47,7 @@ public function test_each_style_on_a_terminal(ConsoleStyle $style, string $class #[TestWith([ConsoleStyle::line])] public function test_a_non_terminal_gets_the_log(ConsoleStyle $style): void { - static::assertInstanceOf(LogHeartbeat::class, (new ConsoleHeartbeatFactory())->create( + static::assertInstanceOf(LogHeartbeat::class, new ConsoleHeartbeatFactory()->create( new BufferedOutput(), $style, )); @@ -60,7 +60,7 @@ public function test_a_section_of_the_caller_gets_the_line(ConsoleStyle $style): $terminal = new TerminalContext(100); try { - static::assertInstanceOf(StatusLineHeartbeat::class, (new ConsoleHeartbeatFactory())->create( + static::assertInstanceOf(StatusLineHeartbeat::class, new ConsoleHeartbeatFactory()->create( $terminal->section(), $style, )); diff --git a/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/LogHeartbeatTest.php b/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/LogHeartbeatTest.php index ec2cd5cdde..dac2c8f25f 100644 --- a/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/LogHeartbeatTest.php +++ b/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/LogHeartbeatTest.php @@ -26,9 +26,7 @@ public function test_no_progress_line_before_ten_seconds(): void { $output = new BufferedOutput(); - (new LogHeartbeat( - $output, - ))->beat(PulseMother::pulse(elapsedSeconds: 9.9, stages: [StageProgressMother::open()])); + new LogHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 9.9, stages: [StageProgressMother::open()])); static::assertSame('', $output->fetch()); } @@ -56,7 +54,7 @@ public function test_a_write_entry_prints_its_done_line(): void { $output = new BufferedOutput(); - (new LogHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 1.0, stages: [ + new LogHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 1.0, stages: [ StageProgressMother::done(StageName::write, 20_000, 0.3, 0.5), ])); @@ -67,7 +65,7 @@ public function test_a_write_line_shows_its_directory(): void { $output = new BufferedOutput(); - (new LogHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 1.0, stages: [ + new LogHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 1.0, stages: [ StageProgressMother::done(StageName::write, 1_000, 0.3, 0.5, subject: 'file:///out/customer_totals/'), ])); @@ -78,7 +76,7 @@ public function test_a_write_line_shows_its_collection(): void { $output = new BufferedOutput(); - (new LogHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 1.0, stages: [ + new LogHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 1.0, stages: [ StageProgressMother::done(StageName::write, 1_000, 0.3, 0.5, subject: 'heartbeat_demo_customer_totals'), ])); @@ -292,7 +290,7 @@ public function test_built_directly_it_draws_on_the_output_it_was_given(): void try { $console = $terminal->console(); - (new LogHeartbeat($console))->beat(PulseMother::pulse(elapsedSeconds: 3.0, stages: [ + new LogHeartbeat($console)->beat(PulseMother::pulse(elapsedSeconds: 3.0, stages: [ StageProgressMother::done(StageName::read, 3, endedAtSeconds: 1.0), ])); diff --git a/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/StageLineTest.php b/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/StageLineTest.php index 00073ddcf0..d833b0efc6 100644 --- a/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/StageLineTest.php +++ b/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/StageLineTest.php @@ -24,10 +24,10 @@ public function test_location_keeps_the_last_segments(string $location, string $ { static::assertSame( $shown, - (new StageLine( + new StageLine( StageProgressMother::open(subject: $location), PulseMother::pulse(elapsedSeconds: 2.0), - ))->subject(24), + )->subject(24), ); } @@ -35,33 +35,32 @@ public function test_a_long_location_is_cut_from_the_left(): void { static::assertSame( '…' . str_repeat('a', 15) . '.csv', - (new StageLine( + new StageLine( StageProgressMother::open(subject: 'memory://in/' . str_repeat('a', 36) . '.csv'), PulseMother::pulse(elapsedSeconds: 2.0), - ))->subject(20), + )->subject(20), ); } public function test_no_location_below_eight_columns_or_without_one(): void { - static::assertNull((new StageLine( + static::assertNull(new StageLine( StageProgressMother::open(subject: 'memory://in/orders.csv'), PulseMother::pulse(elapsedSeconds: 2.0), - ))->subject(7)); - static::assertNull((new StageLine( - StageProgressMother::open(), - PulseMother::pulse(elapsedSeconds: 2.0), - ))->subject(24)); + )->subject(7)); + static::assertNull(new StageLine(StageProgressMother::open(), PulseMother::pulse(elapsedSeconds: 2.0))->subject( + 24, + )); } public function test_the_label_reads_without_an_underscore(): void { static::assertSame( 'group by', - (new StageLine( + new StageLine( StageProgressMother::open(StageName::group_by), PulseMother::pulse(elapsedSeconds: 2.0), - ))->label(), + )->label(), ); } @@ -95,14 +94,14 @@ public function test_a_count_of_one_names_its_unit_in_the_singular(ProgressUnit public function test_a_count_against_a_total_of_one_names_its_unit_in_the_singular(): void { static::assertSame(['0 / 1 row', '1 / 5 rows'], [ - (new StageLine( + new StageLine( StageProgressMother::open(StageName::read, 0, 1), PulseMother::pulse(elapsedSeconds: 2.0), - ))->exactCount(), - (new StageLine( + )->exactCount(), + new StageLine( StageProgressMother::open(StageName::read, 1, 5), PulseMother::pulse(elapsedSeconds: 2.0), - ))->exactCount(), + )->exactCount(), ]); } @@ -127,27 +126,21 @@ public function test_rate_is_for_rows_only(): void $pulse = PulseMother::pulse(elapsedSeconds: 2.0); static::assertSame(['5.5M/s', null, null], [ - (new StageLine(StageProgressMother::open(count: 11_000_000), $pulse))->rate(), - (new StageLine( + new StageLine(StageProgressMother::open(count: 11_000_000), $pulse)->rate(), + new StageLine( StageProgressMother::open(StageName::group_by, 40, unit: ProgressUnit::groups), $pulse, - ))->rate(), - (new StageLine(StageProgressMother::open(StageName::commit, 8, unit: ProgressUnit::files), $pulse))->rate(), + )->rate(), + new StageLine(StageProgressMother::open(StageName::commit, 8, unit: ProgressUnit::files), $pulse)->rate(), ]); } public function test_no_rate_for_a_stage_shorter_than_half_a_second(): void { static::assertSame([null, null, '1.0M/s'], [ - (new StageLine(StageProgressMother::done(count: 400, endedAtSeconds: 0.4), PulseMother::pulse()))->rate(), - (new StageLine( - StageProgressMother::open(count: 400), - PulseMother::pulse(elapsedSeconds: 0.49), - ))->perSecond(), - (new StageLine( - StageProgressMother::done(count: 500_000, endedAtSeconds: 0.5), - PulseMother::pulse(), - ))->rate(), + new StageLine(StageProgressMother::done(count: 400, endedAtSeconds: 0.4), PulseMother::pulse())->rate(), + new StageLine(StageProgressMother::open(count: 400), PulseMother::pulse(elapsedSeconds: 0.49))->perSecond(), + new StageLine(StageProgressMother::done(count: 500_000, endedAtSeconds: 0.5), PulseMother::pulse())->rate(), ]); } @@ -156,8 +149,8 @@ public function test_duration_runs_to_the_end_or_to_now(): void $pulse = PulseMother::pulse(elapsedSeconds: 9.2); static::assertSame(['6.6s', '8.0s'], [ - (new StageLine(StageProgressMother::done(startedAtSeconds: 0.2, endedAtSeconds: 6.8), $pulse))->duration(), - (new StageLine(StageProgressMother::open(startedAtSeconds: 1.2), $pulse))->duration(), + new StageLine(StageProgressMother::done(startedAtSeconds: 0.2, endedAtSeconds: 6.8), $pulse)->duration(), + new StageLine(StageProgressMother::open(startedAtSeconds: 1.2), $pulse)->duration(), ]); } @@ -214,14 +207,14 @@ public function test_files_sum_every_commit_entry(): void public function test_an_ended_entry_or_a_zero_total_shows_no_percentage(): void { static::assertSame([null, null], [ - (new StageLine( + new StageLine( StageProgressMother::done(StageName::read, 30_000_000, total: 30_000_000), PulseMother::pulse(elapsedSeconds: 7.0), - ))->percent(), - (new StageLine( + )->percent(), + new StageLine( StageProgressMother::open(StageName::read, 0, 0), PulseMother::pulse(elapsedSeconds: 2.0), - ))->percent(), + )->percent(), ]); } } diff --git a/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/StatusLineHeartbeatTest.php b/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/StatusLineHeartbeatTest.php index dcc0c24794..37d01794ef 100644 --- a/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/StatusLineHeartbeatTest.php +++ b/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/StatusLineHeartbeatTest.php @@ -64,7 +64,7 @@ public function test_the_first_candidate_that_fits_is_drawn(int $columns, string $this->terminal->columns($columns); $output = $this->terminal->stream(); - (new StatusLineHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 6.0, stages: $this->stages)); + new StatusLineHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 6.0, stages: $this->stages)); static::assertSame($line, str_replace("\r", '', $this->terminal->text($output))); } @@ -127,7 +127,7 @@ public function test_a_planned_entry_is_left_out_and_a_skipped_one_is_finished_w { $output = $this->terminal->stream(); - (new StatusLineHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 6.0, stages: [ + new StatusLineHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 6.0, stages: [ StageProgressMother::skipped(StageName::sort, 5.0, id: 1), StageProgressMother::open(StageName::read, 10, id: 2), StageProgressMother::planned(StageName::commit, id: 3), @@ -151,7 +151,7 @@ public function test_built_directly_it_draws_on_the_output_it_was_given(): void { $console = $this->terminal->console(); - (new StatusLineHeartbeat($console))->beat(PulseMother::pulse()); + new StatusLineHeartbeat($console)->beat(PulseMother::pulse()); static::assertSame([true, ''], [ str_contains($this->terminal->text($console), ' sort 1.3M rows'), @@ -174,7 +174,7 @@ public function test_memory_shows_at_verbose(): void { $output = $this->terminal->stream(OutputInterface::VERBOSITY_VERBOSE); - (new StatusLineHeartbeat($output))->beat(PulseMother::pulse()); + new StatusLineHeartbeat($output)->beat(PulseMother::pulse()); static::assertStringEndsWith(' sort 1.3M rows 15.1K/s 142 MiB · 1m 23s', $this->terminal->text($output)); } @@ -210,7 +210,7 @@ public function test_a_subject_with_console_tags_prints_them_literally(): void { $output = $this->terminal->stream(); - (new StatusLineHeartbeat($output))->beat(PulseMother::pulse(stages: [ + new StatusLineHeartbeat($output)->beat(PulseMother::pulse(stages: [ StageProgressMother::open(count: 1_250_000, subject: 'x'), ])); @@ -236,7 +236,7 @@ public function test_finish_without_a_beat_does_nothing(): void $output = $this->terminal->stream(); $output->write('command line'); - (new StatusLineHeartbeat($output))->finish(); + new StatusLineHeartbeat($output)->finish(); static::assertSame('command line', $this->terminal->raw($output)); } @@ -259,7 +259,7 @@ public function test_a_line_is_at_most_100_columns_on_a_wider_terminal(): void $this->terminal->columns(150); $output = $this->terminal->stream(); - (new StatusLineHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ + new StatusLineHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ StageProgressMother::open(StageName::sort, 15_301_437, subject: 'memory://in/orders.floe'), StageProgressMother::open(StageName::join, 11, id: 2), StageProgressMother::open(StageName::group_by, 3, id: 3), @@ -275,9 +275,9 @@ public function test_a_terminal_of_a_few_columns_still_gets_one_character(): voi $this->terminal->columns(2); $output = $this->terminal->stream(); - (new StatusLineHeartbeat( + new StatusLineHeartbeat( $output, - ))->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [StageProgressMother::open( + )->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [StageProgressMother::open( StageName::sort, 15_301_437, )])); @@ -289,7 +289,7 @@ public function test_a_pulse_with_no_stage_shows_the_time_only(): void { $output = $this->terminal->stream(); - (new StatusLineHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 83.0, stages: [])); + new StatusLineHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 83.0, stages: [])); static::assertSame("\r ⠋ 1m 23s", $this->terminal->text($output)); } diff --git a/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/TaskListHeartbeatTest.php b/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/TaskListHeartbeatTest.php index 322f75dbbf..860ba467f9 100644 --- a/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/TaskListHeartbeatTest.php +++ b/src/bridge/symfony/console/tests/Flow/Bridge/Symfony/Console/Tests/Unit/TaskListHeartbeatTest.php @@ -53,7 +53,7 @@ public function test_open_entries_at_100_columns(): void { $output = $this->terminal->stream(); - (new TaskListHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ + new TaskListHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ StageProgressMother::open(StageName::read, 15_301_437, 30_000_000, subject: 'memory://in/orders.csv'), StageProgressMother::open(StageName::sort, 11_300_000, id: 2, startedAtSeconds: 0.2), ])); @@ -75,7 +75,7 @@ public function test_a_narrow_line_drops_the_rate_shortens_the_count_then_cuts_a $this->terminal->columns($columns); $output = $this->terminal->stream(); - (new TaskListHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ + new TaskListHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ StageProgressMother::open(StageName::read, 15_301_437, 30_000_000, subject: 'memory://in/orders.csv'), ])); @@ -214,7 +214,7 @@ public function test_memory_shows_at_verbose(): void { $output = $this->terminal->stream(OutputInterface::VERBOSITY_VERBOSE); - (new TaskListHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ + new TaskListHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ StageProgressMother::open(StageName::sort, 11_300_000), ])); @@ -379,7 +379,7 @@ public function test_an_entry_without_a_location_has_no_location_column(): void { $output = $this->terminal->stream(); - (new TaskListHeartbeat($output))->beat(PulseMother::pulse(stages: [StageProgressMother::done( + new TaskListHeartbeat($output)->beat(PulseMother::pulse(stages: [StageProgressMother::done( StageName::group_by, 40, 6.6, @@ -574,7 +574,7 @@ public function test_the_graph_style_draws_a_sparkline_from_90_columns(int $colu $this->terminal->columns($columns); $output = $this->terminal->stream(); - (new ConsoleHeartbeatFactory()) + new ConsoleHeartbeatFactory() ->create($output, ConsoleStyle::graph) ->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [StageProgressMother::open(count: 11_300_000)])); @@ -584,7 +584,7 @@ public function test_the_graph_style_draws_a_sparkline_from_90_columns(int $colu public function test_the_dot_leader_of_a_short_sparkline_runs_up_to_its_first_bar(): void { $output = $this->terminal->stream(); - $heartbeat = (new ConsoleHeartbeatFactory())->create($output, ConsoleStyle::graph); + $heartbeat = new ConsoleHeartbeatFactory()->create($output, ConsoleStyle::graph); $heartbeat->beat(PulseMother::pulse(elapsedSeconds: 1.0, stages: [StageProgressMother::open(count: 10)])); $heartbeat->beat(PulseMother::pulse(beat: 2, elapsedSeconds: 2.0, stages: [ @@ -680,7 +680,7 @@ public function test_a_line_is_at_most_100_columns_on_a_wider_terminal(): void $this->terminal->columns(150); $output = $this->terminal->stream(); - (new TaskListHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ + new TaskListHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ StageProgressMother::open( StageName::sort, 15_301_437, @@ -697,7 +697,7 @@ public function test_a_subject_that_fits_is_not_cut(): void $this->terminal->columns(96); $output = $this->terminal->stream(); - (new TaskListHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ + new TaskListHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ StageProgressMother::done( StageName::read, 1_000_000, @@ -716,7 +716,7 @@ public function test_a_long_subject_is_cut_to_the_room_of_the_line(): void $this->terminal->columns(96); $output = $this->terminal->stream(); - (new TaskListHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ + new TaskListHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ StageProgressMother::done( StageName::read, 1_000_000, @@ -735,9 +735,7 @@ public function test_memory_drops_before_the_rate(): void $this->terminal->columns(56); $output = $this->terminal->stream(OutputInterface::VERBOSITY_VERBOSE); - (new TaskListHeartbeat( - $output, - ))->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [StageProgressMother::open( + new TaskListHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [StageProgressMother::open( StageName::sort, 15_301_437, )])); @@ -750,7 +748,7 @@ public function test_a_terminal_too_narrow_for_any_dots_gets_the_label_the_count $this->terminal->columns(30); $output = $this->terminal->stream(); - (new TaskListHeartbeat($output))->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ + new TaskListHeartbeat($output)->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [ StageProgressMother::open( StageName::sort, 15_301_437, @@ -766,9 +764,9 @@ public function test_built_directly_it_draws_on_the_output_it_was_given(): void { $console = $this->terminal->console(); - (new TaskListHeartbeat( + new TaskListHeartbeat( $console, - ))->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [StageProgressMother::open()])); + )->beat(PulseMother::pulse(elapsedSeconds: 2.0, stages: [StageProgressMother::open()])); static::assertSame([true, ''], [ str_contains($this->terminal->text($console), ' sort '), diff --git a/src/bridge/symfony/filesystem-bundle/composer.json b/src/bridge/symfony/filesystem-bundle/composer.json index 3733381aab..aa6b6687a7 100644 --- a/src/bridge/symfony/filesystem-bundle/composer.json +++ b/src/bridge/symfony/filesystem-bundle/composer.json @@ -11,19 +11,19 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/filesystem": "self.version", "flow-php/types": "self.version", - "symfony/config": "^6.4 || ^7.4 || ^8.0", - "symfony/dependency-injection": "^6.4 || ^7.4 || ^8.0", - "symfony/http-kernel": "^6.4 || ^7.4 || ^8.0" + "symfony/config": "^7.4 || ^8.0", + "symfony/dependency-injection": "^7.4 || ^8.0", + "symfony/http-kernel": "^7.4 || ^8.0" }, "require-dev": { "flow-php/filesystem-async-aws-bridge": "self.version", "flow-php/filesystem-azure-bridge": "self.version", "flow-php/symfony-filesystem-cache-bridge": "self.version", - "symfony/cache": "^6.4 || ^7.4 || ^8.0", - "symfony/framework-bundle": "^6.4 || ^7.4 || ^8.0" + "symfony/cache": "^7.4 || ^8.0", + "symfony/framework-bundle": "^7.4 || ^8.0" }, "suggest": { "flow-php/filesystem-async-aws-bridge": "Required for the `aws_s3` filesystem type.", diff --git a/src/bridge/symfony/filesystem-bundle/src/Flow/Bridge/Symfony/FilesystemBundle/DependencyInjection/Compiler/BuildFstabsPass.php b/src/bridge/symfony/filesystem-bundle/src/Flow/Bridge/Symfony/FilesystemBundle/DependencyInjection/Compiler/BuildFstabsPass.php index fee0a6e1a1..dabc188332 100644 --- a/src/bridge/symfony/filesystem-bundle/src/Flow/Bridge/Symfony/FilesystemBundle/DependencyInjection/Compiler/BuildFstabsPass.php +++ b/src/bridge/symfony/filesystem-bundle/src/Flow/Bridge/Symfony/FilesystemBundle/DependencyInjection/Compiler/BuildFstabsPass.php @@ -107,7 +107,7 @@ public function process(ContainerBuilder $container): void $mountServiceId = self::MOUNT_SERVICE_PREFIX . $fstabNameStr . '.' . $mountName; $container->setDefinition( $mountServiceId, - (new Definition(Filesystem::class)) + new Definition(Filesystem::class) ->setFactory([new Reference(RegisterFilesystemFactoriesPass::REGISTRY_SERVICE_ID), 'create']) ->setArguments([$fstabNameStr, $mountName, $resolvedEntry]) ->setPublic(false), diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Context/SymfonyContext.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Context/SymfonyContext.php index 265cc8fd12..2ecc65e833 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Context/SymfonyContext.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Context/SymfonyContext.php @@ -68,7 +68,7 @@ public function bootTracedMemoryFstab(callable $configurator): TestKernel ): void { $container->setDefinition( 'app.telemetry', - (new Definition(Telemetry::class))->setFactory([TelemetryStubFactory::class, 'create']), + new Definition(Telemetry::class)->setFactory([TelemetryStubFactory::class, 'create']), ); $container->setDefinition('app.clock', new Definition(SystemClock::class)); $configurator($container); diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Fixtures/TestKernel.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Fixtures/TestKernel.php index f17728c3f7..f3a8e966c7 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Fixtures/TestKernel.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Fixtures/TestKernel.php @@ -9,7 +9,7 @@ use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; +use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel\Kernel; use function array_merge; @@ -20,7 +20,7 @@ final class TestKernel extends Kernel { - /** @var array> */ + /** @var array> */ private array $testBundles = []; /** @var array */ @@ -42,7 +42,7 @@ public function __construct(string $environment = 'test', bool $debug = true) } /** - * @param class-string $bundleClass + * @param class-string $bundleClass */ public function addTestBundle(string $bundleClass): void { diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Integration/CachePoolRegistrationTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Integration/CachePoolRegistrationTest.php index cb90d5d1cd..b6a2d7aed0 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Integration/CachePoolRegistrationTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Integration/CachePoolRegistrationTest.php @@ -62,7 +62,7 @@ public function test_cache_pool_with_marshaller_service_id_injects_marshaller(): $kernel->addTestContainerConfigurator(static function (ContainerBuilder $container): void { $container->setDefinition( 'test.marshaller', - (new Definition(DefaultMarshaller::class))->setPublic(true), + new Definition(DefaultMarshaller::class)->setPublic(true), ); }); }, @@ -74,7 +74,7 @@ public function test_cache_pool_with_marshaller_service_id_injects_marshaller(): static::assertSame( $container->get('test.marshaller'), - (new ReflectionObject($adapter)) + new ReflectionObject($adapter) ->getProperty('marshaller') ->getValue($adapter), ); diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Attribute/AsFilesystemFactoryTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Attribute/AsFilesystemFactoryTest.php index 6e7ee703f6..a0fbcfae1b 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Attribute/AsFilesystemFactoryTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Attribute/AsFilesystemFactoryTest.php @@ -22,6 +22,6 @@ public function test_attribute_targets_class_only(): void public function test_exposes_type_as_public_readonly(): void { - static::assertSame('file', (new AsFilesystemFactory(type: 'file'))->type); + static::assertSame('file', new AsFilesystemFactory(type: 'file')->type); } } diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Attribute/AsFilesystemTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Attribute/AsFilesystemTest.php index 2fa3737447..99355d7f42 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Attribute/AsFilesystemTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Attribute/AsFilesystemTest.php @@ -22,7 +22,7 @@ public function test_attribute_targets_parameter_only(): void public function test_defaults_fstab_to_null(): void { - static::assertNull((new AsFilesystem(mount: 'memory'))->fstab); + static::assertNull(new AsFilesystem(mount: 'memory')->fstab); } public function test_exposes_mount_and_fstab_as_public_readonly(): void diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/ConfigurationTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/ConfigurationTest.php index 677598e7a5..14cfec411a 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/ConfigurationTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/ConfigurationTest.php @@ -430,7 +430,7 @@ public function test_valid_hyphenated_mount_names_are_preserved_without_normaliz ], static function (ContainerBuilder $container): void { $container->setDefinition( 'x', - (new Definition(S3Client::class))->setArguments([[ + new Definition(S3Client::class)->setArguments([[ 'accessKeyId' => 'k', 'accessKeySecret' => 's', 'region' => 'us-east-1', @@ -438,7 +438,7 @@ public function test_valid_hyphenated_mount_names_are_preserved_without_normaliz ); $container->setDefinition( 'y', - (new Definition(BlobServiceInterface::class)) + new Definition(BlobServiceInterface::class) ->setSynthetic(true) ->setPublic(false), ); @@ -540,11 +540,9 @@ public function test_valid_telemetry_fully_configured(): void ], static function (ContainerBuilder $container): void { $container->setDefinition( 'app.telemetry', - (new Definition(Telemetry::class))->setFactory([TelemetryStubFactory::class, 'create'])->setPublic( - true, - ), + new Definition(Telemetry::class)->setFactory([TelemetryStubFactory::class, 'create'])->setPublic(true), ); - $container->setDefinition('app.clock', (new Definition(SystemClock::class))->setPublic(true)); + $container->setDefinition('app.clock', new Definition(SystemClock::class)->setPublic(true)); }); $fstabs = is_array($config['fstabs'] ?? null) ? $config['fstabs'] : []; diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/BuildFstabsPassTelemetryTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/BuildFstabsPassTelemetryTest.php index ed741b6c7f..cca8750f09 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/BuildFstabsPassTelemetryTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/BuildFstabsPassTelemetryTest.php @@ -41,7 +41,7 @@ public function test_creates_telemetry_config_definition_when_enabled(): void ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); static::assertTrue($container->hasDefinition('.flow.filesystem.telemetry_config.default')); $configDefinition = $container->getDefinition('.flow.filesystem.telemetry_config.default'); @@ -76,7 +76,7 @@ public function test_adds_no_with_telemetry_call_when_disabled(): void ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); static::assertSame([], $container->getDefinition('.flow.filesystem.fstab.default')->getMethodCalls()); } @@ -101,7 +101,7 @@ public function test_throws_when_telemetry_enabled_without_clock_service_id(): v $this->expectException(LogicException::class); $this->expectExceptionMessage('clock_service_id'); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); } public function test_throws_when_telemetry_enabled_without_telemetry_service_id(): void @@ -124,6 +124,6 @@ public function test_throws_when_telemetry_enabled_without_telemetry_service_id( $this->expectException(LogicException::class); $this->expectExceptionMessage('telemetry_service_id'); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); } } diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/BuildFstabsPassTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/BuildFstabsPassTest.php index ab3d254dfe..84fd68f289 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/BuildFstabsPassTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/BuildFstabsPassTest.php @@ -37,7 +37,7 @@ public function test_camel_cases_snake_case_fstab_names_in_alias(): void ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); static::assertTrue($container->hasAlias(FilesystemTable::class . ' $myWarehouseFstab')); } @@ -55,7 +55,7 @@ public function test_does_not_register_fqcn_alias_when_default_fstab_null(): voi ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); static::assertFalse($container->hasAlias(FilesystemTable::class)); } @@ -64,7 +64,7 @@ public function test_does_nothing_when_config_parameter_missing(): void { $container = new ContainerBuilder(); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); static::assertFalse($container->hasDefinition('.flow.filesystem.fstab.default')); } @@ -83,7 +83,7 @@ public function test_fstab_service_is_built_from_its_mount_services(): void ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); $definition = $container->getDefinition('.flow.filesystem.fstab.default'); @@ -110,7 +110,7 @@ public function test_registers_private_mount_service_for_each_mount(): void ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); $definition = $container->getDefinition('flow.filesystem.mount.default.memory'); @@ -138,7 +138,7 @@ public function test_registers_fqcn_alias_pointing_to_default_fstab(): void ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); static::assertTrue($container->hasAlias(FilesystemTable::class)); $alias = $container->getAlias(FilesystemTable::class); @@ -159,7 +159,7 @@ public function test_registers_named_argument_alias_for_each_fstab(): void ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); $aliasId = FilesystemTable::class . ' $defaultFstab'; static::assertTrue($container->hasAlias($aliasId)); @@ -186,7 +186,7 @@ public function test_registers_private_fstab_service_for_each_configured_fstab() ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); $defaultDef = $container->getDefinition('.flow.filesystem.fstab.default'); static::assertSame(FilesystemTable::class, $defaultDef->getClass()); @@ -212,7 +212,7 @@ public function test_throws_on_unknown_default_fstab(): void $this->expectException(LogicException::class); $this->expectExceptionMessage('flow_filesystem: default_fstab "nope"'); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); } public function test_throws_on_unknown_type_at_compile_time(): void @@ -233,7 +233,7 @@ public function test_throws_on_unknown_type_at_compile_time(): void 'Fstab "default" mount "ftp": no filesystem factory registered for type "aws_s3"', ); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); } public function test_registers_per_mount_filesystem_service_resolving_through_fstab(): void @@ -249,7 +249,7 @@ public function test_registers_per_mount_filesystem_service_resolving_through_fs ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); $definition = $container->getDefinition('.flow.filesystem.fs.default.memory'); @@ -272,7 +272,7 @@ public function test_registers_bare_and_prefixed_mount_aliases_for_default_fstab ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); static::assertSame( '.flow.filesystem.fs.default.memory', @@ -302,7 +302,7 @@ public function test_registers_only_prefixed_mount_alias_for_non_default_fstab() ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); static::assertTrue($container->hasAlias(Filesystem::class . ' $secondaryFile')); static::assertFalse($container->hasAlias(Filesystem::class . ' $file')); @@ -321,7 +321,7 @@ public function test_camel_cases_separator_protocols_in_mount_aliases(): void ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); static::assertTrue($container->hasDefinition('.flow.filesystem.fs.default.aws-s3')); static::assertTrue($container->hasAlias(Filesystem::class . ' $awsS3')); @@ -353,7 +353,7 @@ public function test_resolves_aws_s3_client_service_ids_to_references(): void AsyncAwsS3FilesystemFactory::class, )->addTag('flow.filesystem.factory', ['type' => 'aws_s3']); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); static::assertEquals( [ @@ -400,7 +400,7 @@ public function test_resolves_azure_blob_client_service_ids_to_references(): voi AzureBlobFilesystemFactory::class, )->addTag('flow.filesystem.factory', ['type' => 'azure_blob']); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); static::assertEquals( [ @@ -427,7 +427,7 @@ public function test_skips_a_config_parameter_that_is_not_an_array(): void $container = new ContainerBuilder(); $container->setParameter(BuildFstabsPass::CONFIG_PARAMETER, 'not an array'); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); static::assertFalse($container->hasAlias(FilesystemTable::class)); } @@ -447,7 +447,7 @@ public function test_skips_fstabs_and_mounts_that_are_not_arrays(): void ], ]); - (new BuildFstabsPass())->process($container); + new BuildFstabsPass()->process($container); static::assertTrue($container->hasDefinition('flow.filesystem.mount.default.memory')); static::assertFalse($container->hasDefinition('flow.filesystem.mount.default.broken')); diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/RegisterFilesystemFactoriesPassTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/RegisterFilesystemFactoriesPassTest.php index 5d2f40ba11..23356a2411 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/RegisterFilesystemFactoriesPassTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/RegisterFilesystemFactoriesPassTest.php @@ -23,7 +23,7 @@ public function test_does_nothing_when_registry_definition_absent(): void { $container = new ContainerBuilder(); - (new RegisterFilesystemFactoriesPass())->process($container); + new RegisterFilesystemFactoriesPass()->process($container); static::assertFalse($container->hasDefinition('.flow.filesystem.factory_registry')); } @@ -31,9 +31,9 @@ public function test_does_nothing_when_registry_definition_absent(): void public function test_injects_tagged_factories_as_references(): void { $container = new ContainerBuilder(); - $container->setDefinition('.flow.filesystem.factory_registry', (new Definition( + $container->setDefinition('.flow.filesystem.factory_registry', new Definition( FilesystemFactoryRegistry::class, - ))->setArgument(0, [])); + )->setArgument(0, [])); $memory = new Definition(MemoryFilesystemFactory::class); $memory->addTag('flow.filesystem.factory', ['type' => 'memory']); @@ -43,7 +43,7 @@ public function test_injects_tagged_factories_as_references(): void $native->addTag('flow.filesystem.factory', ['type' => 'file']); $container->setDefinition('.flow.filesystem.factory.file', $native); - (new RegisterFilesystemFactoriesPass())->process($container); + new RegisterFilesystemFactoriesPass()->process($container); // @mago-expect analysis:mixed-assignment $argument = $container->getDefinition('.flow.filesystem.factory_registry')->getArgument(0); @@ -59,11 +59,11 @@ public function test_injects_tagged_factories_as_references(): void public function test_leaves_registry_empty_when_no_tagged_services(): void { $container = new ContainerBuilder(); - $container->setDefinition('.flow.filesystem.factory_registry', (new Definition( + $container->setDefinition('.flow.filesystem.factory_registry', new Definition( FilesystemFactoryRegistry::class, - ))->setArgument(0, [])); + )->setArgument(0, [])); - (new RegisterFilesystemFactoriesPass())->process($container); + new RegisterFilesystemFactoriesPass()->process($container); static::assertSame([], $container->getDefinition('.flow.filesystem.factory_registry')->getArgument(0)); } @@ -71,9 +71,9 @@ public function test_leaves_registry_empty_when_no_tagged_services(): void public function test_throws_on_duplicate_type_across_services(): void { $container = new ContainerBuilder(); - $container->setDefinition('.flow.filesystem.factory_registry', (new Definition( + $container->setDefinition('.flow.filesystem.factory_registry', new Definition( FilesystemFactoryRegistry::class, - ))->setArgument(0, [])); + )->setArgument(0, [])); $a = new Definition(MemoryFilesystemFactory::class); $a->addTag('flow.filesystem.factory', ['type' => 'memory']); @@ -86,15 +86,15 @@ public function test_throws_on_duplicate_type_across_services(): void $this->expectException(LogicException::class); $this->expectExceptionMessage('Duplicate filesystem factory for type "memory"'); - (new RegisterFilesystemFactoriesPass())->process($container); + new RegisterFilesystemFactoriesPass()->process($container); } public function test_throws_on_tag_without_type_attribute(): void { $container = new ContainerBuilder(); - $container->setDefinition('.flow.filesystem.factory_registry', (new Definition( + $container->setDefinition('.flow.filesystem.factory_registry', new Definition( FilesystemFactoryRegistry::class, - ))->setArgument(0, [])); + )->setArgument(0, [])); $memory = new Definition(MemoryFilesystemFactory::class); $memory->addTag('flow.filesystem.factory'); @@ -103,6 +103,6 @@ public function test_throws_on_tag_without_type_attribute(): void $this->expectException(LogicException::class); $this->expectExceptionMessage('missing a non-empty "type" attribute'); - (new RegisterFilesystemFactoriesPass())->process($container); + new RegisterFilesystemFactoriesPass()->process($container); } } diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/RegisterFstabLocatorPassTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/RegisterFstabLocatorPassTest.php index 7bea2db715..ef58d4bdd3 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/RegisterFstabLocatorPassTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/RegisterFstabLocatorPassTest.php @@ -23,7 +23,7 @@ public function test_default_fstab_parameter_is_empty_string_when_null(): void 'fstabs' => ['primary' => ['filesystems' => ['memory' => []]]], ]); - (new RegisterFstabLocatorPass())->process($container); + new RegisterFstabLocatorPass()->process($container); static::assertSame('', $container->getParameter(RegisterFstabLocatorPass::DEFAULT_FSTAB_PARAMETER)); } @@ -32,7 +32,7 @@ public function test_does_nothing_when_config_parameter_missing(): void { $container = new ContainerBuilder(); - (new RegisterFstabLocatorPass())->process($container); + new RegisterFstabLocatorPass()->process($container); static::assertFalse($container->hasDefinition(RegisterFstabLocatorPass::LOCATOR_SERVICE_ID)); static::assertFalse($container->hasParameter(RegisterFstabLocatorPass::DEFAULT_FSTAB_PARAMETER)); @@ -46,7 +46,7 @@ public function test_exposes_default_fstab_parameter(): void 'fstabs' => ['primary' => ['filesystems' => ['memory' => []]]], ]); - (new RegisterFstabLocatorPass())->process($container); + new RegisterFstabLocatorPass()->process($container); static::assertSame('primary', $container->getParameter(RegisterFstabLocatorPass::DEFAULT_FSTAB_PARAMETER)); } @@ -62,7 +62,7 @@ public function test_registers_locator_with_reference_per_fstab(): void ], ]); - (new RegisterFstabLocatorPass())->process($container); + new RegisterFstabLocatorPass()->process($container); $definition = $container->getDefinition(RegisterFstabLocatorPass::LOCATOR_SERVICE_ID); static::assertSame(ServiceLocator::class, $definition->getClass()); diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/ResolveFilesystemArgumentsPassTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/ResolveFilesystemArgumentsPassTest.php index 3485769a31..7e89dde922 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/ResolveFilesystemArgumentsPassTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/DependencyInjection/Compiler/ResolveFilesystemArgumentsPassTest.php @@ -34,7 +34,7 @@ public function test_binds_argument_to_default_fstab_mount_when_fstab_omitted(): 'fstab' => '', ]); - (new ResolveFilesystemArgumentsPass())->process($container); + new ResolveFilesystemArgumentsPass()->process($container); static::assertEquals( new Reference('.flow.filesystem.fs.primary.memory'), @@ -57,7 +57,7 @@ public function test_binds_argument_to_explicit_fstab_mount(): void 'fstab' => 'archive', ]); - (new ResolveFilesystemArgumentsPass())->process($container); + new ResolveFilesystemArgumentsPass()->process($container); static::assertEquals( new Reference('.flow.filesystem.fs.archive.file'), @@ -69,7 +69,7 @@ public function test_does_nothing_when_config_parameter_missing(): void { $container = new ContainerBuilder(); - (new ResolveFilesystemArgumentsPass())->process($container); + new ResolveFilesystemArgumentsPass()->process($container); static::assertFalse($container->hasDefinition('app.consumer')); } @@ -91,7 +91,7 @@ public function test_throws_when_no_default_fstab_and_fstab_omitted(): void $this->expectException(LogicException::class); $this->expectExceptionMessage('Service "app.consumer" uses #[AsFilesystem(\'memory\')] without an fstab'); - (new ResolveFilesystemArgumentsPass())->process($container); + new ResolveFilesystemArgumentsPass()->process($container); } public function test_throws_on_unknown_fstab(): void @@ -111,7 +111,7 @@ public function test_throws_on_unknown_fstab(): void $this->expectException(LogicException::class); $this->expectExceptionMessage('references fstab "nope" which is not configured. Available fstabs: [primary]'); - (new ResolveFilesystemArgumentsPass())->process($container); + new ResolveFilesystemArgumentsPass()->process($container); } public function test_throws_on_unknown_mount(): void @@ -133,6 +133,6 @@ public function test_throws_on_unknown_mount(): void 'references mount "warehouse" which is not mounted in fstab "primary". Available mounts: [memory]', ); - (new ResolveFilesystemArgumentsPass())->process($container); + new ResolveFilesystemArgumentsPass()->process($container); } } diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/AsyncAwsS3FilesystemFactoryTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/AsyncAwsS3FilesystemFactoryTest.php index 2db9093707..1e155365fb 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/AsyncAwsS3FilesystemFactoryTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/AsyncAwsS3FilesystemFactoryTest.php @@ -18,7 +18,7 @@ final class AsyncAwsS3FilesystemFactoryTest extends TestCase { public function test_applies_block_size_option(): void { - $filesystem = (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + $filesystem = new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1', 'access_key_id' => 'k', 'access_key_secret' => 's'], 'options' => ['block_size' => 6 * 1024 * 1024], @@ -29,7 +29,7 @@ public function test_applies_block_size_option(): void public function test_mode_a_builds_filesystem_from_resolved_client(): void { - $filesystem = (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + $filesystem = new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'my-bucket', 'client' => new S3Client(['accessKeyId' => 'k', 'accessKeySecret' => 's', 'region' => 'us-east-1']), ]); @@ -40,7 +40,7 @@ public function test_mode_a_builds_filesystem_from_resolved_client(): void public function test_mode_b_accepts_resolved_http_client_and_logger(): void { - $filesystem = (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + $filesystem = new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => [ 'region' => 'us-east-1', @@ -56,7 +56,7 @@ public function test_mode_b_accepts_resolved_http_client_and_logger(): void public function test_mode_b_builds_client_from_inline_config(): void { - $filesystem = (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + $filesystem = new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'my-bucket', 'client' => [ 'region' => 'eu-west-1', @@ -70,7 +70,7 @@ public function test_mode_b_builds_client_from_inline_config(): void public function test_mount_protocol_is_propagated_to_filesystem(): void { - $filesystem = (new AsyncAwsS3FilesystemFactory())->create('warehouse', [ + $filesystem = new AsyncAwsS3FilesystemFactory()->create('warehouse', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1', 'access_key_id' => 'k', 'access_key_secret' => 's'], ]); @@ -83,7 +83,7 @@ public function test_throws_on_invalid_block_size_type(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`options.block_size` must be an integer'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1'], 'options' => ['block_size' => 'not-an-int'], @@ -95,7 +95,7 @@ public function test_throws_on_missing_bucket(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('non-empty `bucket`'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', ['client' => []]); + new AsyncAwsS3FilesystemFactory()->create('aws-s3', ['client' => []]); } public function test_throws_on_unknown_client_keys(): void @@ -103,7 +103,7 @@ public function test_throws_on_unknown_client_keys(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`client` contains unknown keys: [nope]'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => ['nope' => 'x'], ]); @@ -114,7 +114,7 @@ public function test_throws_on_unknown_options_keys(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`options` contains unknown keys: [nope]'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1'], 'options' => ['nope' => 1], @@ -126,7 +126,7 @@ public function test_throws_on_unknown_top_level_keys(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('received unknown keys: [container]'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1'], 'container' => 'nope', @@ -138,7 +138,7 @@ public function test_throws_when_client_is_invalid_type(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`client` must be an array or AsyncAws\\S3\\S3Client instance'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => new stdClass(), ]); @@ -149,7 +149,7 @@ public function test_throws_when_http_client_is_wrong_type(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`client.http_client_service_id` must reference a service implementing'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => [ 'region' => 'us-east-1', @@ -163,7 +163,7 @@ public function test_throws_when_logger_is_wrong_type(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`client.logger_service_id` must reference a service implementing'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => [ 'region' => 'us-east-1', @@ -177,7 +177,7 @@ public function test_throws_when_no_client_supplied(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('exactly one of'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', ['bucket' => 'b']); + new AsyncAwsS3FilesystemFactory()->create('aws-s3', ['bucket' => 'b']); } public function test_throws_when_options_is_not_array(): void @@ -185,7 +185,7 @@ public function test_throws_when_options_is_not_array(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`options` must be an array'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1'], 'options' => 'not-an-array', @@ -194,12 +194,12 @@ public function test_throws_when_options_is_not_array(): void public function test_type_returns_aws_s3(): void { - static::assertSame('aws_s3', (new AsyncAwsS3FilesystemFactory())->type()); + static::assertSame('aws_s3', new AsyncAwsS3FilesystemFactory()->type()); } public function test_an_inline_client_configuration_builds_a_describable_filesystem(): void { - $filesystem = (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + $filesystem = new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1', 'access_key_id' => 'k', 'access_key_secret' => 's'], ]); @@ -216,7 +216,7 @@ public function test_an_inline_client_configuration_builds_a_describable_filesys public function test_an_injected_client_builds_a_filesystem_without_configuration(): void { static::assertNull( - (new AsyncAwsS3FilesystemFactory()) + new AsyncAwsS3FilesystemFactory() ->create('aws-s3', [ 'bucket' => 'b', 'client' => new S3Client(['region' => 'us-east-1', 'accessKeyId' => 'k', 'accessKeySecret' => 's']), @@ -228,7 +228,7 @@ public function test_an_injected_client_builds_a_filesystem_without_configuratio public function test_an_injected_http_client_builds_a_filesystem_without_configuration(): void { static::assertNull( - (new AsyncAwsS3FilesystemFactory()) + new AsyncAwsS3FilesystemFactory() ->create('aws-s3', [ 'bucket' => 'b', 'client' => [ @@ -244,7 +244,7 @@ public function test_an_injected_http_client_builds_a_filesystem_without_configu public function test_client_http_keeps_the_filesystem_describable(): void { - $configuration = (new AsyncAwsS3FilesystemFactory()) + $configuration = new AsyncAwsS3FilesystemFactory() ->create('aws-s3', [ 'bucket' => 'b', 'client' => [ @@ -268,7 +268,7 @@ public function test_client_http_with_an_injected_http_client_is_rejected(): voi 'Filesystem factory for backend "aws_s3": client.http cannot be used together with client.http_client_service_id or client.logger_service_id, because the limits apply only to the client the bundle builds.', ); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1', 'http' => ['timeout' => 1], 'http_client' => HttpClient::create()], ]); @@ -281,7 +281,7 @@ public function test_client_http_with_an_injected_logger_is_rejected(): void 'Filesystem factory for backend "aws_s3": client.http cannot be used together with client.http_client_service_id or client.logger_service_id, because the limits apply only to the client the bundle builds.', ); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1', 'http' => ['timeout' => 1], 'logger' => new NullLogger()], ]); @@ -292,7 +292,7 @@ public function test_client_http_must_be_an_array(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Filesystem factory for backend "aws_s3" `client.http` must be an array.'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1', 'http' => 30], ]); @@ -300,7 +300,7 @@ public function test_client_http_must_be_an_array(): void public function test_options_bulk_delete(): void { - $configuration = (new AsyncAwsS3FilesystemFactory()) + $configuration = new AsyncAwsS3FilesystemFactory() ->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1'], @@ -317,7 +317,7 @@ public function test_options_bulk_delete_must_be_a_boolean(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`options.bulk_delete` must be a boolean.'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1'], 'options' => ['bulk_delete' => 'false'], @@ -326,7 +326,7 @@ public function test_options_bulk_delete_must_be_a_boolean(): void public function test_options_copy_part_size(): void { - $configuration = (new AsyncAwsS3FilesystemFactory()) + $configuration = new AsyncAwsS3FilesystemFactory() ->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1'], @@ -343,7 +343,7 @@ public function test_options_copy_part_size_above_5_gb_is_rejected(): void $this->expectException(FilesystemInvalidArgumentException::class); $this->expectExceptionMessage('Copy part size must be between 5 MiB and 5 GB, got 5000000001 bytes'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1'], 'options' => ['copy_part_size' => 5_000_000_001], @@ -355,7 +355,7 @@ public function test_options_copy_part_size_must_be_an_integer(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`options.copy_part_size` must be an integer.'); - (new AsyncAwsS3FilesystemFactory())->create('aws-s3', [ + new AsyncAwsS3FilesystemFactory()->create('aws-s3', [ 'bucket' => 'b', 'client' => ['region' => 'us-east-1'], 'options' => ['copy_part_size' => '5242880'], diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/AzureBlobFilesystemFactoryTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/AzureBlobFilesystemFactoryTest.php index 1ec0c31eb4..ed0b5aafa2 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/AzureBlobFilesystemFactoryTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/AzureBlobFilesystemFactoryTest.php @@ -22,7 +22,7 @@ final class AzureBlobFilesystemFactoryTest extends TestCase { public function test_applies_block_size_option(): void { - $filesystem = (new AzureBlobFilesystemFactory())->create('azure-blob', [ + $filesystem = new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a', 'auth' => ['shared_key' => base64_encode('k')]], 'options' => ['block_size' => 8 * 1024 * 1024, 'list_blob_max_results' => 100], @@ -33,7 +33,7 @@ public function test_applies_block_size_option(): void public function test_applies_copy_part_size_option(): void { - $filesystem = (new AzureBlobFilesystemFactory())->create('azure-blob', [ + $filesystem = new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a', 'auth' => ['shared_key' => base64_encode('k')]], 'options' => ['copy_part_size' => 5 * 1024 * 1024], @@ -45,7 +45,7 @@ public function test_applies_copy_part_size_option(): void public function test_applies_bulk_delete_option(): void { - $filesystem = (new AzureBlobFilesystemFactory())->create('azure-blob', [ + $filesystem = new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a', 'auth' => ['shared_key' => base64_encode('k')]], 'options' => ['bulk_delete' => false], @@ -59,7 +59,7 @@ public function test_throws_on_invalid_bulk_delete_type(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`options.bulk_delete` must be a boolean.'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a', 'auth' => ['shared_key' => 'k']], 'options' => ['bulk_delete' => 'false'], @@ -71,7 +71,7 @@ public function test_throws_on_invalid_copy_part_size_type(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`options.copy_part_size` must be an integer.'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a', 'auth' => ['shared_key' => 'k']], 'options' => ['copy_part_size' => 'nope'], @@ -80,7 +80,7 @@ public function test_throws_on_invalid_copy_part_size_type(): void public function test_mode_a_builds_filesystem_from_resolved_client(): void { - $filesystem = (new AzureBlobFilesystemFactory())->create('azure-blob', [ + $filesystem = new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'my-container', 'client' => self::createStub(BlobServiceInterface::class), ]); @@ -91,7 +91,7 @@ public function test_mode_a_builds_filesystem_from_resolved_client(): void public function test_mode_b_accepts_resolved_http_and_factories(): void { - $filesystem = (new AzureBlobFilesystemFactory())->create('azure-blob', [ + $filesystem = new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => [ 'account_name' => 'a', @@ -108,7 +108,7 @@ public function test_mode_b_accepts_resolved_http_and_factories(): void public function test_mode_b_builds_blob_service_from_inline_shared_key(): void { - $filesystem = (new AzureBlobFilesystemFactory())->create('azure-blob', [ + $filesystem = new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'my-container', 'client' => [ 'account_name' => 'myaccount', @@ -121,7 +121,7 @@ public function test_mode_b_builds_blob_service_from_inline_shared_key(): void public function test_mode_b_uses_azurite_url_factory_when_host_set(): void { - $filesystem = (new AzureBlobFilesystemFactory())->create('azure-blob', [ + $filesystem = new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'my-container', 'client' => [ 'account_name' => 'devstoreaccount1', @@ -138,7 +138,7 @@ public function test_throws_on_invalid_block_size_type(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('block_size'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a', 'auth' => ['shared_key' => 'k']], 'options' => ['block_size' => 'nope'], @@ -150,7 +150,7 @@ public function test_throws_on_invalid_list_blob_max_results_type(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('list_blob_max_results'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a', 'auth' => ['shared_key' => 'k']], 'options' => ['list_blob_max_results' => 'nope'], @@ -162,7 +162,7 @@ public function test_throws_on_missing_container(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('non-empty `container`'); - (new AzureBlobFilesystemFactory())->create('azure-blob', ['client' => []]); + new AzureBlobFilesystemFactory()->create('azure-blob', ['client' => []]); } public function test_throws_on_unknown_auth_keys(): void @@ -170,7 +170,7 @@ public function test_throws_on_unknown_auth_keys(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`client.auth` contains unknown keys: [sas_token]'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a', 'auth' => ['shared_key' => base64_encode('k'), 'sas_token' => 'x']], ]); @@ -181,7 +181,7 @@ public function test_throws_on_unknown_client_keys(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`client` contains unknown keys: [nope]'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a', 'auth' => ['shared_key' => base64_encode('k')], 'nope' => 1], ]); @@ -192,7 +192,7 @@ public function test_throws_on_unknown_options_keys(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`options` contains unknown keys: [nope]'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a', 'auth' => ['shared_key' => base64_encode('k')]], 'options' => ['nope' => 1], @@ -204,7 +204,7 @@ public function test_throws_on_unknown_top_level_keys(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('received unknown keys: [bucket]'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a', 'auth' => ['shared_key' => base64_encode('k')]], 'bucket' => 'no', @@ -216,7 +216,7 @@ public function test_throws_when_client_is_invalid_type(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`client` must be an array or Flow\\Azure\\SDK\\BlobServiceInterface instance'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => new stdClass(), ]); @@ -227,7 +227,7 @@ public function test_throws_when_http_client_is_wrong_type(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`client.http_client_service` must reference a service implementing'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => [ 'account_name' => 'a', @@ -242,7 +242,7 @@ public function test_throws_when_mode_b_missing_account_name(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`client.account_name`'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['auth' => ['shared_key' => 'k']], ]); @@ -253,7 +253,7 @@ public function test_throws_when_mode_b_missing_shared_key(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`client.auth.shared_key`'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a'], ]); @@ -264,7 +264,7 @@ public function test_throws_when_no_client_supplied(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('exactly one of'); - (new AzureBlobFilesystemFactory())->create('azure-blob', ['container' => 'c']); + new AzureBlobFilesystemFactory()->create('azure-blob', ['container' => 'c']); } public function test_throws_when_options_is_not_array(): void @@ -272,7 +272,7 @@ public function test_throws_when_options_is_not_array(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('`options` must be an array'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a', 'auth' => ['shared_key' => 'k']], 'options' => 'nope', @@ -281,12 +281,12 @@ public function test_throws_when_options_is_not_array(): void public function test_type_returns_azure_blob(): void { - static::assertSame('azure_blob', (new AzureBlobFilesystemFactory())->type()); + static::assertSame('azure_blob', new AzureBlobFilesystemFactory()->type()); } public function test_an_inline_client_configuration_builds_a_describable_filesystem(): void { - $filesystem = (new AzureBlobFilesystemFactory())->create('azure-blob', [ + $filesystem = new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => [ 'account_name' => 'a', @@ -313,7 +313,7 @@ public function test_an_inline_client_configuration_builds_a_describable_filesys public function test_an_injected_service_builds_a_filesystem_without_configuration(): void { static::assertNull( - (new AzureBlobFilesystemFactory()) + new AzureBlobFilesystemFactory() ->create('azure-blob', [ 'container' => 'c', 'client' => self::createStub(BlobServiceInterface::class), @@ -325,7 +325,7 @@ public function test_an_injected_service_builds_a_filesystem_without_configurati public function test_an_injected_logger_builds_a_filesystem_without_configuration(): void { static::assertNull( - (new AzureBlobFilesystemFactory()) + new AzureBlobFilesystemFactory() ->create('azure-blob', [ 'container' => 'c', 'client' => [ @@ -348,7 +348,7 @@ public static function injected_services(): Generator public function test_client_http_keeps_the_filesystem_describable(): void { - $configuration = (new AzureBlobFilesystemFactory()) + $configuration = new AzureBlobFilesystemFactory() ->create('azure-blob', [ 'container' => 'c', 'client' => [ @@ -371,7 +371,7 @@ public function test_client_http_must_be_an_array(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Filesystem factory for backend "azure_blob" `client.http` must be an array.'); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => ['account_name' => 'a', 'auth' => ['shared_key' => base64_encode('k')], 'http' => 30], ]); @@ -385,7 +385,7 @@ public function test_client_http_with_an_injected_service_is_rejected(string $se 'Filesystem factory for backend "azure_blob": client.http cannot be used together with client.http_client_service, client.request_factory_service, client.stream_factory_service or client.logger_service_id, because the limits apply only to the client the bundle builds.', ); - (new AzureBlobFilesystemFactory())->create('azure-blob', [ + new AzureBlobFilesystemFactory()->create('azure-blob', [ 'container' => 'c', 'client' => [ 'account_name' => 'a', diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/MemoryFilesystemFactoryTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/MemoryFilesystemFactoryTest.php index 7d82f0b70e..9fbde5ba6c 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/MemoryFilesystemFactoryTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/MemoryFilesystemFactoryTest.php @@ -12,7 +12,7 @@ final class MemoryFilesystemFactoryTest extends TestCase { public function test_creates_filesystem_with_given_mount_protocol(): void { - static::assertSame('memory', (new MemoryFilesystemFactory())->create('memory', [])->mount()->protocol); + static::assertSame('memory', new MemoryFilesystemFactory()->create('memory', [])->mount()->protocol); } public function test_throws_on_unknown_options(): void @@ -22,11 +22,11 @@ public function test_throws_on_unknown_options(): void 'Filesystem factory for type "memory" does not accept any options. Unknown keys: [foo, bar].', ); - (new MemoryFilesystemFactory())->create('memory', ['foo' => 1, 'bar' => 2]); + new MemoryFilesystemFactory()->create('memory', ['foo' => 1, 'bar' => 2]); } public function test_type_returns_memory(): void { - static::assertSame('memory', (new MemoryFilesystemFactory())->type()); + static::assertSame('memory', new MemoryFilesystemFactory()->type()); } } diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/NativeLocalFilesystemFactoryTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/NativeLocalFilesystemFactoryTest.php index 40c19ad6e1..fdf16ccb48 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/NativeLocalFilesystemFactoryTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/NativeLocalFilesystemFactoryTest.php @@ -12,14 +12,14 @@ final class NativeLocalFilesystemFactoryTest extends TestCase { public function test_creates_filesystem_with_given_mount_protocol(): void { - static::assertSame('file', (new NativeLocalFilesystemFactory())->create('file', [])->mount()->protocol); + static::assertSame('file', new NativeLocalFilesystemFactory()->create('file', [])->mount()->protocol); } public function test_creates_filesystem_with_non_canonical_mount_protocol(): void { static::assertSame( 'project-root', - (new NativeLocalFilesystemFactory())->create('project-root', [])->mount()->protocol, + new NativeLocalFilesystemFactory()->create('project-root', [])->mount()->protocol, ); } @@ -30,11 +30,11 @@ public function test_throws_on_unknown_options(): void 'Filesystem factory for type "file" does not accept any options. Unknown keys: [foo, bar].', ); - (new NativeLocalFilesystemFactory())->create('file', ['foo' => 1, 'bar' => 2]); + new NativeLocalFilesystemFactory()->create('file', ['foo' => 1, 'bar' => 2]); } public function test_type_returns_file(): void { - static::assertSame('file', (new NativeLocalFilesystemFactory())->type()); + static::assertSame('file', new NativeLocalFilesystemFactory()->type()); } } diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/StdoutFilesystemFactoryTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/StdoutFilesystemFactoryTest.php index 3ab66fa416..6a212e556c 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/StdoutFilesystemFactoryTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/Factory/StdoutFilesystemFactoryTest.php @@ -12,7 +12,7 @@ final class StdoutFilesystemFactoryTest extends TestCase { public function test_creates_filesystem_with_given_mount_protocol(): void { - static::assertSame('stdout', (new StdoutFilesystemFactory())->create('stdout', [])->mount()->protocol); + static::assertSame('stdout', new StdoutFilesystemFactory()->create('stdout', [])->mount()->protocol); } public function test_throws_on_unknown_options(): void @@ -22,11 +22,11 @@ public function test_throws_on_unknown_options(): void 'Filesystem factory for type "stdout" does not accept any options. Unknown keys: [foo, bar].', ); - (new StdoutFilesystemFactory())->create('stdout', ['foo' => 1, 'bar' => 2]); + new StdoutFilesystemFactory()->create('stdout', ['foo' => 1, 'bar' => 2]); } public function test_type_returns_stdout(): void { - static::assertSame('stdout', (new StdoutFilesystemFactory())->type()); + static::assertSame('stdout', new StdoutFilesystemFactory()->type()); } } diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/FilesystemFactoryRegistryTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/FilesystemFactoryRegistryTest.php index 979f072137..c590905cbd 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/FilesystemFactoryRegistryTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/Filesystem/FilesystemFactoryRegistryTest.php @@ -41,7 +41,7 @@ public function test_create_passes_entry_options_without_type_to_factory(): void $filesystem = native_local_filesystem('my-fs'); $capturing = new CapturingFilesystemFactory('file', $filesystem); - $created = (new FilesystemFactoryRegistry([$capturing]))->create('default', 'my-fs', [ + $created = new FilesystemFactoryRegistry([$capturing])->create('default', 'my-fs', [ 'type' => 'file', 'foo' => 'bar', ]); @@ -57,7 +57,7 @@ public function test_create_throws_when_factory_missing_for_type(): void 'Fstab "primary" mount "memory": No filesystem factory registered for type "memory". Available types: [].', ); - (new FilesystemFactoryRegistry([]))->create('primary', 'memory', ['type' => 'memory']); + new FilesystemFactoryRegistry([])->create('primary', 'memory', ['type' => 'memory']); } public function test_create_wraps_factory_error_with_fstab_and_mount(): void @@ -67,7 +67,7 @@ public function test_create_wraps_factory_error_with_fstab_and_mount(): void 'Fstab "primary" mount "memory": Filesystem factory for type "memory" does not accept any options. Unknown keys: [foo].', ); - (new FilesystemFactoryRegistry([new MemoryFilesystemFactory()]))->create('primary', 'memory', [ + new FilesystemFactoryRegistry([new MemoryFilesystemFactory()])->create('primary', 'memory', [ 'type' => 'memory', 'foo' => 'bar', ]); @@ -85,12 +85,12 @@ public function test_get_throws_on_unknown_type(): void public function test_has_returns_false_for_unknown_type(): void { - static::assertFalse((new FilesystemFactoryRegistry([new StubFilesystemFactory('memory')]))->has('file')); + static::assertFalse(new FilesystemFactoryRegistry([new StubFilesystemFactory('memory')])->has('file')); } public function test_has_returns_true_for_registered_type(): void { - static::assertTrue((new FilesystemFactoryRegistry([new StubFilesystemFactory('memory')]))->has('memory')); + static::assertTrue(new FilesystemFactoryRegistry([new StubFilesystemFactory('memory')])->has('memory')); } public function test_returns_factory_by_type(): void diff --git a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/FlowFilesystemBundleTest.php b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/FlowFilesystemBundleTest.php index df3efb13dd..eb55d87a31 100644 --- a/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/FlowFilesystemBundleTest.php +++ b/src/bridge/symfony/filesystem-bundle/tests/Flow/Bridge/Symfony/FilesystemBundle/Tests/Unit/FlowFilesystemBundleTest.php @@ -17,7 +17,7 @@ final class FlowFilesystemBundleTest extends TestCase public function test_build_registers_as_filesystem_factory_attribute_for_autoconfiguration(): void { $container = new ContainerBuilder(); - (new FlowFilesystemBundle())->build($container); + new FlowFilesystemBundle()->build($container); $container ->register(AutoconfiguredStubFilesystemFactory::class, AutoconfiguredStubFilesystemFactory::class) ->setAutoconfigured(true) @@ -35,7 +35,7 @@ public function test_build_registers_as_filesystem_factory_attribute_for_autocon public function test_bundle_alias_resolves_to_flow_filesystem(): void { - $extension = (new FlowFilesystemBundle())->getContainerExtension(); + $extension = new FlowFilesystemBundle()->getContainerExtension(); static::assertNotNull($extension); static::assertSame('flow_filesystem', $extension->getAlias()); diff --git a/src/bridge/symfony/filesystem-cache/composer.json b/src/bridge/symfony/filesystem-cache/composer.json index c04389031c..1ea24aa2b7 100644 --- a/src/bridge/symfony/filesystem-cache/composer.json +++ b/src/bridge/symfony/filesystem-cache/composer.json @@ -9,13 +9,13 @@ "bridge" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/filesystem": "self.version", "psr/clock": "^1.0", - "symfony/cache": "^6.4 || ^7.4 || ^8.0" + "symfony/cache": "^7.4 || ^8.0" }, "require-dev": { - "symfony/clock": "^6.4 || ^7.4 || ^8.0" + "symfony/clock": "^7.4 || ^8.0" }, "config": { "optimize-autoloader": true, diff --git a/src/bridge/symfony/http-foundation-telemetry/composer.json b/src/bridge/symfony/http-foundation-telemetry/composer.json index cc8eb2157e..6cc9e64b40 100644 --- a/src/bridge/symfony/http-foundation-telemetry/composer.json +++ b/src/bridge/symfony/http-foundation-telemetry/composer.json @@ -12,9 +12,9 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/telemetry": "self.version", - "symfony/http-foundation": "^6.4 || ^7.4 || ^8.0" + "symfony/http-foundation": "^7.4 || ^8.0" }, "autoload": { "psr-4": { diff --git a/src/bridge/symfony/http-foundation-telemetry/tests/Flow/Bridge/Symfony/HttpFoundationTelemetry/Tests/Unit/ResponseCarrierTest.php b/src/bridge/symfony/http-foundation-telemetry/tests/Flow/Bridge/Symfony/HttpFoundationTelemetry/Tests/Unit/ResponseCarrierTest.php index f8b6d272e1..167d368d60 100644 --- a/src/bridge/symfony/http-foundation-telemetry/tests/Flow/Bridge/Symfony/HttpFoundationTelemetry/Tests/Unit/ResponseCarrierTest.php +++ b/src/bridge/symfony/http-foundation-telemetry/tests/Flow/Bridge/Symfony/HttpFoundationTelemetry/Tests/Unit/ResponseCarrierTest.php @@ -16,7 +16,7 @@ public function test_fluent_chaining(): void { $response = new Response(); - $modifiedResponse = (new ResponseCarrier($response)) + $modifiedResponse = new ResponseCarrier($response) ->set('X-Header-1', 'value1') ->set('X-Header-2', 'value2') ->unwrap(); diff --git a/src/bridge/symfony/http-foundation/composer.json b/src/bridge/symfony/http-foundation/composer.json index 8a75e79938..cd9de861c3 100644 --- a/src/bridge/symfony/http-foundation/composer.json +++ b/src/bridge/symfony/http-foundation/composer.json @@ -11,8 +11,8 @@ "response" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", - "symfony/http-foundation": "^6.4 || ^7.4 || ^8.0", + "php": "~8.5.0 || ~8.6.0", + "symfony/http-foundation": "^7.4 || ^8.0", "flow-php/etl": "self.version", "flow-php/filesystem": "self.version" }, diff --git a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Response/FlowBufferedResponse.php b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Response/FlowBufferedResponse.php index e4fd543373..5a6acd25e1 100644 --- a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Response/FlowBufferedResponse.php +++ b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Response/FlowBufferedResponse.php @@ -46,7 +46,7 @@ public function __construct( throw new InvalidArgumentException('A DataFrame source carries its own config'); } - $this->config = $config ?? (new ConfigBuilder())->build(); + $this->config = $config ?? new ConfigBuilder()->build(); parent::__construct(null, $status, $headers); } diff --git a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Response/FlowStreamedResponse.php b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Response/FlowStreamedResponse.php index 635b9c6fc7..3148752e50 100644 --- a/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Response/FlowStreamedResponse.php +++ b/src/bridge/symfony/http-foundation/src/Flow/Bridge/Symfony/HttpFoundation/Response/FlowStreamedResponse.php @@ -45,7 +45,7 @@ public function __construct( throw new InvalidArgumentException('A DataFrame source carries its own config'); } - $this->config = $config ?? (new ConfigBuilder())->build(); + $this->config = $config ?? new ConfigBuilder()->build(); parent::__construct($this->stream(...), $status, $headers); diff --git a/src/bridge/symfony/postgresql-bundle/composer.json b/src/bridge/symfony/postgresql-bundle/composer.json index 389de34f38..228b64eb64 100644 --- a/src/bridge/symfony/postgresql-bundle/composer.json +++ b/src/bridge/symfony/postgresql-bundle/composer.json @@ -11,13 +11,13 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/filesystem": "self.version", "flow-php/postgresql": "self.version", - "symfony/config": "^6.4 || ^7.4 || ^8.0", - "symfony/console": "^6.4.34 || ^7.4.6 || ^8.0.6", - "symfony/dependency-injection": "^6.4 || ^7.4 || ^8.0", - "symfony/http-kernel": "^6.4 || ^7.4 || ^8.0", + "symfony/config": "^7.4 || ^8.0", + "symfony/console": "^7.4.6 || ^8.0.6", + "symfony/dependency-injection": "^7.4 || ^8.0", + "symfony/http-kernel": "^7.4 || ^8.0", "twig/twig": "^3.0" }, "require-dev": { @@ -27,12 +27,12 @@ "flow-php/symfony-postgresql-cache-bridge": "self.version", "flow-php/symfony-postgresql-messenger-bridge": "self.version", "flow-php/symfony-postgresql-session-bridge": "self.version", - "symfony/cache": "^6.4 || ^7.4 || ^8.0", - "symfony/framework-bundle": "^6.4 || ^7.4 || ^8.0", - "symfony/lock": "^6.4 || ^7.4 || ^8.0", - "symfony/messenger": "^6.4 || ^7.4 || ^8.0", - "symfony/var-dumper": "^6.4 || ^7.4 || ^8.0", - "symfony/web-profiler-bundle": "^6.4 || ^7.4 || ^8.0" + "symfony/cache": "^7.4 || ^8.0", + "symfony/framework-bundle": "^7.4 || ^8.0", + "symfony/lock": "^7.4 || ^8.0", + "symfony/messenger": "^7.4 || ^8.0", + "symfony/var-dumper": "^7.4 || ^8.0", + "symfony/web-profiler-bundle": "^7.4 || ^8.0" }, "suggest": { "flow-php/phpunit-postgresql-bridge": "For PHPUnit PostgreSQL transaction rollback support in tests", diff --git a/src/bridge/symfony/postgresql-bundle/src/Flow/Bridge/Symfony/PostgreSqlBundle/Command/FormatSqlCommand.php b/src/bridge/symfony/postgresql-bundle/src/Flow/Bridge/Symfony/PostgreSqlBundle/Command/FormatSqlCommand.php index 98396bcd66..d416cad883 100644 --- a/src/bridge/symfony/postgresql-bundle/src/Flow/Bridge/Symfony/PostgreSqlBundle/Command/FormatSqlCommand.php +++ b/src/bridge/symfony/postgresql-bundle/src/Flow/Bridge/Symfony/PostgreSqlBundle/Command/FormatSqlCommand.php @@ -144,7 +144,7 @@ private function formatPath( OutputInterface $output, DeparseOptions $options, ): int { - $files = (new SqlFileFinder(native_local_filesystem()))->find(path($pathString)); + $files = new SqlFileFinder(native_local_filesystem())->find(path($pathString)); if ($files === []) { $output->writeln(sprintf('No .sql files found at: %s', $pathString)); diff --git a/src/bridge/symfony/postgresql-bundle/src/Flow/Bridge/Symfony/PostgreSqlBundle/FlowPostgreSqlBundle.php b/src/bridge/symfony/postgresql-bundle/src/Flow/Bridge/Symfony/PostgreSqlBundle/FlowPostgreSqlBundle.php index 84464941e1..42c77e48b4 100644 --- a/src/bridge/symfony/postgresql-bundle/src/Flow/Bridge/Symfony/PostgreSqlBundle/FlowPostgreSqlBundle.php +++ b/src/bridge/symfony/postgresql-bundle/src/Flow/Bridge/Symfony/PostgreSqlBundle/FlowPostgreSqlBundle.php @@ -99,6 +99,7 @@ final class FlowPostgreSqlBundle extends AbstractBundle private const string WEB_PROFILER_BUNDLE = 'Symfony\\Bundle\\WebProfilerBundle\\WebProfilerBundle'; + #[Override] protected string $extensionAlias = 'flow_postgresql'; /** diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Context/ConfigurationContext.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Context/ConfigurationContext.php index 57b622b839..ed097f571b 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Context/ConfigurationContext.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Context/ConfigurationContext.php @@ -19,7 +19,7 @@ */ public function processConfig(array $config): array { - $extension = (new FlowPostgreSqlBundle())->getContainerExtension(); + $extension = new FlowPostgreSqlBundle()->getContainerExtension(); if (!$extension instanceof ConfigurationExtensionInterface) { throw new LogicException('FlowPostgreSqlBundle extension does not expose a configuration tree.'); @@ -31,6 +31,6 @@ public function processConfig(array $config): array throw new LogicException('FlowPostgreSqlBundle extension exposes no configuration tree.'); } - return (new Processor())->processConfiguration($configuration, [$config]); + return new Processor()->processConfiguration($configuration, [$config]); } } diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Context/ExtensionContext.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Context/ExtensionContext.php index e5c2fa4765..b77d6b0d57 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Context/ExtensionContext.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Context/ExtensionContext.php @@ -17,7 +17,7 @@ */ public function load(array $config, bool $debug = false, array $bundles = []): ContainerBuilder { - $extension = (new FlowPostgreSqlBundle())->getContainerExtension(); + $extension = new FlowPostgreSqlBundle()->getContainerExtension(); if (!$extension instanceof ExtensionInterface) { throw new LogicException('FlowPostgreSqlBundle extension is not loadable.'); diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Context/SymfonyContext.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Context/SymfonyContext.php index bc893131b0..d1921656e7 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Context/SymfonyContext.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Context/SymfonyContext.php @@ -74,7 +74,7 @@ public function getService(string $serviceId, string $typeClass): object */ public function readPrivateProperty(object $service, string $propertyName): mixed { - return (new ReflectionProperty($service, $propertyName))->getValue($service); + return new ReflectionProperty($service, $propertyName)->getValue($service); } public function shutdown(): void diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Double/TemporaryDirectory.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Double/TemporaryDirectory.php index ff1a4311fc..0cbb035779 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Double/TemporaryDirectory.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Double/TemporaryDirectory.php @@ -23,6 +23,6 @@ public function __construct() public function cleanUp(): void { - (new NativeLocalFilesystem())->rm(path_real($this->path)); + new NativeLocalFilesystem()->rm(path_real($this->path)); } } diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Fixtures/TestKernel.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Fixtures/TestKernel.php index 5b60021fe1..20421c4f49 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Fixtures/TestKernel.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Fixtures/TestKernel.php @@ -11,7 +11,7 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; +use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel\Kernel; use function array_merge; @@ -22,7 +22,7 @@ final class TestKernel extends Kernel { - /** @var array> */ + /** @var array> */ private array $testBundles = []; /** @var array */ @@ -44,7 +44,7 @@ public function __construct(string $environment = 'test', bool $debug = true) } /** - * @param class-string $bundleClass + * @param class-string $bundleClass */ public function addTestBundle(string $bundleClass): void { diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/Command/CommandTestContext.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/Command/CommandTestContext.php index 1c6e58248b..d6767f84a0 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/Command/CommandTestContext.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/Command/CommandTestContext.php @@ -48,7 +48,7 @@ public function __construct() $this->migrationsDir = dirname(__DIR__, 8) . '/var/tests/flow_test_migrations_' . bin2hex(random_bytes(4)); mkdir($this->migrationsDir, 0755, true); - $client = PgSqlClient::connect((new DsnParser())->parse($this->testDsn)); + $client = PgSqlClient::connect(new DsnParser()->parse($this->testDsn)); $client->execute('DROP TABLE IF EXISTS test_users, flow_migrations_test CASCADE'); $client->close(); } @@ -146,7 +146,7 @@ public function container(): ContainerInterface public function createDatabase(string $name): void { $client = PgSqlClient::connect( - (new DsnParser()) + new DsnParser() ->parse($this->testDsn) ->withDatabase('postgres'), ); @@ -157,7 +157,7 @@ public function createDatabase(string $name): void public function databaseExists(string $name): bool { $client = PgSqlClient::connect( - (new DsnParser()) + new DsnParser() ->parse($this->testDsn) ->withDatabase('postgres'), ); @@ -170,7 +170,7 @@ public function databaseExists(string $name): bool public function dropDatabase(string $name): void { $client = PgSqlClient::connect( - (new DsnParser()) + new DsnParser() ->parse($this->testDsn) ->withDatabase('postgres'), ); @@ -205,7 +205,7 @@ public function generateDiffMigration(): string public function generateMigrationOlderThanAnyExecuted(): void { - (new CommandTester($this->command('flow.postgresql.command.generate')))->execute(['name' => 'older']); + new CommandTester($this->command('flow.postgresql.command.generate'))->execute(['name' => 'older']); $this->filesystem->mv( path((string) $this->migrationDirs('*_older')[0]), @@ -215,7 +215,7 @@ public function generateMigrationOlderThanAnyExecuted(): void public function isUpToDate(): bool { - return (new CommandTester($this->command('flow.postgresql.command.up_to_date')))->execute([]) + return new CommandTester($this->command('flow.postgresql.command.up_to_date'))->execute([]) === Command::SUCCESS; } @@ -244,7 +244,7 @@ public function shutdown(): void { $this->symfonyContext->shutdown(); - $client = PgSqlClient::connect((new DsnParser())->parse($this->testDsn)); + $client = PgSqlClient::connect(new DsnParser()->parse($this->testDsn)); $client->execute('DROP TABLE IF EXISTS test_users, flow_migrations_test, flow_sql_test CASCADE'); $client->close(); @@ -253,7 +253,7 @@ public function shutdown(): void public function tableExists(string $table, string $schema = 'public'): bool { - $client = PgSqlClient::connect((new DsnParser())->parse($this->testDsn)); + $client = PgSqlClient::connect(new DsnParser()->parse($this->testDsn)); $result = $client->fetch('SELECT 1 FROM information_schema.tables WHERE table_schema = $1 AND table_name = $2', [ $schema, $table, @@ -270,7 +270,7 @@ public function tableExistsInDatabase(string $database, string $table, string $s if (!is_string($targetDsn)) { throw new LogicException('Failed to build target DSN.'); } - $client = PgSqlClient::connect((new DsnParser())->parse($targetDsn)); + $client = PgSqlClient::connect(new DsnParser()->parse($targetDsn)); $result = $client->fetch('SELECT 1 FROM information_schema.tables WHERE table_schema = $1 AND table_name = $2', [ $schema, $table, diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/FlowPostgreSqlExtensionTest.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/FlowPostgreSqlExtensionTest.php index 948ded2a98..2a25c912a8 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/FlowPostgreSqlExtensionTest.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/FlowPostgreSqlExtensionTest.php @@ -1921,7 +1921,7 @@ public function test_migrations_configuration_receives_the_configured_lock(array public function test_migrate_command_receives_the_configured_lock_timeout(): void { - $container = (new ExtensionContext())->load([ + $container = new ExtensionContext()->load([ 'connections' => [ 'default' => ['dsn' => 'postgresql://postgres:postgres@localhost:5432/postgres'], ], diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/MigrationExecutionContext.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/MigrationExecutionContext.php index 88f8002b19..113495db16 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/MigrationExecutionContext.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/MigrationExecutionContext.php @@ -128,7 +128,7 @@ public function tableExists(string $table): bool private function connect(): Client { - return PgSqlClient::connect((new DsnParser())->parse($this->dsn)); + return PgSqlClient::connect(new DsnParser()->parse($this->dsn)); } private function dropTestTables(): void diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/Profiler/FlowMigrationsProfilerTest.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/Profiler/FlowMigrationsProfilerTest.php index 0a01b22a9b..d78a558d1c 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/Profiler/FlowMigrationsProfilerTest.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Integration/Profiler/FlowMigrationsProfilerTest.php @@ -43,7 +43,7 @@ final class FlowMigrationsProfilerTest extends KernelTestCase #[Override] protected function tearDown(): void { - $client = PgSqlClient::connect((new DsnParser())->parse($this->dsn())); + $client = PgSqlClient::connect(new DsnParser()->parse($this->dsn())); $client->execute('DROP TABLE IF EXISTS users, ' . self::STORE_TABLE . ' CASCADE'); $client->close(); diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/CatalogProvider/ArrayCatalogProviderTest.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/CatalogProvider/ArrayCatalogProviderTest.php index befb4ff82b..70b3462197 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/CatalogProvider/ArrayCatalogProviderTest.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/CatalogProvider/ArrayCatalogProviderTest.php @@ -109,7 +109,7 @@ public function test_restores_catalog_extensions(): void static::assertEquals( $catalog->extensions(), - (new ArrayCatalogProvider($catalog->normalize()))->get()->extensions(), + new ArrayCatalogProvider($catalog->normalize())->get()->extensions(), ); } } diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Lock/SymfonyMigrationLockTest.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Lock/SymfonyMigrationLockTest.php index 3618efe4b0..04773b79e1 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Lock/SymfonyMigrationLockTest.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Lock/SymfonyMigrationLockTest.php @@ -42,7 +42,7 @@ public function test_release_without_acquire_throws(): void { $this->expectExceptionObject(MigrationException::lockExpired('public.flow_migrations')); - (new SymfonyMigrationLock(new LockFactory(new InMemoryStore())))->release('public.flow_migrations'); + new SymfonyMigrationLock(new LockFactory(new InMemoryStore()))->release('public.flow_migrations'); } public function test_second_lock_on_the_same_store_acquires_after_release(): void diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/FlowMigrationsDataCollectorTest.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/FlowMigrationsDataCollectorTest.php index b88edd13ee..8cecbd8abb 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/FlowMigrationsDataCollectorTest.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/FlowMigrationsDataCollectorTest.php @@ -46,7 +46,7 @@ public function test_get_name_is_flow_postgresql_migrations(): void static::assertSame( 'flow_postgresql_migrations', - (new FlowMigrationsDataCollector('default', $migrator, $configuration))->getName(), + new FlowMigrationsDataCollector('default', $migrator, $configuration)->getName(), ); } diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/ProfilerClientTest.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/ProfilerClientTest.php index 5faf356fab..7478083144 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/ProfilerClientTest.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/ProfilerClientTest.php @@ -25,7 +25,7 @@ public function test_execute_records_statement_parameters_and_affected_rows(): v $inner = new FakeClient(); $inner->executeReturn = 3; - $affected = (new ProfilerClient($inner, $recorder))->execute('DELETE FROM users WHERE id = $1', [42]); + $affected = new ProfilerClient($inner, $recorder)->execute('DELETE FROM users WHERE id = $1', [42]); static::assertSame(3, $affected); static::assertCount(1, $recorder->queries()); @@ -48,7 +48,7 @@ public function test_execute_records_converted_parameters_as_their_values(): voi $inner = new FakeClient(); $inner->executeReturn = 2; - $affected = (new ProfilerClient($inner, $recorder))->execute( + $affected = new ProfilerClient($inner, $recorder)->execute( 'DELETE FROM users WHERE id = $1', new ConvertedParameters(['42']), ); @@ -64,7 +64,7 @@ public function test_records_the_configured_connection_name(): void { $recorder = new QueryRecorder(); - (new ProfilerClient(new FakeClient(), $recorder, 'analytics'))->execute('SELECT 1'); + new ProfilerClient(new FakeClient(), $recorder, 'analytics')->execute('SELECT 1'); static::assertSame('analytics', $recorder->queries()[0]->connection); } @@ -146,7 +146,7 @@ public function test_fetch_records_one_row_when_row_returned(): void $inner = new FakeClient(); $inner->fetchReturn = ['id' => 1]; - $row = (new ProfilerClient($inner, $recorder))->fetch('SELECT * FROM users LIMIT 1'); + $row = new ProfilerClient($inner, $recorder)->fetch('SELECT * FROM users LIMIT 1'); static::assertSame(['id' => 1], $row); static::assertSame(1, $recorder->queries()[0]->rowCount); @@ -158,7 +158,7 @@ public function test_fetch_records_zero_rows_when_null(): void $inner = new FakeClient(); $inner->fetchReturn = null; - (new ProfilerClient($inner, $recorder))->fetch('SELECT * FROM users WHERE 1 = 0'); + new ProfilerClient($inner, $recorder)->fetch('SELECT * FROM users WHERE 1 = 0'); static::assertSame(0, $recorder->queries()[0]->rowCount); } @@ -169,7 +169,7 @@ public function test_fetch_all_records_returned_row_count(): void $inner = new FakeClient(); $inner->fetchAllReturn = [['id' => 1], ['id' => 2], ['id' => 3]]; - $rows = (new ProfilerClient($inner, $recorder))->fetchAll('SELECT * FROM users'); + $rows = new ProfilerClient($inner, $recorder)->fetchAll('SELECT * FROM users'); static::assertCount(3, $rows); static::assertSame(3, $recorder->queries()[0]->rowCount); @@ -181,7 +181,7 @@ public function test_fetch_scalar_int_records_query(): void $inner = new FakeClient(); $inner->fetchScalarIntReturn = 7; - $count = (new ProfilerClient($inner, $recorder))->fetchScalarInt('SELECT COUNT(*) FROM users'); + $count = new ProfilerClient($inner, $recorder)->fetchScalarInt('SELECT COUNT(*) FROM users'); static::assertSame(7, $count); static::assertSame('SELECT COUNT(*) FROM users', $recorder->queries()[0]->sql); @@ -198,7 +198,7 @@ public function toSql(): string } }; - (new ProfilerClient(new FakeClient(), $recorder))->execute($sql); + new ProfilerClient(new FakeClient(), $recorder)->execute($sql); static::assertSame('SELECT 1', $recorder->queries()[0]->sql); } @@ -231,7 +231,7 @@ public function test_cursor_records_statement_with_unknown_row_count_and_returns $cursor = $this->createStub(Cursor::class); $inner = new FakeClient($cursor); - $returned = (new ProfilerClient($inner, $recorder))->cursor('SELECT * FROM big_table'); + $returned = new ProfilerClient($inner, $recorder)->cursor('SELECT * FROM big_table'); static::assertSame($cursor, $returned); static::assertCount(1, $recorder->queries()); diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/QueryRecorderOptionsTest.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/QueryRecorderOptionsTest.php index f3fd43bdd3..b15e392dac 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/QueryRecorderOptionsTest.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/QueryRecorderOptionsTest.php @@ -68,12 +68,12 @@ public function test_rejects_negative_max_parameters(): void public function test_allows_null_max_parameters_as_unlimited(): void { - static::assertNull((new QueryRecorderOptions(maxRetainedParameters: null))->maxRetainedParameters); + static::assertNull(new QueryRecorderOptions(maxRetainedParameters: null)->maxRetainedParameters); } public function test_retains_parameters_within_limit(): void { - static::assertTrue((new QueryRecorderOptions(maxRetainedParameters: 100))->retainsParameters(array_fill( + static::assertTrue(new QueryRecorderOptions(maxRetainedParameters: 100)->retainsParameters(array_fill( 0, 5, 'v', @@ -82,7 +82,7 @@ public function test_retains_parameters_within_limit(): void public function test_retains_parameters_at_exact_limit(): void { - static::assertTrue((new QueryRecorderOptions(maxRetainedParameters: 100))->retainsParameters(array_fill( + static::assertTrue(new QueryRecorderOptions(maxRetainedParameters: 100)->retainsParameters(array_fill( 0, 100, 'v', @@ -91,7 +91,7 @@ public function test_retains_parameters_at_exact_limit(): void public function test_does_not_retain_parameters_over_limit(): void { - static::assertFalse((new QueryRecorderOptions(maxRetainedParameters: 100))->retainsParameters(array_fill( + static::assertFalse(new QueryRecorderOptions(maxRetainedParameters: 100)->retainsParameters(array_fill( 0, 101, 'v', @@ -100,7 +100,7 @@ public function test_does_not_retain_parameters_over_limit(): void public function test_retains_everything_when_max_parameters_is_null(): void { - static::assertTrue((new QueryRecorderOptions(maxRetainedParameters: null))->retainsParameters(array_fill( + static::assertTrue(new QueryRecorderOptions(maxRetainedParameters: null)->retainsParameters(array_fill( 0, 17_000, 'v', @@ -109,11 +109,11 @@ public function test_retains_everything_when_max_parameters_is_null(): void public function test_does_not_retain_parameters_when_include_parameters_disabled(): void { - static::assertFalse((new QueryRecorderOptions(includeParameters: false))->retainsParameters([42])); + static::assertFalse(new QueryRecorderOptions(includeParameters: false)->retainsParameters([42])); } public function test_retains_empty_parameters_when_include_parameters_disabled(): void { - static::assertTrue((new QueryRecorderOptions(includeParameters: false))->retainsParameters([])); + static::assertTrue(new QueryRecorderOptions(includeParameters: false)->retainsParameters([])); } } diff --git a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/QueryRecorderTest.php b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/QueryRecorderTest.php index 048b63ca9b..8462a47a95 100644 --- a/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/QueryRecorderTest.php +++ b/src/bridge/symfony/postgresql-bundle/tests/Flow/Bridge/Symfony/PostgreSqlBundle/Tests/Unit/Profiler/QueryRecorderTest.php @@ -20,7 +20,7 @@ final class QueryRecorderTest extends TestCase { public function test_starts_empty(): void { - static::assertSame([], (new QueryRecorder())->queries()); + static::assertSame([], new QueryRecorder()->queries()); } public function test_add_appends_in_order(): void diff --git a/src/bridge/symfony/postgresql-cache/composer.json b/src/bridge/symfony/postgresql-cache/composer.json index 07b73c440d..df07dbf24d 100644 --- a/src/bridge/symfony/postgresql-cache/composer.json +++ b/src/bridge/symfony/postgresql-cache/composer.json @@ -9,9 +9,9 @@ "bridge" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/postgresql": "self.version", - "symfony/cache": "^6.4 || ^7.4 || ^8.0" + "symfony/cache": "^7.4 || ^8.0" }, "config": { "optimize-autoloader": true, diff --git a/src/bridge/symfony/postgresql-cache/tests/Flow/Bridge/Symfony/PostgreSQLCache/Tests/Unit/CacheCatalogProviderTest.php b/src/bridge/symfony/postgresql-cache/tests/Flow/Bridge/Symfony/PostgreSQLCache/Tests/Unit/CacheCatalogProviderTest.php index c980018d0b..62761ba7db 100644 --- a/src/bridge/symfony/postgresql-cache/tests/Flow/Bridge/Symfony/PostgreSQLCache/Tests/Unit/CacheCatalogProviderTest.php +++ b/src/bridge/symfony/postgresql-cache/tests/Flow/Bridge/Symfony/PostgreSQLCache/Tests/Unit/CacheCatalogProviderTest.php @@ -12,7 +12,7 @@ final class CacheCatalogProviderTest extends TestCase { public function test_data_column_is_bytea_not_null(): void { - $col = (new CacheCatalogProvider())->get()->get('public')->tables[0]->column('item_data'); + $col = new CacheCatalogProvider()->get()->get('public')->tables[0]->column('item_data'); static::assertFalse($col->nullable); static::assertTrue($col->type->isEqual(ColumnType::bytea())); @@ -20,14 +20,14 @@ public function test_data_column_is_bytea_not_null(): void public function test_get_returns_catalog_with_custom_schema(): void { - $catalog = (new CacheCatalogProvider(schemaName: 'cache'))->get(); + $catalog = new CacheCatalogProvider(schemaName: 'cache')->get(); static::assertSame(['cache'], $catalog->names()); } public function test_id_column_is_primary_key_and_varchar_255(): void { - $table = (new CacheCatalogProvider())->get()->get('public')->tables[0]; + $table = new CacheCatalogProvider()->get()->get('public')->tables[0]; static::assertSame(['item_id'], $table->primaryKey?->columns); static::assertTrue($table->column('item_id')->type->isEqual(ColumnType::varchar(255))); @@ -36,7 +36,7 @@ public function test_id_column_is_primary_key_and_varchar_255(): void public function test_index_on_lifetime_time_uses_table_prefix(): void { - $indexes = (new CacheCatalogProvider('my_cache'))->get()->get('public')->tables[0]->indexes; + $indexes = new CacheCatalogProvider('my_cache')->get()->get('public')->tables[0]->indexes; static::assertCount(1, $indexes); static::assertSame('idx_my_cache_lifetime_time', $indexes[0]->name); @@ -45,7 +45,7 @@ public function test_index_on_lifetime_time_uses_table_prefix(): void public function test_lifetime_column_is_integer_nullable(): void { - $col = (new CacheCatalogProvider())->get()->get('public')->tables[0]->column('item_lifetime'); + $col = new CacheCatalogProvider()->get()->get('public')->tables[0]->column('item_lifetime'); static::assertTrue($col->nullable); static::assertTrue($col->type->isEqual(ColumnType::integer())); @@ -53,12 +53,12 @@ public function test_lifetime_column_is_integer_nullable(): void public function test_table_has_custom_columns(): void { - $table = (new CacheCatalogProvider( + $table = new CacheCatalogProvider( idCol: 'cid', dataCol: 'cdata', lifetimeCol: 'cttl', timeCol: 'cts', - ))->get()->get('public')->tables[0]; + )->get()->get('public')->tables[0]; static::assertSame(['cid', 'cdata', 'cttl', 'cts'], $table->columnNames()); static::assertSame(['cid'], $table->primaryKey?->columns); @@ -66,7 +66,7 @@ public function test_table_has_custom_columns(): void public function test_table_has_custom_name_and_schema(): void { - $table = (new CacheCatalogProvider('app_cache', 'app'))->get()->get('app')->tables[0]; + $table = new CacheCatalogProvider('app_cache', 'app')->get()->get('app')->tables[0]; static::assertSame('app_cache', $table->name); static::assertSame('app', $table->schema); @@ -74,14 +74,14 @@ public function test_table_has_custom_name_and_schema(): void public function test_table_has_default_name(): void { - $table = (new CacheCatalogProvider())->get()->get('public')->tables[0]; + $table = new CacheCatalogProvider()->get()->get('public')->tables[0]; static::assertSame('cache_items', $table->name); } public function test_time_column_is_integer_not_null(): void { - $col = (new CacheCatalogProvider())->get()->get('public')->tables[0]->column('item_time'); + $col = new CacheCatalogProvider()->get()->get('public')->tables[0]->column('item_time'); static::assertFalse($col->nullable); static::assertTrue($col->type->isEqual(ColumnType::integer())); diff --git a/src/bridge/symfony/postgresql-messenger/composer.json b/src/bridge/symfony/postgresql-messenger/composer.json index f75936c0b3..ced81894f1 100644 --- a/src/bridge/symfony/postgresql-messenger/composer.json +++ b/src/bridge/symfony/postgresql-messenger/composer.json @@ -9,9 +9,9 @@ "bridge" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/postgresql": "self.version", - "symfony/messenger": "^6.4 || ^7.4 || ^8.0" + "symfony/messenger": "^7.4 || ^8.0" }, "config": { "optimize-autoloader": true, diff --git a/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Integration/FlowPostgreSqlTransportTest.php b/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Integration/FlowPostgreSqlTransportTest.php index 1e4a77e23a..23ef26b568 100644 --- a/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Integration/FlowPostgreSqlTransportTest.php +++ b/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Integration/FlowPostgreSqlTransportTest.php @@ -193,7 +193,7 @@ public function test_send_with_delay_hides_message_until_available(): void new PhpSerializer(), ); - $transport->send((new Envelope(new IntegrationTestMessage('delayed')))->with(new DelayStamp(60000))); + $transport->send(new Envelope(new IntegrationTestMessage('delayed'))->with(new DelayStamp(60000))); static::assertCount(0, iterator_to_array($transport->get(), false)); } diff --git a/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Unit/FlowPostgreSqlReceiverTest.php b/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Unit/FlowPostgreSqlReceiverTest.php index 292a4b3af5..2dcc066660 100644 --- a/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Unit/FlowPostgreSqlReceiverTest.php +++ b/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Unit/FlowPostgreSqlReceiverTest.php @@ -28,7 +28,7 @@ public function test_ack_delegates_to_connection_with_stamp_id(): void $client->executeReturn = 1; $receiver = new FlowPostgreSqlReceiver(new Connection($client), new FakeSerializer()); - $envelope = (new Envelope((object) []))->with(new TransportMessageIdStamp('42')); + $envelope = new Envelope((object) [])->with(new TransportMessageIdStamp('42')); $receiver->ack($envelope); static::assertSame([42], $client->executedQueries[0]['parameters']); @@ -260,7 +260,7 @@ public function test_keepalive_delegates_with_stamp_id_and_seconds(): void $client = new SpyClient(); $receiver = new FlowPostgreSqlReceiver(new Connection($client), new FakeSerializer()); - $envelope = (new Envelope((object) []))->with(new TransportMessageIdStamp('42')); + $envelope = new Envelope((object) [])->with(new TransportMessageIdStamp('42')); $receiver->keepalive($envelope, 60); static::assertSame([42], [$client->executedQueries[0]['parameters'][1]]); @@ -276,7 +276,7 @@ public function execute(Sql|string $sql, array|ConvertedParameters $parameters = }; $receiver = new FlowPostgreSqlReceiver(new Connection($client), new FakeSerializer()); - $envelope = (new Envelope((object) []))->with(new TransportMessageIdStamp('1')); + $envelope = new Envelope((object) [])->with(new TransportMessageIdStamp('1')); $this->expectException(TransportException::class); $receiver->keepalive($envelope); @@ -288,7 +288,7 @@ public function test_reject_delegates_to_connection(): void $client->executeReturn = 1; $receiver = new FlowPostgreSqlReceiver(new Connection($client), new FakeSerializer()); - $envelope = (new Envelope((object) []))->with(new TransportMessageIdStamp('42')); + $envelope = new Envelope((object) [])->with(new TransportMessageIdStamp('42')); $receiver->reject($envelope); static::assertSame([42], $client->executedQueries[0]['parameters']); @@ -304,7 +304,7 @@ public function execute(Sql|string $sql, array|ConvertedParameters $parameters = }; $receiver = new FlowPostgreSqlReceiver(new Connection($client), new FakeSerializer()); - $envelope = (new Envelope((object) []))->with(new TransportMessageIdStamp('1')); + $envelope = new Envelope((object) [])->with(new TransportMessageIdStamp('1')); $this->expectException(TransportException::class); $receiver->reject($envelope); diff --git a/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Unit/FlowPostgreSqlSenderTest.php b/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Unit/FlowPostgreSqlSenderTest.php index e1d7920556..acb224e31c 100644 --- a/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Unit/FlowPostgreSqlSenderTest.php +++ b/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Unit/FlowPostgreSqlSenderTest.php @@ -85,7 +85,7 @@ public function test_send_with_delay_stamp_delegates_delay_to_connection(): void $client->fetchSingleReturn = ['id' => 1]; $sender = new FlowPostgreSqlSender(new Connection($client), new FakeSerializer()); - $envelope = (new Envelope((object) []))->with(new DelayStamp(5000)); + $envelope = new Envelope((object) [])->with(new DelayStamp(5000)); $sender->send($envelope); static::assertCount(1, $client->executedQueries); diff --git a/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Unit/FlowPostgreSqlTransportTest.php b/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Unit/FlowPostgreSqlTransportTest.php index cde23cf3c0..29c14ec9e0 100644 --- a/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Unit/FlowPostgreSqlTransportTest.php +++ b/src/bridge/symfony/postgresql-messenger/tests/Flow/Bridge/Symfony/PostgreSQLMessenger/Tests/Unit/FlowPostgreSqlTransportTest.php @@ -28,7 +28,7 @@ public function test_ack_delegates_to_receiver(): void $client->executeReturn = 1; $transport = new FlowPostgreSqlTransport(new Connection($client), new FakeSerializer()); - $envelope = (new Envelope((object) []))->with(new TransportMessageIdStamp('1')); + $envelope = new Envelope((object) [])->with(new TransportMessageIdStamp('1')); $transport->ack($envelope); static::assertSame([1], $client->executedQueries[0]['parameters']); @@ -47,7 +47,7 @@ public function test_all_delegates_to_receiver(): void public function test_does_not_implement_setupable_transport_interface(): void { - static::assertFalse((new ReflectionClass(FlowPostgreSqlTransport::class))->implementsInterface( + static::assertFalse(new ReflectionClass(FlowPostgreSqlTransport::class)->implementsInterface( SetupableTransportInterface::class, )); } @@ -94,7 +94,7 @@ public function test_keepalive_delegates_to_receiver(): void $client = new SpyClient(); $transport = new FlowPostgreSqlTransport(new Connection($client), new FakeSerializer()); - $envelope = (new Envelope((object) []))->with(new TransportMessageIdStamp('1')); + $envelope = new Envelope((object) [])->with(new TransportMessageIdStamp('1')); $transport->keepalive($envelope); static::assertCount(1, $client->executedQueries); @@ -106,7 +106,7 @@ public function test_reject_delegates_to_receiver(): void $client->executeReturn = 1; $transport = new FlowPostgreSqlTransport(new Connection($client), new FakeSerializer()); - $envelope = (new Envelope((object) []))->with(new TransportMessageIdStamp('1')); + $envelope = new Envelope((object) [])->with(new TransportMessageIdStamp('1')); $transport->reject($envelope); static::assertSame([1], $client->executedQueries[0]['parameters']); diff --git a/src/bridge/symfony/postgresql-session/composer.json b/src/bridge/symfony/postgresql-session/composer.json index 8a8e44be7f..7db20d26ad 100644 --- a/src/bridge/symfony/postgresql-session/composer.json +++ b/src/bridge/symfony/postgresql-session/composer.json @@ -9,9 +9,9 @@ "bridge" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/postgresql": "self.version", - "symfony/http-foundation": "^6.4 || ^7.4 || ^8.0" + "symfony/http-foundation": "^7.4 || ^8.0" }, "config": { "optimize-autoloader": true, diff --git a/src/bridge/symfony/postgresql-session/tests/Flow/Bridge/Symfony/PostgreSQLSession/Tests/Unit/SessionCatalogProviderTest.php b/src/bridge/symfony/postgresql-session/tests/Flow/Bridge/Symfony/PostgreSQLSession/Tests/Unit/SessionCatalogProviderTest.php index 07908a3f35..e570305788 100644 --- a/src/bridge/symfony/postgresql-session/tests/Flow/Bridge/Symfony/PostgreSQLSession/Tests/Unit/SessionCatalogProviderTest.php +++ b/src/bridge/symfony/postgresql-session/tests/Flow/Bridge/Symfony/PostgreSQLSession/Tests/Unit/SessionCatalogProviderTest.php @@ -12,7 +12,7 @@ final class SessionCatalogProviderTest extends TestCase { public function test_data_column_is_bytea_not_null(): void { - $col = (new SessionCatalogProvider())->get()->get('public')->tables[0]->column('sess_data'); + $col = new SessionCatalogProvider()->get()->get('public')->tables[0]->column('sess_data'); static::assertFalse($col->nullable); static::assertTrue($col->type->isEqual(ColumnType::bytea())); @@ -20,14 +20,14 @@ public function test_data_column_is_bytea_not_null(): void public function test_get_returns_catalog_with_custom_schema(): void { - $catalog = (new SessionCatalogProvider(schemaName: 'session'))->get(); + $catalog = new SessionCatalogProvider(schemaName: 'session')->get(); static::assertSame(['session'], $catalog->names()); } public function test_id_column_is_primary_key_and_varchar_128(): void { - $table = (new SessionCatalogProvider())->get()->get('public')->tables[0]; + $table = new SessionCatalogProvider()->get()->get('public')->tables[0]; static::assertSame(['sess_id'], $table->primaryKey?->columns); static::assertTrue($table->column('sess_id')->type->isEqual(ColumnType::varchar(128))); @@ -36,7 +36,7 @@ public function test_id_column_is_primary_key_and_varchar_128(): void public function test_index_on_lifetime_uses_table_prefix(): void { - $indexes = (new SessionCatalogProvider('app_sessions'))->get()->get('public')->tables[0]->indexes; + $indexes = new SessionCatalogProvider('app_sessions')->get()->get('public')->tables[0]->indexes; static::assertCount(1, $indexes); static::assertSame('idx_app_sessions_lifetime', $indexes[0]->name); @@ -45,7 +45,7 @@ public function test_index_on_lifetime_uses_table_prefix(): void public function test_lifetime_column_is_integer_not_null(): void { - $col = (new SessionCatalogProvider())->get()->get('public')->tables[0]->column('sess_lifetime'); + $col = new SessionCatalogProvider()->get()->get('public')->tables[0]->column('sess_lifetime'); static::assertFalse($col->nullable); static::assertTrue($col->type->isEqual(ColumnType::integer())); @@ -53,12 +53,12 @@ public function test_lifetime_column_is_integer_not_null(): void public function test_table_has_custom_columns(): void { - $table = (new SessionCatalogProvider( + $table = new SessionCatalogProvider( idCol: 'sid', dataCol: 'sdata', lifetimeCol: 'sttl', timeCol: 'sts', - ))->get()->get('public')->tables[0]; + )->get()->get('public')->tables[0]; static::assertSame(['sid', 'sdata', 'sttl', 'sts'], $table->columnNames()); static::assertSame(['sid'], $table->primaryKey?->columns); @@ -66,7 +66,7 @@ public function test_table_has_custom_columns(): void public function test_table_has_custom_name_and_schema(): void { - $table = (new SessionCatalogProvider('app_sessions', 'app'))->get()->get('app')->tables[0]; + $table = new SessionCatalogProvider('app_sessions', 'app')->get()->get('app')->tables[0]; static::assertSame('app_sessions', $table->name); static::assertSame('app', $table->schema); @@ -74,14 +74,14 @@ public function test_table_has_custom_name_and_schema(): void public function test_table_has_default_name(): void { - $table = (new SessionCatalogProvider())->get()->get('public')->tables[0]; + $table = new SessionCatalogProvider()->get()->get('public')->tables[0]; static::assertSame('sessions', $table->name); } public function test_time_column_is_integer_not_null(): void { - $col = (new SessionCatalogProvider())->get()->get('public')->tables[0]->column('sess_time'); + $col = new SessionCatalogProvider()->get()->get('public')->tables[0]->column('sess_time'); static::assertFalse($col->nullable); static::assertTrue($col->type->isEqual(ColumnType::integer())); diff --git a/src/bridge/symfony/telemetry-bundle/composer.json b/src/bridge/symfony/telemetry-bundle/composer.json index f98fd2e94a..3440d1a674 100644 --- a/src/bridge/symfony/telemetry-bundle/composer.json +++ b/src/bridge/symfony/telemetry-bundle/composer.json @@ -15,39 +15,39 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/psr3-telemetry-bridge": "self.version", "flow-php/telemetry": "self.version", "psr/clock": "^1.0", - "symfony/config": "^6.4 || ^7.4 || ^8.0", - "symfony/console": "^6.4.34 || ^7.4.6 || ^8.0.6", - "symfony/dependency-injection": "^6.4 || ^7.4 || ^8.0", + "symfony/config": "^7.4 || ^8.0", + "symfony/console": "^7.4.6 || ^8.0.6", + "symfony/dependency-injection": "^7.4 || ^8.0", "symfony/http-client-contracts": "^3.0", - "symfony/http-kernel": "^6.4 || ^7.4 || ^8.0", + "symfony/http-kernel": "^7.4 || ^8.0", "symfony/polyfill-mbstring": "^1.33" }, "require-dev": { "composer-runtime-api": "^2.2", "composer/semver": "^3.4", - "doctrine/dbal": "^4.5", + "doctrine/dbal": "^4.6", "flow-php/psr18-telemetry-bridge": "self.version", "flow-php/symfony-http-foundation-telemetry-bridge": "self.version", "flow-php/telemetry-otlp-bridge": "self.version", "nyholm/psr7": "^1.8", - "symfony/framework-bundle": "^6.4 || ^7.4 || ^8.0", - "symfony/http-client": "^6.4 || ^7.4 || ^8.0", - "symfony/messenger": "^6.4 || ^7.4 || ^8.0", - "symfony/routing": "^6.4 || ^7.4 || ^8.0", - "symfony/security-bundle": "^6.4 || ^7.4 || ^8.0", - "symfony/security-core": "^6.4 || ^7.4 || ^8.0", - "symfony/security-http": "^6.4 || ^7.4 || ^8.0", - "symfony/serializer": "^6.4 || ^7.4 || ^8.0", - "symfony/var-dumper": "^6.4 || ^7.4 || ^8.0", - "symfony/web-profiler-bundle": "^6.4 || ^7.4 || ^8.0", + "symfony/framework-bundle": "^7.4 || ^8.0", + "symfony/http-client": "^7.4 || ^8.0", + "symfony/messenger": "^7.4 || ^8.0", + "symfony/routing": "^7.4 || ^8.0", + "symfony/security-bundle": "^7.4 || ^8.0", + "symfony/security-core": "^7.4 || ^8.0", + "symfony/security-http": "^7.4 || ^8.0", + "symfony/serializer": "^7.4 || ^8.0", + "symfony/var-dumper": "^7.4 || ^8.0", + "symfony/web-profiler-bundle": "^7.4 || ^8.0", "twig/twig": "^3.0" }, "suggest": { - "doctrine/dbal": "Required for Doctrine DBAL tracing (^4.5)", + "doctrine/dbal": "Required for Doctrine DBAL tracing (^4.6)", "flow-php/psr18-telemetry-bridge": "Required for PSR-18 HTTP client tracing", "flow-php/symfony-http-foundation-telemetry-bridge": "Required for HTTP trace context propagation (extract incoming / inject outgoing W3C trace headers)", "flow-php/telemetry-otlp-bridge": "Required for OTLP exporter support", diff --git a/src/bridge/symfony/telemetry-bundle/src/Flow/Bridge/Symfony/TelemetryBundle/Instrumentation/HttpKernel/HttpKernelSpanSubscriber.php b/src/bridge/symfony/telemetry-bundle/src/Flow/Bridge/Symfony/TelemetryBundle/Instrumentation/HttpKernel/HttpKernelSpanSubscriber.php index e2a5f813e6..856fa7aa0d 100644 --- a/src/bridge/symfony/telemetry-bundle/src/Flow/Bridge/Symfony/TelemetryBundle/Instrumentation/HttpKernel/HttpKernelSpanSubscriber.php +++ b/src/bridge/symfony/telemetry-bundle/src/Flow/Bridge/Symfony/TelemetryBundle/Instrumentation/HttpKernel/HttpKernelSpanSubscriber.php @@ -308,7 +308,7 @@ private function extractContextFromRequest(Request $request): void $spanContext = $propagationContext->spanContext; if ($spanContext !== null) { - $context = (new Context())->withActiveSpan($spanContext); + $context = new Context()->withActiveSpan($spanContext); if ($propagationContext->baggage !== null) { $context = $context->withBaggage($propagationContext->baggage); diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Context/ConfigurationContext.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Context/ConfigurationContext.php index ef3b62e995..9a95169d80 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Context/ConfigurationContext.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Context/ConfigurationContext.php @@ -35,7 +35,7 @@ public function processRawConfig(mixed $config): array */ public function processConfigs(mixed ...$configs): array { - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); if (!$extension instanceof ConfigurationExtensionInterface) { throw new LogicException('FlowTelemetryBundle extension does not expose a configuration tree.'); @@ -47,6 +47,6 @@ public function processConfigs(mixed ...$configs): array throw new LogicException('FlowTelemetryBundle extension exposes no configuration tree.'); } - return (new Processor())->processConfiguration($configuration, $configs); + return new Processor()->processConfiguration($configuration, $configs); } } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Fixtures/TestKernel.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Fixtures/TestKernel.php index 5485b6e4ce..ff841bb562 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Fixtures/TestKernel.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Fixtures/TestKernel.php @@ -10,7 +10,7 @@ use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; +use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel\Kernel; use function array_merge; @@ -21,7 +21,7 @@ final class TestKernel extends Kernel { - /** @var array> */ + /** @var array> */ private array $testBundles = []; /** @var array */ @@ -43,7 +43,7 @@ public function __construct(string $environment = 'test', bool $debug = true) } /** - * @param class-string $bundleClass + * @param class-string $bundleClass */ public function addTestBundle(string $bundleClass): void { diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Fixtures/config/profiler_panel_routes.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Fixtures/config/profiler_panel_routes.php index 027fd37b87..0556162db5 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Fixtures/config/profiler_panel_routes.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Fixtures/config/profiler_panel_routes.php @@ -2,14 +2,8 @@ declare(strict_types=1); -use Composer\InstalledVersions; -use Composer\Semver\VersionParser; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; return static function (RoutingConfigurator $routes): void { - if (InstalledVersions::satisfies(new VersionParser(), 'symfony/web-profiler-bundle', '^6.4.0')) { - $routes->import('@WebProfilerBundle/Resources/config/routing/profiler.xml')->prefix('/_profiler'); - } else { - $routes->import('@WebProfilerBundle/Resources/config/routing/profiler.php')->prefix('/_profiler'); - } + $routes->import('@WebProfilerBundle/Resources/config/routing/profiler.php')->prefix('/_profiler'); }; diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Integration/DependencyInjection/Compiler/CacheTelemetryPassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Integration/DependencyInjection/Compiler/CacheTelemetryPassTest.php index 33e5f45224..1c1ceac811 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Integration/DependencyInjection/Compiler/CacheTelemetryPassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Integration/DependencyInjection/Compiler/CacheTelemetryPassTest.php @@ -16,7 +16,6 @@ use Symfony\Component\DependencyInjection\Compiler\PassConfig; use Symfony\Component\DependencyInjection\ContainerBuilder; -use function class_exists; use function restore_exception_handler; use function version_compare; @@ -133,10 +132,6 @@ public function test_excluded_pools_are_not_traced_in_a_booted_kernel(): void */ public function test_container_lint_passes_with_every_instrumentation_enabled(): void { - if (!class_exists(CheckAliasValidityPass::class)) { - static::markTestSkipped('CheckAliasValidityPass requires symfony/dependency-injection >= 7.3'); - } - $collector = new CompiledIdCollectorPass(); $this->bootKernel([ @@ -170,10 +165,6 @@ public function test_container_lint_passes_with_every_instrumentation_enabled(): public function test_container_lint_passes_with_a_tag_aware_app_pool(): void { - if (!class_exists(CheckAliasValidityPass::class)) { - static::markTestSkipped('CheckAliasValidityPass requires symfony/dependency-injection >= 7.3'); - } - $collector = new CompiledIdCollectorPass(); $this->bootKernel([ diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Integration/FlowTelemetryExtensionTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Integration/FlowTelemetryExtensionTest.php index 7a7fdb03f5..310c9e057a 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Integration/FlowTelemetryExtensionTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Integration/FlowTelemetryExtensionTest.php @@ -609,7 +609,7 @@ public function test_async_curl_transport_options_and_error_handler_are_wired(): $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -640,7 +640,7 @@ public function test_async_curl_transport_is_tagged_for_worker_pump(): void $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -666,7 +666,7 @@ public function test_sync_curl_transport_is_not_tagged_for_worker_pump(): void $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -696,7 +696,7 @@ public function test_async_curl_transport_tick_subscriber_is_registered_when_mes $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -716,7 +716,7 @@ public function test_security_instrumentation_registers_subscriber_and_field_par $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -748,7 +748,7 @@ public function test_security_instrumentation_is_not_registered_by_default(): vo $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([['resource' => []]], $container); @@ -761,7 +761,7 @@ public function test_trace_context_propagation_services_are_registered(): void $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([['resource' => []]], $container); @@ -781,7 +781,7 @@ public function test_telemetry_definition_registers_process_end_shutdown(): void $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([['resource' => []]], $container); @@ -1024,7 +1024,7 @@ public function test_otlp_exporter_uses_named_error_handler(): void $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -1057,7 +1057,7 @@ public function test_messenger_defaults_trace_true_and_registers_suppression(): $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -1087,7 +1087,7 @@ public function test_messenger_trace_false_disables_the_handler_span(): void $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -1104,7 +1104,7 @@ public function test_exclude_commands_defaults_to_messenger_consume(): void $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([['resource' => []]], $container); @@ -1120,7 +1120,7 @@ public function test_exclude_commands_can_be_customized(): void $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -1139,7 +1139,7 @@ public function test_exclude_commands_empty_traces_everything(): void $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -1159,7 +1159,7 @@ public function test_messenger_context_storage_wired_even_when_propagation_disab $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -1182,7 +1182,7 @@ public function test_messenger_flush_subscriber_is_registered_and_tagged_when_en $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -1202,7 +1202,7 @@ public function test_messenger_flush_subscriber_absent_when_messenger_disabled() $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -1305,7 +1305,7 @@ public function test_processor_uses_named_error_handler(): void $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -1336,7 +1336,7 @@ public function test_max_batch_age_is_passed_to_batching_processor_definitions() $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -1365,7 +1365,7 @@ public function test_max_batch_age_defaults_to_null_in_batching_processor_defini $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], @@ -1394,7 +1394,7 @@ public function test_provider_uses_named_error_handler(): void $container->setParameter('kernel.environment', 'test'); $container->setParameter('kernel.project_dir', sys_get_temp_dir()); $container->setParameter('kernel.build_dir', sys_get_temp_dir()); - $extension = (new FlowTelemetryBundle())->getContainerExtension(); + $extension = new FlowTelemetryBundle()->getContainerExtension(); assert($extension !== null); $extension->load([[ 'resource' => [], diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Integration/Instrumentation/Cache/TraceableCacheAdapterTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Integration/Instrumentation/Cache/TraceableCacheAdapterTest.php index dbbef93bbe..4ae49692d3 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Integration/Instrumentation/Cache/TraceableCacheAdapterTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Integration/Instrumentation/Cache/TraceableCacheAdapterTest.php @@ -681,7 +681,7 @@ public function test_traceable_adapter_records_error_span_when_operation_fails() /** @var TraceableCacheAdapter $cache */ $cache = $container->get('test.cache.app'); - $item = (new ArrayCacheAdapter())->getItem('save-key'); + $item = new ArrayCacheAdapter()->getItem('save-key'); $failures = 0; @@ -815,7 +815,7 @@ public function test_tag_aware_adapter_records_error_span_when_operation_fails() /** @var TagAwareTraceableCacheAdapter $cache */ $cache = $container->get('test.cache.tags'); - $item = (new TagAwareArrayCacheAdapter())->getItem('save-key'); + $item = new TagAwareArrayCacheAdapter()->getItem('save-key'); $failures = 0; diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Mother/CachePoolContainerMother.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Mother/CachePoolContainerMother.php index 135fce1daf..717a25626f 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Mother/CachePoolContainerMother.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Mother/CachePoolContainerMother.php @@ -27,25 +27,25 @@ public static function frameworkPoolGraph(): ContainerBuilder $container->setDefinition( 'cache.system', - (new ChildDefinition('cache.adapter.system')) + new ChildDefinition('cache.adapter.system') ->addTag('cache.pool') ->setPublic(true), ); $container->setDefinition( 'cache.validator', - (new ChildDefinition('cache.system')) + new ChildDefinition('cache.system') ->addTag('cache.pool') ->setPublic(true), ); $container->setDefinition( 'cache.app', - (new ChildDefinition('cache.adapter.filesystem')) + new ChildDefinition('cache.adapter.filesystem') ->addTag('cache.pool') ->setPublic(true), ); $container->setDefinition( 'cache.doctrine.orm.default.result', - (new ChildDefinition('cache.app')) + new ChildDefinition('cache.app') ->addTag('cache.pool') ->setPublic(true), ); diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Attribute/WithTelemetryChannelTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Attribute/WithTelemetryChannelTest.php index de6571cf95..15abddfeca 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Attribute/WithTelemetryChannelTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Attribute/WithTelemetryChannelTest.php @@ -15,12 +15,12 @@ final class WithTelemetryChannelTest extends TestCase { public function test_exposes_the_channel(): void { - static::assertSame('events', (new WithTelemetryChannel('events'))->channel); + static::assertSame('events', new WithTelemetryChannel('events')->channel); } public function test_is_a_class_targeted_attribute(): void { - $attributes = (new ReflectionClass(WithTelemetryChannel::class))->getAttributes(Attribute::class); + $attributes = new ReflectionClass(WithTelemetryChannel::class)->getAttributes(Attribute::class); static::assertCount(1, $attributes); static::assertSame(Attribute::TARGET_CLASS, $attributes[0]->newInstance()->flags); diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ArgumentResolverTelemetryPassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ArgumentResolverTelemetryPassTest.php index 5ff68d33a7..615bc9c769 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ArgumentResolverTelemetryPassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ArgumentResolverTelemetryPassTest.php @@ -19,7 +19,7 @@ public function test_no_op_when_parameter_absent(): void $container = new ContainerBuilder(); $container->setDefinition('argument_resolver', new Definition()); - (new ArgumentResolverTelemetryPass())->process($container); + new ArgumentResolverTelemetryPass()->process($container); static::assertFalse($container->hasDefinition('argument_resolver.flow_telemetry')); } @@ -30,7 +30,7 @@ public function test_no_op_when_parameter_false(): void $container->setParameter('flow.telemetry.http_kernel.trace_controller_arguments', false); $container->setDefinition('argument_resolver', new Definition()); - (new ArgumentResolverTelemetryPass())->process($container); + new ArgumentResolverTelemetryPass()->process($container); static::assertFalse($container->hasDefinition('argument_resolver.flow_telemetry')); } @@ -41,7 +41,7 @@ public function test_decorates_argument_resolver_when_enabled(): void $container->setParameter('flow.telemetry.http_kernel.trace_controller_arguments', true); $container->setDefinition('argument_resolver', new Definition()); - (new ArgumentResolverTelemetryPass())->process($container); + new ArgumentResolverTelemetryPass()->process($container); $decorator = $container->getDefinition('argument_resolver.flow_telemetry'); static::assertSame(TracingArgumentResolver::class, $decorator->getClass()); diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ArgumentValueResolverTelemetryPassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ArgumentValueResolverTelemetryPassTest.php index 54da5c7891..71e5e6f668 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ArgumentValueResolverTelemetryPassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ArgumentValueResolverTelemetryPassTest.php @@ -20,10 +20,10 @@ public function test_no_op_when_parameter_absent(): void $container = new ContainerBuilder(); $container->setDefinition( 'value_resolver.test', - (new Definition())->addTag('controller.argument_value_resolver'), + new Definition()->addTag('controller.argument_value_resolver'), ); - (new ArgumentValueResolverTelemetryPass())->process($container); + new ArgumentValueResolverTelemetryPass()->process($container); static::assertFalse($container->hasDefinition('value_resolver.test.flow_telemetry')); } @@ -34,10 +34,10 @@ public function test_no_op_when_parameter_false(): void $container->setParameter('flow.telemetry.http_kernel.trace_controller_argument_resolvers', false); $container->setDefinition( 'value_resolver.test', - (new Definition())->addTag('controller.argument_value_resolver'), + new Definition()->addTag('controller.argument_value_resolver'), ); - (new ArgumentValueResolverTelemetryPass())->process($container); + new ArgumentValueResolverTelemetryPass()->process($container); static::assertFalse($container->hasDefinition('value_resolver.test.flow_telemetry')); } @@ -46,22 +46,16 @@ public function test_decorates_concrete_tagged_resolvers_only(): void { $container = new ContainerBuilder(); $container->setParameter('flow.telemetry.http_kernel.trace_controller_argument_resolvers', true); - $container->setDefinition( - 'value_resolver.one', - (new Definition())->addTag('controller.argument_value_resolver'), - ); - $container->setDefinition( - 'value_resolver.two', - (new Definition())->addTag('controller.argument_value_resolver'), - ); + $container->setDefinition('value_resolver.one', new Definition()->addTag('controller.argument_value_resolver')); + $container->setDefinition('value_resolver.two', new Definition()->addTag('controller.argument_value_resolver')); $container->setDefinition( 'value_resolver.abstract', - (new Definition()) + new Definition() ->setAbstract(true) ->addTag('controller.argument_value_resolver'), ); - (new ArgumentValueResolverTelemetryPass())->process($container); + new ArgumentValueResolverTelemetryPass()->process($container); static::assertFalse($container->hasDefinition('value_resolver.abstract.flow_telemetry')); @@ -84,12 +78,12 @@ public function test_a_resolver_that_also_listens_to_events_is_not_decorated(str $container->setParameter('flow.telemetry.http_kernel.trace_controller_argument_resolvers', true); $container->setDefinition( 'value_resolver.listening', - (new Definition()) + new Definition() ->addTag('controller.argument_value_resolver') ->addTag($eventTag), ); - (new ArgumentValueResolverTelemetryPass())->process($container); + new ArgumentValueResolverTelemetryPass()->process($container); static::assertFalse($container->hasDefinition('value_resolver.listening.flow_telemetry')); } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/CacheTelemetryPassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/CacheTelemetryPassTest.php index 482765012f..a62b33ab29 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/CacheTelemetryPassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/CacheTelemetryPassTest.php @@ -22,7 +22,7 @@ public function test_abstract_adapter_templates_are_skipped(): void { $container = CachePoolContainerMother::frameworkPoolGraph(); - (new CacheTelemetryPass())->process($container); + new CacheTelemetryPass()->process($container); static::assertFalse($container->hasDefinition('cache.adapter.system.flow_telemetry')); static::assertFalse($container->hasDefinition('cache.adapter.filesystem.flow_telemetry')); @@ -32,7 +32,7 @@ public function test_pool_inheriting_its_class_from_a_parent_is_traced(): void { $container = CachePoolContainerMother::frameworkPoolGraph(); - (new CacheTelemetryPass())->process($container); + new CacheTelemetryPass()->process($container); static::assertSame( TraceableCacheAdapter::class, @@ -48,7 +48,7 @@ public function test_pool_inheriting_through_multiple_levels_is_traced(): void { $container = CachePoolContainerMother::frameworkPoolGraph(); - (new CacheTelemetryPass())->process($container); + new CacheTelemetryPass()->process($container); static::assertSame( TraceableCacheAdapter::class, @@ -60,7 +60,7 @@ public function test_tag_aware_pool_gets_the_tag_aware_decorator(): void { $container = CachePoolContainerMother::frameworkPoolGraph(); - (new CacheTelemetryPass())->process($container); + new CacheTelemetryPass()->process($container); static::assertSame( TagAwareTraceableCacheAdapter::class, @@ -72,7 +72,7 @@ public function test_pool_declared_as_a_parameter_is_traced(): void { $container = CachePoolContainerMother::frameworkPoolGraph(); - (new CacheTelemetryPass())->process($container); + new CacheTelemetryPass()->process($container); static::assertSame( TraceableCacheAdapter::class, @@ -86,7 +86,7 @@ public function test_tag_aware_pool_declared_as_a_parameter_gets_the_tag_aware_d $container->setParameter('app.tag_aware_pool.class', RedisTagAwareAdapter::class); $container->register('app.param_tag_aware_pool', '%app.tag_aware_pool.class%')->addTag('cache.pool'); - (new CacheTelemetryPass())->process($container); + new CacheTelemetryPass()->process($container); static::assertSame( TagAwareTraceableCacheAdapter::class, @@ -99,7 +99,7 @@ public function test_pool_excluded_by_exact_id_is_left_untouched(): void $container = CachePoolContainerMother::frameworkPoolGraph(); $container->setParameter('flow.telemetry.cache.exclude_pools', ['cache.system']); - (new CacheTelemetryPass())->process($container); + new CacheTelemetryPass()->process($container); static::assertFalse($container->hasDefinition('cache.system.flow_telemetry')); static::assertTrue($container->hasDefinition('cache.validator.flow_telemetry')); @@ -110,7 +110,7 @@ public function test_pool_excluded_by_regex_is_left_untouched(): void $container = CachePoolContainerMother::frameworkPoolGraph(); $container->setParameter('flow.telemetry.cache.exclude_pools', ['/^cache\.validator.*/']); - (new CacheTelemetryPass())->process($container); + new CacheTelemetryPass()->process($container); static::assertFalse($container->hasDefinition('cache.validator.flow_telemetry')); static::assertTrue($container->hasDefinition('cache.system.flow_telemetry')); @@ -122,7 +122,7 @@ public function test_nothing_is_decorated_when_disabled(): void $container->setParameter('flow.telemetry.cache.enabled', false); $container->setParameter('flow.telemetry.cache.flush_deferred', true); - (new CacheTelemetryPass())->process($container); + new CacheTelemetryPass()->process($container); static::assertFalse($container->hasDefinition('cache.system.flow_telemetry')); static::assertFalse($container->hasDefinition('app.redis_pool.flow_telemetry')); @@ -134,7 +134,7 @@ public function test_deferred_flush_subscriber_collects_the_newly_traced_pools() $container = CachePoolContainerMother::frameworkPoolGraph(); $container->setParameter('flow.telemetry.cache.flush_deferred', true); - (new CacheTelemetryPass())->process($container); + new CacheTelemetryPass()->process($container); /** @var mixed $innerPools */ $innerPools = $container->getDefinition('flow.telemetry.cache.deferred_flush_subscriber')->getArgument(0); diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ChannelLoggerPassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ChannelLoggerPassTest.php index 3f81f11cc9..ac34fb3ff0 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ChannelLoggerPassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ChannelLoggerPassTest.php @@ -24,7 +24,7 @@ public function test_app_channel_is_synthesized_like_any_other_channel(): void { $container = ChannelLoggerMother::taggedConsumerContainer('app'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertTrue($container->hasDefinition('flow.telemetry.app.logger')); static::assertSame( @@ -40,7 +40,7 @@ public function test_default_channel_reuses_the_always_present_default_logger(): $container->setDefinition('flow.telemetry.default.logger', $existing); $container->setDefinition('flow.telemetry.default.logger.psr3', new Definition(Logger::class)); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertSame($existing, $container->getDefinition('flow.telemetry.default.logger')); static::assertSame( @@ -53,7 +53,7 @@ public function test_binds_channel_logger_to_tagged_service(): void { $container = ChannelLoggerMother::taggedConsumerContainer('events'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertSame( 'flow.telemetry.events.logger.psr3', @@ -65,7 +65,7 @@ public function test_binds_native_logger_to_tagged_service(): void { $container = ChannelLoggerMother::taggedConsumerContainer('events'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertSame( 'flow.telemetry.events.logger', @@ -77,7 +77,7 @@ public function test_app_channel_binds_its_own_native_logger(): void { $container = ChannelLoggerMother::taggedConsumerContainer('app'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertSame( 'flow.telemetry.app.logger', @@ -89,7 +89,7 @@ public function test_registers_native_logger_named_argument_alias(): void { $container = ChannelLoggerMother::taggedConsumerContainer('events'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); $aliasId = Logger::class . ' $eventsLogger'; static::assertTrue($container->hasAlias($aliasId)); @@ -103,7 +103,7 @@ public function test_does_not_override_a_declared_logger(): void $container->setDefinition('flow.telemetry.events.logger', $declared); $container->setDefinition('flow.telemetry.events.logger.psr3', new Definition(Logger::class)); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertSame($declared, $container->getDefinition('flow.telemetry.events.logger')); } @@ -115,7 +115,7 @@ public function test_empty_channel_attribute_throws(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('missing the required non-empty "channel" attribute'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); } public function test_channel_parameter_resolving_to_empty_throws(): void @@ -126,7 +126,7 @@ public function test_channel_parameter_resolving_to_empty_throws(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('did not resolve to a non-empty string'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); } public function test_missing_channel_attribute_throws(): void @@ -139,14 +139,14 @@ public function test_missing_channel_attribute_throws(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Service "consumer" is tagged'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); } public function test_registers_camel_cased_named_argument_alias(): void { $container = ChannelLoggerMother::taggedConsumerContainer('http_client'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); $aliasId = LoggerInterface::class . ' $httpClientLogger'; static::assertTrue($container->hasAlias($aliasId)); @@ -158,7 +158,7 @@ public function test_rewrites_explicit_logger_reference_in_arguments(): void $container = ChannelLoggerMother::taggedConsumerContainer('events'); $container->getDefinition('consumer')->setArgument(0, new Reference('logger')); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertSame( 'flow.telemetry.events.logger.psr3', @@ -170,7 +170,7 @@ public function test_synthesizes_channel_logger_with_log_channel_on_both_scope_a { $container = ChannelLoggerMother::taggedConsumerContainer('events'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); $logger = $container->getDefinition('flow.telemetry.events.logger'); @@ -192,7 +192,7 @@ public function test_channel_attribute_target_scope_places_log_channel_on_scope_ $container = ChannelLoggerMother::taggedConsumerContainer('events'); $container->setParameter('flow.telemetry.channel_attribute_target', 'scope'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); $logger = $container->getDefinition('flow.telemetry.events.logger'); @@ -208,7 +208,7 @@ public function test_channel_attribute_target_signal_places_log_channel_on_signa $container = ChannelLoggerMother::taggedConsumerContainer('events'); $container->setParameter('flow.telemetry.channel_attribute_target', 'signal'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); $logger = $container->getDefinition('flow.telemetry.events.logger'); @@ -223,7 +223,7 @@ public function test_captures_framework_monolog_logger_channel(): void { $container = ChannelLoggerMother::frameworkConsumerContainer('request'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertSame( 'flow.telemetry.request.logger.psr3', @@ -237,7 +237,7 @@ public function test_does_not_capture_framework_channels_when_disabled(): void $container->setParameter('flow.telemetry.capture_framework_channels', false); $container->getDefinition('framework.consumer')->setArgument(0, new Reference('logger')); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertSame('logger', (string) $container->getDefinition('framework.consumer')->getArgument(0)); static::assertArrayNotHasKey( @@ -255,7 +255,7 @@ public function test_explicit_channel_takes_precedence_over_framework_channel(): $consumer->addTag(ChannelLoggerPass::TAG, ['channel' => 'events']); $container->setDefinition('consumer', $consumer); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertSame( 'flow.telemetry.events.logger.psr3', @@ -271,7 +271,7 @@ public function test_preserves_invalid_reference_behavior_when_rewriting(): void new Reference('logger', ContainerInterface::IGNORE_ON_INVALID_REFERENCE), ); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); // @mago-expect analysis:mixed-assignment $reference = $container->getDefinition('framework.consumer')->getArgument(0); @@ -284,7 +284,7 @@ public function test_registers_named_argument_alias_for_framework_channel(): voi { $container = ChannelLoggerMother::frameworkConsumerContainer('http_client'); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); $aliasId = LoggerInterface::class . ' $httpClientLogger'; static::assertTrue($container->hasAlias($aliasId)); @@ -296,7 +296,7 @@ public function test_rewrites_logger_reference_in_method_call(): void $container = ChannelLoggerMother::frameworkConsumerContainer('cache'); $container->getDefinition('framework.consumer')->addMethodCall('setLogger', [new Reference('logger')]); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); // @mago-expect analysis:mixed-assignment $call = $container->getDefinition('framework.consumer')->getMethodCalls()[0] ?? null; @@ -316,7 +316,7 @@ public function test_skips_framework_tag_whose_channel_resolves_to_empty(): void $container->setParameter('flow.test.channel', ''); $container->getDefinition('framework.consumer')->setArgument(0, new Reference('logger')); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertSame('logger', (string) $container->getDefinition('framework.consumer')->getArgument(0)); } @@ -330,7 +330,7 @@ public function test_skips_framework_tag_without_a_channel(): void $consumer->setArgument(0, new Reference('logger')); $container->setDefinition('framework.consumer', $consumer); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertSame('logger', (string) $container->getDefinition('framework.consumer')->getArgument(0)); } @@ -340,7 +340,7 @@ public function test_still_routes_explicitly_tagged_services_when_telemetry_is_d $container = ChannelLoggerMother::taggedConsumerContainer('events'); $container->setParameter('flow.telemetry.enabled', false); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertTrue($container->hasDefinition('flow.telemetry.events.logger')); static::assertSame( @@ -355,7 +355,7 @@ public function test_does_not_capture_framework_channels_when_telemetry_is_disab $container->setParameter('flow.telemetry.enabled', false); $container->getDefinition('framework.consumer')->setArgument(0, new Reference('logger')); - (new ChannelLoggerPass())->process($container); + new ChannelLoggerPass()->process($container); static::assertSame('logger', (string) $container->getDefinition('framework.consumer')->getArgument(0)); static::assertArrayNotHasKey( diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ControllerResolverTelemetryPassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ControllerResolverTelemetryPassTest.php index 33ca7de1a0..31663821af 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ControllerResolverTelemetryPassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ControllerResolverTelemetryPassTest.php @@ -19,7 +19,7 @@ public function test_no_op_when_parameter_absent(): void $container = new ContainerBuilder(); $container->setDefinition('controller_resolver', new Definition()); - (new ControllerResolverTelemetryPass())->process($container); + new ControllerResolverTelemetryPass()->process($container); static::assertFalse($container->hasDefinition('controller_resolver.flow_telemetry')); } @@ -30,7 +30,7 @@ public function test_no_op_when_parameter_false(): void $container->setParameter('flow.telemetry.http_kernel.trace_controller_resolution', false); $container->setDefinition('controller_resolver', new Definition()); - (new ControllerResolverTelemetryPass())->process($container); + new ControllerResolverTelemetryPass()->process($container); static::assertFalse($container->hasDefinition('controller_resolver.flow_telemetry')); } @@ -41,7 +41,7 @@ public function test_decorates_controller_resolver_when_enabled(): void $container->setParameter('flow.telemetry.http_kernel.trace_controller_resolution', true); $container->setDefinition('controller_resolver', new Definition()); - (new ControllerResolverTelemetryPass())->process($container); + new ControllerResolverTelemetryPass()->process($container); $decorator = $container->getDefinition('controller_resolver.flow_telemetry'); static::assertSame(TracingControllerResolver::class, $decorator->getClass()); diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/DBALTelemetryPassOrderingTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/DBALTelemetryPassOrderingTest.php index f52c640812..23c150d136 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/DBALTelemetryPassOrderingTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/DBALTelemetryPassOrderingTest.php @@ -34,7 +34,7 @@ public function test_dbal_pass_runs_before_a_priority_zero_pass_registered_befor $consumer = new NoopCompilerPass(); $container->addCompilerPass($consumer, PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); - (new FlowTelemetryBundle())->build($container); + new FlowTelemetryBundle()->build($container); $passes = $container->getCompiler()->getPassConfig()->getBeforeOptimizationPasses(); $dbalIndex = null; @@ -61,7 +61,7 @@ public function test_dbal_pass_runs_before_a_priority_zero_pass_registered_after $container = new ContainerBuilder(); $container->setParameter('flow.telemetry.dbal.enabled', true); - (new FlowTelemetryBundle())->build($container); + new FlowTelemetryBundle()->build($container); $consumer = new NoopCompilerPass(); $container->addCompilerPass($consumer, PassConfig::TYPE_BEFORE_OPTIMIZATION, 0); diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/DBALTelemetryPassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/DBALTelemetryPassTest.php index 889772b169..7b8517db51 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/DBALTelemetryPassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/DBALTelemetryPassTest.php @@ -30,7 +30,7 @@ public function test_transaction_spans_mode_is_wired_into_the_middleware_definit $container->setParameter('flow.telemetry.dbal.transaction_spans', 'per_operation'); $container->setParameter('doctrine.connections', ['default' => 'doctrine.dbal.default_connection']); - (new DBALTelemetryPass())->process($container); + new DBALTelemetryPass()->process($container); static::assertSame( TransactionSpanMode::PER_OPERATION, @@ -44,7 +44,7 @@ public function test_transaction_spans_mode_defaults_to_grouped_when_parameter_a $container->setParameter('flow.telemetry.dbal.enabled', true); $container->setParameter('doctrine.connections', ['default' => 'doctrine.dbal.default_connection']); - (new DBALTelemetryPass())->process($container); + new DBALTelemetryPass()->process($container); static::assertSame( TransactionSpanMode::GROUPED, @@ -62,7 +62,7 @@ public function test_metric_and_parameter_config_is_wired_into_the_middleware_de $container->setParameter('flow.telemetry.dbal.max_parameter_length', 20); $container->setParameter('doctrine.connections', ['default' => 'doctrine.dbal.default_connection']); - (new DBALTelemetryPass())->process($container); + new DBALTelemetryPass()->process($container); $definition = $container->getDefinition('flow.telemetry.dbal.middleware.default'); static::assertFalse($definition->getArgument(6), 'collect_metrics'); diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/DefinitionClassResolverTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/DefinitionClassResolverTest.php index b2cf4688b5..e5453695e2 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/DefinitionClassResolverTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/DefinitionClassResolverTest.php @@ -22,7 +22,7 @@ public function test_resolves_a_directly_declared_class(): void static::assertSame( MockPsr18Client::class, - (new DefinitionClassResolver($container))->resolve($container->register( + new DefinitionClassResolver($container)->resolve($container->register( 'app.client', MockPsr18Client::class, )), @@ -37,7 +37,7 @@ public function test_resolves_a_class_from_a_direct_parent(): void static::assertSame( MockPsr18Client::class, - (new DefinitionClassResolver($container))->resolve($container->getDefinition('app.client')), + new DefinitionClassResolver($container)->resolve($container->getDefinition('app.client')), ); } @@ -47,13 +47,13 @@ public function test_resolves_a_class_through_a_multi_level_parent_chain(): void $container->register('app.grandparent_client', MockPsr18Client::class)->setAbstract(true); $container->setDefinition( 'app.parent_client', - (new ChildDefinition('app.grandparent_client'))->setAbstract(true), + new ChildDefinition('app.grandparent_client')->setAbstract(true), ); $container->setDefinition('app.client', new ChildDefinition('app.parent_client')); static::assertSame( MockPsr18Client::class, - (new DefinitionClassResolver($container))->resolve($container->getDefinition('app.client')), + new DefinitionClassResolver($container)->resolve($container->getDefinition('app.client')), ); } @@ -64,10 +64,7 @@ public function test_resolves_a_class_declared_as_a_parameter(): void static::assertSame( MockPsr18Client::class, - (new DefinitionClassResolver($container))->resolve($container->register( - 'app.client', - '%app.client.class%', - )), + new DefinitionClassResolver($container)->resolve($container->register('app.client', '%app.client.class%')), ); } @@ -77,7 +74,7 @@ public function test_returns_null_for_a_circular_parent_chain(): void $container->setDefinition('app.first', new ChildDefinition('app.second')); $container->setDefinition('app.second', new ChildDefinition('app.first')); - static::assertNull((new DefinitionClassResolver($container))->resolve($container->getDefinition('app.first'))); + static::assertNull(new DefinitionClassResolver($container)->resolve($container->getDefinition('app.first'))); } public function test_returns_null_for_a_definition_that_is_its_own_parent(): void @@ -85,23 +82,21 @@ public function test_returns_null_for_a_definition_that_is_its_own_parent(): voi $container = new ContainerBuilder(); $container->setDefinition('app.client', new ChildDefinition('app.client')); - static::assertNull((new DefinitionClassResolver($container))->resolve($container->getDefinition('app.client'))); + static::assertNull(new DefinitionClassResolver($container)->resolve($container->getDefinition('app.client'))); } public function test_returns_null_when_the_parent_service_is_missing(): void { $container = new ContainerBuilder(); - static::assertNull((new DefinitionClassResolver($container))->resolve( - new ChildDefinition('app.does_not_exist'), - )); + static::assertNull(new DefinitionClassResolver($container)->resolve(new ChildDefinition('app.does_not_exist'))); } public function test_returns_null_when_the_class_does_not_exist(): void { $container = new ContainerBuilder(); - static::assertNull((new DefinitionClassResolver($container))->resolve($container->register( + static::assertNull(new DefinitionClassResolver($container)->resolve($container->register( 'app.client', 'Flow\Bridge\Symfony\TelemetryBundle\Tests\NoSuchClass', ))); @@ -111,7 +106,7 @@ public function test_returns_null_when_the_class_parameter_does_not_exist(): voi { $container = new ContainerBuilder(); - static::assertNull((new DefinitionClassResolver($container))->resolve($container->register( + static::assertNull(new DefinitionClassResolver($container)->resolve($container->register( 'app.client', '%app.absent.class%', ))); @@ -122,7 +117,7 @@ public function test_returns_null_when_the_class_parameter_is_not_a_string(): vo $container = new ContainerBuilder(); $container->setParameter('app.client.class', [MockPsr18Client::class]); - static::assertNull((new DefinitionClassResolver($container))->resolve($container->register( + static::assertNull(new DefinitionClassResolver($container)->resolve($container->register( 'app.client', '%app.client.class%', ))); @@ -134,7 +129,7 @@ public function test_resolves_an_interface_declared_as_a_class(): void static::assertSame( AdapterInterface::class, - (new DefinitionClassResolver($container))->resolve($container->register( + new DefinitionClassResolver($container)->resolve($container->register( 'cache.adapter.system', AdapterInterface::class, )), @@ -143,6 +138,6 @@ public function test_resolves_an_interface_declared_as_a_class(): void public function test_returns_null_for_a_definition_without_a_class(): void { - static::assertNull((new DefinitionClassResolver(new ContainerBuilder()))->resolve(new Definition())); + static::assertNull(new DefinitionClassResolver(new ContainerBuilder())->resolve(new Definition())); } } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/FrameworkLoggerPassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/FrameworkLoggerPassTest.php index f51fef63c1..d24b9fb961 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/FrameworkLoggerPassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/FrameworkLoggerPassTest.php @@ -20,7 +20,7 @@ public function test_leaves_symfony_logger_untouched_when_telemetry_is_disabled( $container->setParameter('flow.telemetry.enabled', false); $container->setDefinition('logger', new Definition(SymfonyDefaultLogger::class)); - (new FrameworkLoggerPass())->process($container); + new FrameworkLoggerPass()->process($container); static::assertFalse($container->hasAlias('logger')); static::assertSame(SymfonyDefaultLogger::class, $container->getDefinition('logger')->getClass()); @@ -32,7 +32,7 @@ public function test_aliases_symfony_logger_when_telemetry_is_enabled(): void $container->setParameter('flow.telemetry.enabled', true); $container->setDefinition('logger', new Definition(SymfonyDefaultLogger::class)); - (new FrameworkLoggerPass())->process($container); + new FrameworkLoggerPass()->process($container); static::assertTrue($container->hasAlias('logger')); static::assertSame('flow.telemetry.default.logger.psr3', (string) $container->getAlias('logger')); @@ -44,7 +44,7 @@ public function test_symfony_logger_stays_when_logs_have_no_destination(): void $container->setParameter('flow.telemetry.logger_provider.has_destination', false); $container->setDefinition('logger', new Definition(SymfonyDefaultLogger::class)); - (new FrameworkLoggerPass())->process($container); + new FrameworkLoggerPass()->process($container); static::assertFalse($container->hasAlias('logger')); static::assertSame(SymfonyDefaultLogger::class, $container->getDefinition('logger')->getClass()); @@ -56,7 +56,7 @@ public function test_symfony_logger_is_aliased_when_logs_have_a_destination(): v $container->setParameter('flow.telemetry.logger_provider.has_destination', true); $container->setDefinition('logger', new Definition(SymfonyDefaultLogger::class)); - (new FrameworkLoggerPass())->process($container); + new FrameworkLoggerPass()->process($container); static::assertSame('flow.telemetry.default.logger.psr3', (string) $container->getAlias('logger')); } @@ -69,7 +69,7 @@ public function test_framework_logger_is_aliased_without_a_destination(): void $container->setDefinition('logger', new Definition(SymfonyDefaultLogger::class)); $container->setDefinition('flow.telemetry.default.logger.psr3', new Definition(SymfonyDefaultLogger::class)); - (new FrameworkLoggerPass())->process($container); + new FrameworkLoggerPass()->process($container); static::assertSame('flow.telemetry.default.logger.psr3', (string) $container->getAlias('logger')); } @@ -79,7 +79,7 @@ public function test_aliases_symfony_logger_when_enabled_parameter_is_absent(): $container = new ContainerBuilder(); $container->setDefinition('logger', new Definition(SymfonyDefaultLogger::class)); - (new FrameworkLoggerPass())->process($container); + new FrameworkLoggerPass()->process($container); static::assertTrue($container->hasAlias('logger')); } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/HttpClientTelemetryPassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/HttpClientTelemetryPassTest.php index 6a9d2d6b79..98497ba9d0 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/HttpClientTelemetryPassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/HttpClientTelemetryPassTest.php @@ -20,7 +20,7 @@ public function test_decorator_receives_url_sanitizer(): void $container->setParameter('flow.telemetry.http_client.enabled', true); $container->register('app.http_client', SuccessHttpClient::class)->addTag('http_client.client'); - (new HttpClientTelemetryPass())->process($container); + new HttpClientTelemetryPass()->process($container); static::assertEquals( new Reference('flow.telemetry.url_sanitizer'), diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/InterfaceAliasRepointerTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/InterfaceAliasRepointerTest.php index 50fc1dba59..cbba220350 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/InterfaceAliasRepointerTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/InterfaceAliasRepointerTest.php @@ -8,7 +8,6 @@ use Flow\Bridge\Symfony\TelemetryBundle\Instrumentation\Cache\TraceableCacheAdapter; use Flow\Bridge\Symfony\TelemetryBundle\Tests\Fixtures\Cache\ArrayCacheAdapter; use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\RequiresMethod; use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -18,14 +17,13 @@ #[CoversClass(InterfaceAliasRepointer::class)] final class InterfaceAliasRepointerTest extends TestCase { - #[RequiresMethod(NamespacedPoolInterface::class, 'withSubNamespace')] public function test_alias_the_decorator_cannot_satisfy_is_pointed_at_the_inner_service(): void { $container = new ContainerBuilder(); $container->register('cache.app', ArrayCacheAdapter::class); $container->setAlias(NamespacedPoolInterface::class, 'cache.app'); - (new InterfaceAliasRepointer($container))->repoint( + new InterfaceAliasRepointer($container)->repoint( 'cache.app', 'cache.app.flow_telemetry.inner', TraceableCacheAdapter::class, @@ -43,7 +41,7 @@ public function test_alias_the_decorator_satisfies_is_left_alone(): void $container->register('cache.app', ArrayCacheAdapter::class); $container->setAlias(CacheInterface::class, 'cache.app'); - (new InterfaceAliasRepointer($container))->repoint( + new InterfaceAliasRepointer($container)->repoint( 'cache.app', 'cache.app.flow_telemetry.inner', TraceableCacheAdapter::class, @@ -52,14 +50,13 @@ public function test_alias_the_decorator_satisfies_is_left_alone(): void static::assertSame('cache.app', (string) $container->getAlias(CacheInterface::class)); } - #[RequiresMethod(NamespacedPoolInterface::class, 'withSubNamespace')] public function test_alias_pointing_at_another_service_is_left_alone(): void { $container = new ContainerBuilder(); $container->register('cache.other', ArrayCacheAdapter::class); $container->setAlias(NamespacedPoolInterface::class, 'cache.other'); - (new InterfaceAliasRepointer($container))->repoint( + new InterfaceAliasRepointer($container)->repoint( 'cache.app', 'cache.app.flow_telemetry.inner', TraceableCacheAdapter::class, @@ -74,7 +71,7 @@ public function test_alias_that_is_not_an_interface_is_left_alone(): void $container->register('cache.app', ArrayCacheAdapter::class); $container->setAlias('cache.app.alias', 'cache.app'); - (new InterfaceAliasRepointer($container))->repoint( + new InterfaceAliasRepointer($container)->repoint( 'cache.app', 'cache.app.flow_telemetry.inner', TraceableCacheAdapter::class, @@ -83,14 +80,13 @@ public function test_alias_that_is_not_an_interface_is_left_alone(): void static::assertSame('cache.app', (string) $container->getAlias('cache.app.alias')); } - #[RequiresMethod(NamespacedPoolInterface::class, 'withSubNamespace')] public function test_public_visibility_is_preserved(): void { $container = new ContainerBuilder(); $container->register('cache.app', ArrayCacheAdapter::class); $container->setAlias(NamespacedPoolInterface::class, new Alias('cache.app', true)); - (new InterfaceAliasRepointer($container))->repoint( + new InterfaceAliasRepointer($container)->repoint( 'cache.app', 'cache.app.flow_telemetry.inner', TraceableCacheAdapter::class, @@ -99,14 +95,13 @@ public function test_public_visibility_is_preserved(): void static::assertTrue($container->getAlias(NamespacedPoolInterface::class)->isPublic()); } - #[RequiresMethod(NamespacedPoolInterface::class, 'withSubNamespace')] public function test_private_visibility_is_preserved(): void { $container = new ContainerBuilder(); $container->register('cache.app', ArrayCacheAdapter::class); $container->setAlias(NamespacedPoolInterface::class, new Alias('cache.app', false)); - (new InterfaceAliasRepointer($container))->repoint( + new InterfaceAliasRepointer($container)->repoint( 'cache.app', 'cache.app.flow_telemetry.inner', TraceableCacheAdapter::class, @@ -115,7 +110,6 @@ public function test_private_visibility_is_preserved(): void static::assertFalse($container->getAlias(NamespacedPoolInterface::class)->isPublic()); } - #[RequiresMethod(NamespacedPoolInterface::class, 'withSubNamespace')] public function test_deprecation_is_preserved(): void { $container = new ContainerBuilder(); @@ -126,7 +120,7 @@ public function test_deprecation_is_preserved(): void 'The "%alias_id%" alias is deprecated.', ); - (new InterfaceAliasRepointer($container))->repoint( + new InterfaceAliasRepointer($container)->repoint( 'cache.app', 'cache.app.flow_telemetry.inner', TraceableCacheAdapter::class, diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/MessengerTelemetryPassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/MessengerTelemetryPassTest.php index ada0ee0e3c..da553ba3b5 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/MessengerTelemetryPassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/MessengerTelemetryPassTest.php @@ -23,7 +23,7 @@ public function test_prepends_the_tracing_middleware_to_every_bus(): void $container->setParameter('messenger.bus.default.middleware', [['id' => 'add_bus_name_stamp_middleware']]); $container->setParameter('messenger.bus.commands.middleware', []); - (new MessengerTelemetryPass())->process($container); + new MessengerTelemetryPass()->process($container); static::assertSame( [['id' => 'flow.telemetry.messenger.middleware'], ['id' => 'add_bus_name_stamp_middleware']], @@ -41,7 +41,7 @@ public function test_is_a_no_op_when_the_middleware_is_not_registered(): void $container->register('messenger.bus.default')->addTag('messenger.bus'); $container->setParameter('messenger.bus.default.middleware', []); - (new MessengerTelemetryPass())->process($container); + new MessengerTelemetryPass()->process($container); static::assertSame([], $container->getParameter('messenger.bus.default.middleware')); } @@ -52,7 +52,7 @@ public function test_skips_buses_without_a_middleware_parameter(): void $container->setDefinition('flow.telemetry.messenger.middleware', new Definition(TracingMiddleware::class)); $container->register('messenger.bus.default')->addTag('messenger.bus'); - (new MessengerTelemetryPass())->process($container); + new MessengerTelemetryPass()->process($container); static::assertFalse($container->hasParameter('messenger.bus.default.middleware')); } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/OTLPAvailabilityPassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/OTLPAvailabilityPassTest.php index 58a417a5c1..b70f2d620f 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/OTLPAvailabilityPassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/OTLPAvailabilityPassTest.php @@ -17,7 +17,7 @@ public function test_does_not_set_otlp_available_when_telemetry_is_disabled(): v $container = new ContainerBuilder(); $container->setParameter('flow.telemetry.enabled', false); - (new OTLPAvailabilityPass())->process($container); + new OTLPAvailabilityPass()->process($container); static::assertFalse($container->hasParameter('flow.telemetry.otlp_available')); } @@ -27,7 +27,7 @@ public function test_sets_otlp_available_when_telemetry_is_enabled(): void $container = new ContainerBuilder(); $container->setParameter('flow.telemetry.enabled', true); - (new OTLPAvailabilityPass())->process($container); + new OTLPAvailabilityPass()->process($container); static::assertTrue($container->hasParameter('flow.telemetry.otlp_available')); } @@ -36,7 +36,7 @@ public function test_sets_otlp_available_when_enabled_parameter_is_absent(): voi { $container = new ContainerBuilder(); - (new OTLPAvailabilityPass())->process($container); + new OTLPAvailabilityPass()->process($container); static::assertTrue($container->hasParameter('flow.telemetry.otlp_available')); } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ProfilerSignalCapturePassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ProfilerSignalCapturePassTest.php index fe1dfba93f..4fd956ac3a 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ProfilerSignalCapturePassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ProfilerSignalCapturePassTest.php @@ -21,7 +21,7 @@ public function test_no_op_when_parameter_absent(): void $container = new ContainerBuilder(); $container->setDefinition('flow.telemetry.exporter.primary', new Definition(VoidExporter::class)); - (new ProfilerSignalCapturePass())->process($container); + new ProfilerSignalCapturePass()->process($container); static::assertFalse($container->hasDefinition('flow.telemetry.exporter.primary.profiler_tee')); } @@ -31,7 +31,7 @@ public function test_no_op_when_captured_list_empty(): void $container = new ContainerBuilder(); $container->setParameter('flow.telemetry.profiler.captured_exporters', []); - (new ProfilerSignalCapturePass())->process($container); + new ProfilerSignalCapturePass()->process($container); static::assertFalse($container->hasDefinition('flow.telemetry.exporter.primary.profiler_tee')); } @@ -42,7 +42,7 @@ public function test_decorates_captured_exporter_into_a_composite(): void $container->setDefinition('flow.telemetry.exporter.primary', new Definition(VoidExporter::class)); $container->setParameter('flow.telemetry.profiler.captured_exporters', ['flow.telemetry.exporter.primary']); - (new ProfilerSignalCapturePass())->process($container); + new ProfilerSignalCapturePass()->process($container); $decorator = $container->getDefinition('flow.telemetry.exporter.primary.profiler_tee'); static::assertSame(CompositeExporter::class, $decorator->getClass()); @@ -60,7 +60,7 @@ public function test_throws_when_captured_exporter_is_an_alias(): void $this->expectException(RuntimeException::class); - (new ProfilerSignalCapturePass())->process($container); + new ProfilerSignalCapturePass()->process($container); } public function test_throws_when_captured_exporter_is_not_defined(): void @@ -70,6 +70,6 @@ public function test_throws_when_captured_exporter_is_not_defined(): void $this->expectException(RuntimeException::class); - (new ProfilerSignalCapturePass())->process($container); + new ProfilerSignalCapturePass()->process($container); } } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/Psr18ClientTelemetryPassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/Psr18ClientTelemetryPassTest.php index e328fdaca7..3f77228745 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/Psr18ClientTelemetryPassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/Psr18ClientTelemetryPassTest.php @@ -44,7 +44,7 @@ public function test_child_of_an_abstract_psr18_parent_compiles_and_is_traced(): $container->register(Telemetry::class)->setSynthetic(true); $container->register('flow.telemetry.url_sanitizer', UrlSanitizer::class); $container->register('app.base_client', MockPsr18Client::class)->setAbstract(true); - $container->setDefinition('app.child_client', (new ChildDefinition('app.base_client'))->setPublic(true)); + $container->setDefinition('app.child_client', new ChildDefinition('app.base_client')->setPublic(true)); $container->addCompilerPass(new Psr18ClientTelemetryPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION); $container->compile(); @@ -87,7 +87,7 @@ public function test_decorator_receives_url_sanitizer(): void $container->setParameter('flow.telemetry.psr18_client.enabled', true); $container->register('psr18.http_client', MockPsr18Client::class); - (new Psr18ClientTelemetryPass())->process($container); + new Psr18ClientTelemetryPass()->process($container); static::assertEquals( new Reference('flow.telemetry.url_sanitizer'), diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ServiceIdPatternsTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ServiceIdPatternsTest.php index 1d8e800bcc..a03102587a 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ServiceIdPatternsTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/ServiceIdPatternsTest.php @@ -28,7 +28,7 @@ public function test_matching_a_service_id_against_patterns( string $serviceId, bool $expected, ): void { - static::assertSame($expected, (new ServiceIdPatterns($patterns))->matches($serviceId)); + static::assertSame($expected, new ServiceIdPatterns($patterns)->matches($serviceId)); } #[TestWith(['[unterminated'])] @@ -36,7 +36,7 @@ public function test_matching_a_service_id_against_patterns( #[TestWith(['cache.system'])] public function test_an_invalid_regular_expression_is_compared_as_an_exact_service_id(string $pattern): void { - static::assertTrue((new ServiceIdPatterns([$pattern]))->matches($pattern)); - static::assertFalse((new ServiceIdPatterns([$pattern]))->matches('some.other.service')); + static::assertTrue(new ServiceIdPatterns([$pattern])->matches($pattern)); + static::assertFalse(new ServiceIdPatterns([$pattern])->matches('some.other.service')); } } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/TraceContextUrlGeneratorPassTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/TraceContextUrlGeneratorPassTest.php index d73da6d020..68a7e4bcd1 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/TraceContextUrlGeneratorPassTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/DependencyInjection/Compiler/TraceContextUrlGeneratorPassTest.php @@ -18,7 +18,7 @@ public function test_does_nothing_when_generator_definition_is_absent(): void { $container = new ContainerBuilder(); - (new TraceContextUrlGeneratorPass())->process($container); + new TraceContextUrlGeneratorPass()->process($container); static::assertFalse($container->hasDefinition('flow.telemetry.trace_context_url_generator')); } @@ -29,7 +29,7 @@ public function test_keeps_generator_when_router_is_present(): void $container->register('flow.telemetry.trace_context_url_generator', stdClass::class); $container->register('router', stdClass::class); - (new TraceContextUrlGeneratorPass())->process($container); + new TraceContextUrlGeneratorPass()->process($container); static::assertTrue($container->hasDefinition('flow.telemetry.trace_context_url_generator')); } @@ -40,7 +40,7 @@ public function test_removes_generator_when_router_is_absent(): void $container->register('flow.telemetry.trace_context_url_generator', stdClass::class); $container->setAlias(TraceContextUrlGenerator::class, 'flow.telemetry.trace_context_url_generator'); - (new TraceContextUrlGeneratorPass())->process($container); + new TraceContextUrlGeneratorPass()->process($container); static::assertFalse($container->hasDefinition('flow.telemetry.trace_context_url_generator')); } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Cache/CacheDeferredFlushSubscriberTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Cache/CacheDeferredFlushSubscriberTest.php index 998af4f1c0..086a12f82b 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Cache/CacheDeferredFlushSubscriberTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Cache/CacheDeferredFlushSubscriberTest.php @@ -38,7 +38,7 @@ public function test_it_commits_deferred_writes_of_every_pool(): void $itemB->set('value'); $poolB->saveDeferred($itemB); - (new CacheDeferredFlushSubscriber([$poolA, $poolB], $telemetry))->onFlush(new stdClass()); + new CacheDeferredFlushSubscriber([$poolA, $poolB], $telemetry)->onFlush(new stdClass()); static::assertTrue($poolA->hasItem('a')); static::assertTrue($poolB->hasItem('b')); @@ -49,7 +49,7 @@ public function test_it_wraps_the_flush_in_a_single_cache_flush_span(): void $processor = new MemorySpanProcessor(new MemoryExporter()); $telemetry = TelemetryMother::withSpanProcessor($processor); - (new CacheDeferredFlushSubscriber([new ArrayCacheAdapter()], $telemetry))->onFlush(new stdClass()); + new CacheDeferredFlushSubscriber([new ArrayCacheAdapter()], $telemetry)->onFlush(new stdClass()); $spans = $processor->endedSpans(); static::assertCount(1, $spans); @@ -66,7 +66,7 @@ public function test_pool_writes_are_nested_under_the_flush_span(): void $item->set('value'); $pool->saveDeferred($item); - (new CacheDeferredFlushSubscriber([$pool], $telemetry))->onFlush(new stdClass()); + new CacheDeferredFlushSubscriber([$pool], $telemetry)->onFlush(new stdClass()); $byName = []; diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Console/CommandExclusionRuleTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Console/CommandExclusionRuleTest.php index 743e6ff029..38af449c16 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Console/CommandExclusionRuleTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Console/CommandExclusionRuleTest.php @@ -22,6 +22,6 @@ final class CommandExclusionRuleTest extends TestCase #[TestWith(['/^messenger:consume$/', 'messenger:consume-failed', false])] public function test_matches(string $pattern, string $commandName, bool $expected): void { - static::assertSame($expected, (new CommandExclusionRule($pattern))->matches($commandName)); + static::assertSame($expected, new CommandExclusionRule($pattern)->matches($commandName)); } } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Console/ConsoleAttributesTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Console/ConsoleAttributesTest.php index 1756121d0e..fc9abe0981 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Console/ConsoleAttributesTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Console/ConsoleAttributesTest.php @@ -13,7 +13,7 @@ final class ConsoleAttributesTest extends TestCase public function test_all_custom_keys_use_the_flow_prefix(): void { // @mago-expect analysis:mixed-assignment - foreach ((new ReflectionClass(ConsoleAttributes::class))->getConstants() as $name => $value) { + foreach (new ReflectionClass(ConsoleAttributes::class)->getConstants() as $name => $value) { static::assertIsString($value); static::assertStringStartsWith( 'flow.symfony.', diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Console/ConsoleLogOutputSubscriberTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Console/ConsoleLogOutputSubscriberTest.php index 865c497c86..ec0154f278 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Console/ConsoleLogOutputSubscriberTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Console/ConsoleLogOutputSubscriberTest.php @@ -26,7 +26,7 @@ public function test_on_command_pushes_the_output_into_the_processor(): void $processor = new ConsoleOutputLogProcessor(ConsoleVerbosityLevels::default()); $output = new BufferedOutput(); - (new ConsoleLogOutputSubscriber($processor))->onCommand( + new ConsoleLogOutputSubscriber($processor)->onCommand( new ConsoleCommandEvent(new Command('t'), new ArrayInput([]), $output), ); diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/DbAttributesTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/DbAttributesTest.php index bc01a53f12..17f0503d5d 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/DbAttributesTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/DbAttributesTest.php @@ -13,7 +13,7 @@ final class DbAttributesTest extends TestCase public function test_all_custom_keys_use_the_flow_prefix(): void { // @mago-expect analysis:mixed-assignment - foreach ((new ReflectionClass(DbAttributes::class))->getConstants() as $name => $value) { + foreach (new ReflectionClass(DbAttributes::class)->getConstants() as $name => $value) { static::assertIsString($value); static::assertStringStartsWith( 'flow.db.', diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/ParameterFormatterTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/ParameterFormatterTest.php index f1a621c355..8bbadd47fd 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/ParameterFormatterTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/ParameterFormatterTest.php @@ -14,7 +14,7 @@ final class ParameterFormatterTest extends TestCase { public function test_formats_scalars_null_and_bool(): void { - $formatted = (new ParameterFormatter())->format([42, null, true, 'x'], 10, 100); + $formatted = new ParameterFormatter()->format([42, null, true, 'x'], 10, 100); static::assertSame( [ @@ -29,14 +29,14 @@ public function test_formats_scalars_null_and_bool(): void public function test_formats_named_parameters(): void { - $formatted = (new ParameterFormatter())->format(['name' => 'John'], 10, 100); + $formatted = new ParameterFormatter()->format(['name' => 'John'], 10, 100); static::assertSame(['db.query.parameter.name' => 'John'], $formatted); } public function test_caps_number_of_parameters(): void { - $formatted = (new ParameterFormatter())->format([1, 2, 3, 4], 2, 100); + $formatted = new ParameterFormatter()->format([1, 2, 3, 4], 2, 100); static::assertSame( [ @@ -49,33 +49,33 @@ public function test_caps_number_of_parameters(): void public function test_truncates_long_values(): void { - $formatted = (new ParameterFormatter())->format(['abcdefghij'], 10, 4); + $formatted = new ParameterFormatter()->format(['abcdefghij'], 10, 4); static::assertSame(['db.query.parameter.0' => 'abcd...'], $formatted); } public function test_returns_empty_for_no_parameters(): void { - static::assertSame([], (new ParameterFormatter())->format([], 10, 100)); + static::assertSame([], new ParameterFormatter()->format([], 10, 100)); } public function test_does_not_truncate_when_max_length_is_zero(): void { - $formatted = (new ParameterFormatter())->format(['abcdefghij'], 10, 0); + $formatted = new ParameterFormatter()->format(['abcdefghij'], 10, 0); static::assertSame(['db.query.parameter.0' => 'abcdefghij'], $formatted); } public function test_formats_datetime(): void { - $formatted = (new ParameterFormatter())->format([new DateTimeImmutable('2026-01-01T00:00:00+00:00')], 10, 100); + $formatted = new ParameterFormatter()->format([new DateTimeImmutable('2026-01-01T00:00:00+00:00')], 10, 100); static::assertSame(['db.query.parameter.0' => '2026-01-01T00:00:00+00:00'], $formatted); } public function test_formats_arrays_as_json(): void { - $formatted = (new ParameterFormatter())->format([['a' => 1]], 10, 100); + $formatted = new ParameterFormatter()->format([['a' => 1]], 10, 100); static::assertSame(['db.query.parameter.0' => '{"a":1}'], $formatted); } @@ -89,7 +89,7 @@ public function __toString(): string } }; - $formatted = (new ParameterFormatter())->format([$stringable], 10, 100); + $formatted = new ParameterFormatter()->format([$stringable], 10, 100); static::assertSame(['db.query.parameter.0' => 'stringable'], $formatted); } @@ -100,7 +100,7 @@ public function test_formats_plain_objects_as_json(): void public int $id = 7; }; - $formatted = (new ParameterFormatter())->format([$object], 10, 100); + $formatted = new ParameterFormatter()->format([$object], 10, 100); static::assertSame(['db.query.parameter.0' => '{"id":7}'], $formatted); } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/SqlAttributesExtractorTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/SqlAttributesExtractorTest.php index ad3d0652f7..4f4fb53298 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/SqlAttributesExtractorTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/SqlAttributesExtractorTest.php @@ -23,7 +23,7 @@ final class SqlAttributesExtractorTest extends TestCase #[TestWith(['not a real sql statement', null, null])] public function test_extract(string $sql, ?string $operation, ?string $collection): void { - $attributes = (new SqlAttributesExtractor())->extract($sql); + $attributes = new SqlAttributesExtractor()->extract($sql); static::assertSame($operation, $attributes->operation); static::assertSame($collection, $attributes->collection); diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/TracingDriverTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/TracingDriverTest.php index f4c1a03105..b8efdb614f 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/TracingDriverTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Doctrine/DBAL/TracingDriverTest.php @@ -12,7 +12,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\DB2Platform; use Doctrine\DBAL\Platforms\MariaDBPlatform; -use Doctrine\DBAL\Platforms\MySQL80Platform; +use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Platforms\OraclePlatform; use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Platforms\SQLitePlatform; @@ -103,8 +103,7 @@ public function test_get_semantic_db_system_detects_mysql(): void $spanProcessor = new MemorySpanProcessor(new MemoryExporter()); $telemetry = TelemetryMother::withSpanProcessor($spanProcessor); - // @mago-expect analysis:deprecated-class - $platform = new MySQL80Platform(); + $platform = new MySQLPlatform(); $driver = $this->createMockDriverWithPlatform($platform); $tracingDriver = new TracingDriver($telemetry, $driver, 'default', maxSqlLength: 100); diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpClient/HttpClientAttributesTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpClient/HttpClientAttributesTest.php index c319769a50..1f650d47e8 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpClient/HttpClientAttributesTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpClient/HttpClientAttributesTest.php @@ -13,7 +13,7 @@ final class HttpClientAttributesTest extends TestCase public function test_all_custom_keys_use_the_flow_prefix(): void { // @mago-expect analysis:mixed-assignment - foreach ((new ReflectionClass(HttpClientAttributes::class))->getConstants() as $name => $value) { + foreach (new ReflectionClass(HttpClientAttributes::class)->getConstants() as $name => $value) { static::assertIsString($value); static::assertStringStartsWith( 'flow.http.', diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/HttpKernelAttributesTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/HttpKernelAttributesTest.php index 28eb79584c..956c301958 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/HttpKernelAttributesTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/HttpKernelAttributesTest.php @@ -13,7 +13,7 @@ final class HttpKernelAttributesTest extends TestCase public function test_all_custom_keys_use_the_flow_prefix(): void { // @mago-expect analysis:mixed-assignment - foreach ((new ReflectionClass(HttpKernelAttributes::class))->getConstants() as $name => $value) { + foreach (new ReflectionClass(HttpKernelAttributes::class)->getConstants() as $name => $value) { static::assertIsString($value); static::assertStringStartsWith( 'flow.symfony.', diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/RouteNamePathMapTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/RouteNamePathMapTest.php index c715742b43..9d43c9a8a5 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/RouteNamePathMapTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/RouteNamePathMapTest.php @@ -35,7 +35,7 @@ public function test_path_for_degrades_to_null_when_the_map_cannot_be_written(): static::assertNull($map->pathFor('order_show')); static::assertNull($map->pathFor('order_show')); - static::assertNull((new RouteNamePathMap($router, $directory, false))->pathFor('order_show')); + static::assertNull(new RouteNamePathMap($router, $directory, false)->pathFor('order_show')); static::assertSame(0, $router->getRouteCollectionCalls); }); } @@ -46,7 +46,7 @@ public function test_path_for_does_not_touch_the_router_once_the_map_is_written( $routes = new RouteCollection(); $routes->add('order_show', new Route('/orders/{id}')); - (new RouteNamePathMap(new FakeRouter($routes), $directory, false))->warmUp(''); + new RouteNamePathMap(new FakeRouter($routes), $directory, false)->warmUp(''); $router = new FakeRouter($routes); $map = new RouteNamePathMap($router, $directory, false); @@ -101,7 +101,7 @@ public function test_stale_map_is_rebuilt_in_debug_when_route_resources_change() $router = new FakeRouter($routes); - (new RouteNamePathMap($router, $directory, true))->warmUp(''); + new RouteNamePathMap($router, $directory, true)->warmUp(''); $changedRoutes = new RouteCollection(); $changedRoutes->add('order_show', new Route('/purchases/{id}')); @@ -111,7 +111,7 @@ public function test_stale_map_is_rebuilt_in_debug_when_route_resources_change() static::assertSame( '/purchases/{id}', - (new RouteNamePathMap($router, $directory, true))->pathFor('order_show'), + new RouteNamePathMap($router, $directory, true)->pathFor('order_show'), ); }); } @@ -122,7 +122,7 @@ public function test_warm_up_returns_the_map_file_for_preloading(): void $routes = new RouteCollection(); $routes->add('order_show', new Route('/orders/{id}')); - $preload = (new RouteNamePathMap(new FakeRouter($routes), $directory, false))->warmUp(''); + $preload = new RouteNamePathMap(new FakeRouter($routes), $directory, false)->warmUp(''); static::assertSame([$directory . '/flow_telemetry_route_paths.php'], $preload); static::assertFileExists($directory . '/flow_telemetry_route_paths.php'); @@ -142,7 +142,7 @@ public function test_warm_up_without_router_writes_nothing(): void public function test_warmer_is_optional(): void { TempDirectoryContext::with(static function (string $directory): void { - static::assertTrue((new RouteNamePathMap(null, $directory, false))->isOptional()); + static::assertTrue(new RouteNamePathMap(null, $directory, false)->isOptional()); }); } } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/TracingArgumentResolverTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/TracingArgumentResolverTest.php index de6778bd70..adaf21bb78 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/TracingArgumentResolverTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/TracingArgumentResolverTest.php @@ -41,10 +41,7 @@ public function test_traces_argument_resolution_when_request_span_present(): voi $request = new Request(); $request->attributes->set(HttpKernelSpanSubscriber::SPAN_ATTRIBUTE, $requestSpan); - $arguments = (new TracingArgumentResolver($inner, $telemetry))->getArguments( - $request, - static fn(): null => null, - ); + $arguments = new TracingArgumentResolver($inner, $telemetry)->getArguments($request, static fn(): null => null); static::assertSame(['a', 'b'], $arguments); @@ -63,7 +60,7 @@ public function test_passes_through_when_request_span_absent(): void $inner = $this->createStub(ArgumentResolverInterface::class); $inner->method('getArguments')->willReturn(['a']); - $arguments = (new TracingArgumentResolver($inner, $telemetry))->getArguments( + $arguments = new TracingArgumentResolver($inner, $telemetry)->getArguments( new Request(), static fn(): null => null, ); @@ -96,7 +93,7 @@ public function test_records_exception_when_inner_resolver_fails(): void $caught = false; try { - (new TracingArgumentResolver($inner, $telemetry))->getArguments($request, static fn(): null => null); + new TracingArgumentResolver($inner, $telemetry)->getArguments($request, static fn(): null => null); } catch (RuntimeException) { $caught = true; } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/TracingControllerResolverTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/TracingControllerResolverTest.php index cb4aea6b38..8935aef1f0 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/TracingControllerResolverTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/TracingControllerResolverTest.php @@ -42,7 +42,7 @@ public function test_traces_resolution_when_request_span_present(): void $request = new Request(); $request->attributes->set(HttpKernelSpanSubscriber::SPAN_ATTRIBUTE, $requestSpan); - static::assertSame($controller, (new TracingControllerResolver($inner, $telemetry))->getController($request)); + static::assertSame($controller, new TracingControllerResolver($inner, $telemetry)->getController($request)); $spans = $spanProcessor->endedSpans(); static::assertCount(1, $spans); @@ -62,7 +62,7 @@ public function test_passes_through_when_request_span_absent(): void static::assertSame( $controller, - (new TracingControllerResolver($inner, $telemetry))->getController(new Request()), + new TracingControllerResolver($inner, $telemetry)->getController(new Request()), ); static::assertCount(0, $spanProcessor->endedSpans()); } @@ -91,7 +91,7 @@ public function test_records_exception_when_inner_resolver_fails(): void $caught = false; try { - (new TracingControllerResolver($inner, $telemetry))->getController($request); + new TracingControllerResolver($inner, $telemetry)->getController($request); } catch (RuntimeException) { $caught = true; } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/TracingValueResolverTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/TracingValueResolverTest.php index bed2408b01..d1096a333c 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/TracingValueResolverTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/HttpKernel/TracingValueResolverTest.php @@ -45,7 +45,7 @@ public function test_traces_value_resolution_when_request_span_present(): void $request->attributes->set(HttpKernelSpanSubscriber::SPAN_ATTRIBUTE, $requestSpan); $argument = new ArgumentMetadata('id', 'int', false, false, null); - $resolved = iterator_to_array((new TracingValueResolver($inner, $telemetry))->resolve($request, $argument)); + $resolved = iterator_to_array(new TracingValueResolver($inner, $telemetry)->resolve($request, $argument)); static::assertSame(['resolved'], $resolved); @@ -66,7 +66,7 @@ public function test_passes_through_when_request_span_absent(): void $inner = $this->createStub(ValueResolverInterface::class); $inner->method('resolve')->willReturn(['resolved']); - $resolved = iterator_to_array((new TracingValueResolver($inner, $telemetry))->resolve( + $resolved = iterator_to_array(new TracingValueResolver($inner, $telemetry)->resolve( new Request(), new ArgumentMetadata('id', 'int', false, false, null), )); @@ -100,7 +100,7 @@ public function test_records_exception_when_inner_resolver_fails(): void $caught = false; try { - iterator_to_array((new TracingValueResolver($inner, $telemetry))->resolve($request, $argument)); + iterator_to_array(new TracingValueResolver($inner, $telemetry)->resolve($request, $argument)); } catch (RuntimeException) { $caught = true; } diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Messenger/AsyncCurlTransportTickSubscriberTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Messenger/AsyncCurlTransportTickSubscriberTest.php index ad6a90588f..fbc0fa3600 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Messenger/AsyncCurlTransportTickSubscriberTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Messenger/AsyncCurlTransportTickSubscriberTest.php @@ -45,7 +45,7 @@ public function dispatch(object $message, array $stamps = []): Envelope } }; - (new AsyncCurlTransportTickSubscriber($transports))->onWorkerRunning( + new AsyncCurlTransportTickSubscriber($transports)->onWorkerRunning( new WorkerRunningEvent(new Worker([], $bus), false), ); diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Messenger/MessengerAttributesTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Messenger/MessengerAttributesTest.php index c2c8267e06..00b2d3e0d5 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Messenger/MessengerAttributesTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Messenger/MessengerAttributesTest.php @@ -13,7 +13,7 @@ final class MessengerAttributesTest extends TestCase public function test_all_custom_keys_use_the_flow_prefix(): void { // @mago-expect analysis:mixed-assignment - foreach ((new ReflectionClass(MessengerAttributes::class))->getConstants() as $name => $value) { + foreach (new ReflectionClass(MessengerAttributes::class)->getConstants() as $name => $value) { static::assertIsString($value); static::assertStringStartsWith( 'flow.messenger.', diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Messenger/MessengerFlushSubscriberTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Messenger/MessengerFlushSubscriberTest.php index 99dc4e2ee6..b01acb9101 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Messenger/MessengerFlushSubscriberTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Instrumentation/Messenger/MessengerFlushSubscriberTest.php @@ -28,7 +28,7 @@ public function test_flush_on_handled_exports_buffered_span(): void static::assertCount(0, $exporter->spans()); - (new MessengerFlushSubscriber($telemetry))->onMessageHandled( + new MessengerFlushSubscriber($telemetry)->onMessageHandled( new WorkerMessageHandledEvent(new Envelope(new stdClass()), 'receiver'), ); @@ -60,7 +60,7 @@ public function test_flush_on_failed_exports_buffered_span(): void static::assertCount(0, $exporter->spans()); - (new MessengerFlushSubscriber($telemetry))->onMessageFailed( + new MessengerFlushSubscriber($telemetry)->onMessageFailed( new WorkerMessageFailedEvent(new Envelope(new stdClass()), 'receiver', new RuntimeException('boom')), ); diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Logger/ConsoleOutputLogProcessorTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Logger/ConsoleOutputLogProcessorTest.php index 365704b246..01d777abea 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Logger/ConsoleOutputLogProcessorTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Logger/ConsoleOutputLogProcessorTest.php @@ -29,7 +29,7 @@ public function test_debug_verbosity_writes_debug(): void public function test_flush_is_a_noop_returning_true(): void { - static::assertTrue((new ConsoleOutputLogProcessor(ConsoleVerbosityLevels::default()))->flush()); + static::assertTrue(new ConsoleOutputLogProcessor(ConsoleVerbosityLevels::default())->flush()); } public function test_includes_attributes(): void diff --git a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Propagation/TraceContextProviderTest.php b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Propagation/TraceContextProviderTest.php index 398220b593..58b59c950a 100644 --- a/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Propagation/TraceContextProviderTest.php +++ b/src/bridge/symfony/telemetry-bundle/tests/Flow/Bridge/Symfony/TelemetryBundle/Tests/Unit/Propagation/TraceContextProviderTest.php @@ -39,11 +39,11 @@ public function test_current_emits_the_request_span_traceparent(): void $requestStack = new RequestStack(); $requestStack->push($request); - $context = (new TraceContextProvider( + $context = new TraceContextProvider( new W3CTraceContext(), new MemoryContextStorage(), $requestStack, - ))->current(); + )->current(); static::assertArrayHasKey('traceparent', $context); static::assertStringStartsWith('00-' . self::TRACE_ID . '-' . self::SPAN_ID . '-', $context['traceparent']); @@ -64,7 +64,7 @@ public function test_traceparent_returns_the_request_span_w3c_value(): void static::assertStringStartsWith( '00-' . self::TRACE_ID . '-' . self::SPAN_ID . '-', - (new TraceContextProvider(new W3CTraceContext(), new MemoryContextStorage(), $requestStack))->traceparent(), + new TraceContextProvider(new W3CTraceContext(), new MemoryContextStorage(), $requestStack)->traceparent(), ); } @@ -82,12 +82,12 @@ public function test_request_span_wins_over_the_active_inner_span(): void $requestStack->push($request); $storage = new MemoryContextStorage(); - $storage->attach((new Context())->withActiveSpan(SpanContext::create( + $storage->attach(new Context()->withActiveSpan(SpanContext::create( TraceId::fromHex(self::TRACE_ID), SpanId::fromHex('aaaaaaaaaaaaaaaa'), ))); - $context = (new TraceContextProvider(new W3CTraceContext(), $storage, $requestStack))->current(); + $context = new TraceContextProvider(new W3CTraceContext(), $storage, $requestStack)->current(); static::assertStringStartsWith('00-' . self::TRACE_ID . '-' . self::SPAN_ID . '-', $context['traceparent']); static::assertStringNotContainsString('aaaaaaaaaaaaaaaa', $context['traceparent']); @@ -106,11 +106,9 @@ public function test_append_to_url_adds_request_context_to_a_plain_url(): void $requestStack = new RequestStack(); $requestStack->push($request); - $url = (new TraceContextProvider( - new W3CTraceContext(), - new MemoryContextStorage(), - $requestStack, - ))->appendToUrl('/next'); + $url = new TraceContextProvider(new W3CTraceContext(), new MemoryContextStorage(), $requestStack)->appendToUrl( + '/next', + ); static::assertStringStartsWith('/next?traceparent=00-' . self::TRACE_ID, $url); } @@ -128,11 +126,9 @@ public function test_append_to_url_uses_ampersand_when_a_query_already_exists(): $requestStack = new RequestStack(); $requestStack->push($request); - $url = (new TraceContextProvider( - new W3CTraceContext(), - new MemoryContextStorage(), - $requestStack, - ))->appendToUrl('/next?page=2'); + $url = new TraceContextProvider(new W3CTraceContext(), new MemoryContextStorage(), $requestStack)->appendToUrl( + '/next?page=2', + ); static::assertStringContainsString('page=2&traceparent=00-' . self::TRACE_ID, $url); } diff --git a/src/bridge/telemetry/otlp/composer.json b/src/bridge/telemetry/otlp/composer.json index f2867c6da1..45fabaddb5 100644 --- a/src/bridge/telemetry/otlp/composer.json +++ b/src/bridge/telemetry/otlp/composer.json @@ -15,7 +15,7 @@ "homepage": "https://github.com/flow-php/flow", "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/telemetry": "self.version" }, "require-dev": { @@ -25,7 +25,7 @@ "nyholm/psr7": "^1.8", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "symfony/http-client": "^6.4 || ^7.4 || ^8.0" + "symfony/http-client": "^7.4 || ^8.0" }, "suggest": { "ext-grpc": "Required for gRPC transport", diff --git a/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Exporter/OTLPExporterTest.php b/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Exporter/OTLPExporterTest.php index f4e881237c..3b7b952079 100644 --- a/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Exporter/OTLPExporterTest.php +++ b/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Exporter/OTLPExporterTest.php @@ -66,7 +66,7 @@ public function test_export_logs_calls_transport(): void $transport = new RecordingTransport(); $exporter = new OTLPExporter($transport); $entry = new LogEntry( - (new LogRecord()) + new LogRecord() ->setSeverity(Severity::INFO) ->setBody('hello'), ResourceMother::default(), diff --git a/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/AsyncCurlTransportOptionsTest.php b/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/AsyncCurlTransportOptionsTest.php index 21b5e7d741..f7c24cd917 100644 --- a/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/AsyncCurlTransportOptionsTest.php +++ b/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/AsyncCurlTransportOptionsTest.php @@ -63,14 +63,14 @@ public function test_default_shutdown_timeout(): void public function test_with_pump_timeout(): void { - $options = (new AsyncCurlTransportOptions())->withPumpTimeout(250); + $options = new AsyncCurlTransportOptions()->withPumpTimeout(250); static::assertSame(250, $options->pumpTimeoutMs()); } public function test_with_pump_timeout_accepts_zero(): void { - $options = (new AsyncCurlTransportOptions())->withPumpTimeout(0); + $options = new AsyncCurlTransportOptions()->withPumpTimeout(0); static::assertSame(0, $options->pumpTimeoutMs()); } @@ -80,7 +80,7 @@ public function test_with_pump_timeout_rejects_negative_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Pump timeout must be non-negative'); - (new AsyncCurlTransportOptions())->withPumpTimeout(-1); + new AsyncCurlTransportOptions()->withPumpTimeout(-1); } public function test_dsl_function_creates_options(): void @@ -140,7 +140,7 @@ public function test_to_curl_options_basic(): void public function test_to_curl_options_with_all_settings(): void { - $options = (new AsyncCurlTransportOptions()) + $options = new AsyncCurlTransportOptions() ->withTimeout(2000) ->withConnectTimeout(500) ->withSslVerification(false, false) @@ -164,14 +164,14 @@ public function test_to_curl_options_with_all_settings(): void public function test_with_ca_info(): void { - $options = (new AsyncCurlTransportOptions())->withCaInfo('/path/to/ca-bundle.crt'); + $options = new AsyncCurlTransportOptions()->withCaInfo('/path/to/ca-bundle.crt'); static::assertSame('/path/to/ca-bundle.crt', $options->caInfoPath()); } public function test_with_compression_disabled(): void { - $options = (new AsyncCurlTransportOptions()) + $options = new AsyncCurlTransportOptions() ->withCompression(true) ->withCompression(false); @@ -180,14 +180,14 @@ public function test_with_compression_disabled(): void public function test_with_compression_enabled(): void { - $options = (new AsyncCurlTransportOptions())->withCompression(); + $options = new AsyncCurlTransportOptions()->withCompression(); static::assertTrue($options->compression()); } public function test_with_connect_timeout(): void { - $options = (new AsyncCurlTransportOptions())->withConnectTimeout(750); + $options = new AsyncCurlTransportOptions()->withConnectTimeout(750); static::assertSame(750, $options->connectTimeoutMs()); } @@ -197,19 +197,19 @@ public function test_with_connect_timeout_rejects_negative_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Connect timeout must be non-negative'); - (new AsyncCurlTransportOptions())->withConnectTimeout(-1); + new AsyncCurlTransportOptions()->withConnectTimeout(-1); } public function test_with_follow_redirects_disabled(): void { - $options = (new AsyncCurlTransportOptions())->withFollowRedirects(false); + $options = new AsyncCurlTransportOptions()->withFollowRedirects(false); static::assertFalse($options->followRedirects()); } public function test_with_follow_redirects_enabled(): void { - $options = (new AsyncCurlTransportOptions())->withFollowRedirects(true, 5); + $options = new AsyncCurlTransportOptions()->withFollowRedirects(true, 5); static::assertTrue($options->followRedirects()); static::assertSame(5, $options->maxRedirects()); @@ -220,12 +220,12 @@ public function test_with_follow_redirects_rejects_negative_max_redirects(): voi $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Max redirects must be non-negative'); - (new AsyncCurlTransportOptions())->withFollowRedirects(true, -1); + new AsyncCurlTransportOptions()->withFollowRedirects(true, -1); } public function test_with_header(): void { - $options = (new AsyncCurlTransportOptions()) + $options = new AsyncCurlTransportOptions() ->withHeader('Authorization', 'Bearer token') ->withHeader('X-Custom', 'value'); @@ -240,7 +240,7 @@ public function test_with_header(): void public function test_with_headers(): void { - $options = (new AsyncCurlTransportOptions())->withHeaders([ + $options = new AsyncCurlTransportOptions()->withHeaders([ 'Authorization' => 'Bearer token', 'X-Custom' => 'value', ]); @@ -256,7 +256,7 @@ public function test_with_headers(): void public function test_with_headers_replaces_previous_headers(): void { - $options = (new AsyncCurlTransportOptions()) + $options = new AsyncCurlTransportOptions() ->withHeader('Old-Header', 'old-value') ->withHeaders(['New-Header' => 'new-value']); @@ -265,14 +265,14 @@ public function test_with_headers_replaces_previous_headers(): void public function test_with_proxy(): void { - $options = (new AsyncCurlTransportOptions())->withProxy('http://proxy:8080'); + $options = new AsyncCurlTransportOptions()->withProxy('http://proxy:8080'); static::assertSame('http://proxy:8080', $options->proxy()); } public function test_with_shutdown_timeout(): void { - $options = (new AsyncCurlTransportOptions())->withShutdownTimeout(7500); + $options = new AsyncCurlTransportOptions()->withShutdownTimeout(7500); static::assertSame(7500, $options->shutdownTimeoutMs()); } @@ -282,12 +282,12 @@ public function test_with_shutdown_timeout_rejects_negative_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Shutdown timeout must be non-negative'); - (new AsyncCurlTransportOptions())->withShutdownTimeout(-1); + new AsyncCurlTransportOptions()->withShutdownTimeout(-1); } public function test_with_ssl_certificate(): void { - $options = (new AsyncCurlTransportOptions())->withSslCertificate('/path/to/cert.pem'); + $options = new AsyncCurlTransportOptions()->withSslCertificate('/path/to/cert.pem'); static::assertSame('/path/to/cert.pem', $options->sslCertPath()); static::assertNull($options->sslKeyPath()); @@ -295,7 +295,7 @@ public function test_with_ssl_certificate(): void public function test_with_ssl_certificate_and_key(): void { - $options = (new AsyncCurlTransportOptions())->withSslCertificate('/path/to/cert.pem', '/path/to/key.pem'); + $options = new AsyncCurlTransportOptions()->withSslCertificate('/path/to/cert.pem', '/path/to/key.pem'); static::assertSame('/path/to/cert.pem', $options->sslCertPath()); static::assertSame('/path/to/key.pem', $options->sslKeyPath()); @@ -303,7 +303,7 @@ public function test_with_ssl_certificate_and_key(): void public function test_with_ssl_verification_disabled(): void { - $options = (new AsyncCurlTransportOptions())->withSslVerification(false, false); + $options = new AsyncCurlTransportOptions()->withSslVerification(false, false); static::assertFalse($options->sslVerifyPeer()); static::assertFalse($options->sslVerifyHost()); @@ -311,7 +311,7 @@ public function test_with_ssl_verification_disabled(): void public function test_with_ssl_verification_enabled(): void { - $options = (new AsyncCurlTransportOptions())->withSslVerification(true, true); + $options = new AsyncCurlTransportOptions()->withSslVerification(true, true); static::assertTrue($options->sslVerifyPeer()); static::assertTrue($options->sslVerifyHost()); @@ -319,7 +319,7 @@ public function test_with_ssl_verification_enabled(): void public function test_with_timeout(): void { - $options = (new AsyncCurlTransportOptions())->withTimeout(2500); + $options = new AsyncCurlTransportOptions()->withTimeout(2500); static::assertSame(2500, $options->timeoutMs()); } @@ -329,6 +329,6 @@ public function test_with_timeout_rejects_negative_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Timeout must be non-negative'); - (new AsyncCurlTransportOptions())->withTimeout(-1); + new AsyncCurlTransportOptions()->withTimeout(-1); } } diff --git a/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/AsyncCurlTransportTest.php b/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/AsyncCurlTransportTest.php index e2ed3ff649..8279cb6495 100644 --- a/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/AsyncCurlTransportTest.php +++ b/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/AsyncCurlTransportTest.php @@ -113,7 +113,7 @@ public function test_failover_receives_failed_batches_and_shutdown_throws_compos $transport = new AsyncCurlTransport( 'http://127.0.0.1:1', new JsonSerializer(), - (new AsyncCurlTransportOptions()) + new AsyncCurlTransportOptions() ->withConnectTimeout(1) ->withTimeout(1), $failover, @@ -155,7 +155,7 @@ public function test_failover_records_double_failure_when_failover_send_also_thr $transport = new AsyncCurlTransport( 'http://127.0.0.1:1', new JsonSerializer(), - (new AsyncCurlTransportOptions()) + new AsyncCurlTransportOptions() ->withConnectTimeout(1) ->withTimeout(1), $failover, @@ -227,7 +227,7 @@ public function test_shutdown_cascades_to_failover_shutdown(): void $transport = new AsyncCurlTransport( 'http://127.0.0.1:1', new JsonSerializer(), - (new AsyncCurlTransportOptions()) + new AsyncCurlTransportOptions() ->withConnectTimeout(1) ->withTimeout(1), $failover, @@ -293,7 +293,7 @@ public function test_shutdown_with_zero_timeout_forwards_pending_to_failover(): $transport = new AsyncCurlTransport( 'http://127.0.0.1:1', new JsonSerializer(), - (new AsyncCurlTransportOptions()) + new AsyncCurlTransportOptions() ->withConnectTimeout(60_000) ->withTimeout(60_000) ->withShutdownTimeout(0), @@ -324,7 +324,7 @@ public function test_shutdown_with_zero_timeout_surfaces_pending_failure_to_erro $transport = new AsyncCurlTransport( 'http://127.0.0.1:1', new JsonSerializer(), - (new AsyncCurlTransportOptions()) + new AsyncCurlTransportOptions() ->withConnectTimeout(60_000) ->withTimeout(60_000) ->withShutdownTimeout(0), diff --git a/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/CurlTransportOptionsTest.php b/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/CurlTransportOptionsTest.php index d70fd1c85a..3897c5381a 100644 --- a/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/CurlTransportOptionsTest.php +++ b/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/CurlTransportOptionsTest.php @@ -108,7 +108,7 @@ public function test_to_curl_options_basic(): void public function test_to_curl_options_with_all_settings(): void { - $options = (new CurlTransportOptions()) + $options = new CurlTransportOptions() ->withTimeout(2000) ->withConnectTimeout(500) ->withSslVerification(false, false) @@ -132,14 +132,14 @@ public function test_to_curl_options_with_all_settings(): void public function test_with_ca_info(): void { - $options = (new CurlTransportOptions())->withCaInfo('/path/to/ca-bundle.crt'); + $options = new CurlTransportOptions()->withCaInfo('/path/to/ca-bundle.crt'); static::assertSame('/path/to/ca-bundle.crt', $options->caInfoPath()); } public function test_with_compression_disabled(): void { - $options = (new CurlTransportOptions()) + $options = new CurlTransportOptions() ->withCompression(true) ->withCompression(false); @@ -148,14 +148,14 @@ public function test_with_compression_disabled(): void public function test_with_compression_enabled(): void { - $options = (new CurlTransportOptions())->withCompression(); + $options = new CurlTransportOptions()->withCompression(); static::assertTrue($options->compression()); } public function test_with_connect_timeout(): void { - $options = (new CurlTransportOptions())->withConnectTimeout(750); + $options = new CurlTransportOptions()->withConnectTimeout(750); static::assertSame(750, $options->connectTimeoutMs()); } @@ -165,19 +165,19 @@ public function test_with_connect_timeout_rejects_negative_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Connect timeout must be non-negative'); - (new CurlTransportOptions())->withConnectTimeout(-1); + new CurlTransportOptions()->withConnectTimeout(-1); } public function test_with_follow_redirects_disabled(): void { - $options = (new CurlTransportOptions())->withFollowRedirects(false); + $options = new CurlTransportOptions()->withFollowRedirects(false); static::assertFalse($options->followRedirects()); } public function test_with_follow_redirects_enabled(): void { - $options = (new CurlTransportOptions())->withFollowRedirects(true, 5); + $options = new CurlTransportOptions()->withFollowRedirects(true, 5); static::assertTrue($options->followRedirects()); static::assertSame(5, $options->maxRedirects()); @@ -188,12 +188,12 @@ public function test_with_follow_redirects_rejects_negative_max_redirects(): voi $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Max redirects must be non-negative'); - (new CurlTransportOptions())->withFollowRedirects(true, -1); + new CurlTransportOptions()->withFollowRedirects(true, -1); } public function test_with_header(): void { - $options = (new CurlTransportOptions()) + $options = new CurlTransportOptions() ->withHeader('Authorization', 'Bearer token') ->withHeader('X-Custom', 'value'); @@ -208,7 +208,7 @@ public function test_with_header(): void public function test_with_headers(): void { - $options = (new CurlTransportOptions())->withHeaders([ + $options = new CurlTransportOptions()->withHeaders([ 'Authorization' => 'Bearer token', 'X-Custom' => 'value', ]); @@ -224,7 +224,7 @@ public function test_with_headers(): void public function test_with_headers_replaces_previous_headers(): void { - $options = (new CurlTransportOptions()) + $options = new CurlTransportOptions() ->withHeader('Old-Header', 'old-value') ->withHeaders(['New-Header' => 'new-value']); @@ -233,14 +233,14 @@ public function test_with_headers_replaces_previous_headers(): void public function test_with_proxy(): void { - $options = (new CurlTransportOptions())->withProxy('http://proxy:8080'); + $options = new CurlTransportOptions()->withProxy('http://proxy:8080'); static::assertSame('http://proxy:8080', $options->proxy()); } public function test_with_shutdown_timeout(): void { - $options = (new CurlTransportOptions())->withShutdownTimeout(7500); + $options = new CurlTransportOptions()->withShutdownTimeout(7500); static::assertSame(7500, $options->shutdownTimeoutMs()); } @@ -250,12 +250,12 @@ public function test_with_shutdown_timeout_rejects_negative_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Shutdown timeout must be non-negative'); - (new CurlTransportOptions())->withShutdownTimeout(-1); + new CurlTransportOptions()->withShutdownTimeout(-1); } public function test_with_ssl_certificate(): void { - $options = (new CurlTransportOptions())->withSslCertificate('/path/to/cert.pem'); + $options = new CurlTransportOptions()->withSslCertificate('/path/to/cert.pem'); static::assertSame('/path/to/cert.pem', $options->sslCertPath()); static::assertNull($options->sslKeyPath()); @@ -263,7 +263,7 @@ public function test_with_ssl_certificate(): void public function test_with_ssl_certificate_and_key(): void { - $options = (new CurlTransportOptions())->withSslCertificate('/path/to/cert.pem', '/path/to/key.pem'); + $options = new CurlTransportOptions()->withSslCertificate('/path/to/cert.pem', '/path/to/key.pem'); static::assertSame('/path/to/cert.pem', $options->sslCertPath()); static::assertSame('/path/to/key.pem', $options->sslKeyPath()); @@ -271,7 +271,7 @@ public function test_with_ssl_certificate_and_key(): void public function test_with_ssl_verification_disabled(): void { - $options = (new CurlTransportOptions())->withSslVerification(false, false); + $options = new CurlTransportOptions()->withSslVerification(false, false); static::assertFalse($options->sslVerifyPeer()); static::assertFalse($options->sslVerifyHost()); @@ -279,7 +279,7 @@ public function test_with_ssl_verification_disabled(): void public function test_with_ssl_verification_enabled(): void { - $options = (new CurlTransportOptions())->withSslVerification(true, true); + $options = new CurlTransportOptions()->withSslVerification(true, true); static::assertTrue($options->sslVerifyPeer()); static::assertTrue($options->sslVerifyHost()); @@ -287,7 +287,7 @@ public function test_with_ssl_verification_enabled(): void public function test_with_timeout(): void { - $options = (new CurlTransportOptions())->withTimeout(2500); + $options = new CurlTransportOptions()->withTimeout(2500); static::assertSame(2500, $options->timeoutMs()); } @@ -297,6 +297,6 @@ public function test_with_timeout_rejects_negative_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Timeout must be non-negative'); - (new CurlTransportOptions())->withTimeout(-1); + new CurlTransportOptions()->withTimeout(-1); } } diff --git a/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/CurlTransportTest.php b/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/CurlTransportTest.php index 56ccb28335..90f3f619db 100644 --- a/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/CurlTransportTest.php +++ b/src/bridge/telemetry/otlp/tests/Flow/Bridge/Telemetry/OTLP/Tests/Unit/Transport/CurlTransportTest.php @@ -128,7 +128,7 @@ public function test_send_forwards_failed_batch_to_failover_and_throws(): void $transport = new CurlTransport( 'http://127.0.0.1:1', new JsonSerializer(), - (new CurlTransportOptions()) + new CurlTransportOptions() ->withConnectTimeout(1) ->withTimeout(1), $failover, @@ -164,7 +164,7 @@ public function test_send_records_double_failure_when_failover_send_also_throws( $transport = new CurlTransport( 'http://127.0.0.1:1', new JsonSerializer(), - (new CurlTransportOptions()) + new CurlTransportOptions() ->withConnectTimeout(1) ->withTimeout(1), $failover, @@ -209,7 +209,7 @@ public function test_shutdown_cascades_to_failover_shutdown(): void $transport = new CurlTransport( 'http://127.0.0.1:1', new JsonSerializer(), - (new CurlTransportOptions()) + new CurlTransportOptions() ->withConnectTimeout(1) ->withTimeout(1), $failover, diff --git a/src/cli/composer.json b/src/cli/composer.json index 992c31716c..3a51e9c9ea 100644 --- a/src/cli/composer.json +++ b/src/cli/composer.json @@ -8,11 +8,11 @@ "cli" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", - "symfony/console": "^6.4.34 || ^7.4.6 || ^8.0.6", - "symfony/http-client": "^6.4 || ^7.4 || ^8.0", + "php": "~8.5.0 || ~8.6.0", + "symfony/console": "^7.4.6 || ^8.0.6", + "symfony/http-client": "^7.4 || ^8.0", "nyholm/psr7": "^1.8", - "symfony/uid": "^6.4 || ^7.4 || ^8.0", + "symfony/uid": "^7.4 || ^8.0", "flow-php/etl": "self.version", "flow-php/etl-adapter-csv": "self.version", "flow-php/etl-adapter-parquet": "self.version", diff --git a/src/cli/flow b/src/cli/flow index d03206e6e3..9485ae8edc 100755 --- a/src/cli/flow +++ b/src/cli/flow @@ -1,9 +1,9 @@ #!/usr/bin/env php configure($this); + new DbConnectionOptions()->configure($this); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -103,7 +103,7 @@ protected function initialize(InputInterface $input, OutputInterface $output): v ), ); - $this->connection = DriverManager::getConnection((new DsnParser())->parse($connectionString)); + $this->connection = DriverManager::getConnection(new DsnParser()->parse($connectionString)); } } } diff --git a/src/cli/src/Flow/CLI/Command/DatabaseTableSchemaCommand.php b/src/cli/src/Flow/CLI/Command/DatabaseTableSchemaCommand.php index 6a47da7ffc..ff5212116b 100644 --- a/src/cli/src/Flow/CLI/Command/DatabaseTableSchemaCommand.php +++ b/src/cli/src/Flow/CLI/Command/DatabaseTableSchemaCommand.php @@ -53,7 +53,7 @@ public function configure(): void 'Filter schema by column name(s)', ); - (new DbConnectionOptions())->configure($this); + new DbConnectionOptions()->configure($this); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -109,19 +109,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if (option_bool('output-ascii', $input)) { - $style->write((new ASCIISchemaFormatter())->format($schema)); + $style->write(new ASCIISchemaFormatter()->format($schema)); return Command::SUCCESS; } if (option_bool('output-table', $input)) { - $style->write((new ASCIISchemaFormatter(true))->format($schema)); + $style->write(new ASCIISchemaFormatter(true)->format($schema)); return Command::SUCCESS; } if (option_bool('output-php', $input)) { - $style->writeln((new PHPSchemaFormatter())->format($schema)); + $style->writeln(new PHPSchemaFormatter()->format($schema)); return Command::SUCCESS; } @@ -145,7 +145,7 @@ protected function initialize(InputInterface $input, OutputInterface $output): v ), ); - $this->connection = DriverManager::getConnection((new DsnParser())->parse($connectionString)); + $this->connection = DriverManager::getConnection(new DsnParser()->parse($connectionString)); } } } diff --git a/src/cli/src/Flow/CLI/Command/FileAnalyzeCommand.php b/src/cli/src/Flow/CLI/Command/FileAnalyzeCommand.php index b4e9228ebd..089f170506 100644 --- a/src/cli/src/Flow/CLI/Command/FileAnalyzeCommand.php +++ b/src/cli/src/Flow/CLI/Command/FileAnalyzeCommand.php @@ -85,14 +85,14 @@ public function configure(): void null, ); - (new ConfigOption('config'))->configure($this); - (new JSONInputOptions())->configure($this); - (new CSVInputOptions())->configure($this); - (new ExcelInputOptions())->configure($this); - (new XMLInputOptions())->configure($this); - (new ParquetInputOptions())->configure($this); - (new SchemaInferenceOptions())->configure($this); - (new StatisticsOptions())->configure($this); + new ConfigOption('config')->configure($this); + new JSONInputOptions()->configure($this); + new CSVInputOptions()->configure($this); + new ExcelInputOptions()->configure($this); + new XMLInputOptions()->configure($this); + new ParquetInputOptions()->configure($this); + new SchemaInferenceOptions()->configure($this); + new StatisticsOptions()->configure($this); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -106,9 +106,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $style->title('Analyzing File'); $style->info('File path: ' . $this->sourcePath->basename()); - $extractor = (new ExtractorFactory($this->sourcePath, $this->fileFormat))->get($input); + $extractor = new ExtractorFactory($this->sourcePath, $this->fileFormat)->get($input); - if (!(new SchemaInferenceOptions())->apply($extractor, $input, $style)) { + if (!new SchemaInferenceOptions()->apply($extractor, $input, $style)) { return Command::FAILURE; } @@ -162,15 +162,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int $progress?->finish(); } - (new PipelineReportFormatter($report, $style, $input))->format(); + new PipelineReportFormatter($report, $style, $input)->format(); return Command::SUCCESS; } protected function initialize(InputInterface $input, OutputInterface $output): void { - $this->flowConfig = (new ConfigOption('config'))->get($input); - $this->sourcePath = (new FilePathArgument('input-file'))->getExisting($input); - $this->fileFormat = (new FileFormatOption($this->sourcePath, 'input-file-format'))->get($input); + $this->flowConfig = new ConfigOption('config')->get($input); + $this->sourcePath = new FilePathArgument('input-file')->getExisting($input); + $this->fileFormat = new FileFormatOption($this->sourcePath, 'input-file-format')->get($input); } } diff --git a/src/cli/src/Flow/CLI/Command/FileConvertCommand.php b/src/cli/src/Flow/CLI/Command/FileConvertCommand.php index 4edda313df..8a3dffe78b 100644 --- a/src/cli/src/Flow/CLI/Command/FileConvertCommand.php +++ b/src/cli/src/Flow/CLI/Command/FileConvertCommand.php @@ -113,16 +113,16 @@ public function configure(): void false, ); - (new ConfigOption('config'))->configure($this); - (new JSONInputOptions())->configure($this); - (new JSONOutputOptions())->configure($this); - (new CSVInputOptions())->configure($this); - (new CSVOutputOptions())->configure($this); - (new ExcelInputOptions())->configure($this); - (new XMLInputOptions())->configure($this); - (new XMLOutputOptions())->configure($this); - (new ParquetInputOptions())->configure($this); - (new SchemaInferenceOptions())->configure($this); + new ConfigOption('config')->configure($this); + new JSONInputOptions()->configure($this); + new JSONOutputOptions()->configure($this); + new CSVInputOptions()->configure($this); + new CSVOutputOptions()->configure($this); + new ExcelInputOptions()->configure($this); + new XMLInputOptions()->configure($this); + new XMLOutputOptions()->configure($this); + new ParquetInputOptions()->configure($this); + new SchemaInferenceOptions()->configure($this); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -139,9 +139,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $style = new SymfonyStyle($input, $output); - $extractor = (new ExtractorFactory($this->inputFile, $this->inputFileFormat))->get($input); + $extractor = new ExtractorFactory($this->inputFile, $this->inputFileFormat)->get($input); - if (!(new SchemaInferenceOptions())->apply($extractor, $input, $style)) { + if (!new SchemaInferenceOptions()->apply($extractor, $input, $style)) { return Command::FAILURE; } @@ -175,7 +175,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $df = $df->offset($offset); } - $loader = (new LoaderFactory($this->outputFile, $this->outputFileFormat))->get($input); + $loader = new LoaderFactory($this->outputFile, $this->outputFileFormat)->get($input); if (option_bool('output-overwrite', $input)) { $loader->saveMode(overwrite()); @@ -201,10 +201,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int protected function initialize(InputInterface $input, OutputInterface $output): void { - $this->flowConfig = (new ConfigOption('config'))->get($input); - $this->inputFile = (new FilePathArgument('input-file'))->getExisting($input); - $this->outputFile = (new FilePathArgument('output-file'))->get($input); - $this->inputFileFormat = (new FileFormatOption($this->inputFile, 'input-file-format'))->get($input); - $this->outputFileFormat = (new FileFormatOption($this->outputFile, 'output-file-format'))->get($input); + $this->flowConfig = new ConfigOption('config')->get($input); + $this->inputFile = new FilePathArgument('input-file')->getExisting($input); + $this->outputFile = new FilePathArgument('output-file')->get($input); + $this->inputFileFormat = new FileFormatOption($this->inputFile, 'input-file-format')->get($input); + $this->outputFileFormat = new FileFormatOption($this->outputFile, 'output-file-format')->get($input); } } diff --git a/src/cli/src/Flow/CLI/Command/FileReadCommand.php b/src/cli/src/Flow/CLI/Command/FileReadCommand.php index 31dac9e3f5..263f2be69e 100644 --- a/src/cli/src/Flow/CLI/Command/FileReadCommand.php +++ b/src/cli/src/Flow/CLI/Command/FileReadCommand.php @@ -96,13 +96,13 @@ public function configure(): void [], ); - (new ConfigOption('config'))->configure($this); - (new JSONInputOptions())->configure($this); - (new CSVInputOptions())->configure($this); - (new ExcelInputOptions())->configure($this); - (new XMLInputOptions())->configure($this); - (new ParquetInputOptions())->configure($this); - (new SchemaInferenceOptions())->configure($this); + new ConfigOption('config')->configure($this); + new JSONInputOptions()->configure($this); + new CSVInputOptions()->configure($this); + new ExcelInputOptions()->configure($this); + new XMLInputOptions()->configure($this); + new ParquetInputOptions()->configure($this); + new SchemaInferenceOptions()->configure($this); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -113,9 +113,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $style = new SymfonyStyle($input, $output); - $extractor = (new ExtractorFactory($this->sourcePath, $this->fileFormat))->get($input); + $extractor = new ExtractorFactory($this->sourcePath, $this->fileFormat)->get($input); - if (!(new SchemaInferenceOptions())->apply($extractor, $input, $style)) { + if (!new SchemaInferenceOptions()->apply($extractor, $input, $style)) { return Command::FAILURE; } @@ -161,8 +161,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int protected function initialize(InputInterface $input, OutputInterface $output): void { - $this->flowConfig = (new ConfigOption('config'))->get($input); - $this->sourcePath = (new FilePathArgument('input-file'))->getExisting($input); - $this->fileFormat = (new FileFormatOption($this->sourcePath, 'input-file-format'))->get($input); + $this->flowConfig = new ConfigOption('config')->get($input); + $this->sourcePath = new FilePathArgument('input-file')->getExisting($input); + $this->fileFormat = new FileFormatOption($this->sourcePath, 'input-file-format')->get($input); } } diff --git a/src/cli/src/Flow/CLI/Command/FileRowsCountCommand.php b/src/cli/src/Flow/CLI/Command/FileRowsCountCommand.php index 740b587f49..edf4eff715 100644 --- a/src/cli/src/Flow/CLI/Command/FileRowsCountCommand.php +++ b/src/cli/src/Flow/CLI/Command/FileRowsCountCommand.php @@ -70,12 +70,12 @@ public function configure(): void null, ); - (new ConfigOption('config'))->configure($this); - (new JSONInputOptions())->configure($this); - (new ExcelInputOptions())->configure($this); - (new CSVInputOptions())->configure($this); - (new XMLInputOptions())->configure($this); - (new ParquetInputOptions())->configure($this); + new ConfigOption('config')->configure($this); + new JSONInputOptions()->configure($this); + new ExcelInputOptions()->configure($this); + new CSVInputOptions()->configure($this); + new XMLInputOptions()->configure($this); + new ParquetInputOptions()->configure($this); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -92,7 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $this->flowConfig->heartbeat($progress, everySeconds: 0.25, onFailure: HeartbeatFailure::log); } - $df = df($this->flowConfig)->read((new ExtractorFactory($this->sourcePath, $this->fileFormat))->get($input)); + $df = df($this->flowConfig)->read(new ExtractorFactory($this->sourcePath, $this->fileFormat)->get($input)); $limit = option_int_nullable('input-file-limit', $input); @@ -119,8 +119,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int protected function initialize(InputInterface $input, OutputInterface $output): void { - $this->flowConfig = (new ConfigOption('config'))->get($input); - $this->sourcePath = (new FilePathArgument('input-file'))->getExisting($input); - $this->fileFormat = (new FileFormatOption($this->sourcePath, 'input-file-format'))->get($input); + $this->flowConfig = new ConfigOption('config')->get($input); + $this->sourcePath = new FilePathArgument('input-file')->getExisting($input); + $this->fileFormat = new FileFormatOption($this->sourcePath, 'input-file-format')->get($input); } } diff --git a/src/cli/src/Flow/CLI/Command/FileSchemaCommand.php b/src/cli/src/Flow/CLI/Command/FileSchemaCommand.php index bf0e19f356..43049e2e34 100644 --- a/src/cli/src/Flow/CLI/Command/FileSchemaCommand.php +++ b/src/cli/src/Flow/CLI/Command/FileSchemaCommand.php @@ -83,13 +83,13 @@ public function configure(): void ->addOption('output-table', null, InputOption::VALUE_NONE, 'Print schema as ascii table') ->addOption('output-ascii', null, InputOption::VALUE_NONE, 'Print schema as ascii list'); - (new ConfigOption('config'))->configure($this); - (new JSONInputOptions())->configure($this); - (new CSVInputOptions())->configure($this); - (new ExcelInputOptions())->configure($this); - (new XMLInputOptions())->configure($this); - (new ParquetInputOptions())->configure($this); - (new SchemaInferenceOptions())->configure($this); + new ConfigOption('config')->configure($this); + new JSONInputOptions()->configure($this); + new CSVInputOptions()->configure($this); + new ExcelInputOptions()->configure($this); + new XMLInputOptions()->configure($this); + new ParquetInputOptions()->configure($this); + new SchemaInferenceOptions()->configure($this); } protected function execute(InputInterface $input, OutputInterface $output): int @@ -100,9 +100,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int $style = new SymfonyStyle($input, $output); - $extractor = (new ExtractorFactory($this->sourcePath, $this->fileFormat))->get($input); + $extractor = new ExtractorFactory($this->sourcePath, $this->fileFormat)->get($input); - if (!(new SchemaInferenceOptions())->apply($extractor, $input, $style)) { + if (!new SchemaInferenceOptions()->apply($extractor, $input, $style)) { return Command::FAILURE; } @@ -133,19 +133,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int } if (option_bool('output-ascii', $input)) { - $style->write((new ASCIISchemaFormatter())->format($schema)); + $style->write(new ASCIISchemaFormatter()->format($schema)); return Command::SUCCESS; } if (option_bool('output-table', $input)) { - $style->write((new ASCIISchemaFormatter(true))->format($schema)); + $style->write(new ASCIISchemaFormatter(true)->format($schema)); return Command::SUCCESS; } if (option_bool('output-php', $input)) { - $style->writeln((new PHPSchemaFormatter())->format($schema)); + $style->writeln(new PHPSchemaFormatter()->format($schema)); return Command::SUCCESS; } @@ -157,8 +157,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int protected function initialize(InputInterface $input, OutputInterface $output): void { - $this->flowConfig = (new ConfigOption('config'))->get($input); - $this->sourcePath = (new FilePathArgument('input-file'))->getExisting($input); - $this->fileFormat = (new FileFormatOption($this->sourcePath, 'input-file-format'))->get($input); + $this->flowConfig = new ConfigOption('config')->get($input); + $this->sourcePath = new FilePathArgument('input-file')->getExisting($input); + $this->fileFormat = new FileFormatOption($this->sourcePath, 'input-file-format')->get($input); } } diff --git a/src/cli/src/Flow/CLI/Command/PipelineRunCommand.php b/src/cli/src/Flow/CLI/Command/PipelineRunCommand.php index c2d9045b36..1badc8087a 100644 --- a/src/cli/src/Flow/CLI/Command/PipelineRunCommand.php +++ b/src/cli/src/Flow/CLI/Command/PipelineRunCommand.php @@ -56,7 +56,7 @@ public function configure(): void false, ); - (new StatisticsOptions())->configure($this); + new StatisticsOptions()->configure($this); } public function execute(InputInterface $input, OutputInterface $output): int @@ -86,7 +86,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $extension = $this->pipelinePath->extension(); $df = match ($extension) { - 'php' => (new PipelineFactory($this->pipelinePath))->fromPHP(), + 'php' => new PipelineFactory($this->pipelinePath)->fromPHP(), default => throw new InvalidFileFormatException('php', is_string($extension) ? $extension : 'unknown'), }; $report = $df->run(analyze: $analyze); @@ -95,7 +95,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $style->writeln($buffered !== false ? $buffered : ''); if ($report !== null) { - (new PipelineReportFormatter($report, $style, $input))->format(); + new PipelineReportFormatter($report, $style, $input)->format(); } } catch (Exception $exception) { $style->error($exception->getMessage()); @@ -108,6 +108,6 @@ public function execute(InputInterface $input, OutputInterface $output): int protected function initialize(InputInterface $input, OutputInterface $output): void { - $this->pipelinePath = (new FilePathArgument('pipeline-file'))->getExisting($input); + $this->pipelinePath = new FilePathArgument('pipeline-file')->getExisting($input); } } diff --git a/src/cli/src/Flow/CLI/Command/SchemaFormatCommand.php b/src/cli/src/Flow/CLI/Command/SchemaFormatCommand.php index 4e39821a87..1917d07e37 100644 --- a/src/cli/src/Flow/CLI/Command/SchemaFormatCommand.php +++ b/src/cli/src/Flow/CLI/Command/SchemaFormatCommand.php @@ -49,25 +49,25 @@ public function execute(InputInterface $input, OutputInterface $output): int $style = new SymfonyStyle($input, $output); $schema = schema_from_json( - (new NativeLocalFilesystem()) + new NativeLocalFilesystem() ->readFrom($this->schemaPath) ->content(), ); if (option_bool('output-ascii', $input)) { - $style->write((new ASCIISchemaFormatter())->format($schema)); + $style->write(new ASCIISchemaFormatter()->format($schema)); return Command::SUCCESS; } if (option_bool('output-table', $input)) { - $style->write((new ASCIISchemaFormatter(true))->format($schema)); + $style->write(new ASCIISchemaFormatter(true)->format($schema)); return Command::SUCCESS; } if (option_bool('output-php', $input)) { - $style->writeln((new PHPSchemaFormatter())->format($schema)); + $style->writeln(new PHPSchemaFormatter()->format($schema)); return Command::SUCCESS; } @@ -79,6 +79,6 @@ public function execute(InputInterface $input, OutputInterface $output): int protected function initialize(InputInterface $input, OutputInterface $output): void { - $this->schemaPath = (new FilePathArgument('input-schema-file'))->getExisting($input); + $this->schemaPath = new FilePathArgument('input-schema-file')->getExisting($input); } } diff --git a/src/cli/src/Flow/CLI/DSL/functions.php b/src/cli/src/Flow/CLI/DSL/functions.php index f00b321002..043a0ccc77 100644 --- a/src/cli/src/Flow/CLI/DSL/functions.php +++ b/src/cli/src/Flow/CLI/DSL/functions.php @@ -11,32 +11,32 @@ function option_bool(string $name, InputInterface $input): bool { - return (new TypedOption($name))->asBool($input); + return new TypedOption($name)->asBool($input); } function option_bool_nullable(string $name, InputInterface $input): ?bool { - return (new TypedOption($name))->asBoolNullable($input); + return new TypedOption($name)->asBoolNullable($input); } function option_string(string $name, InputInterface $input, ?string $default = null): string { - return (new TypedOption($name))->asString($input, $default); + return new TypedOption($name)->asString($input, $default); } function option_string_nullable(string $name, InputInterface $input): ?string { - return (new TypedOption($name))->asStringNullable($input); + return new TypedOption($name)->asStringNullable($input); } function option_int(string $name, InputInterface $input, ?int $default = null): int { - return (new TypedOption($name))->asInt($input, $default); + return new TypedOption($name)->asInt($input, $default); } function option_int_nullable(string $name, InputInterface $input): ?int { - return (new TypedOption($name))->asIntNullable($input); + return new TypedOption($name)->asIntNullable($input); } /** @@ -44,7 +44,7 @@ function option_int_nullable(string $name, InputInterface $input): ?int */ function option_list_of_strings(string $name, InputInterface $input): array { - return (new TypedOption($name))->asListOfStrings($input); + return new TypedOption($name)->asListOfStrings($input); } /** @@ -52,17 +52,17 @@ function option_list_of_strings(string $name, InputInterface $input): array */ function option_list_of_strings_nullable(string $name, InputInterface $input): ?array { - return (new TypedOption($name))->asListOfStringsNullable($input); + return new TypedOption($name)->asListOfStringsNullable($input); } function argument_string(string $name, InputInterface $input): string { - return (new TypedArgument($name))->asString($input); + return new TypedArgument($name)->asString($input); } function argument_string_nullable(string $name, InputInterface $input): ?string { - return (new TypedArgument($name))->asStringNullable($input); + return new TypedArgument($name)->asStringNullable($input); } /** @@ -74,5 +74,5 @@ function argument_string_nullable(string $name, InputInterface $input): ?string */ function option_include_file(string $name, InputInterface $input, string $expectedClass): object { - return (new IncludeFileOption($name, $expectedClass))->include($input); + return new IncludeFileOption($name, $expectedClass)->include($input); } diff --git a/src/cli/src/Flow/CLI/Factory/ExtractorFactory.php b/src/cli/src/Flow/CLI/Factory/ExtractorFactory.php index 1446f8922c..ffc19b3729 100644 --- a/src/cli/src/Flow/CLI/Factory/ExtractorFactory.php +++ b/src/cli/src/Flow/CLI/Factory/ExtractorFactory.php @@ -21,12 +21,12 @@ public function __construct( public function get(InputInterface $input): Extractor { return match ($this->format) { - FileFormat::CSV => (new CSVExtractorFactory($this->path))->get($input), - FileFormat::JSON => (new JsonExtractorFactory($this->path))->get($input), - FileFormat::PARQUET => (new ParquetExtractorFactory($this->path))->get($input), + FileFormat::CSV => new CSVExtractorFactory($this->path)->get($input), + FileFormat::JSON => new JsonExtractorFactory($this->path)->get($input), + FileFormat::PARQUET => new ParquetExtractorFactory($this->path)->get($input), FileFormat::TEXT => from_text($this->path), - FileFormat::XML => (new XMLExtractorFactory($this->path))->get($input), - FileFormat::ODS, FileFormat::XLSX => (new ExcelExtractorFactory($this->path))->get($input), + FileFormat::XML => new XMLExtractorFactory($this->path)->get($input), + FileFormat::ODS, FileFormat::XLSX => new ExcelExtractorFactory($this->path)->get($input), }; } } diff --git a/src/cli/src/Flow/CLI/Factory/LoaderFactory.php b/src/cli/src/Flow/CLI/Factory/LoaderFactory.php index 5dd6767cfd..a00166c5ff 100644 --- a/src/cli/src/Flow/CLI/Factory/LoaderFactory.php +++ b/src/cli/src/Flow/CLI/Factory/LoaderFactory.php @@ -23,10 +23,10 @@ public function __construct( public function get(InputInterface $input): Loader&FileLoader { return match ($this->format) { - FileFormat::CSV => (new CSVLoaderFactory($this->path))->get($input), - FileFormat::JSON => (new JsonLoaderFactory($this->path))->get($input), - FileFormat::XML => (new XMLLoaderFactory($this->path))->get($input), - FileFormat::PARQUET => (new ParquetLoaderFactory($this->path))->get($input), + FileFormat::CSV => new CSVLoaderFactory($this->path)->get($input), + FileFormat::JSON => new JsonLoaderFactory($this->path)->get($input), + FileFormat::XML => new XMLLoaderFactory($this->path)->get($input), + FileFormat::PARQUET => new ParquetLoaderFactory($this->path)->get($input), FileFormat::TEXT => to_text($this->path), FileFormat::ODS, FileFormat::XLSX => throw new InvalidArgumentException('To be implemented'), }; diff --git a/src/cli/tests/Flow/CLI/Tests/Context/DatabaseContext.php b/src/cli/tests/Flow/CLI/Tests/Context/DatabaseContext.php index 741748ef71..0eff43599b 100644 --- a/src/cli/tests/Flow/CLI/Tests/Context/DatabaseContext.php +++ b/src/cli/tests/Flow/CLI/Tests/Context/DatabaseContext.php @@ -17,7 +17,7 @@ public function __construct() { - $this->connection = DriverManager::getConnection((new DsnParser(['postgresql' => 'pdo_pgsql']))->parse( + $this->connection = DriverManager::getConnection(new DsnParser(['postgresql' => 'pdo_pgsql'])->parse( getenv('PGSQL_DATABASE_URL') ?: '', )); } diff --git a/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableListCommandTest.php b/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableListCommandTest.php index bb8e283889..7e0258579e 100644 --- a/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableListCommandTest.php +++ b/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableListCommandTest.php @@ -9,7 +9,6 @@ use Doctrine\DBAL\Schema\Name\UnqualifiedName; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\CLI\Command\DatabaseTableListCommand; use Flow\CLI\Tests\Context\DatabaseContext; @@ -40,7 +39,7 @@ public function test_config_option_is_not_accepted(): void $this->expectException(InvalidOptionException::class); $this->expectExceptionMessage('The "--config" option does not exist.'); - (new CommandTester(new DatabaseTableListCommand('db:table:list')))->execute([ + new CommandTester(new DatabaseTableListCommand('db:table:list'))->execute([ '--db-connection-file' => __DIR__ . '/Fixtures/connection.php', '--config' => 'x.php', ]); @@ -49,11 +48,11 @@ public function test_config_option_is_not_accepted(): void public function test_run_db_table_list(): void { $this->dbContext()->createTable( - (new Table('table_01', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table('table_01', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint( new PrimaryKeyConstraint(null, [new UnqualifiedName(Identifier::unquoted('id'))], true), @@ -62,14 +61,14 @@ public function test_run_db_table_list(): void ); $this->dbContext()->createTable( - (new Table('table_02', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('created_at', Type::getType(Types::DATETIME_IMMUTABLE), ['notnull' => true]), - new Column('tags', Type::getType(Types::JSON), [ + new Table('table_02', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('created_at', Types::DATETIME_IMMUTABLE, ['notnull' => true]), + new Column('tags', Types::JSON, [ 'notnull' => true, 'platformOptions' => ['jsonb' => true], ]), - ])) + ]) ->edit() ->addPrimaryKeyConstraint( new PrimaryKeyConstraint(null, [new UnqualifiedName(Identifier::unquoted('id'))], true), diff --git a/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableSchemaCommandTest.php b/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableSchemaCommandTest.php index a7240259c9..cf0a2e531c 100644 --- a/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableSchemaCommandTest.php +++ b/src/cli/tests/Flow/CLI/Tests/Integration/DatabaseTableSchemaCommandTest.php @@ -9,7 +9,6 @@ use Doctrine\DBAL\Schema\Name\UnqualifiedName; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\CLI\Command\DatabaseTableSchemaCommand; use Flow\CLI\Tests\Context\DatabaseContext; @@ -19,8 +18,6 @@ use Symfony\Component\Console\Exception\InvalidOptionException; use Symfony\Component\Console\Tester\CommandTester; -use function method_exists; - final class DatabaseTableSchemaCommandTest extends FlowTestCase { protected ?DatabaseContext $dbContext = null; @@ -42,7 +39,7 @@ public function test_config_option_is_not_accepted(): void $this->expectException(InvalidOptionException::class); $this->expectExceptionMessage('The "--config" option does not exist.'); - (new CommandTester(new DatabaseTableSchemaCommand('db:table:schema')))->execute([ + new CommandTester(new DatabaseTableSchemaCommand('db:table:schema'))->execute([ 'input-db-table' => 'table_01', '--db-connection-file' => __DIR__ . '/Fixtures/connection.php', '--config' => 'x.php', @@ -52,11 +49,11 @@ public function test_config_option_is_not_accepted(): void public function test_run_db_table_list(): void { $this->dbContext()->createTable( - (new Table('table_01', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table('table_01', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint( new PrimaryKeyConstraint(null, [new UnqualifiedName(Identifier::unquoted('id'))], true), @@ -65,14 +62,14 @@ public function test_run_db_table_list(): void ); $this->dbContext()->createTable( - (new Table('table_02', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('created_at', Type::getType(Types::DATETIME_IMMUTABLE), ['notnull' => true]), - new Column('tags', Type::getType(Types::JSON), [ + new Table('table_02', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('created_at', Types::DATETIME_IMMUTABLE, ['notnull' => true]), + new Column('tags', Types::JSON, [ 'notnull' => true, 'platformOptions' => ['jsonb' => true], ]), - ])) + ]) ->edit() ->addPrimaryKeyConstraint( new PrimaryKeyConstraint(null, [new UnqualifiedName(Identifier::unquoted('id'))], true), @@ -90,44 +87,24 @@ public function test_run_db_table_list(): void $tester->assertCommandIsSuccessful(); - // changeColumn was removed in doctrine/dbal 4.0 - // We are using it to perform a different assertion since prior to 4.0 all - // columns were also getting precision set to 10 due to a bug that was executing precision set - // even when precision value was null. - if (!method_exists(Table::class, 'changeColumn')) { - static::assertSame(<<<'PHP' - \Flow\ETL\DSL\schema( - \Flow\ETL\DSL\integer_schema("id", nullable: false, metadata: \Flow\ETL\DSL\schema_metadata(["dbal_column_primary" => ""])), - \Flow\ETL\DSL\string_schema("name", nullable: false, metadata: \Flow\ETL\DSL\schema_metadata(["dbal_column_length" => 255])), - \Flow\ETL\DSL\string_schema("description", nullable: false, metadata: \Flow\ETL\DSL\schema_metadata(["dbal_column_length" => 255])), - ); - - PHP, $tester->getDisplay()); - } else { - static::assertSame(<<<'PHP' - \Flow\ETL\DSL\schema( - \Flow\ETL\DSL\integer_schema("id", nullable: false, metadata: \Flow\ETL\DSL\schema_metadata(["dbal_column_precision" => 10, "dbal_column_primary" => ""])), - \Flow\ETL\DSL\string_schema("name", nullable: false, metadata: \Flow\ETL\DSL\schema_metadata(["dbal_column_length" => 255, "dbal_column_precision" => 10])), - \Flow\ETL\DSL\string_schema("description", nullable: false, metadata: \Flow\ETL\DSL\schema_metadata(["dbal_column_length" => 255, "dbal_column_precision" => 10])), - ); - - PHP, $tester->getDisplay()); - } + static::assertSame(<<<'PHP' + \Flow\ETL\DSL\schema( + \Flow\ETL\DSL\integer_schema("id", nullable: false, metadata: \Flow\ETL\DSL\schema_metadata(["dbal_column_primary" => ""])), + \Flow\ETL\DSL\string_schema("name", nullable: false, metadata: \Flow\ETL\DSL\schema_metadata(["dbal_column_length" => 255])), + \Flow\ETL\DSL\string_schema("description", nullable: false, metadata: \Flow\ETL\DSL\schema_metadata(["dbal_column_length" => 255])), + ); + + PHP, $tester->getDisplay()); } public function test_selecting_specific_columns_only(): void { - // We don't need to test this edge case on doctrine/dbal below version 4.0 since the logic does not change. - if (method_exists(Table::class, 'changeColumn')) { - static::markTestSkipped('This test is not supported in doctrine/dbal 4.0'); - } - $this->dbContext()->createTable( - (new Table('table_01', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table('table_01', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint( new PrimaryKeyConstraint(null, [new UnqualifiedName(Identifier::unquoted('id'))], true), @@ -157,17 +134,12 @@ public function test_selecting_specific_columns_only(): void public function test_selecting_not_existing_column(): void { - // We don't need to test this edge case on doctrine/dbal below version 4.0 since the logic does not change. - if (method_exists(Table::class, 'changeColumn')) { - static::markTestSkipped('This test is not supported in doctrine/dbal 4.0'); - } - $this->dbContext()->createTable( - (new Table('table_01', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ])) + new Table('table_01', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) ->edit() ->addPrimaryKeyConstraint( new PrimaryKeyConstraint(null, [new UnqualifiedName(Identifier::unquoted('id'))], true), diff --git a/src/cli/tests/Flow/CLI/Tests/Integration/FileAnalyzeCommandTest.php b/src/cli/tests/Flow/CLI/Tests/Integration/FileAnalyzeCommandTest.php index d92ebe7532..1179771c51 100644 --- a/src/cli/tests/Flow/CLI/Tests/Integration/FileAnalyzeCommandTest.php +++ b/src/cli/tests/Flow/CLI/Tests/Integration/FileAnalyzeCommandTest.php @@ -36,7 +36,7 @@ public function test_a_plain_output_gets_no_progress(): void { $output = new BufferedOutput(); - (new FileAnalyzeCommand('analyze'))->run(new ArrayInput([ + new FileAnalyzeCommand('analyze')->run(new ArrayInput([ 'input-file' => __DIR__ . '/Fixtures/orders.csv', '--config' => __DIR__ . '/Fixtures/stepping-clock-config.php', ]), $output); diff --git a/src/cli/tests/Flow/CLI/Tests/Integration/FileConvertCommandTest.php b/src/cli/tests/Flow/CLI/Tests/Integration/FileConvertCommandTest.php index 64191cf084..e819072853 100644 --- a/src/cli/tests/Flow/CLI/Tests/Integration/FileConvertCommandTest.php +++ b/src/cli/tests/Flow/CLI/Tests/Integration/FileConvertCommandTest.php @@ -52,7 +52,7 @@ public function test_a_plain_output_gets_no_progress(): void $output = __DIR__ . '/var/' . bin2hex(random_bytes(16)) . '.csv'; $buffered = new BufferedOutput(); - (new FileConvertCommand('convert'))->run(new ArrayInput([ + new FileConvertCommand('convert')->run(new ArrayInput([ 'input-file' => __DIR__ . '/Fixtures/orders.csv', 'output-file' => $output, '--config' => __DIR__ . '/Fixtures/stepping-clock-config.php', diff --git a/src/cli/tests/Flow/CLI/Tests/Integration/FileRowsCountCommandTest.php b/src/cli/tests/Flow/CLI/Tests/Integration/FileRowsCountCommandTest.php index 6997731257..3d034a56fe 100644 --- a/src/cli/tests/Flow/CLI/Tests/Integration/FileRowsCountCommandTest.php +++ b/src/cli/tests/Flow/CLI/Tests/Integration/FileRowsCountCommandTest.php @@ -36,7 +36,7 @@ public function test_a_plain_output_gets_only_the_count(): void { $output = new BufferedOutput(); - (new FileRowsCountCommand('count'))->run(new ArrayInput([ + new FileRowsCountCommand('count')->run(new ArrayInput([ 'input-file' => __DIR__ . '/Fixtures/orders.csv', '--config' => __DIR__ . '/Fixtures/stepping-clock-config.php', ]), $output); diff --git a/src/cli/tests/Flow/CLI/Tests/Integration/Fixtures/connection.php b/src/cli/tests/Flow/CLI/Tests/Integration/Fixtures/connection.php index d75efd3bfc..c52f711d75 100644 --- a/src/cli/tests/Flow/CLI/Tests/Integration/Fixtures/connection.php +++ b/src/cli/tests/Flow/CLI/Tests/Integration/Fixtures/connection.php @@ -5,6 +5,6 @@ use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Tools\DsnParser; -return DriverManager::getConnection((new DsnParser(['postgresql' => 'pdo_pgsql']))->parse( +return DriverManager::getConnection(new DsnParser(['postgresql' => 'pdo_pgsql'])->parse( getenv('PGSQL_DATABASE_URL') ?: '', )); diff --git a/src/cli/tests/Flow/CLI/Tests/Integration/Options/ConfigOptionTest.php b/src/cli/tests/Flow/CLI/Tests/Integration/Options/ConfigOptionTest.php index 5061b95106..c0c575fced 100644 --- a/src/cli/tests/Flow/CLI/Tests/Integration/Options/ConfigOptionTest.php +++ b/src/cli/tests/Flow/CLI/Tests/Integration/Options/ConfigOptionTest.php @@ -21,7 +21,7 @@ public function test_getting_config_from_option(): void $option = new InputOption('config', null, InputOption::VALUE_REQUIRED); $definition = new InputDefinition([$option]); - $config = (new ConfigOption('config'))->get(new ArrayInput([ + $config = new ConfigOption('config')->get(new ArrayInput([ '--config' => __DIR__ . '/Fixtures/.flow.config.php', ], $definition)); @@ -34,7 +34,7 @@ public function test_getting_default_config(): void $option = new InputOption('config', null, InputOption::VALUE_OPTIONAL); $definition = new InputDefinition([$option]); - $config = (new ConfigOption('config'))->get(new ArrayInput([], $definition)); + $config = new ConfigOption('config')->get(new ArrayInput([], $definition)); static::assertInstanceOf(ConfigBuilder::class, $config); static::assertNotSame('execution-id', $config->build()->id()); @@ -52,7 +52,7 @@ public function test_throwing_exception_when_config_file_returns_a_built_config( $path, )); - (new ConfigOption('config'))->get(new ArrayInput(['--config' => $path], $definition)); + new ConfigOption('config')->get(new ArrayInput(['--config' => $path], $definition)); } public function test_throwing_exception_when_config_file_does_not_exist(): void @@ -62,6 +62,6 @@ public function test_throwing_exception_when_config_file_does_not_exist(): void $this->expectException(InvalidArgumentException::class); - (new ConfigOption('config'))->get(new ArrayInput(['--config' => 'non-existing-file.php'], $definition)); + new ConfigOption('config')->get(new ArrayInput(['--config' => 'non-existing-file.php'], $definition)); } } diff --git a/src/cli/tests/Flow/CLI/Tests/Integration/PipelineRunCommandTest.php b/src/cli/tests/Flow/CLI/Tests/Integration/PipelineRunCommandTest.php index 4c012c6d97..2abc1bde0f 100644 --- a/src/cli/tests/Flow/CLI/Tests/Integration/PipelineRunCommandTest.php +++ b/src/cli/tests/Flow/CLI/Tests/Integration/PipelineRunCommandTest.php @@ -19,7 +19,7 @@ public function test_config_option_is_not_accepted(): void $this->expectException(InvalidOptionException::class); $this->expectExceptionMessage('The "--config" option does not exist.'); - (new CommandTester(new PipelineRunCommand('run')))->execute([ + new CommandTester(new PipelineRunCommand('run'))->execute([ 'pipeline-file' => __DIR__ . '/Fixtures/pipeline.php', '--config' => 'x.php', ]); diff --git a/src/cli/tests/Flow/CLI/Tests/Integration/SchemaFormatCommandTest.php b/src/cli/tests/Flow/CLI/Tests/Integration/SchemaFormatCommandTest.php index a49e75194a..3a1e94ce83 100644 --- a/src/cli/tests/Flow/CLI/Tests/Integration/SchemaFormatCommandTest.php +++ b/src/cli/tests/Flow/CLI/Tests/Integration/SchemaFormatCommandTest.php @@ -18,7 +18,7 @@ public function test_config_option_is_not_accepted(): void $this->expectException(InvalidOptionException::class); $this->expectExceptionMessage('The "--config" option does not exist.'); - (new CommandTester(new SchemaFormatCommand('schema:format')))->execute([ + new CommandTester(new SchemaFormatCommand('schema:format'))->execute([ 'input-schema-file' => __DIR__ . '/Fixtures/schema.json', '--config' => 'x.php', ]); diff --git a/src/cli/tests/Flow/CLI/Tests/Unit/Formatter/PipelineReportFormatterTest.php b/src/cli/tests/Flow/CLI/Tests/Unit/Formatter/PipelineReportFormatterTest.php index 6bf6565ca6..827ad79078 100644 --- a/src/cli/tests/Flow/CLI/Tests/Unit/Formatter/PipelineReportFormatterTest.php +++ b/src/cli/tests/Flow/CLI/Tests/Unit/Formatter/PipelineReportFormatterTest.php @@ -18,13 +18,13 @@ final class PipelineReportFormatterTest extends FlowTestCase { public function test_a_launched_run_prints_the_worker_peak_and_the_peak_sum(): void { - $input = new ArrayInput(['pipeline-file' => 'pipeline.php'], (new PipelineRunCommand('run'))->getDefinition()); + $input = new ArrayInput(['pipeline-file' => 'pipeline.php'], new PipelineRunCommand('run')->getDefinition()); $output = new BufferedOutput(); - (new PipelineReportFormatter(ReportMother::of(new Processes(Unit::fromMb(25), [ + new PipelineReportFormatter(ReportMother::of(new Processes(Unit::fromMb(25), [ Unit::fromMb(40), Unit::fromMb(41), - ])), new SymfonyStyle($input, $output), $input))->format(); + ])), new SymfonyStyle($input, $output), $input)->format(); $display = $output->fetch(); static::assertMatchesRegularExpression('/Heap Peak\s+[\d.]+ (B|KiB|MiB|GiB)\s/', $display); @@ -35,14 +35,14 @@ public function test_a_launched_run_prints_the_worker_peak_and_the_peak_sum(): v public function test_a_serial_run_prints_no_worker_rows(): void { - $input = new ArrayInput(['pipeline-file' => 'pipeline.php'], (new PipelineRunCommand('run'))->getDefinition()); + $input = new ArrayInput(['pipeline-file' => 'pipeline.php'], new PipelineRunCommand('run')->getDefinition()); $output = new BufferedOutput(); - (new PipelineReportFormatter( + new PipelineReportFormatter( ReportMother::of(new Processes(Unit::fromMb(25), [])), new SymfonyStyle($input, $output), $input, - ))->format(); + )->format(); $display = $output->fetch(); static::assertMatchesRegularExpression('/Process Peak\s+25\.0 MiB\s/', $display); diff --git a/src/cli/tests/Flow/CLI/Tests/Unit/Options/FileFormatOptionTest.php b/src/cli/tests/Flow/CLI/Tests/Unit/Options/FileFormatOptionTest.php index c0af1e6361..5edbe806d2 100644 --- a/src/cli/tests/Flow/CLI/Tests/Unit/Options/FileFormatOptionTest.php +++ b/src/cli/tests/Flow/CLI/Tests/Unit/Options/FileFormatOptionTest.php @@ -20,7 +20,7 @@ public function test_getting_format_from_option_for_path_with_extension(): void $option = new InputOption('format', null, InputOption::VALUE_OPTIONAL); $definition = new InputDefinition([$option]); - static::assertSame(FileFormat::JSON, (new FileFormatOption(path(__DIR__ . '/file.csv'), 'format'))->get( + static::assertSame(FileFormat::JSON, new FileFormatOption(path(__DIR__ . '/file.csv'), 'format')->get( new ArrayInput(['--format' => 'json'], $definition), )); } @@ -30,7 +30,7 @@ public function test_getting_format_from_option_for_path_without_extension(): vo $option = new InputOption('format', null, InputOption::VALUE_OPTIONAL); $definition = new InputDefinition([$option]); - static::assertSame(FileFormat::JSON, (new FileFormatOption(path(__DIR__ . '/file'), 'format'))->get( + static::assertSame(FileFormat::JSON, new FileFormatOption(path(__DIR__ . '/file'), 'format')->get( new ArrayInput(['--format' => 'json'], $definition), )); } @@ -42,7 +42,7 @@ public function test_getting_format_from_path(): void static::assertSame( FileFormat::CSV, - (new FileFormatOption(path(__DIR__ . '/file.csv'), 'format'))->get(new ArrayInput([], $definition)), + new FileFormatOption(path(__DIR__ . '/file.csv'), 'format')->get(new ArrayInput([], $definition)), ); } @@ -52,6 +52,6 @@ public function test_getting_format_from_path_without_extension(): void $definition = new InputDefinition([$option]); $this->expectExceptionMessage("Option 'format' is required"); - (new FileFormatOption(path(__DIR__ . '/file'), 'format'))->get(new ArrayInput([], $definition)); + new FileFormatOption(path(__DIR__ . '/file'), 'format')->get(new ArrayInput([], $definition)); } } diff --git a/src/cli/tests/Flow/CLI/Tests/Unit/Options/TypedOptionTest.php b/src/cli/tests/Flow/CLI/Tests/Unit/Options/TypedOptionTest.php index 7a0839d099..f2e600e1ed 100644 --- a/src/cli/tests/Flow/CLI/Tests/Unit/Options/TypedOptionTest.php +++ b/src/cli/tests/Flow/CLI/Tests/Unit/Options/TypedOptionTest.php @@ -18,21 +18,21 @@ public function test_getting_bool_nullable_value(): void $option = new InputOption('option', null, InputOption::VALUE_OPTIONAL); $definition = new InputDefinition([$option]); - static::assertTrue((new TypedOption('option'))->asBoolNullable(new ArrayInput([ + static::assertTrue(new TypedOption('option')->asBoolNullable(new ArrayInput([ '--option' => 'true', ], $definition))); - static::assertTrue((new TypedOption('option'))->asBoolNullable(new ArrayInput([ + static::assertTrue(new TypedOption('option')->asBoolNullable(new ArrayInput([ '--option' => 'on', ], $definition))); - static::assertTrue((new TypedOption('option'))->asBoolNullable(new ArrayInput([ + static::assertTrue(new TypedOption('option')->asBoolNullable(new ArrayInput([ '--option' => '1', ], $definition))); - static::assertTrue((new TypedOption('option'))->asBoolNullable(new ArrayInput(['--option' => 1], $definition))); + static::assertTrue(new TypedOption('option')->asBoolNullable(new ArrayInput(['--option' => 1], $definition))); - static::assertNull((new TypedOption('option'))->asBoolNullable(new ArrayInput([ + static::assertNull(new TypedOption('option')->asBoolNullable(new ArrayInput([ '--option' => 'lol', ], $definition))); - static::assertNull((new TypedOption('option'))->asBoolNullable(new ArrayInput([], $definition))); + static::assertNull(new TypedOption('option')->asBoolNullable(new ArrayInput([], $definition))); } public function test_getting_bool_nullable_value_with_default_definition(): void @@ -40,21 +40,21 @@ public function test_getting_bool_nullable_value_with_default_definition(): void $option = new InputOption('option', null, InputOption::VALUE_OPTIONAL, '', false); $definition = new InputDefinition([$option]); - static::assertTrue((new TypedOption('option'))->asBoolNullable(new ArrayInput([ + static::assertTrue(new TypedOption('option')->asBoolNullable(new ArrayInput([ '--option' => 'true', ], $definition))); - static::assertTrue((new TypedOption('option'))->asBoolNullable(new ArrayInput([ + static::assertTrue(new TypedOption('option')->asBoolNullable(new ArrayInput([ '--option' => 'on', ], $definition))); - static::assertTrue((new TypedOption('option'))->asBoolNullable(new ArrayInput([ + static::assertTrue(new TypedOption('option')->asBoolNullable(new ArrayInput([ '--option' => '1', ], $definition))); - static::assertTrue((new TypedOption('option'))->asBoolNullable(new ArrayInput(['--option' => 1], $definition))); + static::assertTrue(new TypedOption('option')->asBoolNullable(new ArrayInput(['--option' => 1], $definition))); - static::assertNull((new TypedOption('option'))->asBoolNullable(new ArrayInput([ + static::assertNull(new TypedOption('option')->asBoolNullable(new ArrayInput([ '--option' => 'lol', ], $definition))); - static::assertFalse((new TypedOption('option'))->asBoolNullable(new ArrayInput([], $definition))); + static::assertFalse(new TypedOption('option')->asBoolNullable(new ArrayInput([], $definition))); } public function test_getting_bool_value(): void @@ -62,8 +62,8 @@ public function test_getting_bool_value(): void $option = new InputOption('option', null, InputOption::VALUE_NONE); $definition = new InputDefinition([$option]); - static::assertTrue((new TypedOption('option'))->asBool(new ArrayInput(['--option' => null], $definition))); - static::assertFalse((new TypedOption('option'))->asBool(new ArrayInput([], $definition))); + static::assertTrue(new TypedOption('option')->asBool(new ArrayInput(['--option' => null], $definition))); + static::assertFalse(new TypedOption('option')->asBool(new ArrayInput([], $definition))); } public function test_getting_int_value(): void @@ -71,12 +71,12 @@ public function test_getting_int_value(): void $option = new InputOption('option', null, InputOption::VALUE_REQUIRED); $definition = new InputDefinition([$option]); - static::assertSame(1, (new TypedOption('option'))->asInt(new ArrayInput(['--option' => '1'], $definition))); - static::assertSame(1, (new TypedOption('option'))->asInt(new ArrayInput(['--option' => 1], $definition))); - static::assertSame(10, (new TypedOption('option'))->asInt(new ArrayInput([], $definition), 10)); + static::assertSame(1, new TypedOption('option')->asInt(new ArrayInput(['--option' => '1'], $definition))); + static::assertSame(1, new TypedOption('option')->asInt(new ArrayInput(['--option' => 1], $definition))); + static::assertSame(10, new TypedOption('option')->asInt(new ArrayInput([], $definition), 10)); $this->expectException(InvalidArgumentException::class); - (new TypedOption('option'))->asInt(new ArrayInput([], $definition)); + new TypedOption('option')->asInt(new ArrayInput([], $definition)); } public function test_getting_list_of_strings(): void @@ -84,11 +84,11 @@ public function test_getting_list_of_strings(): void $option = new InputOption('option', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY); $definition = new InputDefinition([$option]); - static::assertEquals(['value1', 'value2', '1'], (new TypedOption('option'))->asListOfStrings(new ArrayInput( + static::assertEquals(['value1', 'value2', '1'], new TypedOption('option')->asListOfStrings(new ArrayInput( ['--option' => ['value1', 'value2', 1]], $definition, ))); - static::assertEquals([], (new TypedOption('option'))->asListOfStrings(new ArrayInput([], $definition))); + static::assertEquals([], new TypedOption('option')->asListOfStrings(new ArrayInput([], $definition))); } public function test_getting_list_of_strings_nullable(): void @@ -96,11 +96,11 @@ public function test_getting_list_of_strings_nullable(): void $option = new InputOption('option', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY); $definition = new InputDefinition([$option]); - static::assertEquals(['value1', 'value2'], (new TypedOption('option'))->asListOfStringsNullable(new ArrayInput( + static::assertEquals(['value1', 'value2'], new TypedOption('option')->asListOfStringsNullable(new ArrayInput( ['--option' => ['value1', 'value2']], $definition, ))); - static::assertNull((new TypedOption('option'))->asListOfStringsNullable(new ArrayInput([], $definition))); + static::assertNull(new TypedOption('option')->asListOfStringsNullable(new ArrayInput([], $definition))); } public function test_getting_string_value(): void @@ -108,15 +108,15 @@ public function test_getting_string_value(): void $option = new InputOption('option', null, InputOption::VALUE_REQUIRED); $definition = new InputDefinition([$option]); - static::assertSame('value', (new TypedOption('option'))->asString(new ArrayInput([ + static::assertSame('value', new TypedOption('option')->asString(new ArrayInput([ '--option' => 'value', ], $definition))); - static::assertSame('default value', (new TypedOption('option'))->asString( + static::assertSame('default value', new TypedOption('option')->asString( new ArrayInput([], $definition), 'default value', )); $this->expectException(InvalidArgumentException::class); - (new TypedOption('option'))->asString(new ArrayInput([], $definition)); + new TypedOption('option')->asString(new ArrayInput([], $definition)); } } diff --git a/src/core/etl/composer.json b/src/core/etl/composer.json index c3c4b702b7..67181da3a0 100644 --- a/src/core/etl/composer.json +++ b/src/core/etl/composer.json @@ -9,17 +9,17 @@ "load" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "ext-json": "*", "psr/clock": "^1.0", - "brick/math": "^0.12 || ^0.13 || ^0.14 || ^0.15 || ^0.16 || ^0.17 || ^0.18 || ^1.0", + "brick/math": "^0.14.2 || ^0.15 || ^0.16 || ^0.17 || ^0.18 || ^1.0", "composer-runtime-api": "^2.2", "flow-php/telemetry": "self.version", "flow-php/types": "self.version", "flow-php/array-dot": "self.version", "flow-php/filesystem": "self.version", "psr/simple-cache": "^1.0 || ^2.0 || ^3.0", - "symfony/string": "^6.4 || ^7.4 || ^8.0" + "symfony/string": "^7.4 || ^8.0" }, "conflict": { "ext-flow_php": "<0.45" @@ -31,7 +31,7 @@ "require-dev": { "ramsey/uuid": "^4.5", "symfony/polyfill-mbstring": "^1.33", - "symfony/uid": "^6.4 || ^7.4 || ^8.0" + "symfony/uid": "^7.4 || ^8.0" }, "config": { "optimize-autoloader": true, diff --git a/src/core/etl/src/Flow/ETL/API/DataFrame.php b/src/core/etl/src/Flow/ETL/API/DataFrame.php index 55494e5e41..9d28e89e74 100644 --- a/src/core/etl/src/Flow/ETL/API/DataFrame.php +++ b/src/core/etl/src/Flow/ETL/API/DataFrame.php @@ -769,7 +769,7 @@ public function withColumn(string|Definition $column, ScalarFunction|WindowFunct return new self( match (true) { $reference instanceof WindowFunction => new Node\WindowColumn($this->root, $column, $reference), - (new ExpandingFunctions())->in($reference) !== [] => new Node\ExpandColumn( + new ExpandingFunctions()->in($reference) !== [] => new Node\ExpandColumn( $this->root, $column, $reference, diff --git a/src/core/etl/src/Flow/ETL/DSL/functions.php b/src/core/etl/src/Flow/ETL/DSL/functions.php index 0b4e5c902f..8fdc6b9229 100644 --- a/src/core/etl/src/Flow/ETL/DSL/functions.php +++ b/src/core/etl/src/Flow/ETL/DSL/functions.php @@ -1466,7 +1466,7 @@ function number_format( #[DocumentationDSL(module: Module::CORE, type: DSLType::DATA_FRAME)] function array_to_rows(array $data, Schema $schema, Backend $backend = new AdaptiveBackend()): Rows { - return (new RowsBuilder($schema, $backend)) + return new RowsBuilder($schema, $backend) ->appendRecords($data) ->finish(); } @@ -1618,7 +1618,7 @@ function schema(Definition ...$definitions): Schema #[DocumentationDSL(module: Module::CORE, type: DSLType::HELPER)] function schema_to_json(Schema $schema, bool $pretty = false): string { - return (new JsonSchemaFormatter($pretty))->format($schema); + return new JsonSchemaFormatter($pretty)->format($schema); } /** @@ -1630,7 +1630,7 @@ function schema_to_php( ValueFormatter $valueFormatter = new ValueFormatter(), TypeFormatter $typeFormatter = new TypeFormatter(), ): string { - return (new PHPSchemaFormatter($valueFormatter, $typeFormatter))->format($schema); + return new PHPSchemaFormatter($valueFormatter, $typeFormatter)->format($schema); } /** @@ -1916,7 +1916,7 @@ function infer_schema(): SchemaInferenceBuilder #[DocumentationDSL(module: Module::CORE, type: DSLType::DATA_FRAME)] function execution_context(?Config $config = null): FlowContext { - return new FlowContext($config ?? (new ConfigBuilder())->build()); + return new FlowContext($config ?? new ConfigBuilder()->build()); } #[DocumentationDSL(module: Module::CORE, type: DSLType::DATA_FRAME)] @@ -1928,7 +1928,7 @@ function flow_context(?Config $config = null): FlowContext #[DocumentationDSL(module: Module::CORE, type: DSLType::DATA_FRAME)] function config(): Config { - return (new ConfigBuilder())->build(); + return new ConfigBuilder()->build(); } #[DocumentationDSL(module: Module::CORE, type: DSLType::DATA_FRAME)] diff --git a/src/core/etl/src/Flow/ETL/Flow.php b/src/core/etl/src/Flow/ETL/Flow.php index 0fe157eafa..d5c5faec7b 100644 --- a/src/core/etl/src/Flow/ETL/Flow.php +++ b/src/core/etl/src/Flow/ETL/Flow.php @@ -24,7 +24,7 @@ public function __construct(Config|ConfigBuilder|null $config = null) $config = $config->build(); } - $this->config = $config ?: (new ConfigBuilder())->build(); + $this->config = $config ?: new ConfigBuilder()->build(); } public static function setUp(ConfigBuilder|Config $config): self diff --git a/src/core/etl/src/Flow/ETL/Foundation/Calculator/Calculator.php b/src/core/etl/src/Flow/ETL/Foundation/Calculator/Calculator.php index 5ca5a5df57..1754e0d350 100644 --- a/src/core/etl/src/Flow/ETL/Foundation/Calculator/Calculator.php +++ b/src/core/etl/src/Flow/ETL/Foundation/Calculator/Calculator.php @@ -15,7 +15,6 @@ use Flow\ETL\Foundation\Exception\InvalidArgumentException; use function abs; -use function defined; use function floor; use function ini_get; use function is_finite; @@ -87,30 +86,18 @@ public function divide( $aDecimal = BigDecimal::of((string) $a); $effectiveScale = $scale ?? $aDecimal->getScale(); - $useNewNaming = defined('Brick\Math\RoundingMode::Up'); - // @mago-ignore analysis:possibly-invalid-argument $result = $aDecimal->dividedBy(BigDecimal::of((string) $b), $effectiveScale, match ($rounding) { - // @mago-ignore analysis:non-existent-class-constant - Rounding::UP => $useNewNaming ? RoundingMode::Up : RoundingMode::UP, - // @mago-ignore analysis:non-existent-class-constant - Rounding::DOWN => $useNewNaming ? RoundingMode::Down : RoundingMode::DOWN, - // @mago-ignore analysis:non-existent-class-constant - Rounding::CEILING => $useNewNaming ? RoundingMode::Ceiling : RoundingMode::CEILING, - // @mago-ignore analysis:non-existent-class-constant - Rounding::FLOOR => $useNewNaming ? RoundingMode::Floor : RoundingMode::FLOOR, - // @mago-ignore analysis:non-existent-class-constant - Rounding::HALF_UP => $useNewNaming ? RoundingMode::HalfUp : RoundingMode::HALF_UP, - // @mago-ignore analysis:non-existent-class-constant - Rounding::HALF_DOWN => $useNewNaming ? RoundingMode::HalfDown : RoundingMode::HALF_DOWN, - // @mago-ignore analysis:non-existent-class-constant - Rounding::HALF_CEILING => $useNewNaming ? RoundingMode::HalfCeiling : RoundingMode::HALF_CEILING, - // @mago-ignore analysis:non-existent-class-constant - Rounding::HALF_FLOOR => $useNewNaming ? RoundingMode::HalfFloor : RoundingMode::HALF_FLOOR, - // @mago-ignore analysis:non-existent-class-constant - Rounding::HALF_EVEN => $useNewNaming ? RoundingMode::HalfEven : RoundingMode::HALF_EVEN, - // @mago-ignore analysis:non-existent-class-constant - default => $useNewNaming ? RoundingMode::Unnecessary : RoundingMode::UNNECESSARY, + Rounding::UP => RoundingMode::Up, + Rounding::DOWN => RoundingMode::Down, + Rounding::CEILING => RoundingMode::Ceiling, + Rounding::FLOOR => RoundingMode::Floor, + Rounding::HALF_UP => RoundingMode::HalfUp, + Rounding::HALF_DOWN => RoundingMode::HalfDown, + Rounding::HALF_CEILING => RoundingMode::HalfCeiling, + Rounding::HALF_FLOOR => RoundingMode::HalfFloor, + Rounding::HALF_EVEN => RoundingMode::HalfEven, + default => RoundingMode::Unnecessary, }); return $result->toFloat(); diff --git a/src/core/etl/src/Flow/ETL/Foundation/Describe/ConfiguredFilesystem.php b/src/core/etl/src/Flow/ETL/Foundation/Describe/ConfiguredFilesystem.php index 04e9147573..895550c702 100644 --- a/src/core/etl/src/Flow/ETL/Foundation/Describe/ConfiguredFilesystem.php +++ b/src/core/etl/src/Flow/ETL/Foundation/Describe/ConfiguredFilesystem.php @@ -26,7 +26,7 @@ public static function fromDescription(#[SensitiveParameter] array $data, Rebuil { $class = type_string()->assert($data['filesystem'] ?? null); - if (!is_a($class, Filesystem::class, true) || (new ReflectionClass($class))->isAbstract()) { + if (!is_a($class, Filesystem::class, true) || new ReflectionClass($class)->isAbstract()) { throw InvalidArgumentException::because('%s is not a concrete Filesystem', $class); } diff --git a/src/core/etl/src/Flow/ETL/Foundation/Describe/Rebuild.php b/src/core/etl/src/Flow/ETL/Foundation/Describe/Rebuild.php index b5cead1882..26687f69bb 100644 --- a/src/core/etl/src/Flow/ETL/Foundation/Describe/Rebuild.php +++ b/src/core/etl/src/Flow/ETL/Foundation/Describe/Rebuild.php @@ -97,7 +97,7 @@ public function object(Description $description, string $type): object ); } - if ((new ReflectionClass($class))->isAbstract()) { + if (new ReflectionClass($class)->isAbstract()) { throw InvalidArgumentException::because('%s is not a concrete class', $class); } diff --git a/src/core/etl/src/Flow/ETL/Foundation/Exception/ColumnMismatchException.php b/src/core/etl/src/Flow/ETL/Foundation/Exception/ColumnMismatchException.php index 3c65dab734..606a8704a0 100644 --- a/src/core/etl/src/Flow/ETL/Foundation/Exception/ColumnMismatchException.php +++ b/src/core/etl/src/Flow/ETL/Foundation/Exception/ColumnMismatchException.php @@ -72,7 +72,7 @@ public static function valueDoesNotMatch( : sprintf( ': could not convert %s (%s) to %s', self::describe($value), - (new TypeDetector()) + new TypeDetector() ->detectType($value) ->toString(), $type, diff --git a/src/core/etl/src/Flow/ETL/Foundation/Exception/RequiredPHPVersionException.php b/src/core/etl/src/Flow/ETL/Foundation/Exception/RequiredPHPVersionException.php deleted file mode 100644 index 9f45f3c1da..0000000000 --- a/src/core/etl/src/Flow/ETL/Foundation/Exception/RequiredPHPVersionException.php +++ /dev/null @@ -1,18 +0,0 @@ -closestTo($column, array_values($available))); + return new self($column, new SimilarNames()->closestTo($column, array_values($available))); } /** diff --git a/src/core/etl/src/Flow/ETL/Functions/All.php b/src/core/etl/src/Flow/ETL/Functions/All.php index a8089f2ea4..898a470535 100644 --- a/src/core/etl/src/Flow/ETL/Functions/All.php +++ b/src/core/etl/src/Flow/ETL/Functions/All.php @@ -102,7 +102,7 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), ...array_map( + return new Nullability()->any(type_boolean(), ...array_map( static fn(ScalarFunction $function): Type => $function->returns(), $this->functions, )); @@ -121,7 +121,7 @@ public function eval(Rows $rows, Backend $backend): Column break; } - $truths = (new Selection($undecided))->truths($function, $rows, $backend); + $truths = new Selection($undecided)->truths($function, $rows, $backend); foreach (array_keys($truths, null, true) as $k) { $sawNull[$undecided[$k]] = true; @@ -146,7 +146,7 @@ public function eval(Rows $rows, Backend $backend): Column $ordered[] = $results[$i]; } - return (new ResultColumn($backend))->of($this, $ordered); + return new ResultColumn($backend)->of($this, $ordered); } public function or(ScalarFunction $scalarFunction): Any diff --git a/src/core/etl/src/Flow/ETL/Functions/Any.php b/src/core/etl/src/Flow/ETL/Functions/Any.php index 4428f49ee2..4d86c31e1b 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Any.php +++ b/src/core/etl/src/Flow/ETL/Functions/Any.php @@ -102,7 +102,7 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), ...array_map( + return new Nullability()->any(type_boolean(), ...array_map( static fn(ScalarFunction $function): Type => $function->returns(), $this->functions, )); @@ -121,7 +121,7 @@ public function eval(Rows $rows, Backend $backend): Column break; } - $truths = (new Selection($undecided))->truths($function, $rows, $backend); + $truths = new Selection($undecided)->truths($function, $rows, $backend); foreach (array_keys($truths, null, true) as $k) { $sawNull[$undecided[$k]] = true; @@ -146,7 +146,7 @@ public function eval(Rows $rows, Backend $backend): Column $ordered[] = $results[$i]; } - return (new ResultColumn($backend))->of($this, $ordered); + return new ResultColumn($backend)->of($this, $ordered); } public function or(ScalarFunction $scalarFunction): self diff --git a/src/core/etl/src/Flow/ETL/Functions/Append.php b/src/core/etl/src/Flow/ETL/Functions/Append.php index f0b8b98e17..d6fa2de189 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Append.php +++ b/src/core/etl/src/Flow/ETL/Functions/Append.php @@ -75,8 +75,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $suffixes = (new Parameter($this->suffix))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $suffixes = new Parameter($this->suffix)->asStrings($rows, $backend); $results = []; $i = 0; @@ -100,6 +100,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayExpand.php b/src/core/etl/src/Flow/ETL/Functions/ArrayExpand.php index 2e1cd1b6b9..a9fd77b8c0 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayExpand.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayExpand.php @@ -110,7 +110,7 @@ public function eval(Rows $rows, Backend $backend): Column { $lists = []; - foreach ((new Parameter($this->ref))->asArrays($rows, $backend) as $array) { + foreach (new Parameter($this->ref)->asArrays($rows, $backend) as $array) { if ($array === null) { $lists[] = []; @@ -128,6 +128,6 @@ public function eval(Rows $rows, Backend $backend): Column }; } - return (new ResultColumn($backend))->lists($this, $lists); + return new ResultColumn($backend)->lists($this, $lists); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayFilter.php b/src/core/etl/src/Flow/ETL/Functions/ArrayFilter.php index b2c2c524ff..33f511e239 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayFilter.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayFilter.php @@ -87,8 +87,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $arrays = (new Parameter($this->array))->asArrays($rows, $backend); - $values = (new Parameter($this->value))->values($rows, $backend); + $arrays = new Parameter($this->array)->asArrays($rows, $backend); + $values = new Parameter($this->value)->values($rows, $backend); $results = []; $i = 0; @@ -107,6 +107,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayGet.php b/src/core/etl/src/Flow/ETL/Functions/ArrayGet.php index 11b3573649..9c5144afe0 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayGet.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayGet.php @@ -118,13 +118,13 @@ public function returns(): Type $type = $element->type; } - return $nullable ? (new TypeWidener())->nullable($type) : $type; + return $nullable ? new TypeWidener()->nullable($type) : $type; } public function eval(Rows $rows, Backend $backend): Column { try { - $values = (new Parameter($this->ref))->asArrays($rows, $backend); + $values = new Parameter($this->ref)->asArrays($rows, $backend); } catch (EvaluationException $e) { throw new EvaluationException( $e->rowIndex, @@ -151,6 +151,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayGetCollection.php b/src/core/etl/src/Flow/ETL/Functions/ArrayGetCollection.php index 403bf491c7..8f7bf14968 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayGetCollection.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayGetCollection.php @@ -103,9 +103,9 @@ public static function fromFirst(ScalarFunction $ref, ScalarFunction|array $keys public function eval(Rows $rows, Backend $backend): Column { try { - $values = (new Parameter($this->ref))->asArrays($rows, $backend); - $indexes = (new Parameter($this->index))->asStrings($rows, $backend); - $keysList = (new Parameter($this->keys))->asArrays($rows, $backend); + $values = new Parameter($this->ref)->asArrays($rows, $backend); + $indexes = new Parameter($this->index)->asStrings($rows, $backend); + $keysList = new Parameter($this->keys)->asArrays($rows, $backend); } catch (EvaluationException $e) { throw new EvaluationException( $e->rowIndex, @@ -173,6 +173,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayKeep.php b/src/core/etl/src/Flow/ETL/Functions/ArrayKeep.php index a903241d85..07bf6108c1 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayKeep.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayKeep.php @@ -87,8 +87,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $arrays = (new Parameter($this->array))->asArrays($rows, $backend); - $values = (new Parameter($this->value))->values($rows, $backend); + $arrays = new Parameter($this->array)->asArrays($rows, $backend); + $values = new Parameter($this->value)->values($rows, $backend); $results = []; $i = 0; @@ -107,6 +107,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayKeyRename.php b/src/core/etl/src/Flow/ETL/Functions/ArrayKeyRename.php index ecda1ea7e7..65e0da8b48 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayKeyRename.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayKeyRename.php @@ -75,7 +75,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->ref))->asArrays($rows, $backend); + $values = new Parameter($this->ref)->asArrays($rows, $backend); $results = []; $i = 0; @@ -91,6 +91,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayKeys.php b/src/core/etl/src/Flow/ETL/Functions/ArrayKeys.php index da6d169178..08bee26f17 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayKeys.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayKeys.php @@ -90,7 +90,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $arrays = (new Parameter($this->array))->asArrays($rows, $backend); + $arrays = new Parameter($this->array)->asArrays($rows, $backend); $results = []; $i = 0; @@ -106,6 +106,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayKeysStyleConvert.php b/src/core/etl/src/Flow/ETL/Functions/ArrayKeysStyleConvert.php index 239b5269e5..755d801922 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayKeysStyleConvert.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayKeysStyleConvert.php @@ -149,7 +149,7 @@ public function converted(Type $type): Type public function eval(Rows $rows, Backend $backend): Column { - $arrays = (new Parameter($this->ref))->asArrays($rows, $backend); + $arrays = new Parameter($this->ref)->asArrays($rows, $backend); $converter = new ArrayKeyConverter(fn(string $key): string => $this->style->convert($key)); $results = []; $i = 0; @@ -166,6 +166,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayMerge.php b/src/core/etl/src/Flow/ETL/Functions/ArrayMerge.php index 3097c796e9..11c496c1c1 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayMerge.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayMerge.php @@ -87,7 +87,7 @@ public function returns(): Type if ($left instanceof ListType && $right instanceof ListType) { return type_list( - (new PromotingUnifier())->unify( + new PromotingUnifier()->unify( $left->element(), $right->element(), ) ?? throw InvalidTypeException::noCommonType($left->element(), $right->element()), @@ -99,8 +99,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $lefts = (new Parameter($this->left))->asArrays($rows, $backend); - $rights = (new Parameter($this->right))->asArrays($rows, $backend); + $lefts = new Parameter($this->left)->asArrays($rows, $backend); + $rights = new Parameter($this->right)->asArrays($rows, $backend); $results = []; $i = 0; @@ -118,6 +118,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayMergeCollection.php b/src/core/etl/src/Flow/ETL/Functions/ArrayMergeCollection.php index a84a912f8a..022d75b148 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayMergeCollection.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayMergeCollection.php @@ -103,7 +103,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $arrays = (new Parameter($this->array))->asArrays($rows, $backend); + $arrays = new Parameter($this->array)->asArrays($rows, $backend); $results = []; $i = 0; @@ -129,6 +129,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayPathExists.php b/src/core/etl/src/Flow/ETL/Functions/ArrayPathExists.php index fdb9b25cc4..6085a50e9e 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayPathExists.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayPathExists.php @@ -74,14 +74,14 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), $this->array->returns(), $this->path->returns()); + return new Nullability()->any(type_boolean(), $this->array->returns(), $this->path->returns()); } public function eval(Rows $rows, Backend $backend): Column { try { - $arrays = (new Parameter($this->array))->asArrays($rows, $backend); - $paths = (new Parameter($this->path))->asStrings($rows, $backend); + $arrays = new Parameter($this->array)->asArrays($rows, $backend); + $paths = new Parameter($this->path)->asStrings($rows, $backend); } catch (EvaluationException $e) { throw new EvaluationException( $e->rowIndex, @@ -114,6 +114,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayReverse.php b/src/core/etl/src/Flow/ETL/Functions/ArrayReverse.php index 13a8d10fbc..3a0e843e77 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayReverse.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayReverse.php @@ -87,7 +87,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $arrays = (new Parameter($this->array))->asArrays($rows, $backend); + $arrays = new Parameter($this->array)->asArrays($rows, $backend); $results = []; $i = 0; @@ -103,6 +103,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ArraySort.php b/src/core/etl/src/Flow/ETL/Functions/ArraySort.php index 494a35ec23..0b7bba6969 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArraySort.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArraySort.php @@ -114,9 +114,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $arrays = (new Parameter($this->ref))->asArrays($rows, $backend); - $flagsList = (new Parameter($this->flags))->asInts($rows, $backend); - $recursives = (new Parameter($this->recursive))->asBooleans($rows, $backend); + $arrays = new Parameter($this->ref)->asArrays($rows, $backend); + $flagsList = new Parameter($this->flags)->asInts($rows, $backend); + $recursives = new Parameter($this->recursive)->asBooleans($rows, $backend); $results = []; $i = 0; @@ -139,7 +139,7 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } /** diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayUnpack.php b/src/core/etl/src/Flow/ETL/Functions/ArrayUnpack.php index 0f49e8f91d..8a958d43d3 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayUnpack.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayUnpack.php @@ -71,14 +71,14 @@ public function eval(Rows $rows, Backend $backend): Column $i = 0; try { - foreach ((new Parameter($this->array))->asArrays($rows, $backend) as $i => $array) { + foreach (new Parameter($this->array)->asArrays($rows, $backend) as $i => $array) { $results[] = $array ?? throw new InvalidArgumentException('array_unpack() requires a non-null array'); } } catch (Exception $e) { throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } /** diff --git a/src/core/etl/src/Flow/ETL/Functions/ArrayValues.php b/src/core/etl/src/Flow/ETL/Functions/ArrayValues.php index dff7711a3a..3f74e9edba 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ArrayValues.php +++ b/src/core/etl/src/Flow/ETL/Functions/ArrayValues.php @@ -87,7 +87,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $arrays = (new Parameter($this->array))->asArrays($rows, $backend); + $arrays = new Parameter($this->array)->asArrays($rows, $backend); $results = []; $i = 0; @@ -103,6 +103,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Ascii.php b/src/core/etl/src/Flow/ETL/Functions/Ascii.php index 50fbc2d104..cbc9b85757 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Ascii.php +++ b/src/core/etl/src/Flow/ETL/Functions/Ascii.php @@ -69,7 +69,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $strings = (new Parameter($this->string))->asStrings($rows, $backend); + $strings = new Parameter($this->string)->asStrings($rows, $backend); $results = []; $i = 0; @@ -85,6 +85,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Average.php b/src/core/etl/src/Flow/ETL/Functions/Average.php index 90c2e5e6ae..d61e3129ae 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Average.php +++ b/src/core/etl/src/Flow/ETL/Functions/Average.php @@ -166,7 +166,7 @@ public function frameValues(Rows $partition, array $bounds, Backend $backend, Pr public function values(Rows $partition, Backend $backend, Progress $progress): array { - return (new FrameAccumulation($this->window()->frame()))->values($this, $partition, $backend, $progress); + return new FrameAccumulation($this->window()->frame())->values($this, $partition, $backend, $progress); } public function over(Window $window): static @@ -223,7 +223,7 @@ public function value(): ?float return $sum === null ? null - : (new Calculator())->divide($sum, $this->total->count(), $this->scale, $this->rounding); + : new Calculator()->divide($sum, $this->total->count(), $this->scale, $this->rounding); } public function toString(): string diff --git a/src/core/etl/src/Flow/ETL/Functions/Between.php b/src/core/etl/src/Flow/ETL/Functions/Between.php index ee61bf1565..ffc526d957 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Between.php +++ b/src/core/etl/src/Flow/ETL/Functions/Between.php @@ -105,13 +105,13 @@ public function withOperands(array $operands): static */ public function returns(): Type { - (new ValueComparator())->assertAllTypesComparable([ + new ValueComparator()->assertAllTypesComparable([ $this->value->returns(), $this->lowerBoundRef->returns(), $this->upperBoundRef->returns(), ], Operator::GREATER_THAN_EQUAL); - return (new Nullability())->any( + return new Nullability()->any( type_boolean(), $this->value->returns(), $this->lowerBoundRef->returns(), @@ -122,7 +122,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $boundaries = (new Parameter($this->boundary))->asEnums($rows, $backend, Boundary::class); + $boundaries = new Parameter($this->boundary)->asEnums($rows, $backend, Boundary::class); $columns = array_map(static fn(ScalarFunction $function): Column => $function->eval($rows, $backend), [ $this->value, $this->lowerBoundRef, @@ -151,6 +151,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/BinaryLength.php b/src/core/etl/src/Flow/ETL/Functions/BinaryLength.php index e14595924d..f3473b6803 100644 --- a/src/core/etl/src/Flow/ETL/Functions/BinaryLength.php +++ b/src/core/etl/src/Flow/ETL/Functions/BinaryLength.php @@ -69,7 +69,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); $results = []; $i = 0; @@ -85,6 +85,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/CallUserFunc.php b/src/core/etl/src/Flow/ETL/Functions/CallUserFunc.php index b2409d6580..47292f3df4 100644 --- a/src/core/etl/src/Flow/ETL/Functions/CallUserFunc.php +++ b/src/core/etl/src/Flow/ETL/Functions/CallUserFunc.php @@ -115,8 +115,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $callables = (new Parameter($this->callable))->values($rows, $backend); - $arguments = array_map(static fn(ScalarFunction $parameter): array => (new Parameter($parameter))->values( + $callables = new Parameter($this->callable)->values($rows, $backend); + $arguments = array_map(static fn(ScalarFunction $parameter): array => new Parameter($parameter)->values( $rows, $backend, ), $this->parameters); @@ -146,6 +146,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Capitalize.php b/src/core/etl/src/Flow/ETL/Functions/Capitalize.php index 6c428009bc..0ba17c821a 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Capitalize.php +++ b/src/core/etl/src/Flow/ETL/Functions/Capitalize.php @@ -72,7 +72,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $strings = (new Parameter($this->string))->values($rows, $backend); + $strings = new Parameter($this->string)->values($rows, $backend); $results = []; $i = 0; @@ -89,6 +89,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Cast.php b/src/core/etl/src/Flow/ETL/Functions/Cast.php index a927489ec1..331cc5ffa4 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Cast.php +++ b/src/core/etl/src/Flow/ETL/Functions/Cast.php @@ -140,7 +140,7 @@ public function eval(Rows $rows, Backend $backend): Column /** @var list $bytes */ $bytes = $column->physicals(); $builder = $backend->builder(Definitions::of('value', type_string(), true)); - $builder->appendPhysicals((new TextValues())->uuids($bytes), $column->nullCount()); + $builder->appendPhysicals(new TextValues()->uuids($bytes), $column->nullCount()); return $builder->finish(); } @@ -148,7 +148,7 @@ public function eval(Rows $rows, Backend $backend): Column /** @var list $physicals */ $physicals = $column->physicals(); - return (new ResultColumn($backend))->of($this, (new TextValues())->dateTimes( + return new ResultColumn($backend)->of($this, new TextValues()->dateTimes( $type, $physicals, DateTimeInterface::RFC3339, @@ -168,7 +168,7 @@ public function eval(Rows $rows, Backend $backend): Column try { // @mago-ignore analysis:mixed-assignment - foreach ($values ?? (new Parameter($this->value))->values($rows, $backend) as $i => $value) { + foreach ($values ?? new Parameter($this->value)->values($rows, $backend) as $i => $value) { if ($documents !== null && is_string($value)) { // @mago-ignore analysis:mixed-assignment $value = $documents->text($value) ?? $documents->fromPhysical($value); @@ -188,6 +188,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Chunk.php b/src/core/etl/src/Flow/ETL/Functions/Chunk.php index b9a480a69a..c21699568f 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Chunk.php +++ b/src/core/etl/src/Flow/ETL/Functions/Chunk.php @@ -77,8 +77,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $sizes = (new Parameter($this->size))->asInts($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $sizes = new Parameter($this->size)->asInts($rows, $backend); $results = []; $i = 0; @@ -103,6 +103,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Coalesce.php b/src/core/etl/src/Flow/ETL/Functions/Coalesce.php index fe0d77cc9c..d8263e2d97 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Coalesce.php +++ b/src/core/etl/src/Flow/ETL/Functions/Coalesce.php @@ -73,7 +73,7 @@ public function returns(): Type // SQL COALESCE is nullable only when every branch is - a null in one branch falls through. return ( - (new PromotingUnifier())->unifyAll( + new PromotingUnifier()->unifyAll( NullabilityRule::ALL, ...$branches, ) ?? throw InvalidTypeException::noCommonType(...$branches) @@ -90,7 +90,7 @@ public function eval(Rows $rows, Backend $backend): Column break; } - $column = (new Selection($pending))->evaluate($value, $rows, $backend); + $column = new Selection($pending)->evaluate($value, $rows, $backend); $stillNull = []; // @mago-ignore analysis:mixed-assignment @@ -113,6 +113,6 @@ public function eval(Rows $rows, Backend $backend): Column $results[] = $values[$i] ?? null; } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/CodePointLength.php b/src/core/etl/src/Flow/ETL/Functions/CodePointLength.php index 15e91ef919..4e6e6d281e 100644 --- a/src/core/etl/src/Flow/ETL/Functions/CodePointLength.php +++ b/src/core/etl/src/Flow/ETL/Functions/CodePointLength.php @@ -69,7 +69,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); $results = []; $i = 0; @@ -85,6 +85,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/CollapseWhitespace.php b/src/core/etl/src/Flow/ETL/Functions/CollapseWhitespace.php index 00921f320c..b914684c41 100644 --- a/src/core/etl/src/Flow/ETL/Functions/CollapseWhitespace.php +++ b/src/core/etl/src/Flow/ETL/Functions/CollapseWhitespace.php @@ -69,7 +69,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); $results = []; $i = 0; @@ -85,6 +85,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Combine.php b/src/core/etl/src/Flow/ETL/Functions/Combine.php index c346b1dbbc..100ca110c5 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Combine.php +++ b/src/core/etl/src/Flow/ETL/Functions/Combine.php @@ -96,8 +96,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $keysList = (new Parameter($this->keys))->asArrays($rows, $backend); - $valuesList = (new Parameter($this->values))->asArrays($rows, $backend); + $keysList = new Parameter($this->keys)->asArrays($rows, $backend); + $valuesList = new Parameter($this->values)->asArrays($rows, $backend); $results = []; $i = 0; @@ -139,6 +139,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Comparison.php b/src/core/etl/src/Flow/ETL/Functions/Comparison.php index b8a74fbed9..59cb111b18 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Comparison.php +++ b/src/core/etl/src/Flow/ETL/Functions/Comparison.php @@ -106,15 +106,11 @@ public function withOperands(array $operands): static */ public function returns(): Type { - (new ValueComparator())->assertComparableTypes( - $this->left->returns(), - $this->right->returns(), - $this->operator, - ); + new ValueComparator()->assertComparableTypes($this->left->returns(), $this->right->returns(), $this->operator); return $this->identity() ? type_boolean() - : (new Nullability())->any(type_boolean(), $this->left->returns(), $this->right->returns()); + : new Nullability()->any(type_boolean(), $this->left->returns(), $this->right->returns()); } public function eval(Rows $rows, Backend $backend): Column diff --git a/src/core/etl/src/Flow/ETL/Functions/Concat.php b/src/core/etl/src/Flow/ETL/Functions/Concat.php index 0fb149a8ea..9b2edbb491 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Concat.php +++ b/src/core/etl/src/Flow/ETL/Functions/Concat.php @@ -86,7 +86,7 @@ public function eval(Rows $rows, Backend $backend): Column $arguments = []; foreach ($this->refs as $ref) { - $values = (new Parameter($ref))->values($rows, $backend); + $values = new Parameter($ref)->values($rows, $backend); // a column of strings is taken as it is; anything else is cast once per column, not once per row if ( @@ -112,7 +112,7 @@ public function eval(Rows $rows, Backend $backend): Column $arguments[] = $cast; } - return (new ResultColumn($backend))->of( + return new ResultColumn($backend)->of( $this, $arguments === [] ? array_fill(0, max(0, $rows->count()), '') diff --git a/src/core/etl/src/Flow/ETL/Functions/ConcatWithSeparator.php b/src/core/etl/src/Flow/ETL/Functions/ConcatWithSeparator.php index b2f8f55559..6d863ee157 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ConcatWithSeparator.php +++ b/src/core/etl/src/Flow/ETL/Functions/ConcatWithSeparator.php @@ -88,8 +88,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $separators = (new Parameter($this->separator))->asStrings($rows, $backend); - $arguments = array_map(static fn(ScalarFunction $ref): array => (new Parameter($ref))->values( + $separators = new Parameter($this->separator)->asStrings($rows, $backend); + $arguments = array_map(static fn(ScalarFunction $ref): array => new Parameter($ref)->values( $rows, $backend, ), $this->refs); @@ -122,6 +122,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Contains.php b/src/core/etl/src/Flow/ETL/Functions/Contains.php index decd0d5863..97b6d4d84b 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Contains.php +++ b/src/core/etl/src/Flow/ETL/Functions/Contains.php @@ -76,7 +76,7 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), $this->haystack->returns(), $this->needle->returns()); + return new Nullability()->any(type_boolean(), $this->haystack->returns(), $this->needle->returns()); } public function eval(Rows $rows, Backend $backend): Column @@ -84,11 +84,11 @@ public function eval(Rows $rows, Backend $backend): Column $haystack = $this->haystack->eval($rows, $backend); if (type_bare($haystack->type()) instanceof StringType) { - return $backend->contains($haystack, (new Parameter($this->needle))->asStringColumn($rows, $backend)); + return $backend->contains($haystack, new Parameter($this->needle)->asStringColumn($rows, $backend)); } - $haystacks = (new Parameter($this->haystack))->typesOf($haystack, type_string(), type_array()); - $needles = (new Parameter($this->needle))->asStrings($rows, $backend); + $haystacks = new Parameter($this->haystack)->typesOf($haystack, type_string(), type_array()); + $needles = new Parameter($this->needle)->asStrings($rows, $backend); $results = []; $i = 0; @@ -114,6 +114,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Count.php b/src/core/etl/src/Flow/ETL/Functions/Count.php index eb1cbbf512..5d7731ad72 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Count.php +++ b/src/core/etl/src/Flow/ETL/Functions/Count.php @@ -190,7 +190,7 @@ public function frameValues(Rows $partition, array $bounds, Backend $backend, Pr public function values(Rows $partition, Backend $backend, Progress $progress): array { - return (new FrameAccumulation($this->window()->frame()))->values($this, $partition, $backend, $progress); + return new FrameAccumulation($this->window()->frame())->values($this, $partition, $backend, $progress); } public function over(Window $window): static diff --git a/src/core/etl/src/Flow/ETL/Functions/DOMElementAttributeValue.php b/src/core/etl/src/Flow/ETL/Functions/DOMElementAttributeValue.php index 911a3fda26..1ea4170960 100644 --- a/src/core/etl/src/Flow/ETL/Functions/DOMElementAttributeValue.php +++ b/src/core/etl/src/Flow/ETL/Functions/DOMElementAttributeValue.php @@ -19,7 +19,6 @@ use Flow\Types\Type; use SensitiveParameter; -use function class_exists; use function count; use function Flow\Types\DSL\type_instance_of; use function Flow\Types\DSL\type_list; @@ -89,13 +88,11 @@ public function eval(Rows $rows, Backend $backend): Column type_list(type_instance_of(DOMNode::class)), ]; - if (class_exists('\Dom\HTMLElement')) { - $types[] = type_instance_of(HTMLElement::class); - $types[] = type_list(type_instance_of(HTMLElement::class)); - } + $types[] = type_instance_of(HTMLElement::class); + $types[] = type_list(type_instance_of(HTMLElement::class)); - $nodes = (new Parameter($this->domElement))->asTypes($rows, $backend, ...$types); - $attributeNames = (new Parameter($this->attribute))->asStrings($rows, $backend); + $nodes = new Parameter($this->domElement)->asTypes($rows, $backend, ...$types); + $attributeNames = new Parameter($this->attribute)->asStrings($rows, $backend); $results = []; $i = 0; @@ -147,6 +144,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/DOMElementAttributesCount.php b/src/core/etl/src/Flow/ETL/Functions/DOMElementAttributesCount.php index b677325419..185e31d015 100644 --- a/src/core/etl/src/Flow/ETL/Functions/DOMElementAttributesCount.php +++ b/src/core/etl/src/Flow/ETL/Functions/DOMElementAttributesCount.php @@ -19,7 +19,6 @@ use Flow\Types\Type; use SensitiveParameter; -use function class_exists; use function Flow\Types\DSL\type_instance_of; use function Flow\Types\DSL\type_integer; @@ -77,11 +76,9 @@ public function eval(Rows $rows, Backend $backend): Column type_instance_of(DOMElement::class), ]; - if (class_exists('\Dom\HTMLElement')) { - $types[] = type_instance_of(HTMLElement::class); - } + $types[] = type_instance_of(HTMLElement::class); - $domElements = (new Parameter($this->domElement))->asTypes($rows, $backend, ...$types); + $domElements = new Parameter($this->domElement)->asTypes($rows, $backend, ...$types); $results = []; $i = 0; @@ -97,6 +94,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/DOMElementNamespaceValue.php b/src/core/etl/src/Flow/ETL/Functions/DOMElementNamespaceValue.php index 7eb0bc6f22..7829461d25 100644 --- a/src/core/etl/src/Flow/ETL/Functions/DOMElementNamespaceValue.php +++ b/src/core/etl/src/Flow/ETL/Functions/DOMElementNamespaceValue.php @@ -23,7 +23,6 @@ use Flow\Types\Type; use SensitiveParameter; -use function class_exists; use function count; use function Flow\Types\DSL\type_instance_of; use function Flow\Types\DSL\type_list; @@ -93,13 +92,11 @@ public function eval(Rows $rows, Backend $backend): Column type_list(type_instance_of(DOMNode::class)), ]; - if (class_exists('\Dom\Element')) { - $types[] = type_instance_of(Element::class); - $types[] = type_list(type_instance_of(Element::class)); - } + $types[] = type_instance_of(Element::class); + $types[] = type_list(type_instance_of(Element::class)); - $nodes = (new Parameter($this->domElement))->asTypes($rows, $backend, ...$types); - $attributeNames = (new Parameter($this->attribute))->asStrings($rows, $backend); + $nodes = new Parameter($this->domElement)->asTypes($rows, $backend, ...$types); + $attributeNames = new Parameter($this->attribute)->asStrings($rows, $backend); $results = []; $i = 0; @@ -112,7 +109,7 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } /** @@ -146,7 +143,6 @@ public function namespaceValue(mixed $node, ?string $attributeName): ?string $document = $node->ownerDocument; - // @mago-expect analysis:unavailable-class-like $xpath = $document instanceof Document ? new XPath($document) : new DOMXPath($document); foreach ($xpath->query('namespace::*') ?: [] as $nsNode) { diff --git a/src/core/etl/src/Flow/ETL/Functions/DOMElementNextSibling.php b/src/core/etl/src/Flow/ETL/Functions/DOMElementNextSibling.php index ec071200c5..b20e4ae95e 100644 --- a/src/core/etl/src/Flow/ETL/Functions/DOMElementNextSibling.php +++ b/src/core/etl/src/Flow/ETL/Functions/DOMElementNextSibling.php @@ -21,7 +21,6 @@ use Flow\Types\Type; use SensitiveParameter; -use function class_exists; use function Flow\Types\DSL\type_instance_of; use function Flow\Types\DSL\type_optional; use function Flow\Types\DSL\type_xml_element; @@ -80,12 +79,10 @@ public function eval(Rows $rows, Backend $backend): Column type_instance_of(DOMNode::class), ]; - if (class_exists('\Dom\HTMLElement')) { - $types[] = type_instance_of(CharacterData::class); - $types[] = type_instance_of(HTMLElement::class); - } + $types[] = type_instance_of(CharacterData::class); + $types[] = type_instance_of(HTMLElement::class); - $nodes = (new Parameter($this->element))->asTypes($rows, $backend, ...$types); + $nodes = new Parameter($this->element)->asTypes($rows, $backend, ...$types); $results = []; $i = 0; @@ -110,6 +107,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/DOMElementParent.php b/src/core/etl/src/Flow/ETL/Functions/DOMElementParent.php index fdc2d3b3a7..159dd13399 100644 --- a/src/core/etl/src/Flow/ETL/Functions/DOMElementParent.php +++ b/src/core/etl/src/Flow/ETL/Functions/DOMElementParent.php @@ -20,7 +20,6 @@ use Flow\Types\Type; use SensitiveParameter; -use function class_exists; use function Flow\Types\DSL\type_instance_of; use function Flow\Types\DSL\type_optional; use function Flow\Types\DSL\type_xml_element; @@ -79,11 +78,9 @@ public function eval(Rows $rows, Backend $backend): Column type_instance_of(DOMNode::class), ]; - if (class_exists('\Dom\HTMLElement')) { - $types[] = type_instance_of(HTMLElement::class); - } + $types[] = type_instance_of(HTMLElement::class); - $nodes = (new Parameter($this->element))->asTypes($rows, $backend, ...$types); + $nodes = new Parameter($this->element)->asTypes($rows, $backend, ...$types); $results = []; $i = 0; @@ -110,6 +107,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/DOMElementPreviousSibling.php b/src/core/etl/src/Flow/ETL/Functions/DOMElementPreviousSibling.php index b4b859b28f..e54af40c03 100644 --- a/src/core/etl/src/Flow/ETL/Functions/DOMElementPreviousSibling.php +++ b/src/core/etl/src/Flow/ETL/Functions/DOMElementPreviousSibling.php @@ -21,7 +21,6 @@ use Flow\Types\Type; use SensitiveParameter; -use function class_exists; use function Flow\Types\DSL\type_instance_of; use function Flow\Types\DSL\type_optional; use function Flow\Types\DSL\type_xml_element; @@ -80,12 +79,10 @@ public function eval(Rows $rows, Backend $backend): Column type_instance_of(DOMNode::class), ]; - if (class_exists('\Dom\HTMLElement')) { - $types[] = type_instance_of(CharacterData::class); - $types[] = type_instance_of(HTMLElement::class); - } + $types[] = type_instance_of(CharacterData::class); + $types[] = type_instance_of(HTMLElement::class); - $nodes = (new Parameter($this->element))->asTypes($rows, $backend, ...$types); + $nodes = new Parameter($this->element)->asTypes($rows, $backend, ...$types); $results = []; $i = 0; @@ -110,6 +107,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/DOMElementValue.php b/src/core/etl/src/Flow/ETL/Functions/DOMElementValue.php index 2cf7e2fa92..743f8f70f7 100644 --- a/src/core/etl/src/Flow/ETL/Functions/DOMElementValue.php +++ b/src/core/etl/src/Flow/ETL/Functions/DOMElementValue.php @@ -20,7 +20,6 @@ use Flow\Types\Type; use SensitiveParameter; -use function class_exists; use function count; use function Flow\Types\DSL\type_instance_of; use function Flow\Types\DSL\type_list; @@ -84,13 +83,11 @@ public function eval(Rows $rows, Backend $backend): Column type_list(type_instance_of(DOMNode::class)), ]; - if (class_exists('\Dom\HTMLElement')) { - $types[] = type_instance_of(CharacterData::class); - $types[] = type_instance_of(HTMLElement::class); - $types[] = type_list(type_instance_of(HTMLElement::class)); - } + $types[] = type_instance_of(CharacterData::class); + $types[] = type_instance_of(HTMLElement::class); + $types[] = type_list(type_instance_of(HTMLElement::class)); - $nodes = (new Parameter($this->node))->asTypes($rows, $backend, ...$types); + $nodes = new Parameter($this->node)->asTypes($rows, $backend, ...$types); $results = []; $i = 0; @@ -122,6 +119,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/DateTimeFormat.php b/src/core/etl/src/Flow/ETL/Functions/DateTimeFormat.php index 32dcf74067..973eff4226 100644 --- a/src/core/etl/src/Flow/ETL/Functions/DateTimeFormat.php +++ b/src/core/etl/src/Flow/ETL/Functions/DateTimeFormat.php @@ -99,16 +99,12 @@ public function eval(Rows $rows, Backend $backend): Column ); } - return (new ResultColumn($backend))->of($this, (new TextValues())->dateTimes( - $type, - $physicals, - $format, - )); + return new ResultColumn($backend)->of($this, new TextValues()->dateTimes($type, $physicals, $format)); } } - $values = (new Parameter($this->dateTime))->asInstancesOf($rows, $backend, DateTimeInterface::class); - $formats = (new Parameter($this->format))->asStrings($rows, $backend); + $values = new Parameter($this->dateTime)->asInstancesOf($rows, $backend, DateTimeInterface::class); + $formats = new Parameter($this->format)->asStrings($rows, $backend); $results = []; $i = 0; @@ -126,6 +122,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/DenseRank.php b/src/core/etl/src/Flow/ETL/Functions/DenseRank.php index 62dc6a5ac9..446366e187 100644 --- a/src/core/etl/src/Flow/ETL/Functions/DenseRank.php +++ b/src/core/etl/src/Flow/ETL/Functions/DenseRank.php @@ -75,7 +75,7 @@ public function values(Rows $partition, Backend $backend, Progress $progress): a $rank = 1; $unreported = 0; - foreach ((new RowOrder($orderBy))->ties($partition) as $index => $peer) { + foreach (new RowOrder($orderBy)->ties($partition) as $index => $peer) { if ($index > 0 && !$peer) { $rank++; } diff --git a/src/core/etl/src/Flow/ETL/Functions/Divide.php b/src/core/etl/src/Flow/ETL/Functions/Divide.php index d41ba82c4b..fe42aea986 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Divide.php +++ b/src/core/etl/src/Flow/ETL/Functions/Divide.php @@ -88,10 +88,10 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $lefts = (new Parameter($this->left))->asNumbers($rows, $backend); - $rights = (new Parameter($this->right))->asNumbers($rows, $backend); - $scales = (new Parameter($this->scale))->asInts($rows, $backend); - $roundings = (new Parameter($this->rounding))->asEnums($rows, $backend, Rounding::class); + $lefts = new Parameter($this->left)->asNumbers($rows, $backend); + $rights = new Parameter($this->right)->asNumbers($rows, $backend); + $scales = new Parameter($this->scale)->asInts($rows, $backend); + $roundings = new Parameter($this->rounding)->asEnums($rows, $backend, Rounding::class); $calculator = new Calculator(); $results = []; $i = 0; @@ -114,6 +114,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/EndsWith.php b/src/core/etl/src/Flow/ETL/Functions/EndsWith.php index 7973abd17e..d43b3b4409 100644 --- a/src/core/etl/src/Flow/ETL/Functions/EndsWith.php +++ b/src/core/etl/src/Flow/ETL/Functions/EndsWith.php @@ -66,14 +66,14 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), $this->haystack->returns(), $this->needle->returns()); + return new Nullability()->any(type_boolean(), $this->haystack->returns(), $this->needle->returns()); } public function eval(Rows $rows, Backend $backend): Column { return $backend->endsWith( - (new Parameter($this->haystack))->asStringColumn($rows, $backend), - (new Parameter($this->needle))->asStringColumn($rows, $backend), + new Parameter($this->haystack)->asStringColumn($rows, $backend), + new Parameter($this->needle)->asStringColumn($rows, $backend), ); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/EnsureEnd.php b/src/core/etl/src/Flow/ETL/Functions/EnsureEnd.php index 618bd960a1..70994485d9 100644 --- a/src/core/etl/src/Flow/ETL/Functions/EnsureEnd.php +++ b/src/core/etl/src/Flow/ETL/Functions/EnsureEnd.php @@ -75,8 +75,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $suffixes = (new Parameter($this->suffix))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $suffixes = new Parameter($this->suffix)->asStrings($rows, $backend); $results = []; $i = 0; @@ -100,6 +100,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/EnsureStart.php b/src/core/etl/src/Flow/ETL/Functions/EnsureStart.php index f38c2fe466..e4ab0e1e6e 100644 --- a/src/core/etl/src/Flow/ETL/Functions/EnsureStart.php +++ b/src/core/etl/src/Flow/ETL/Functions/EnsureStart.php @@ -75,8 +75,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $prefixes = (new Parameter($this->prefix))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $prefixes = new Parameter($this->prefix)->asStrings($rows, $backend); $results = []; $i = 0; @@ -100,6 +100,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/EnumName.php b/src/core/etl/src/Flow/ETL/Functions/EnumName.php index 25f07539d1..e35df23d75 100644 --- a/src/core/etl/src/Flow/ETL/Functions/EnumName.php +++ b/src/core/etl/src/Flow/ETL/Functions/EnumName.php @@ -69,7 +69,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $enums = (new Parameter($this->value))->values($rows, $backend); + $enums = new Parameter($this->value)->values($rows, $backend); $results = []; $i = 0; @@ -86,6 +86,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/EnumValue.php b/src/core/etl/src/Flow/ETL/Functions/EnumValue.php index f8a292ffd7..22e16e0101 100644 --- a/src/core/etl/src/Flow/ETL/Functions/EnumValue.php +++ b/src/core/etl/src/Flow/ETL/Functions/EnumValue.php @@ -78,14 +78,14 @@ public function returns(): Type ); } - $backingType = (new ReflectionEnum($value->class))->getBackingType(); + $backingType = new ReflectionEnum($value->class)->getBackingType(); return $backingType !== null && $backingType->getName() === 'int' ? type_integer() : type_string(); } public function eval(Rows $rows, Backend $backend): Column { - $enums = (new Parameter($this->value))->values($rows, $backend); + $enums = new Parameter($this->value)->values($rows, $backend); $results = []; $i = 0; @@ -102,6 +102,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Evaluation/Filter.php b/src/core/etl/src/Flow/ETL/Functions/Evaluation/Filter.php index 46d4ecbfa0..6679efbc6f 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Evaluation/Filter.php +++ b/src/core/etl/src/Flow/ETL/Functions/Evaluation/Filter.php @@ -76,7 +76,7 @@ public function filter(Rows $rows, Backend $backend): Rows break; } - $truths = array_keys((new Selection($kept))->truths($predicate, $rows, $backend), true, true); + $truths = array_keys(new Selection($kept)->truths($predicate, $rows, $backend), true, true); if (count($kept) === $rows->count()) { $kept = $truths; diff --git a/src/core/etl/src/Flow/ETL/Functions/Evaluation/ResultColumn.php b/src/core/etl/src/Flow/ETL/Functions/Evaluation/ResultColumn.php index 51e1b6124b..d5c886fdca 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Evaluation/ResultColumn.php +++ b/src/core/etl/src/Flow/ETL/Functions/Evaluation/ResultColumn.php @@ -71,7 +71,7 @@ public function of(ScalarFunction $function, array $values): Column */ public function holdsLosslessly(Type $type): bool { - return (new PhysicalFor())->supports($type) && $this->keepsValues($type); + return new PhysicalFor()->supports($type) && $this->keepsValues($type); } /** diff --git a/src/core/etl/src/Flow/ETL/Functions/Evaluation/Selection.php b/src/core/etl/src/Flow/ETL/Functions/Evaluation/Selection.php index 26e4b85fa4..340dd60973 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Evaluation/Selection.php +++ b/src/core/etl/src/Flow/ETL/Functions/Evaluation/Selection.php @@ -40,7 +40,7 @@ public function evaluate(ScalarFunction $function, Rows $rows, Backend $backend) $names = []; // only the columns $function reads are copied; a reference the batch lacks (e.g. inside on_each()) is not one - foreach ((new ReferencedColumns())->in($function)->all() as $ref) { + foreach (new ReferencedColumns()->in($function)->all() as $ref) { if ($schema->findDefinition($ref->to()) !== null) { $names[] = $ref->to(); } diff --git a/src/core/etl/src/Flow/ETL/Functions/Evaluation/TolerantEvaluation.php b/src/core/etl/src/Flow/ETL/Functions/Evaluation/TolerantEvaluation.php index 16c3d7df6a..b1ca87d4e9 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Evaluation/TolerantEvaluation.php +++ b/src/core/etl/src/Flow/ETL/Functions/Evaluation/TolerantEvaluation.php @@ -31,7 +31,7 @@ public function evaluate(ScalarFunction $function, Rows $rows, Backend $backend) while (true) { try { // @mago-ignore analysis:mixed-assignment - foreach ((new Selection($live)) + foreach (new Selection($live) ->evaluate($function, $rows, $backend) ->values() as $k => $value) { $values[$live[$k]] = $value; diff --git a/src/core/etl/src/Flow/ETL/Functions/Exists.php b/src/core/etl/src/Flow/ETL/Functions/Exists.php index 8f720ceb92..c6e2260af2 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Exists.php +++ b/src/core/etl/src/Flow/ETL/Functions/Exists.php @@ -73,7 +73,7 @@ public function eval(Rows $rows, Backend $backend): Column $exists = $rows->schema()->findDefinition($this->ref->name()) !== null; // @mago-ignore analysis:possibly-invalid-argument - return (new ResultColumn($backend))->of( + return new ResultColumn($backend)->of( $this, $rows->isEmpty() ? [] : array_fill(0, $rows->count(), $exists), ); @@ -81,8 +81,8 @@ public function eval(Rows $rows, Backend $backend): Column // the operand is left unresolved by the gate (children() is empty): a reference the batch lacks stays // unresolved and throws, which is this function's "no" - $failed = (new TolerantEvaluation())->evaluate( - (new ReferenceResolver())->resolve($this->ref, $rows->schema()), + $failed = new TolerantEvaluation()->evaluate( + new ReferenceResolver()->resolve($this->ref, $rows->schema()), $rows, $backend, )['failed']; @@ -92,6 +92,6 @@ public function eval(Rows $rows, Backend $backend): Column $results[] = !array_key_exists($i, $failed); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Greatest.php b/src/core/etl/src/Flow/ETL/Functions/Greatest.php index a7888743ce..b5a957c84a 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Greatest.php +++ b/src/core/etl/src/Flow/ETL/Functions/Greatest.php @@ -76,7 +76,7 @@ public function returns(): Type // NULL only when every argument is NULL - nulls are skipped otherwise. return ( - (new StrictUnifier())->unifyAll( + new StrictUnifier()->unifyAll( NullabilityRule::ALL, ...$operands, ) ?? throw InvalidTypeException::noCommonType(...$operands) @@ -111,6 +111,6 @@ public function eval(Rows $rows, Backend $backend): Column $results[] = $greatest; } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/HTMLQuerySelector.php b/src/core/etl/src/Flow/ETL/Functions/HTMLQuerySelector.php index 5c634f7cb3..ae3360cb92 100644 --- a/src/core/etl/src/Flow/ETL/Functions/HTMLQuerySelector.php +++ b/src/core/etl/src/Flow/ETL/Functions/HTMLQuerySelector.php @@ -11,7 +11,6 @@ use Flow\ETL\Foundation\Describe\Rebuild; use Flow\ETL\Foundation\Exception\EvaluationException; use Flow\ETL\Foundation\Exception\InvalidArgumentException; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Functions\Evaluation\ResultColumn; use Flow\ETL\Values\Column\Backend; use Flow\ETL\Values\Column\Column; @@ -19,7 +18,6 @@ use Flow\Types\Type; use SensitiveParameter; -use function class_exists; use function Flow\Types\DSL\type_html_element; use function Flow\Types\DSL\type_instance_of; use function Flow\Types\DSL\type_optional; @@ -33,10 +31,6 @@ final class HTMLQuerySelector implements ScalarFunction public function __construct(mixed $value, ScalarFunction|string $selector) { - if (!class_exists('\Dom\HTMLDocument')) { - throw new RequiredPHPVersionException('\Dom\HTMLDocument', '8.4'); - } - $this->value = $value instanceof ScalarFunction ? $value : new Literal($value); $this->selector = $selector instanceof ScalarFunction ? $selector : new Literal($selector); } @@ -84,13 +78,13 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asTypes( + $values = new Parameter($this->value)->asTypes( $rows, $backend, type_instance_of(HTMLDocument::class), type_instance_of(HTMLElement::class), ); - $selectors = (new Parameter($this->selector))->asStrings($rows, $backend); + $selectors = new Parameter($this->selector)->asStrings($rows, $backend); $results = []; $i = 0; @@ -112,6 +106,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/HTMLQuerySelectorAll.php b/src/core/etl/src/Flow/ETL/Functions/HTMLQuerySelectorAll.php index d7f8a41802..e044f5aa0e 100644 --- a/src/core/etl/src/Flow/ETL/Functions/HTMLQuerySelectorAll.php +++ b/src/core/etl/src/Flow/ETL/Functions/HTMLQuerySelectorAll.php @@ -4,15 +4,14 @@ namespace Flow\ETL\Functions; -use DOM\Element; -use DOM\HTMLDocument; +use Dom\Element; +use Dom\HTMLDocument; use Dom\HTMLElement; use Exception; use Flow\ETL\Foundation\Describe\Description; use Flow\ETL\Foundation\Describe\Rebuild; use Flow\ETL\Foundation\Exception\EvaluationException; use Flow\ETL\Foundation\Exception\InvalidArgumentException; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Functions\Evaluation\ResultColumn; use Flow\ETL\Values\Column\Backend; use Flow\ETL\Values\Column\Column; @@ -20,7 +19,6 @@ use Flow\Types\Type; use SensitiveParameter; -use function class_exists; use function Flow\Types\DSL\type_html_element; use function Flow\Types\DSL\type_instance_of; use function Flow\Types\DSL\type_list; @@ -35,10 +33,6 @@ final class HTMLQuerySelectorAll implements ScalarFunction public function __construct(mixed $value, ScalarFunction|string $selector) { - if (!class_exists('\Dom\HTMLDocument')) { - throw new RequiredPHPVersionException('\Dom\HTMLDocument', '8.4'); - } - $this->value = $value instanceof ScalarFunction ? $value : new Literal($value); $this->selector = $selector instanceof ScalarFunction ? $selector : new Literal($selector); } @@ -86,13 +80,13 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asTypes( + $values = new Parameter($this->value)->asTypes( $rows, $backend, type_instance_of(HTMLDocument::class), type_instance_of(HTMLElement::class), ); - $selectors = (new Parameter($this->selector))->asStrings($rows, $backend); + $selectors = new Parameter($this->selector)->asStrings($rows, $backend); $results = []; $i = 0; @@ -132,6 +126,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Hash.php b/src/core/etl/src/Flow/ETL/Functions/Hash.php index 8474acf67e..e42ece5e1d 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Hash.php +++ b/src/core/etl/src/Flow/ETL/Functions/Hash.php @@ -110,6 +110,6 @@ private function texts(Column $column, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $texts); + return new ResultColumn($backend)->of($this, $texts); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/IndexOf.php b/src/core/etl/src/Flow/ETL/Functions/IndexOf.php index 365b047f79..204f047dfc 100644 --- a/src/core/etl/src/Flow/ETL/Functions/IndexOf.php +++ b/src/core/etl/src/Flow/ETL/Functions/IndexOf.php @@ -88,10 +88,10 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $strings = (new Parameter($this->string))->asStrings($rows, $backend); - $needles = (new Parameter($this->needle))->asStrings($rows, $backend); - $offsets = (new Parameter($this->offset))->asTypes($rows, $backend, type_integer()); - $ignoreCases = (new Parameter($this->ignoreCase))->asBooleans($rows, $backend); + $strings = new Parameter($this->string)->asStrings($rows, $backend); + $needles = new Parameter($this->needle)->asStrings($rows, $backend); + $offsets = new Parameter($this->offset)->asTypes($rows, $backend, type_integer()); + $ignoreCases = new Parameter($this->ignoreCase)->asBooleans($rows, $backend); $results = []; $i = 0; @@ -120,6 +120,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/IndexOfLast.php b/src/core/etl/src/Flow/ETL/Functions/IndexOfLast.php index 6ab7ea5196..d6933d9324 100644 --- a/src/core/etl/src/Flow/ETL/Functions/IndexOfLast.php +++ b/src/core/etl/src/Flow/ETL/Functions/IndexOfLast.php @@ -88,10 +88,10 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $strings = (new Parameter($this->string))->asStrings($rows, $backend); - $needles = (new Parameter($this->needle))->asStrings($rows, $backend); - $offsets = (new Parameter($this->offset))->asTypes($rows, $backend, type_integer()); - $ignoreCases = (new Parameter($this->ignoreCase))->asBooleans($rows, $backend); + $strings = new Parameter($this->string)->asStrings($rows, $backend); + $needles = new Parameter($this->needle)->asStrings($rows, $backend); + $offsets = new Parameter($this->offset)->asTypes($rows, $backend, type_integer()); + $ignoreCases = new Parameter($this->ignoreCase)->asBooleans($rows, $backend); $results = []; $i = 0; @@ -120,6 +120,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/IsEmpty.php b/src/core/etl/src/Flow/ETL/Functions/IsEmpty.php index 9b25b43653..67eb0af8fb 100644 --- a/src/core/etl/src/Flow/ETL/Functions/IsEmpty.php +++ b/src/core/etl/src/Flow/ETL/Functions/IsEmpty.php @@ -64,12 +64,12 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), $this->value->returns()); + return new Nullability()->any(type_boolean(), $this->value->returns()); } public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); $results = []; $i = 0; @@ -87,6 +87,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/IsIn.php b/src/core/etl/src/Flow/ETL/Functions/IsIn.php index e401ef3e31..a73811aafc 100644 --- a/src/core/etl/src/Flow/ETL/Functions/IsIn.php +++ b/src/core/etl/src/Flow/ETL/Functions/IsIn.php @@ -104,7 +104,7 @@ public function returns(): Type }; if ($declaredElement !== null) { - (new ValueComparator())->assertComparableTypes($nullability->bare($needle), $declaredElement, '=='); + new ValueComparator()->assertComparableTypes($nullability->bare($needle), $declaredElement, '=='); } return $nullability->any(type_boolean(), $haystack, $needle); @@ -112,9 +112,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - return (new ResultColumn($backend))->of($this, (new ValueEquality())->in( + return new ResultColumn($backend)->of($this, new ValueEquality()->in( $this->needle->eval($rows, $backend), - (new Parameter($this->haystack))->arraysOf($this->haystack->eval($rows, $backend)), + new Parameter($this->haystack)->arraysOf($this->haystack->eval($rows, $backend)), $this->needle instanceof Reference ? $this->needle->to() : 'needle', $this->haystack instanceof Reference ? $this->haystack->to() : 'haystack', )); diff --git a/src/core/etl/src/Flow/ETL/Functions/IsNotNumeric.php b/src/core/etl/src/Flow/ETL/Functions/IsNotNumeric.php index a1295c4636..502795e0ba 100644 --- a/src/core/etl/src/Flow/ETL/Functions/IsNotNumeric.php +++ b/src/core/etl/src/Flow/ETL/Functions/IsNotNumeric.php @@ -64,12 +64,12 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), $this->value->returns()); + return new Nullability()->any(type_boolean(), $this->value->returns()); } public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->values($rows, $backend); + $values = new Parameter($this->value)->values($rows, $backend); $results = []; $i = 0; @@ -88,6 +88,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/IsNumeric.php b/src/core/etl/src/Flow/ETL/Functions/IsNumeric.php index 08a06eaa73..4f452cdf9e 100644 --- a/src/core/etl/src/Flow/ETL/Functions/IsNumeric.php +++ b/src/core/etl/src/Flow/ETL/Functions/IsNumeric.php @@ -64,12 +64,12 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), $this->value->returns()); + return new Nullability()->any(type_boolean(), $this->value->returns()); } public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->values($rows, $backend); + $values = new Parameter($this->value)->values($rows, $backend); $results = []; $i = 0; @@ -88,6 +88,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/IsType.php b/src/core/etl/src/Flow/ETL/Functions/IsType.php index 37eae47296..f21032def8 100644 --- a/src/core/etl/src/Flow/ETL/Functions/IsType.php +++ b/src/core/etl/src/Flow/ETL/Functions/IsType.php @@ -87,7 +87,7 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), $this->value->returns()); + return new Nullability()->any(type_boolean(), $this->value->returns()); } public function eval(Rows $rows, Backend $backend): Column @@ -95,7 +95,7 @@ public function eval(Rows $rows, Backend $backend): Column $results = []; // @mago-ignore analysis:mixed-assignment - foreach ((new Parameter($this->value))->values($rows, $backend) as $value) { + foreach (new Parameter($this->value)->values($rows, $backend) as $value) { // A NULL operand is unknowable, even against type_null() - ->isNull() is the null test. if ($value === null) { $results[] = null; @@ -114,6 +114,6 @@ public function eval(Rows $rows, Backend $backend): Column $results[] = false; } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/IsUtf8.php b/src/core/etl/src/Flow/ETL/Functions/IsUtf8.php index b1d345ed3c..aeec624131 100644 --- a/src/core/etl/src/Flow/ETL/Functions/IsUtf8.php +++ b/src/core/etl/src/Flow/ETL/Functions/IsUtf8.php @@ -64,12 +64,12 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), $this->string->returns()); + return new Nullability()->any(type_boolean(), $this->string->returns()); } public function eval(Rows $rows, Backend $backend): Column { - $strings = (new Parameter($this->string))->asStrings($rows, $backend); + $strings = new Parameter($this->string)->asStrings($rows, $backend); $results = []; $i = 0; @@ -87,6 +87,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Join/Condition/Equal.php b/src/core/etl/src/Flow/ETL/Functions/Join/Condition/Equal.php index f7adfaa495..0d7ef397e8 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Join/Condition/Equal.php +++ b/src/core/etl/src/Flow/ETL/Functions/Join/Condition/Equal.php @@ -29,7 +29,7 @@ public function compare(Rows $left, Rows $right): array $equal = []; // SQL semantics - null never equals anything, including null - foreach ((new ValueEquality())->equal( + foreach (new ValueEquality()->equal( $left->column($this->left()[0]->base()), $right->column($this->right()[0]->base()), $this->left()[0]->name(), diff --git a/src/core/etl/src/Flow/ETL/Functions/Join/Condition/Identical.php b/src/core/etl/src/Flow/ETL/Functions/Join/Condition/Identical.php index e175c81993..7ea37f937b 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Join/Condition/Identical.php +++ b/src/core/etl/src/Flow/ETL/Functions/Join/Condition/Identical.php @@ -30,7 +30,7 @@ public function compare(Rows $left, Rows $right): array $result = []; // SQL semantics - null never equals anything, including null - foreach ((new ValueEquality())->identical( + foreach (new ValueEquality()->identical( $leftColumn, $right->column($this->right()[0]->base()), ) as $i => $identical) { diff --git a/src/core/etl/src/Flow/ETL/Functions/JsonDecode.php b/src/core/etl/src/Flow/ETL/Functions/JsonDecode.php index 8c21a02151..2fea1e4141 100644 --- a/src/core/etl/src/Flow/ETL/Functions/JsonDecode.php +++ b/src/core/etl/src/Flow/ETL/Functions/JsonDecode.php @@ -79,8 +79,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->values($rows, $backend); - $flagsList = (new Parameter($this->flags))->asInts($rows, $backend); + $values = new Parameter($this->value)->values($rows, $backend); + $flagsList = new Parameter($this->flags)->asInts($rows, $backend); $results = []; $i = 0; @@ -130,6 +130,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/JsonEncode.php b/src/core/etl/src/Flow/ETL/Functions/JsonEncode.php index 182cb87426..afe938d838 100644 --- a/src/core/etl/src/Flow/ETL/Functions/JsonEncode.php +++ b/src/core/etl/src/Flow/ETL/Functions/JsonEncode.php @@ -97,8 +97,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->values($rows, $backend); - $flagsList = (new Parameter($this->flags))->asInts($rows, $backend); + $values = new Parameter($this->value)->values($rows, $backend); + $flagsList = new Parameter($this->flags)->asInts($rows, $backend); $results = []; $i = 0; @@ -137,6 +137,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Least.php b/src/core/etl/src/Flow/ETL/Functions/Least.php index 7cd6c78b6d..ac806a78a1 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Least.php +++ b/src/core/etl/src/Flow/ETL/Functions/Least.php @@ -76,7 +76,7 @@ public function returns(): Type // NULL only when every argument is NULL - nulls are skipped otherwise. return ( - (new StrictUnifier())->unifyAll( + new StrictUnifier()->unifyAll( NullabilityRule::ALL, ...$operands, ) ?? throw InvalidTypeException::noCommonType(...$operands) @@ -111,6 +111,6 @@ public function eval(Rows $rows, Backend $backend): Column $results[] = $least; } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ListSelect.php b/src/core/etl/src/Flow/ETL/Functions/ListSelect.php index 7eb13ff4c3..904436547a 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ListSelect.php +++ b/src/core/etl/src/Flow/ETL/Functions/ListSelect.php @@ -126,7 +126,7 @@ public function returns(): Type } $elements[] = $element instanceof MapType - ? structure_element($selected->name(), (new TypeWidener())->nullable($element->value())) + ? structure_element($selected->name(), new TypeWidener()->nullable($element->value())) : structure_element($selected->name(), type_null()); } @@ -137,7 +137,7 @@ public function eval(Rows $rows, Backend $backend): Column { if ($rows->schema()->findDefinition($this->ref->base()) === null) { // @mago-ignore analysis:possibly-invalid-argument - return (new ResultColumn($backend))->of($this, $rows->isEmpty() ? [] : array_fill(0, $rows->count(), null)); + return new ResultColumn($backend)->of($this, $rows->isEmpty() ? [] : array_fill(0, $rows->count(), null)); } $results = []; @@ -168,6 +168,6 @@ public function eval(Rows $rows, Backend $backend): Column $results[] = $output; } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Literal.php b/src/core/etl/src/Flow/ETL/Functions/Literal.php index dcfb41761b..57e6e3b9c6 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Literal.php +++ b/src/core/etl/src/Flow/ETL/Functions/Literal.php @@ -65,7 +65,7 @@ public function __construct( public static function fromDescription(#[SensitiveParameter] array $data, Rebuild $rebuild): static { - return new self((new LiteralValue())->decode(type_array()->assert($data['value'] ?? null))); + return new self(new LiteralValue()->decode(type_array()->assert($data['value'] ?? null))); } /** @@ -81,7 +81,7 @@ public function children(): array */ public function describe(): ?Description { - $value = (new LiteralValue())->encode($this->value); + $value = new LiteralValue()->encode($this->value); return $value === null ? null : new Description(self::class, ['value' => $value]); } @@ -101,7 +101,7 @@ public function withChildren(array $children): static public function returns(): Type { // lit(null) is a nullable null column - a bare NullType would count as NOT NULL. - return $this->value === null ? type_optional(type_null()) : (new TypeDetector())->detectType($this->value); + return $this->value === null ? type_optional(type_null()) : new TypeDetector()->detectType($this->value); } public function eval(Rows $rows, Backend $backend): Column @@ -115,7 +115,7 @@ public function eval(Rows $rows, Backend $backend): Column $type = $type instanceof NullType ? $type : type_optional($type); // @mago-ignore analysis:possibly-invalid-argument - return $this->column = (new ResultColumn($backend))->holdsLosslessly($type) + return $this->column = new ResultColumn($backend)->holdsLosslessly($type) ? $backend->constant(Definitions::of('value', $type), $this->value, $rows->count()) : new ValueColumn($rows->isEmpty() ? [] : array_fill(0, $rows->count(), $this->value)); } diff --git a/src/core/etl/src/Flow/ETL/Functions/LiteralValue.php b/src/core/etl/src/Flow/ETL/Functions/LiteralValue.php index 412606d840..ca2ed91628 100644 --- a/src/core/etl/src/Flow/ETL/Functions/LiteralValue.php +++ b/src/core/etl/src/Flow/ETL/Functions/LiteralValue.php @@ -177,7 +177,7 @@ public function decode(array $encoded): mixed public function encode(mixed $value): ?array { try { - $type = (new TypeDetector())->detectType($value); + $type = new TypeDetector()->detectType($value); } catch (Throwable) { return null; } diff --git a/src/core/etl/src/Flow/ETL/Functions/MatchCases.php b/src/core/etl/src/Flow/ETL/Functions/MatchCases.php index c3d1ddd28e..e51f71e657 100644 --- a/src/core/etl/src/Flow/ETL/Functions/MatchCases.php +++ b/src/core/etl/src/Flow/ETL/Functions/MatchCases.php @@ -109,7 +109,7 @@ public function returns(): Type } return ( - (new PromotingUnifier())->unifyAll( + new PromotingUnifier()->unifyAll( NullabilityRule::ANY, ...$branches, ) ?? throw InvalidTypeException::noCommonType(...$branches) @@ -139,7 +139,7 @@ public function eval(Rows $rows, Backend $backend): Column if ($taken !== []) { // @mago-ignore analysis:mixed-assignment - foreach ((new Selection($taken)) + foreach (new Selection($taken) ->evaluate($case, $rows, $backend) ->values() as $k => $value) { $values[$taken[$k]] = $value; @@ -161,7 +161,7 @@ public function eval(Rows $rows, Backend $backend): Column } // @mago-ignore analysis:mixed-assignment - foreach ((new Selection($pending)) + foreach (new Selection($pending) ->evaluate($this->default, $rows, $backend) ->values() as $k => $value) { $values[$pending[$k]] = $value; @@ -174,6 +174,6 @@ public function eval(Rows $rows, Backend $backend): Column $results[] = $values[$i] ?? null; } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/MatchCases/MatchCondition.php b/src/core/etl/src/Flow/ETL/Functions/MatchCases/MatchCondition.php index e5ef3ac18a..d29c08a9f7 100644 --- a/src/core/etl/src/Flow/ETL/Functions/MatchCases/MatchCondition.php +++ b/src/core/etl/src/Flow/ETL/Functions/MatchCases/MatchCondition.php @@ -109,7 +109,7 @@ public function eval(Rows $rows, Backend $backend): Column */ public function valid(Rows $rows, array $indices, Backend $backend): array { - $column = (new Selection($indices))->evaluate($this->condition, $rows, $backend); + $column = new Selection($indices)->evaluate($this->condition, $rows, $backend); $valid = []; // @mago-ignore analysis:mixed-assignment diff --git a/src/core/etl/src/Flow/ETL/Functions/Minus.php b/src/core/etl/src/Flow/ETL/Functions/Minus.php index c6599f5033..858812bc58 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Minus.php +++ b/src/core/etl/src/Flow/ETL/Functions/Minus.php @@ -98,13 +98,13 @@ public function eval(Rows $rows, Backend $backend): Column { if (!$this->exact) { return $backend->subtract( - (new Parameter($this->left))->asNumberColumn($rows, $backend), - (new Parameter($this->right))->asNumberColumn($rows, $backend), + new Parameter($this->left)->asNumberColumn($rows, $backend), + new Parameter($this->right)->asNumberColumn($rows, $backend), ); } - $lefts = (new Parameter($this->left))->asNumbers($rows, $backend); - $rights = (new Parameter($this->right))->asNumbers($rows, $backend); + $lefts = new Parameter($this->left)->asNumbers($rows, $backend); + $rights = new Parameter($this->right)->asNumbers($rows, $backend); $calculator = new Calculator(); $results = []; $i = 0; @@ -123,6 +123,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Mod.php b/src/core/etl/src/Flow/ETL/Functions/Mod.php index f07c869210..199aebb35b 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Mod.php +++ b/src/core/etl/src/Flow/ETL/Functions/Mod.php @@ -71,8 +71,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { return $backend->modulo( - (new Parameter($this->left))->asIntegerColumn($rows, $backend), - (new Parameter($this->right))->asIntegerColumn($rows, $backend), + new Parameter($this->left)->asIntegerColumn($rows, $backend), + new Parameter($this->right)->asIntegerColumn($rows, $backend), ); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ModifyDateTime.php b/src/core/etl/src/Flow/ETL/Functions/ModifyDateTime.php index 3165395c9c..2366846a5d 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ModifyDateTime.php +++ b/src/core/etl/src/Flow/ETL/Functions/ModifyDateTime.php @@ -82,8 +82,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->reference))->asInstancesOf($rows, $backend, DateTimeInterface::class); - $modifiers = (new Parameter($this->modifier))->asStrings($rows, $backend); + $values = new Parameter($this->reference)->asInstancesOf($rows, $backend, DateTimeInterface::class); + $modifiers = new Parameter($this->modifier)->asStrings($rows, $backend); $results = []; $i = 0; @@ -104,6 +104,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Multiply.php b/src/core/etl/src/Flow/ETL/Functions/Multiply.php index 6e44125317..23948034cf 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Multiply.php +++ b/src/core/etl/src/Flow/ETL/Functions/Multiply.php @@ -98,13 +98,13 @@ public function eval(Rows $rows, Backend $backend): Column { if (!$this->exact) { return $backend->multiply( - (new Parameter($this->left))->asNumberColumn($rows, $backend), - (new Parameter($this->right))->asNumberColumn($rows, $backend), + new Parameter($this->left)->asNumberColumn($rows, $backend), + new Parameter($this->right)->asNumberColumn($rows, $backend), ); } - $lefts = (new Parameter($this->left))->asNumbers($rows, $backend); - $rights = (new Parameter($this->right))->asNumbers($rows, $backend); + $lefts = new Parameter($this->left)->asNumbers($rows, $backend); + $rights = new Parameter($this->right)->asNumbers($rows, $backend); $calculator = new Calculator(); $results = []; $i = 0; @@ -123,6 +123,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Not.php b/src/core/etl/src/Flow/ETL/Functions/Not.php index 9553b2a334..3f9c7b7610 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Not.php +++ b/src/core/etl/src/Flow/ETL/Functions/Not.php @@ -58,7 +58,7 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), $this->value->returns()); + return new Nullability()->any(type_boolean(), $this->value->returns()); } public function eval(Rows $rows, Backend $backend): Column @@ -66,11 +66,11 @@ public function eval(Rows $rows, Backend $backend): Column $results = []; // @mago-ignore analysis:mixed-assignment - foreach ((new Parameter($this->value))->values($rows, $backend) as $value) { + foreach (new Parameter($this->value)->values($rows, $backend) as $value) { // SQL NOT NULL is NULL - the row must drop, not flip to true. $results[] = $value === null ? null : !$value; } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Now.php b/src/core/etl/src/Flow/ETL/Functions/Now.php index a8bbd86ffb..4b88cc4057 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Now.php +++ b/src/core/etl/src/Flow/ETL/Functions/Now.php @@ -81,7 +81,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $tzes = (new Parameter($this->timeZone))->asInstancesOf($rows, $backend, DateTimeZone::class); + $tzes = new Parameter($this->timeZone)->asInstancesOf($rows, $backend, DateTimeZone::class); $results = []; $i = 0; @@ -97,6 +97,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/NumberFormat.php b/src/core/etl/src/Flow/ETL/Functions/NumberFormat.php index 9662be8fed..96f2dc4ca5 100644 --- a/src/core/etl/src/Flow/ETL/Functions/NumberFormat.php +++ b/src/core/etl/src/Flow/ETL/Functions/NumberFormat.php @@ -91,10 +91,10 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asNumbers($rows, $backend); - $decimalsList = (new Parameter($this->decimals))->asInts($rows, $backend); - $decimalSeparators = (new Parameter($this->decimalSeparator))->asStrings($rows, $backend); - $thousandsSeparators = (new Parameter($this->thousandsSeparator))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asNumbers($rows, $backend); + $decimalsList = new Parameter($this->decimals)->asInts($rows, $backend); + $decimalSeparators = new Parameter($this->decimalSeparator)->asStrings($rows, $backend); + $thousandsSeparators = new Parameter($this->thousandsSeparator)->asStrings($rows, $backend); $results = []; $i = 0; @@ -119,6 +119,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/OnEach.php b/src/core/etl/src/Flow/ETL/Functions/OnEach.php index b272c847af..d6270832d0 100644 --- a/src/core/etl/src/Flow/ETL/Functions/OnEach.php +++ b/src/core/etl/src/Flow/ETL/Functions/OnEach.php @@ -48,7 +48,7 @@ public function __construct( private readonly bool $preserveKeys = true, private readonly OnEachElementSchema $elementSchema = new OnEachElementSchema(), ) { - (new ExpandingFunctions())->refuse($function, 'onEach'); + new ExpandingFunctions()->refuse($function, 'onEach'); $this->array = $array instanceof ScalarFunction ? $array : new Literal($array); } @@ -102,7 +102,7 @@ public function bound(): array $arrayType = type_bare($this->array->returns()); $schema = $this->elementSchema->of($arrayType); - $body = (new ReferenceResolver())->bind($this->function, $schema, 'onEach'); + $body = new ReferenceResolver()->bind($this->function, $schema, 'onEach'); $this->bound = [$schema, $body, type_optional($this->typeOver($arrayType, $body))]; } @@ -151,7 +151,7 @@ public function typeOver(Type $arrayType, ScalarFunction $body): Type public function eval(Rows $rows, Backend $backend): Column { - $arrays = (new Parameter($this->array))->asArrays($rows, $backend); + $arrays = new Parameter($this->array)->asArrays($rows, $backend); $elements = []; /** @var list $rowOf the row of $rows every element comes from */ @@ -172,8 +172,8 @@ public function eval(Rows $rows, Backend $backend): Column [$elementSchema, $body, $type] = $this->bound(); try { - $results = (new Parameter($body))->values( - (new RowsBuilder($elementSchema, $backend)) + $results = new Parameter($body)->values( + new RowsBuilder($elementSchema, $backend) ->appendRecords($elements) ->finish(), $backend, @@ -199,6 +199,6 @@ public function eval(Rows $rows, Backend $backend): Column $output[] = $values; } - return (new ResultColumn($backend))->typed($type, $output); + return new ResultColumn($backend)->typed($type, $output); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Optional.php b/src/core/etl/src/Flow/ETL/Functions/Optional.php index 134d464e60..e79d8b03d3 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Optional.php +++ b/src/core/etl/src/Flow/ETL/Functions/Optional.php @@ -64,13 +64,13 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $evaluated = (new TolerantEvaluation())->evaluate($this->function, $rows, $backend); + $evaluated = new TolerantEvaluation()->evaluate($this->function, $rows, $backend); $results = []; for ($i = 0, $count = $rows->count(); $i < $count; $i++) { $results[] = array_key_exists($i, $evaluated['failed']) ? null : $evaluated['values'][$i]; } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Plus.php b/src/core/etl/src/Flow/ETL/Functions/Plus.php index 25a6c515bd..1cbee72d76 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Plus.php +++ b/src/core/etl/src/Flow/ETL/Functions/Plus.php @@ -98,13 +98,13 @@ public function eval(Rows $rows, Backend $backend): Column { if (!$this->exact) { return $backend->add( - (new Parameter($this->left))->asNumberColumn($rows, $backend), - (new Parameter($this->right))->asNumberColumn($rows, $backend), + new Parameter($this->left)->asNumberColumn($rows, $backend), + new Parameter($this->right)->asNumberColumn($rows, $backend), ); } - $lefts = (new Parameter($this->left))->asNumbers($rows, $backend); - $rights = (new Parameter($this->right))->asNumbers($rows, $backend); + $lefts = new Parameter($this->left)->asNumbers($rows, $backend); + $rights = new Parameter($this->right)->asNumbers($rows, $backend); $calculator = new Calculator(); $results = []; $i = 0; @@ -123,6 +123,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Power.php b/src/core/etl/src/Flow/ETL/Functions/Power.php index ee30aff979..1eb76f0f12 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Power.php +++ b/src/core/etl/src/Flow/ETL/Functions/Power.php @@ -98,8 +98,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $lefts = (new Parameter($this->left))->asNumbers($rows, $backend); - $rights = (new Parameter($this->right))->asInts($rows, $backend); + $lefts = new Parameter($this->left)->asNumbers($rows, $backend); + $rights = new Parameter($this->right)->asInts($rows, $backend); $calculator = new Calculator(); $results = []; $i = 0; @@ -134,6 +134,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Prepend.php b/src/core/etl/src/Flow/ETL/Functions/Prepend.php index 94c620ad55..936eea6aeb 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Prepend.php +++ b/src/core/etl/src/Flow/ETL/Functions/Prepend.php @@ -75,8 +75,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $prefixes = (new Parameter($this->prefix))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $prefixes = new Parameter($this->prefix)->asStrings($rows, $backend); $results = []; $i = 0; @@ -100,6 +100,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/RandomString.php b/src/core/etl/src/Flow/ETL/Functions/RandomString.php index 065708d939..ecc62e9ea3 100644 --- a/src/core/etl/src/Flow/ETL/Functions/RandomString.php +++ b/src/core/etl/src/Flow/ETL/Functions/RandomString.php @@ -92,7 +92,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $lengths = (new Parameter($this->length))->asInts($rows, $backend); + $lengths = new Parameter($this->length)->asInts($rows, $backend); $results = []; $i = 0; @@ -108,6 +108,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Rank.php b/src/core/etl/src/Flow/ETL/Functions/Rank.php index bfd7a43fa4..3923f7a263 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Rank.php +++ b/src/core/etl/src/Flow/ETL/Functions/Rank.php @@ -75,7 +75,7 @@ public function values(Rows $partition, Backend $backend, Progress $progress): a $rank = 1; $unreported = 0; - foreach ((new RowOrder($orderBy))->ties($partition) as $index => $peer) { + foreach (new RowOrder($orderBy)->ties($partition) as $index => $peer) { if ($index > 0 && !$peer) { $rank = $index + 1; } diff --git a/src/core/etl/src/Flow/ETL/Functions/Reference/References.php b/src/core/etl/src/Flow/ETL/Functions/Reference/References.php index fe0d75fbf8..28ee305f1c 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Reference/References.php +++ b/src/core/etl/src/Flow/ETL/Functions/Reference/References.php @@ -51,7 +51,7 @@ public function __construct(string|Reference ...$references) public static function fromDescription(#[SensitiveParameter] array $data, Rebuild $rebuild): static { - return (new self(...$rebuild->all($data['refs'] ?? null, Reference::class)))->without( + return new self(...$rebuild->all($data['refs'] ?? null, Reference::class))->without( ...type_list(type_string())->assert($data['without'] ?? null), ); } diff --git a/src/core/etl/src/Flow/ETL/Functions/ReferenceResolver.php b/src/core/etl/src/Flow/ETL/Functions/ReferenceResolver.php index 7fc3ac91c9..4e5f872832 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ReferenceResolver.php +++ b/src/core/etl/src/Flow/ETL/Functions/ReferenceResolver.php @@ -59,7 +59,7 @@ public function resolve(FunctionTree $function, Schema $schema): FunctionTree // @mago-ignore analysis:less-specific-return-statement - withChildren(): static preserves // the node's class, which the analyzer cannot unify with T. - return (new TemporalStringCoercion())->coerce( + return new TemporalStringCoercion()->coerce( $resolved === $children ? $function : $function->withChildren($resolved), ); } @@ -82,7 +82,7 @@ public function bind(FunctionTree $function, Schema $schema, string $method, ?Ty { $resolved = $this->resolve($function, $schema); $this->assertResolved($resolved, $schema); - (new ExpandingFunctions())->refuse($resolved, $method); + new ExpandingFunctions()->refuse($resolved, $method); // type_bare() keeps the gate blind to nullability - a null-propagating predicate declares ?boolean if ( diff --git a/src/core/etl/src/Flow/ETL/Functions/Regex.php b/src/core/etl/src/Flow/ETL/Functions/Regex.php index 66ee44441d..0cdfeb0b77 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Regex.php +++ b/src/core/etl/src/Flow/ETL/Functions/Regex.php @@ -97,9 +97,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $patterns = (new Parameter($this->pattern))->asStrings($rows, $backend); - $subjects = (new Parameter($this->subject))->asStrings($rows, $backend); - $offsets = (new Parameter($this->offset))->asInts($rows, $backend); + $patterns = new Parameter($this->pattern)->asStrings($rows, $backend); + $subjects = new Parameter($this->subject)->asStrings($rows, $backend); + $offsets = new Parameter($this->offset)->asInts($rows, $backend); $results = []; $i = 0; @@ -135,6 +135,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/RegexAll.php b/src/core/etl/src/Flow/ETL/Functions/RegexAll.php index 297413abdb..cec0aaca76 100644 --- a/src/core/etl/src/Flow/ETL/Functions/RegexAll.php +++ b/src/core/etl/src/Flow/ETL/Functions/RegexAll.php @@ -101,9 +101,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $patterns = (new Parameter($this->pattern))->asStrings($rows, $backend); - $subjects = (new Parameter($this->subject))->asStrings($rows, $backend); - $offsets = (new Parameter($this->offset))->asInts($rows, $backend); + $patterns = new Parameter($this->pattern)->asStrings($rows, $backend); + $subjects = new Parameter($this->subject)->asStrings($rows, $backend); + $offsets = new Parameter($this->offset)->asInts($rows, $backend); $results = []; $i = 0; @@ -145,6 +145,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/RegexMatch.php b/src/core/etl/src/Flow/ETL/Functions/RegexMatch.php index 0f78db432c..3cfad27064 100644 --- a/src/core/etl/src/Flow/ETL/Functions/RegexMatch.php +++ b/src/core/etl/src/Flow/ETL/Functions/RegexMatch.php @@ -85,7 +85,7 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any( + return new Nullability()->any( type_boolean(), $this->pattern->returns(), $this->subject->returns(), @@ -96,10 +96,10 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $patterns = (new Parameter($this->pattern))->asStrings($rows, $backend); - $subjects = (new Parameter($this->subject))->asStrings($rows, $backend); - $flagsList = (new Parameter($this->flags))->asInts($rows, $backend); - $offsets = (new Parameter($this->offset))->asInts($rows, $backend); + $patterns = new Parameter($this->pattern)->asStrings($rows, $backend); + $subjects = new Parameter($this->subject)->asStrings($rows, $backend); + $flagsList = new Parameter($this->flags)->asInts($rows, $backend); + $offsets = new Parameter($this->offset)->asInts($rows, $backend); $results = []; $i = 0; @@ -121,6 +121,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/RegexMatchAll.php b/src/core/etl/src/Flow/ETL/Functions/RegexMatchAll.php index 0e22832832..d00277aa8e 100644 --- a/src/core/etl/src/Flow/ETL/Functions/RegexMatchAll.php +++ b/src/core/etl/src/Flow/ETL/Functions/RegexMatchAll.php @@ -85,7 +85,7 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any( + return new Nullability()->any( type_boolean(), $this->pattern->returns(), $this->subject->returns(), @@ -96,10 +96,10 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $patterns = (new Parameter($this->pattern))->asStrings($rows, $backend); - $subjects = (new Parameter($this->subject))->asStrings($rows, $backend); - $flagsList = (new Parameter($this->flags))->asInts($rows, $backend); - $offsets = (new Parameter($this->offset))->asInts($rows, $backend); + $patterns = new Parameter($this->pattern)->asStrings($rows, $backend); + $subjects = new Parameter($this->subject)->asStrings($rows, $backend); + $flagsList = new Parameter($this->flags)->asInts($rows, $backend); + $offsets = new Parameter($this->offset)->asInts($rows, $backend); $results = []; $i = 0; @@ -122,6 +122,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/RegexReplace.php b/src/core/etl/src/Flow/ETL/Functions/RegexReplace.php index f888299f53..4aaa862167 100644 --- a/src/core/etl/src/Flow/ETL/Functions/RegexReplace.php +++ b/src/core/etl/src/Flow/ETL/Functions/RegexReplace.php @@ -100,10 +100,10 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $patterns = (new Parameter($this->pattern))->asStrings($rows, $backend); - $replacements = (new Parameter($this->replacement))->asStrings($rows, $backend); - $subjects = (new Parameter($this->subject))->asStrings($rows, $backend); - $limits = (new Parameter($this->limit))->asInts($rows, $backend); + $patterns = new Parameter($this->pattern)->asStrings($rows, $backend); + $replacements = new Parameter($this->replacement)->asStrings($rows, $backend); + $subjects = new Parameter($this->subject)->asStrings($rows, $backend); + $limits = new Parameter($this->limit)->asInts($rows, $backend); $results = []; $i = 0; @@ -137,6 +137,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Repeat.php b/src/core/etl/src/Flow/ETL/Functions/Repeat.php index 3cadaa8877..7e5077a22b 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Repeat.php +++ b/src/core/etl/src/Flow/ETL/Functions/Repeat.php @@ -75,8 +75,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $timesList = (new Parameter($this->times))->asInts($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $timesList = new Parameter($this->times)->asInts($rows, $backend); $results = []; $i = 0; @@ -98,6 +98,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Reverse.php b/src/core/etl/src/Flow/ETL/Functions/Reverse.php index 2d03b269c9..f8d68c623f 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Reverse.php +++ b/src/core/etl/src/Flow/ETL/Functions/Reverse.php @@ -69,7 +69,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); $results = []; $i = 0; @@ -85,6 +85,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Round.php b/src/core/etl/src/Flow/ETL/Functions/Round.php index 028ed7026d..45558c8b01 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Round.php +++ b/src/core/etl/src/Flow/ETL/Functions/Round.php @@ -82,9 +82,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asNumbers($rows, $backend); - $precisions = (new Parameter($this->precision))->asInts($rows, $backend); - $modes = (new Parameter($this->mode))->asInts($rows, $backend); + $values = new Parameter($this->value)->asNumbers($rows, $backend); + $precisions = new Parameter($this->precision)->asInts($rows, $backend); + $modes = new Parameter($this->mode)->asInts($rows, $backend); $results = []; $i = 0; @@ -110,6 +110,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Sanitize.php b/src/core/etl/src/Flow/ETL/Functions/Sanitize.php index c23757bf6b..34f40afd75 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Sanitize.php +++ b/src/core/etl/src/Flow/ETL/Functions/Sanitize.php @@ -86,9 +86,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $vals = (new Parameter($this->value))->asStrings($rows, $backend); - $placeholders = (new Parameter($this->placeholder))->asStrings($rows, $backend); - $skipCharactersList = (new Parameter($this->skipCharacters))->asInts($rows, $backend); + $vals = new Parameter($this->value)->asStrings($rows, $backend); + $placeholders = new Parameter($this->placeholder)->asStrings($rows, $backend); + $skipCharactersList = new Parameter($this->skipCharacters)->asInts($rows, $backend); $results = []; $i = 0; @@ -120,6 +120,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Size.php b/src/core/etl/src/Flow/ETL/Functions/Size.php index b5edd530bb..4b79712147 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Size.php +++ b/src/core/etl/src/Flow/ETL/Functions/Size.php @@ -72,7 +72,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->values($rows, $backend); + $values = new Parameter($this->value)->values($rows, $backend); $results = []; $i = 0; @@ -97,6 +97,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Slug.php b/src/core/etl/src/Flow/ETL/Functions/Slug.php index b2b4d5b170..1af7ef9924 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Slug.php +++ b/src/core/etl/src/Flow/ETL/Functions/Slug.php @@ -90,10 +90,10 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $strings = (new Parameter($this->string))->asStrings($rows, $backend); - $separators = (new Parameter($this->separator))->asStrings($rows, $backend, '-'); - $locales = (new Parameter($this->locale))->asStrings($rows, $backend); - $symbolsMaps = (new Parameter($this->symbolsMap))->asArrays($rows, $backend); + $strings = new Parameter($this->string)->asStrings($rows, $backend); + $separators = new Parameter($this->separator)->asStrings($rows, $backend, '-'); + $locales = new Parameter($this->locale)->asStrings($rows, $backend); + $symbolsMaps = new Parameter($this->symbolsMap)->asArrays($rows, $backend); $results = []; $i = 0; @@ -107,7 +107,7 @@ public function eval(Rows $rows, Backend $backend): Column throw new InvalidArgumentException('Slug function requires non-null value'); } - $results[] = (new AsciiSlugger(symbolsMap: $symbolsMap)) + $results[] = new AsciiSlugger(symbolsMap: $symbolsMap) ->slug($string, $separator, $locale) ->toString(); } @@ -115,6 +115,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Split.php b/src/core/etl/src/Flow/ETL/Functions/Split.php index f1b543a592..3b93d6b1e5 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Split.php +++ b/src/core/etl/src/Flow/ETL/Functions/Split.php @@ -85,9 +85,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $separators = (new Parameter($this->separator))->asStrings($rows, $backend); - $limits = (new Parameter($this->limit))->asInts($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $separators = new Parameter($this->separator)->asStrings($rows, $backend); + $limits = new Parameter($this->limit)->asInts($rows, $backend); $results = []; $i = 0; @@ -115,6 +115,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Sprintf.php b/src/core/etl/src/Flow/ETL/Functions/Sprintf.php index 4b184697cd..b850175c0d 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Sprintf.php +++ b/src/core/etl/src/Flow/ETL/Functions/Sprintf.php @@ -88,8 +88,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $formats = (new Parameter($this->format))->asStrings($rows, $backend); - $arguments = array_map(static fn(ScalarFunction $value): array => (new Parameter($value))->values( + $formats = new Parameter($this->format)->asStrings($rows, $backend); + $arguments = array_map(static fn(ScalarFunction $value): array => new Parameter($value)->values( $rows, $backend, ), $this->values); @@ -116,6 +116,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StartsWith.php b/src/core/etl/src/Flow/ETL/Functions/StartsWith.php index 5aca19c674..568602bee3 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StartsWith.php +++ b/src/core/etl/src/Flow/ETL/Functions/StartsWith.php @@ -66,14 +66,14 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), $this->haystack->returns(), $this->needle->returns()); + return new Nullability()->any(type_boolean(), $this->haystack->returns(), $this->needle->returns()); } public function eval(Rows $rows, Backend $backend): Column { return $backend->startsWith( - (new Parameter($this->haystack))->asStringColumn($rows, $backend), - (new Parameter($this->needle))->asStringColumn($rows, $backend), + new Parameter($this->haystack)->asStringColumn($rows, $backend), + new Parameter($this->needle)->asStringColumn($rows, $backend), ); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StrPad.php b/src/core/etl/src/Flow/ETL/Functions/StrPad.php index 5e57026940..413daa7d8b 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StrPad.php +++ b/src/core/etl/src/Flow/ETL/Functions/StrPad.php @@ -87,10 +87,10 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $lengths = (new Parameter($this->length))->asInts($rows, $backend); - $padStrings = (new Parameter($this->padString))->asStrings($rows, $backend); - $types = (new Parameter($this->type))->asInts($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $lengths = new Parameter($this->length)->asInts($rows, $backend); + $padStrings = new Parameter($this->padString)->asStrings($rows, $backend); + $types = new Parameter($this->type)->asInts($rows, $backend); $results = []; $i = 0; @@ -114,6 +114,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StrReplace.php b/src/core/etl/src/Flow/ETL/Functions/StrReplace.php index 33c531e881..c92fa0f237 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StrReplace.php +++ b/src/core/etl/src/Flow/ETL/Functions/StrReplace.php @@ -89,9 +89,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $searches = (new Parameter($this->search))->asTypes($rows, $backend, type_string(), type_array()); - $replaces = (new Parameter($this->replace))->asTypes($rows, $backend, type_string(), type_array()); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $searches = new Parameter($this->search)->asTypes($rows, $backend, type_string(), type_array()); + $replaces = new Parameter($this->replace)->asTypes($rows, $backend, type_string(), type_array()); $results = []; $i = 0; @@ -118,6 +118,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/String/StringStyles.php b/src/core/etl/src/Flow/ETL/Functions/String/StringStyles.php index 12b20254d9..28244cbea0 100644 --- a/src/core/etl/src/Flow/ETL/Functions/String/StringStyles.php +++ b/src/core/etl/src/Flow/ETL/Functions/String/StringStyles.php @@ -8,7 +8,6 @@ use Symfony\Component\String\Slugger\AsciiSlugger; use Symfony\Component\String\UnicodeString; -use function function_exists; use function implode; use function mb_internal_encoding; use function mb_strlen; @@ -89,21 +88,14 @@ private function kebab(string $value): string private function slug(string $string): string { - return (new AsciiSlugger()) + return new AsciiSlugger() ->slug($string) ->toString(); } private function ucFirst(string $string): string { - // Available from PHP 8.4+ - if (function_exists('mb_ucfirst')) { - return mb_ucfirst($string); - } - - $encoding = mb_internal_encoding(); - - return mb_strtoupper(mb_substr($string, 0, 1, $encoding), $encoding) . mb_substr($string, 1, null, $encoding); + return mb_ucfirst($string); } private function ucWords(string $string): string diff --git a/src/core/etl/src/Flow/ETL/Functions/StringAfter.php b/src/core/etl/src/Flow/ETL/Functions/StringAfter.php index 2ccc2ec0e7..dbc54a5070 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StringAfter.php +++ b/src/core/etl/src/Flow/ETL/Functions/StringAfter.php @@ -84,9 +84,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $strings = (new Parameter($this->string))->asStrings($rows, $backend); - $needles = (new Parameter($this->needle))->asStrings($rows, $backend); - $includeNeedles = (new Parameter($this->includeNeedle))->asBooleans($rows, $backend); + $strings = new Parameter($this->string)->asStrings($rows, $backend); + $needles = new Parameter($this->needle)->asStrings($rows, $backend); + $includeNeedles = new Parameter($this->includeNeedle)->asBooleans($rows, $backend); $results = []; $i = 0; @@ -103,6 +103,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StringAfterLast.php b/src/core/etl/src/Flow/ETL/Functions/StringAfterLast.php index f8f62ca63d..64c593a219 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StringAfterLast.php +++ b/src/core/etl/src/Flow/ETL/Functions/StringAfterLast.php @@ -84,9 +84,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $strings = (new Parameter($this->string))->asStrings($rows, $backend); - $needles = (new Parameter($this->needle))->asStrings($rows, $backend); - $includeNeedles = (new Parameter($this->includeNeedle))->asBooleans($rows, $backend); + $strings = new Parameter($this->string)->asStrings($rows, $backend); + $needles = new Parameter($this->needle)->asStrings($rows, $backend); + $includeNeedles = new Parameter($this->includeNeedle)->asBooleans($rows, $backend); $results = []; $i = 0; @@ -103,6 +103,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StringBefore.php b/src/core/etl/src/Flow/ETL/Functions/StringBefore.php index 286c157fdd..0d27d1bac3 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StringBefore.php +++ b/src/core/etl/src/Flow/ETL/Functions/StringBefore.php @@ -84,9 +84,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $strings = (new Parameter($this->string))->asStrings($rows, $backend); - $needles = (new Parameter($this->needle))->asStrings($rows, $backend); - $includeNeedles = (new Parameter($this->includeNeedle))->asBooleans($rows, $backend); + $strings = new Parameter($this->string)->asStrings($rows, $backend); + $needles = new Parameter($this->needle)->asStrings($rows, $backend); + $includeNeedles = new Parameter($this->includeNeedle)->asBooleans($rows, $backend); $results = []; $i = 0; @@ -103,6 +103,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StringBeforeLast.php b/src/core/etl/src/Flow/ETL/Functions/StringBeforeLast.php index 3dfc4e8773..2bd423dbcf 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StringBeforeLast.php +++ b/src/core/etl/src/Flow/ETL/Functions/StringBeforeLast.php @@ -84,9 +84,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $strings = (new Parameter($this->string))->asStrings($rows, $backend); - $needles = (new Parameter($this->needle))->asStrings($rows, $backend); - $includeNeedles = (new Parameter($this->includeNeedle))->asBooleans($rows, $backend); + $strings = new Parameter($this->string)->asStrings($rows, $backend); + $needles = new Parameter($this->needle)->asStrings($rows, $backend); + $includeNeedles = new Parameter($this->includeNeedle)->asBooleans($rows, $backend); $results = []; $i = 0; @@ -103,6 +103,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StringContainsAny.php b/src/core/etl/src/Flow/ETL/Functions/StringContainsAny.php index 5995e4dc9a..80da722eb9 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StringContainsAny.php +++ b/src/core/etl/src/Flow/ETL/Functions/StringContainsAny.php @@ -77,13 +77,13 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), $this->value->returns(), $this->needles->returns()); + return new Nullability()->any(type_boolean(), $this->value->returns(), $this->needles->returns()); } public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $needlesList = (new Parameter($this->needles))->asArrays($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $needlesList = new Parameter($this->needles)->asArrays($rows, $backend); $results = []; $i = 0; @@ -109,6 +109,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StringEqualsTo.php b/src/core/etl/src/Flow/ETL/Functions/StringEqualsTo.php index acbdf68770..940d947254 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StringEqualsTo.php +++ b/src/core/etl/src/Flow/ETL/Functions/StringEqualsTo.php @@ -70,13 +70,13 @@ public function withChildren(array $children): static */ public function returns(): Type { - return (new Nullability())->any(type_boolean(), $this->value->returns(), $this->string->returns()); + return new Nullability()->any(type_boolean(), $this->value->returns(), $this->string->returns()); } public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $strings = (new Parameter($this->string))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $strings = new Parameter($this->string)->asStrings($rows, $backend); $results = []; $i = 0; @@ -96,6 +96,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StringFold.php b/src/core/etl/src/Flow/ETL/Functions/StringFold.php index d06504805f..77a478bdb9 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StringFold.php +++ b/src/core/etl/src/Flow/ETL/Functions/StringFold.php @@ -69,7 +69,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $strings = (new Parameter($this->string))->asStrings($rows, $backend); + $strings = new Parameter($this->string)->asStrings($rows, $backend); $results = []; $i = 0; @@ -85,6 +85,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StringMatch.php b/src/core/etl/src/Flow/ETL/Functions/StringMatch.php index 0c8c04d4e7..a823a10fec 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StringMatch.php +++ b/src/core/etl/src/Flow/ETL/Functions/StringMatch.php @@ -77,8 +77,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $haystacks = (new Parameter($this->haystack))->asStrings($rows, $backend); - $patterns = (new Parameter($this->pattern))->asStrings($rows, $backend); + $haystacks = new Parameter($this->haystack)->asStrings($rows, $backend); + $patterns = new Parameter($this->pattern)->asStrings($rows, $backend); $results = []; $i = 0; @@ -107,6 +107,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StringMatchAll.php b/src/core/etl/src/Flow/ETL/Functions/StringMatchAll.php index cd4a53b052..d95697dbdb 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StringMatchAll.php +++ b/src/core/etl/src/Flow/ETL/Functions/StringMatchAll.php @@ -77,8 +77,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $haystacks = (new Parameter($this->haystack))->asStrings($rows, $backend); - $patterns = (new Parameter($this->pattern))->asStrings($rows, $backend); + $haystacks = new Parameter($this->haystack)->asStrings($rows, $backend); + $patterns = new Parameter($this->pattern)->asStrings($rows, $backend); $results = []; $i = 0; @@ -112,6 +112,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StringNormalize.php b/src/core/etl/src/Flow/ETL/Functions/StringNormalize.php index b249053cf0..5bc2ee8812 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StringNormalize.php +++ b/src/core/etl/src/Flow/ETL/Functions/StringNormalize.php @@ -76,8 +76,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $forms = (new Parameter($this->form))->asInts($rows, $backend, Normalizer::NFC); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $forms = new Parameter($this->form)->asInts($rows, $backend, Normalizer::NFC); $results = []; $i = 0; @@ -95,6 +95,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StringStyle.php b/src/core/etl/src/Flow/ETL/Functions/StringStyle.php index 0d43996747..621c7c2852 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StringStyle.php +++ b/src/core/etl/src/Flow/ETL/Functions/StringStyle.php @@ -76,13 +76,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $strings = (new Parameter($this->string))->asStrings($rows, $backend); - $styles = (new Parameter($this->style))->asTypes( - $rows, - $backend, - type_string(), - type_enum(StringStyles::class), - ); + $strings = new Parameter($this->string)->asStrings($rows, $backend); + $styles = new Parameter($this->style)->asTypes($rows, $backend, type_string(), type_enum(StringStyles::class)); $results = []; $i = 0; @@ -108,6 +103,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StringTitle.php b/src/core/etl/src/Flow/ETL/Functions/StringTitle.php index 5aca2d6b9e..5fa20af4de 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StringTitle.php +++ b/src/core/etl/src/Flow/ETL/Functions/StringTitle.php @@ -75,8 +75,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $strings = (new Parameter($this->string))->asStrings($rows, $backend); - $allWordsList = (new Parameter($this->allWords))->asBooleans($rows, $backend); + $strings = new Parameter($this->string)->asStrings($rows, $backend); + $allWordsList = new Parameter($this->allWords)->asBooleans($rows, $backend); $results = []; $i = 0; @@ -96,6 +96,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StringWidth.php b/src/core/etl/src/Flow/ETL/Functions/StringWidth.php index 8f0fb33d1f..297423d2ef 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StringWidth.php +++ b/src/core/etl/src/Flow/ETL/Functions/StringWidth.php @@ -69,7 +69,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); $results = []; $i = 0; @@ -85,6 +85,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Structure.php b/src/core/etl/src/Flow/ETL/Functions/Structure.php index a85b8c9836..ffe768eff9 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Structure.php +++ b/src/core/etl/src/Flow/ETL/Functions/Structure.php @@ -107,7 +107,7 @@ public function eval(Rows $rows, Backend $backend): Column $elements = []; foreach ($this->elements as $name => $element) { - $elements[$name] = (new Parameter($element))->values($rows, $backend); + $elements[$name] = new Parameter($element)->values($rows, $backend); } $results = []; @@ -122,6 +122,6 @@ public function eval(Rows $rows, Backend $backend): Column $results[] = $values; } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StructureSelect.php b/src/core/etl/src/Flow/ETL/Functions/StructureSelect.php index 3cd7984073..b950f8688c 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StructureSelect.php +++ b/src/core/etl/src/Flow/ETL/Functions/StructureSelect.php @@ -125,7 +125,7 @@ public function eval(Rows $rows, Backend $backend): Column { if ($rows->schema()->findDefinition($this->ref->base()) === null) { // @mago-ignore analysis:possibly-invalid-argument - return (new ResultColumn($backend))->of($this, $rows->isEmpty() ? [] : array_fill(0, $rows->count(), null)); + return new ResultColumn($backend)->of($this, $rows->isEmpty() ? [] : array_fill(0, $rows->count(), null)); } $results = []; @@ -151,6 +151,6 @@ public function eval(Rows $rows, Backend $backend): Column $results[] = $output; } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/StructureValues.php b/src/core/etl/src/Flow/ETL/Functions/StructureValues.php index 0843bcb926..e3ffa61aa0 100644 --- a/src/core/etl/src/Flow/ETL/Functions/StructureValues.php +++ b/src/core/etl/src/Flow/ETL/Functions/StructureValues.php @@ -23,7 +23,7 @@ public static function type(string $function, StructureType $structure): Type { return ( - (new PromotingUnifier())->unifyAll(NullabilityRule::ANY, ...array_map( + new PromotingUnifier()->unifyAll(NullabilityRule::ANY, ...array_map( static fn(StructureElement $element): Type => $element->type, $structure->elements(), )) ?? throw SchemaNotDerivableException::function( diff --git a/src/core/etl/src/Flow/ETL/Functions/Sum.php b/src/core/etl/src/Flow/ETL/Functions/Sum.php index 531e783885..82f81f6681 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Sum.php +++ b/src/core/etl/src/Flow/ETL/Functions/Sum.php @@ -148,7 +148,7 @@ public function frameValues(Rows $partition, array $bounds, Backend $backend, Pr public function values(Rows $partition, Backend $backend, Progress $progress): array { - return (new FrameAccumulation($this->window()->frame()))->values($this, $partition, $backend, $progress); + return new FrameAccumulation($this->window()->frame())->values($this, $partition, $backend, $progress); } public function over(Window $window): static diff --git a/src/core/etl/src/Flow/ETL/Functions/ToDate.php b/src/core/etl/src/Flow/ETL/Functions/ToDate.php index ebe363adc8..f6ed6920ca 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ToDate.php +++ b/src/core/etl/src/Flow/ETL/Functions/ToDate.php @@ -88,9 +88,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->values($rows, $backend); - $formats = (new Parameter($this->format))->asStrings($rows, $backend); - $timeZones = (new Parameter($this->timeZone))->asInstancesOf($rows, $backend, DateTimeZone::class); + $values = new Parameter($this->value)->values($rows, $backend); + $formats = new Parameter($this->format)->asStrings($rows, $backend); + $timeZones = new Parameter($this->timeZone)->asInstancesOf($rows, $backend, DateTimeZone::class); $results = []; $i = 0; @@ -136,6 +136,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ToDateTime.php b/src/core/etl/src/Flow/ETL/Functions/ToDateTime.php index 3a4c65577d..6c8d359906 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ToDateTime.php +++ b/src/core/etl/src/Flow/ETL/Functions/ToDateTime.php @@ -110,7 +110,7 @@ public function withChildren(array $children): static */ public function deterministic(): bool { - if ($this->pattern === null || (new PatternCoverage($this->pattern))->fillsFromClock()) { + if ($this->pattern === null || new PatternCoverage($this->pattern)->fillsFromClock()) { return false; } @@ -133,9 +133,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->values($rows, $backend); - $formats = (new Parameter($this->format))->asStrings($rows, $backend); - $timeZones = (new Parameter($this->timeZone))->asInstancesOf($rows, $backend, DateTimeZone::class); + $values = new Parameter($this->value)->values($rows, $backend); + $formats = new Parameter($this->format)->asStrings($rows, $backend); + $timeZones = new Parameter($this->timeZone)->asInstancesOf($rows, $backend, DateTimeZone::class); $results = []; $i = 0; @@ -187,6 +187,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ToLower.php b/src/core/etl/src/Flow/ETL/Functions/ToLower.php index 616214800f..e6430c1bc1 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ToLower.php +++ b/src/core/etl/src/Flow/ETL/Functions/ToLower.php @@ -69,7 +69,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); $results = []; $i = 0; @@ -85,6 +85,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ToTimeZone.php b/src/core/etl/src/Flow/ETL/Functions/ToTimeZone.php index f129516cd8..0c617171bb 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ToTimeZone.php +++ b/src/core/etl/src/Flow/ETL/Functions/ToTimeZone.php @@ -99,7 +99,7 @@ public function eval(Rows $rows, Backend $backend): Column $i = 0; try { - foreach ((new Parameter($this->value))->asInstancesOf( + foreach (new Parameter($this->value)->asInstancesOf( $rows, $backend, DateTimeInterface::class, @@ -114,6 +114,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/ToUpper.php b/src/core/etl/src/Flow/ETL/Functions/ToUpper.php index 55844db42a..8c76fb20ca 100644 --- a/src/core/etl/src/Flow/ETL/Functions/ToUpper.php +++ b/src/core/etl/src/Flow/ETL/Functions/ToUpper.php @@ -69,7 +69,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); $results = []; $i = 0; @@ -85,6 +85,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Trim.php b/src/core/etl/src/Flow/ETL/Functions/Trim.php index da0c7b111d..eed204fadb 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Trim.php +++ b/src/core/etl/src/Flow/ETL/Functions/Trim.php @@ -87,9 +87,9 @@ public function returns(): FlowType public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $types = (new Parameter($this->type))->asEnums($rows, $backend, Type::class); - $charactersList = (new Parameter($this->characters))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $types = new Parameter($this->type)->asEnums($rows, $backend, Type::class); + $charactersList = new Parameter($this->characters)->asStrings($rows, $backend); $results = []; $i = 0; @@ -116,6 +116,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Truncate.php b/src/core/etl/src/Flow/ETL/Functions/Truncate.php index be08884721..8789d6ffe5 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Truncate.php +++ b/src/core/etl/src/Flow/ETL/Functions/Truncate.php @@ -82,9 +82,9 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $lengths = (new Parameter($this->length))->asInts($rows, $backend); - $ellipsisList = (new Parameter($this->ellipsis))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $lengths = new Parameter($this->length)->asInts($rows, $backend); + $ellipsisList = new Parameter($this->ellipsis)->asStrings($rows, $backend); $results = []; $i = 0; @@ -109,6 +109,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Ulid.php b/src/core/etl/src/Flow/ETL/Functions/Ulid.php index 933e065990..f667b9f4b8 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Ulid.php +++ b/src/core/etl/src/Flow/ETL/Functions/Ulid.php @@ -87,7 +87,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $refs = (new Parameter($this->ref))->asStrings($rows, $backend); + $refs = new Parameter($this->ref)->asStrings($rows, $backend); $results = []; $i = 0; @@ -110,12 +110,12 @@ public function eval(Rows $rows, Backend $backend): Column } } - $results[] = (new SymfonyUlid())->toBase32(); + $results[] = new SymfonyUlid()->toBase32(); } } catch (Exception $e) { throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/UnicodeLength.php b/src/core/etl/src/Flow/ETL/Functions/UnicodeLength.php index 0f6cf6b09b..34449c0764 100644 --- a/src/core/etl/src/Flow/ETL/Functions/UnicodeLength.php +++ b/src/core/etl/src/Flow/ETL/Functions/UnicodeLength.php @@ -69,7 +69,7 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); $results = []; $i = 0; @@ -85,6 +85,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Uuid.php b/src/core/etl/src/Flow/ETL/Functions/Uuid.php index c78caa8e0f..6c41d77169 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Uuid.php +++ b/src/core/etl/src/Flow/ETL/Functions/Uuid.php @@ -114,10 +114,10 @@ public function eval(Rows $rows, Backend $backend): Column $results[] = new FlowUuid($this->generateV4()); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } - $params = (new Parameter($this->value))->asTypes( + $params = new Parameter($this->value)->asTypes( $rows, $backend, type_string(), @@ -137,7 +137,7 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } private function generateV4(): UuidV4|UuidInterface diff --git a/src/core/etl/src/Flow/ETL/Functions/When.php b/src/core/etl/src/Flow/ETL/Functions/When.php index 69473dccfb..71237ab966 100644 --- a/src/core/etl/src/Flow/ETL/Functions/When.php +++ b/src/core/etl/src/Flow/ETL/Functions/When.php @@ -89,7 +89,7 @@ public function returns(): Type $branches[] = $this->else->returns(); } - $result = (new PromotingUnifier())->unifyAll( + $result = new PromotingUnifier()->unifyAll( NullabilityRule::ANY, ...$branches, ) ?? throw InvalidTypeException::noCommonType(...$branches); @@ -103,7 +103,7 @@ public function eval(Rows $rows, Backend $backend): Column $then = []; $else = []; - foreach ((new Parameter($this->condition))->asBooleans($rows, $backend) as $i => $condition) { + foreach (new Parameter($this->condition)->asBooleans($rows, $backend) as $i => $condition) { if ($condition) { $then[] = $i; } else { @@ -114,7 +114,7 @@ public function eval(Rows $rows, Backend $backend): Column $values = []; if ($then !== []) { - $column = (new Selection($then))->evaluate($this->then, $rows, $backend); + $column = new Selection($then)->evaluate($this->then, $rows, $backend); // @mago-ignore analysis:mixed-assignment foreach ($column->values() as $k => $value) { @@ -123,7 +123,7 @@ public function eval(Rows $rows, Backend $backend): Column } if ($else !== [] && $this->else !== null) { - $column = (new Selection($else))->evaluate($this->else, $rows, $backend); + $column = new Selection($else)->evaluate($this->else, $rows, $backend); // @mago-ignore analysis:mixed-assignment foreach ($column->values() as $k => $value) { @@ -137,6 +137,6 @@ public function eval(Rows $rows, Backend $backend): Column $results[] = $values[$i] ?? null; } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/Window/PeerFrame.php b/src/core/etl/src/Flow/ETL/Functions/Window/PeerFrame.php index 752d401065..841f3eae6c 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Window/PeerFrame.php +++ b/src/core/etl/src/Flow/ETL/Functions/Window/PeerFrame.php @@ -56,7 +56,7 @@ public function bounds(int $index, Rows $partition): array public function ends(Rows $partition): array { if (!$this->ends->offsetExists($partition)) { - $peers = (new RowOrder($this->orderBy))->ties($partition); + $peers = new RowOrder($this->orderBy)->ties($partition); $ends = []; $end = $partition->count() - 1; diff --git a/src/core/etl/src/Flow/ETL/Functions/Wordwrap.php b/src/core/etl/src/Flow/ETL/Functions/Wordwrap.php index af4e963964..e14b8d99bf 100644 --- a/src/core/etl/src/Flow/ETL/Functions/Wordwrap.php +++ b/src/core/etl/src/Flow/ETL/Functions/Wordwrap.php @@ -88,10 +88,10 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asStrings($rows, $backend); - $breaks = (new Parameter($this->break))->asStrings($rows, $backend); - $widths = (new Parameter($this->width))->asTypes($rows, $backend, type_integer()); - $cuts = (new Parameter($this->cut))->asBooleans($rows, $backend); + $values = new Parameter($this->value)->asStrings($rows, $backend); + $breaks = new Parameter($this->break)->asStrings($rows, $backend); + $widths = new Parameter($this->width)->asTypes($rows, $backend, type_integer()); + $cuts = new Parameter($this->cut)->asBooleans($rows, $backend); $results = []; $i = 0; @@ -124,6 +124,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/Functions/XPath.php b/src/core/etl/src/Flow/ETL/Functions/XPath.php index dbb17d8929..d03ab4ef02 100644 --- a/src/core/etl/src/Flow/ETL/Functions/XPath.php +++ b/src/core/etl/src/Flow/ETL/Functions/XPath.php @@ -82,8 +82,8 @@ public function returns(): Type public function eval(Rows $rows, Backend $backend): Column { - $values = (new Parameter($this->value))->asInstancesOf($rows, $backend, DOMNode::class); - $paths = (new Parameter($this->path))->asStrings($rows, $backend); + $values = new Parameter($this->value)->asInstancesOf($rows, $backend, DOMNode::class); + $paths = new Parameter($this->path)->asStrings($rows, $backend); $results = []; $i = 0; @@ -111,7 +111,7 @@ public function eval(Rows $rows, Backend $backend): Column } /** @var DOMNodeList|false $result */ - $result = (new DOMXPath($value))->query($path); + $result = new DOMXPath($value)->query($path); if ($result === false || $result->length === 0) { $results[] = null; @@ -136,6 +136,6 @@ public function eval(Rows $rows, Backend $backend): Column throw EvaluationException::at($i, $e); } - return (new ResultColumn($backend))->of($this, $results); + return new ResultColumn($backend)->of($this, $results); } } diff --git a/src/core/etl/src/Flow/ETL/IO/Extractor/ArrayExtractor.php b/src/core/etl/src/Flow/ETL/IO/Extractor/ArrayExtractor.php index 85e827f3fe..84bb936de2 100644 --- a/src/core/etl/src/Flow/ETL/IO/Extractor/ArrayExtractor.php +++ b/src/core/etl/src/Flow/ETL/IO/Extractor/ArrayExtractor.php @@ -184,7 +184,7 @@ private function describe(): Schema $inPlace = $this->inPlace(); if ($inPlace !== null) { - return $this->derivedSchema = (new SchemaInferrer($this->inference))->infer( + return $this->derivedSchema = new SchemaInferrer($this->inference)->infer( new InMemoryRows($inPlace), $this->inferenceProgress, )->schema; @@ -197,11 +197,11 @@ private function describe(): Schema ); // SpilledRows writes every row, so the inference reads every row - return $this->derivedSchema = (new SchemaInferrer( - (new SchemaInference(types: $this->inference->types, unionByName: $this->inference->unionByName)) + return $this->derivedSchema = new SchemaInferrer( + new SchemaInference(types: $this->inference->types, unionByName: $this->inference->unionByName) ->everyRow() ->everySource(), - ))->infer($this->source, $this->inferenceProgress)->schema; + )->infer($this->source, $this->inferenceProgress)->schema; } public function statistics(): Statistics diff --git a/src/core/etl/src/Flow/ETL/IO/Extractor/Criteria.php b/src/core/etl/src/Flow/ETL/IO/Extractor/Criteria.php index 25b56cbd2b..a97210d987 100644 --- a/src/core/etl/src/Flow/ETL/IO/Extractor/Criteria.php +++ b/src/core/etl/src/Flow/ETL/IO/Extractor/Criteria.php @@ -85,7 +85,7 @@ public function withFilter(ScalarFunction $filter): self $this->limit, $this->offset, $this->pathFilter, - [...$this->conjuncts, ...(new Conjuncts())->of($filter)], + [...$this->conjuncts, ...new Conjuncts()->of($filter)], $this->split, $this->columns, ); diff --git a/src/core/etl/src/Flow/ETL/IO/Extractor/File/DerivedSchema.php b/src/core/etl/src/Flow/ETL/IO/Extractor/File/DerivedSchema.php index 07e6ca2760..23ca33f03c 100644 --- a/src/core/etl/src/Flow/ETL/IO/Extractor/File/DerivedSchema.php +++ b/src/core/etl/src/Flow/ETL/IO/Extractor/File/DerivedSchema.php @@ -45,7 +45,7 @@ public function normalize(): array */ public function refuseDivergence(string $source, Schema $schema): void { - $validation = (new StrictValidator())->validate($this->derived, $schema); + $validation = new StrictValidator()->validate($this->derived, $schema); if (!$validation->isValid()) { throw InferredSchemaException::filesDiverge($source, $this->derivedFrom, $validation->toString()); diff --git a/src/core/etl/src/Flow/ETL/IO/Extractor/File/FileColumns.php b/src/core/etl/src/Flow/ETL/IO/Extractor/File/FileColumns.php index e501551c4f..617c838a48 100644 --- a/src/core/etl/src/Flow/ETL/IO/Extractor/File/FileColumns.php +++ b/src/core/etl/src/Flow/ETL/IO/Extractor/File/FileColumns.php @@ -117,7 +117,7 @@ public function partitions(Schema $declared): Schema } // only the partition block: $declared may already carry the metadata column declare() adds - return (new self($this->partitionNames, $this->partitionTypes, false)) + return new self($this->partitionNames, $this->partitionTypes, false) ->declare($declared) ->keep(...array_keys($this->partitionNames)); } diff --git a/src/core/etl/src/Flow/ETL/IO/Extractor/File/FileRead.php b/src/core/etl/src/Flow/ETL/IO/Extractor/File/FileRead.php index 62d75e21b9..7d62b08103 100644 --- a/src/core/etl/src/Flow/ETL/IO/Extractor/File/FileRead.php +++ b/src/core/etl/src/Flow/ETL/IO/Extractor/File/FileRead.php @@ -66,7 +66,7 @@ public function normalize(): array */ public function scan(Backend $backend, Criteria $criteria, FileBatches $batches): Generator { - yield from (new FileReadLoop($this, $criteria))->read( + yield from new FileReadLoop($this, $criteria)->read( $this->files->of($criteria), $batches, $backend, diff --git a/src/core/etl/src/Flow/ETL/IO/Extractor/File/SourceFiles.php b/src/core/etl/src/Flow/ETL/IO/Extractor/File/SourceFiles.php index 6a9eacf9c1..c12541dde1 100644 --- a/src/core/etl/src/Flow/ETL/IO/Extractor/File/SourceFiles.php +++ b/src/core/etl/src/Flow/ETL/IO/Extractor/File/SourceFiles.php @@ -44,7 +44,7 @@ public function statuses(Criteria $criteria = new Criteria()): array { if ($criteria->split !== null) { return iterator_to_array( - (new FileListing($this->filesystem))->list( + new FileListing($this->filesystem)->list( $criteria->split->path, new VisibleFiles($criteria->split->path->staticPart()), ), @@ -53,7 +53,7 @@ public function statuses(Criteria $criteria = new Criteria()): array } $this->statuses ??= iterator_to_array( - (new FileListing($this->filesystem))->list($this->path, new VisibleFiles($this->path->staticPart())), + new FileListing($this->filesystem)->list($this->path, new VisibleFiles($this->path->staticPart())), false, ); diff --git a/src/core/etl/src/Flow/ETL/IO/Extractor/FileListingExtractor.php b/src/core/etl/src/Flow/ETL/IO/Extractor/FileListingExtractor.php index f27f85b511..36d2de19cd 100644 --- a/src/core/etl/src/Flow/ETL/IO/Extractor/FileListingExtractor.php +++ b/src/core/etl/src/Flow/ETL/IO/Extractor/FileListingExtractor.php @@ -64,7 +64,7 @@ public function isRepeatable(): bool */ public function extract(Backend $backend, Criteria $criteria): Generator { - return (new ListingScan($this->files, $this->fileColumns->columns(), $this->row))->scan( + return new ListingScan($this->files, $this->fileColumns->columns(), $this->row)->scan( $backend, $criteria, $this->schema(), diff --git a/src/core/etl/src/Flow/ETL/IO/Extractor/Grid/RecordDecoder.php b/src/core/etl/src/Flow/ETL/IO/Extractor/Grid/RecordDecoder.php index 6da577be72..e93df124c2 100644 --- a/src/core/etl/src/Flow/ETL/IO/Extractor/Grid/RecordDecoder.php +++ b/src/core/etl/src/Flow/ETL/IO/Extractor/Grid/RecordDecoder.php @@ -58,7 +58,7 @@ public function decode(array $cells): array|string|null } if ($this->headers === null) { - $this->headers = (new HeaderNames())->of($this->withHeader ? $cells : array_fill(0, count($cells), null)); + $this->headers = new HeaderNames()->of($this->withHeader ? $cells : array_fill(0, count($cells), null)); if ($this->withHeader) { return null; diff --git a/src/core/etl/src/Flow/ETL/IO/Extractor/Memory/SpilledRows.php b/src/core/etl/src/Flow/ETL/IO/Extractor/Memory/SpilledRows.php index 89bc50a1c6..1a8c246a08 100644 --- a/src/core/etl/src/Flow/ETL/IO/Extractor/Memory/SpilledRows.php +++ b/src/core/etl/src/Flow/ETL/IO/Extractor/Memory/SpilledRows.php @@ -199,7 +199,7 @@ public function sniff(int $unit, ?int $rowBudget, Progress $progress): Sample // InMemoryRows owns the raw-row naming; keeping a second copy here would put the "same names array_to_rows() // gives" invariant in two places. - return (new InMemoryRows($spilling()))->sniff(0, null, $progress); + return new InMemoryRows($spilling())->sniff(0, null, $progress); } public function parts(int $unit, int $targetBytes): array diff --git a/src/core/etl/src/Flow/ETL/IO/Extractor/SequenceExtractor.php b/src/core/etl/src/Flow/ETL/IO/Extractor/SequenceExtractor.php index cb0ff003b0..f254b4ac94 100644 --- a/src/core/etl/src/Flow/ETL/IO/Extractor/SequenceExtractor.php +++ b/src/core/etl/src/Flow/ETL/IO/Extractor/SequenceExtractor.php @@ -146,7 +146,7 @@ private function describe(): Schema // no spill: generate() is re-runnable // no seeded name: PHP re-keys integer names - return $this->derivedSchema = (new SchemaInferrer($this->inference))->infer( + return $this->derivedSchema = new SchemaInferrer($this->inference)->infer( new InMemoryRows($items()), $this->inferenceProgress, )->schema; diff --git a/src/core/etl/src/Flow/ETL/IO/Filesystem/ScalarFunctionFilter.php b/src/core/etl/src/Flow/ETL/IO/Filesystem/ScalarFunctionFilter.php index 89e50d0903..d58471f580 100644 --- a/src/core/etl/src/Flow/ETL/IO/Filesystem/ScalarFunctionFilter.php +++ b/src/core/etl/src/Flow/ETL/IO/Filesystem/ScalarFunctionFilter.php @@ -29,7 +29,7 @@ public function __construct( // are both in hand - a filter reaching a Read any other way is gated too. // resolved() guards it: files() and from_path_partitions() declare no partition columns, so // their reference never resolves and returns() would throw instead of answering. - $this->resolved = (new ReferenceResolver())->resolve($function, $partitions); + $this->resolved = new ReferenceResolver()->resolve($function, $partitions); if ($this->resolved->resolved()) { $this->resolved->returns(); @@ -70,9 +70,9 @@ public function accept(FileStatus $status): bool // an undeclared partition column resolves against the file's own path value (a str column) // @mago-ignore analysis:mixed-operand - return (bool) (new ReferenceResolver()) + return (bool) new ReferenceResolver() ->resolve($this->resolved, $schema) - ->eval((new RowsBuilder($schema, $this->backend))->appendRecords([$values])->finish(), $this->backend) + ->eval(new RowsBuilder($schema, $this->backend)->appendRecords([$values])->finish(), $this->backend) ->value(0); } } diff --git a/src/core/etl/src/Flow/ETL/IO/Floe/FloeExtractor.php b/src/core/etl/src/Flow/ETL/IO/Floe/FloeExtractor.php index 1e88aa76d7..650702a5bc 100644 --- a/src/core/etl/src/Flow/ETL/IO/Floe/FloeExtractor.php +++ b/src/core/etl/src/Flow/ETL/IO/Floe/FloeExtractor.php @@ -223,7 +223,7 @@ private function files(): Generator $stream = $this->filesystem->readFrom($source->path); try { - yield new FloeSourceFile((new FooterReader())->read($stream, $this->codec)->footer, $source); + yield new FloeSourceFile(new FooterReader()->read($stream, $this->codec)->footer, $source); } finally { $stream->close(); } diff --git a/src/core/etl/src/Flow/ETL/IO/Floe/FloeLoader.php b/src/core/etl/src/Flow/ETL/IO/Floe/FloeLoader.php index 685c1822dd..19175305d0 100644 --- a/src/core/etl/src/Flow/ETL/IO/Floe/FloeLoader.php +++ b/src/core/etl/src/Flow/ETL/IO/Floe/FloeLoader.php @@ -74,7 +74,7 @@ public function __construct( public static function fromDescription(#[SensitiveParameter] array $data, Rebuild $rebuild): static { - $loader = (new self( + $loader = new self( Path::fromArray(type_array()->assert($data['path'] ?? null)), ($data['metadata'] ?? null) === null ? null @@ -87,7 +87,7 @@ public static function fromDescription(#[SensitiveParameter] array $data, Rebuil ))->assert($data['metadata'])), new Options(type_integer()->assert($data['buffer_size'] ?? null)), $rebuild->of($data['filesystem'] ?? null, ConfiguredFilesystem::class)->filesystem(), - ))->saveMode(type_enum(SaveMode::class)->assert(constant( + )->saveMode(type_enum(SaveMode::class)->assert(constant( SaveMode::class . '::' . type_string()->assert($data['save_mode'] ?? null), ))); @@ -174,12 +174,7 @@ public function partitioning(): Partitioning public function inTask(Part $task): static { - $loader = (new self( - $this->path, - $this->metadata, - $this->options, - $this->filesystem, - ))->saveMode($this->saveMode); + $loader = new self($this->path, $this->metadata, $this->options, $this->filesystem)->saveMode($this->saveMode); if ($this->schema !== null) { $loader->withSchema($this->schema); diff --git a/src/core/etl/src/Flow/ETL/IO/Formatter/ASCII/ASCIIValue.php b/src/core/etl/src/Flow/ETL/IO/Formatter/ASCII/ASCIIValue.php index dae4e30acf..107d4132cc 100644 --- a/src/core/etl/src/Flow/ETL/IO/Formatter/ASCII/ASCIIValue.php +++ b/src/core/etl/src/Flow/ETL/IO/Formatter/ASCII/ASCIIValue.php @@ -111,7 +111,7 @@ private function stringValue(): string { if ($this->stringValue === null) { try { - $this->stringValue = (new TypedValueFormatter())->format($this->type, $this->value); + $this->stringValue = new TypedValueFormatter()->format($this->type, $this->value); } catch (TypesException) { $this->stringValue = '{...}'; diff --git a/src/core/etl/src/Flow/ETL/IO/Formatter/Row/ASCIISchemaFormatter.php b/src/core/etl/src/Flow/ETL/IO/Formatter/Row/ASCIISchemaFormatter.php index e88fcebb75..f37a012f81 100644 --- a/src/core/etl/src/Flow/ETL/IO/Formatter/Row/ASCIISchemaFormatter.php +++ b/src/core/etl/src/Flow/ETL/IO/Formatter/Row/ASCIISchemaFormatter.php @@ -34,7 +34,7 @@ public function __construct( public function format(Schema $schema): string { if ($this->asTable) { - return (new AsciiTableFormatter())->format($this->table($schema), false); + return new AsciiTableFormatter()->format($this->table($schema), false); } /** @var array $buffer */ @@ -77,7 +77,7 @@ private function table(Schema $schema): Rows $columns[] = new StringDefinition('metadata'); } - return (new RowsBuilder(new Schema(...$columns), new AdaptiveBackend())) + return new RowsBuilder(new Schema(...$columns), new AdaptiveBackend()) ->appendRows($rows) ->finish(); } diff --git a/src/core/etl/src/Flow/ETL/IO/Formatter/Schema/PHPSchemaFormatter.php b/src/core/etl/src/Flow/ETL/IO/Formatter/Schema/PHPSchemaFormatter.php index 1bd6531a1a..2f2a51a04b 100644 --- a/src/core/etl/src/Flow/ETL/IO/Formatter/Schema/PHPSchemaFormatter.php +++ b/src/core/etl/src/Flow/ETL/IO/Formatter/Schema/PHPSchemaFormatter.php @@ -51,7 +51,7 @@ public function format(Schema $schema): string { return sprintf( "\%s(%s);", - (new ReflectionFunction("\Flow\ETL\DSL\schema"))->getName(), + new ReflectionFunction("\Flow\ETL\DSL\schema")->getName(), $this->formatSchema($schema), ); } @@ -69,7 +69,7 @@ private function dateTimeType(Definition $definition): string return sprintf( '\%s("%s", nullable: %s, metadata: %s, zone: "%s")', - (new ReflectionFunction('\Flow\ETL\DSL\datetime_schema'))->getName(), + new ReflectionFunction('\Flow\ETL\DSL\datetime_schema')->getName(), $definition->name(), $definition->isNullable() ? 'true' : 'false', $this->formatMetadata($definition->metadata()), @@ -86,7 +86,7 @@ private function enumType(Definition $definition): string return sprintf( '\%s("%s", type: \%s::class, nullable: %s, metadata: %s)', - (new ReflectionFunction("\Flow\ETL\DSL\\enum_schema"))->getName(), + new ReflectionFunction("\Flow\ETL\DSL\\enum_schema")->getName(), $definition->name(), $type->class, $definition->isNullable() ? 'true' : 'false', @@ -101,7 +101,7 @@ private function floatType(Definition $definition): string { return sprintf( '\%s("%s", nullable: %s, metadata: %s)', - (new ReflectionFunction("\Flow\ETL\DSL\\float_schema"))->getName(), + new ReflectionFunction("\Flow\ETL\DSL\\float_schema")->getName(), $definition->name(), $definition->isNullable() ? 'true' : 'false', $this->formatMetadata($definition->metadata()), @@ -171,7 +171,7 @@ private function listType(Definition $definition): string return sprintf( '\%s("%s", type: %s, nullable: %s, metadata: %s)', - (new ReflectionFunction("\Flow\ETL\DSL\\list_schema"))->getName(), + new ReflectionFunction("\Flow\ETL\DSL\\list_schema")->getName(), $definition->name(), $this->typeFormatter->format($type), $definition->isNullable() ? 'true' : 'false', @@ -189,7 +189,7 @@ private function mapType(Definition $definition): string return sprintf( '\%s("%s", type: %s, nullable: %s, metadata: %s)', - (new ReflectionFunction("\Flow\ETL\DSL\\map_schema"))->getName(), + new ReflectionFunction("\Flow\ETL\DSL\\map_schema")->getName(), $definition->name(), $this->typeFormatter->format($type), $definition->isNullable() ? 'true' : 'false', @@ -204,7 +204,7 @@ private function numericStringType(Definition $definition): string { return sprintf( '\%s("%s", type: %s, nullable: %s, metadata: %s)', - (new ReflectionFunction("\Flow\ETL\DSL\\definition_from_type"))->getName(), + new ReflectionFunction("\Flow\ETL\DSL\\definition_from_type")->getName(), $definition->name(), $this->typeFormatter->format($definition->type()), $definition->isNullable() ? 'true' : 'false', @@ -253,7 +253,7 @@ private function structureType(Definition $definition): string return sprintf( '\%s("%s", type: %s, nullable: %s, metadata: %s)', - (new ReflectionFunction("\Flow\ETL\DSL\\structure_schema"))->getName(), + new ReflectionFunction("\Flow\ETL\DSL\\structure_schema")->getName(), $definition->name(), $this->typeFormatter->format($type), $definition->isNullable() ? 'true' : 'false', diff --git a/src/core/etl/src/Flow/ETL/IO/Inference/InferredTypes.php b/src/core/etl/src/Flow/ETL/IO/Inference/InferredTypes.php index 8d7ddd3768..71e4b438f2 100644 --- a/src/core/etl/src/Flow/ETL/IO/Inference/InferredTypes.php +++ b/src/core/etl/src/Flow/ETL/IO/Inference/InferredTypes.php @@ -95,7 +95,7 @@ public static function fromArray(array $data): self } /** - * Every rung but html and xml: no engine infers markup, HTMLType::cast() throws below PHP 8.4, and isXML() + * Every rung but html and xml: no engine infers markup, and isXML() * builds a DOMDocument per cell. * * type_enum(UnitEnum::class) is the family marker, not a rung: no text source ever climbs to an enum, but a diff --git a/src/core/etl/src/Flow/ETL/IO/Loader/File/FileCommit.php b/src/core/etl/src/Flow/ETL/IO/Loader/File/FileCommit.php index cb62d9b52b..59e1330650 100644 --- a/src/core/etl/src/Flow/ETL/IO/Loader/File/FileCommit.php +++ b/src/core/etl/src/Flow/ETL/IO/Loader/File/FileCommit.php @@ -74,7 +74,7 @@ public function __construct( } if ( - (new Part(0, 1, $run, false))->fill($destination)->isPattern() + new Part(0, 1, $run, false)->fill($destination)->isPattern() && [] === $destination->partitionPlaceholders() ) { throw new RuntimeException("Destination path can't be pattern, given: " . $destination->uri()); diff --git a/src/core/etl/src/Flow/ETL/IO/Loader/File/PartitionRouter.php b/src/core/etl/src/Flow/ETL/IO/Loader/File/PartitionRouter.php index 4b714d24e8..9d687b4fc2 100644 --- a/src/core/etl/src/Flow/ETL/IO/Loader/File/PartitionRouter.php +++ b/src/core/etl/src/Flow/ETL/IO/Loader/File/PartitionRouter.php @@ -62,7 +62,7 @@ public function route(Rows $rows): Generator $stripped = $this->dropped === [] ? $schema : $schema->gracefulRemove(...$this->partitioning->by->names()); - foreach (KeyGrouping::indices((new KeyEncoder($this->partitioning->by->names()))->of($rows)) as $indices) { + foreach (KeyGrouping::indices(new KeyEncoder($this->partitioning->by->names())->of($rows)) as $indices) { $group = $rows->gather($indices); yield [ diff --git a/src/core/etl/src/Flow/ETL/Kernels/HashJoin/JoinKeys.php b/src/core/etl/src/Flow/ETL/Kernels/HashJoin/JoinKeys.php index f3304642a0..16ecbe9fd2 100644 --- a/src/core/etl/src/Flow/ETL/Kernels/HashJoin/JoinKeys.php +++ b/src/core/etl/src/Flow/ETL/Kernels/HashJoin/JoinKeys.php @@ -94,7 +94,7 @@ public function types(?Schema $left, ?Schema $right): array $rightDefinition = $right?->findDefinition($this->right[$position]); if ($leftDefinition !== null && $rightDefinition !== null) { - $types[$position] = (new ValueEquality())->type($leftDefinition->type(), $rightDefinition->type()); + $types[$position] = new ValueEquality()->type($leftDefinition->type(), $rightDefinition->type()); } } diff --git a/src/core/etl/src/Flow/ETL/Kernels/Join/JoinSchema.php b/src/core/etl/src/Flow/ETL/Kernels/Join/JoinSchema.php index 80cfa51a89..37887e3f63 100644 --- a/src/core/etl/src/Flow/ETL/Kernels/Join/JoinSchema.php +++ b/src/core/etl/src/Flow/ETL/Kernels/Join/JoinSchema.php @@ -27,7 +27,7 @@ public function __construct( public function cross(Schema $left, Schema $right): Schema { - return (new self($this->prefix, $this->dropLeft, $this->dropRight))->output($left, $right); + return new self($this->prefix, $this->dropLeft, $this->dropRight)->output($left, $right); } public function merger(Schema $left, Schema $right): RowMerger diff --git a/src/core/etl/src/Flow/ETL/Kernels/Sort/ExternalSort.php b/src/core/etl/src/Flow/ETL/Kernels/Sort/ExternalSort.php index 3efe93445a..2ccbbdcb11 100644 --- a/src/core/etl/src/Flow/ETL/Kernels/Sort/ExternalSort.php +++ b/src/core/etl/src/Flow/ETL/Kernels/Sort/ExternalSort.php @@ -283,7 +283,7 @@ public function merge(array $streams, Backend $backend, MemoryBudget $budget, Ba } // held in a variable, so the keys are still alive when the second measurement runs - $_keys = (new RowOrder($this->columns))->keys($first); + $_keys = new RowOrder($this->columns)->keys($first); $perFrame = $full - $budget->remaining(); // a merge round copies the held rows twice more $remaining = intdiv($full, 2); @@ -304,7 +304,7 @@ function (array $group) use ($merger, &$mergedIndex): Generator { ); } - yield from (new KWayMerge($this->columns, $backend, $output))->merge($streams); + yield from new KWayMerge($this->columns, $backend, $output)->merge($streams); return; } @@ -313,7 +313,7 @@ function (array $group) use ($merger, &$mergedIndex): Generator { ? self::MERGE_CURSOR_ROWS : min(self::MERGE_CURSOR_ROWS, $frames * max(1, $first->count())); - yield from (new KWayMerge($this->columns, $backend, $output))->merge(array_map( + yield from new KWayMerge($this->columns, $backend, $output)->merge(array_map( static fn(Generator $stream): Generator => self::coalesced($stream, $cursorRows, $backend), $streams, )); diff --git a/src/core/etl/src/Flow/ETL/Operators/Constraint/UniqueConstraint.php b/src/core/etl/src/Flow/ETL/Operators/Constraint/UniqueConstraint.php index e9458e0cbe..2055a34066 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Constraint/UniqueConstraint.php +++ b/src/core/etl/src/Flow/ETL/Operators/Constraint/UniqueConstraint.php @@ -39,7 +39,7 @@ public function firstViolation(Rows $rows): ?int return null; } - $new = $this->seen->add((new KeyEncoder($this->reference->names()))->of($rows)); + $new = $this->seen->add(new KeyEncoder($this->reference->names())->of($rows)); // rows 0..n-1 all bring a new key until the first that does not foreach ($new as $position => $row) { diff --git a/src/core/etl/src/Flow/ETL/Operators/Join/CrossJoin.php b/src/core/etl/src/Flow/ETL/Operators/Join/CrossJoin.php index 67c72873b7..af8ae5fac2 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Join/CrossJoin.php +++ b/src/core/etl/src/Flow/ETL/Operators/Join/CrossJoin.php @@ -23,7 +23,7 @@ public function __construct( */ public function bind(Schema $left, Schema $right): BoundStep { - return new BoundStep($this, (new JoinSchema($this->prefix))->cross($left, $right)); + return new BoundStep($this, new JoinSchema($this->prefix)->cross($left, $right)); } /** diff --git a/src/core/etl/src/Flow/ETL/Operators/Join/HashJoin.php b/src/core/etl/src/Flow/ETL/Operators/Join/HashJoin.php index f0bf52d280..8e18bea77a 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Join/HashJoin.php +++ b/src/core/etl/src/Flow/ETL/Operators/Join/HashJoin.php @@ -213,14 +213,14 @@ public function join(Generator $left, Generator $right, Backend $backend): Gener // right rows with a null join key can never match, they only surface in right join output if ($equalityKeys !== null && $this->type->dropsNullKeys(Side::right)) { - $rightRows = (new NullKeyFilter($equalityKeys->right))->rows($rightRows); + $rightRows = new NullKeyFilter($equalityKeys->right)->rows($rightRows); } /** @var null|list $held the build side, when all of it fits under the memory limit */ $held = null; if (!$resident) { - [$read, $fits] = (new BoundedRead($budget))->read($rightRows); + [$read, $fits] = new BoundedRead($budget)->read($rightRows); if ($fits) { $held = $read; @@ -233,7 +233,7 @@ public function join(Generator $left, Generator $right, Backend $backend): Gener // left rows with a null join key can never match, they only surface in left/left_anti output if ($equalityKeys !== null && $this->type->dropsNullKeys(Side::left)) { - $leftRows = (new NullKeyFilter($equalityKeys->left))->rows($leftRows); + $leftRows = new NullKeyFilter($equalityKeys->left)->rows($leftRows); } // the right buckets key in the type both sides compare in, so an undeclared left side shows its first batch diff --git a/src/core/etl/src/Flow/ETL/Operators/Processor/BoundExpansion.php b/src/core/etl/src/Flow/ETL/Operators/Processor/BoundExpansion.php index 7337264097..48c34e88fe 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Processor/BoundExpansion.php +++ b/src/core/etl/src/Flow/ETL/Operators/Processor/BoundExpansion.php @@ -55,7 +55,7 @@ public static function of( $resolver = new ReferenceResolver(); $resolved = $resolver->resolve($function, $input); $resolver->assertResolved($resolved, $input); - (new ExpandingFunctions())->refuseNested($resolved); + new ExpandingFunctions()->refuseNested($resolved); $expansion = Expansion::of($resolved, $input) ?? throw InvalidLogicException::because( '%s holds no array_expand(), it is not an expansion', @@ -70,7 +70,7 @@ public static function of( if ($root instanceof UnpackResults) { $written = []; - foreach ((new UnpackedColumns()) + foreach (new UnpackedColumns() ->declared($root) ->names() as $unpacked) { $written[] = $name . '.' . $unpacked; @@ -92,7 +92,7 @@ public static function of( } } - $rootReads = array_diff((new ReferencedColumns())->in($root)->names(), $synthesizedNames); + $rootReads = array_diff(new ReferencedColumns()->in($root)->names(), $synthesizedNames); $gathered = []; foreach ($input->definitions() as $definition) { diff --git a/src/core/etl/src/Flow/ETL/Operators/Processor/CountingProcessor.php b/src/core/etl/src/Flow/ETL/Operators/Processor/CountingProcessor.php index 00ce8e4e6a..b95bdb5149 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Processor/CountingProcessor.php +++ b/src/core/etl/src/Flow/ETL/Operators/Processor/CountingProcessor.php @@ -54,7 +54,7 @@ public function process(Generator $rows, Backend $backend): Generator */ public static function rows(int $count, Backend $backend): Rows { - return (new RowsBuilder(self::schema(), $backend))->appendRecords([['count' => $count]])->finish(); + return new RowsBuilder(self::schema(), $backend)->appendRecords([['count' => $count]])->finish(); } public static function schema(): Schema diff --git a/src/core/etl/src/Flow/ETL/Operators/Processor/GroupByAggregationProcessor.php b/src/core/etl/src/Flow/ETL/Operators/Processor/GroupByAggregationProcessor.php index fd74c39a6b..0868b6bc35 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Processor/GroupByAggregationProcessor.php +++ b/src/core/etl/src/Flow/ETL/Operators/Processor/GroupByAggregationProcessor.php @@ -133,18 +133,18 @@ public function distribution(): ?Distribution $this->shape->input, $partial->aggregations()->resolved($this->shape->input), ); - $partialStep = (new self( + $partialStep = new self( $partial, $this->config, $this->random, progress: $this->progress, - ))->bind($this->shape->input)->step; - $finalStep = (new self( + )->bind($this->shape->input)->step; + $finalStep = new self( new GroupBy($this->groupBy->refs(), new Aggregators(...$merged)), $this->config, $this->random, progress: $this->progress, - ))->bind($partialSchema)->step; + )->bind($partialSchema)->step; $keys = $this->groupBy->refs()->names(); @@ -233,7 +233,7 @@ public function process(Generator $rows, Backend $backend): Generator // SQL scalar aggregate: no input still yields one row if ($shape !== null && $this->groupBy->isGlobal()) { - yield (new AggregatedGroups($this->groupBy, $shape, $backend, $this->progress))->noInputRow($backend); + yield new AggregatedGroups($this->groupBy, $shape, $backend, $this->progress)->noInputRow($backend); } $this->progress->done(); diff --git a/src/core/etl/src/Flow/ETL/Operators/Processor/RepartitionProcessor.php b/src/core/etl/src/Flow/ETL/Operators/Processor/RepartitionProcessor.php index 870a17bb88..f74b872d5e 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Processor/RepartitionProcessor.php +++ b/src/core/etl/src/Flow/ETL/Operators/Processor/RepartitionProcessor.php @@ -93,7 +93,7 @@ public function process(Generator $rows, Backend $backend): Generator $rows->valid(); $budget = MemoryBudget::of($backend, $this->config->memoryLimit); $buckets = new Buckets($this->config->spilling($backend, $budget)); - [$read, $fits] = (new BoundedRead($budget))->read($rows); + [$read, $fits] = new BoundedRead($budget)->read($rows); try { if ($fits) { @@ -108,12 +108,12 @@ public function process(Generator $rows, Backend $backend): Generator return; } - foreach ((new HashBucketing( + foreach (new HashBucketing( new KeyEncoder($this->by->names()), $this->config->bucketsCount, $this->random, 'repartition', - ))->bucketize(BoundedRead::followedBy($read, $rows), $buckets->storage(), $backend) as $bucket) { + )->bucketize(BoundedRead::followedBy($read, $rows), $buckets->storage(), $backend) as $bucket) { $buckets->add($bucket); } diff --git a/src/core/etl/src/Flow/ETL/Operators/Processor/RequiredColumns.php b/src/core/etl/src/Flow/ETL/Operators/Processor/RequiredColumns.php index 9e4fc24ba8..480f9ee85b 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Processor/RequiredColumns.php +++ b/src/core/etl/src/Flow/ETL/Operators/Processor/RequiredColumns.php @@ -64,7 +64,7 @@ public function union(self $other): self public function beforeWriting(string $name, ScalarFunction $function): self { - $read = (new ReferencedColumns())->in($function)->names(); + $read = new ReferencedColumns()->in($function)->names(); // an unpack writes "name.*", known only once bound: keep the demand, add what it reads return $function instanceof UnpackResults ? $this->with(...$read) : $this->without($name)->with(...$read); diff --git a/src/core/etl/src/Flow/ETL/Operators/Processor/WindowProcessor.php b/src/core/etl/src/Flow/ETL/Operators/Processor/WindowProcessor.php index 0315e6c946..b79a1fcd36 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Processor/WindowProcessor.php +++ b/src/core/etl/src/Flow/ETL/Operators/Processor/WindowProcessor.php @@ -117,7 +117,7 @@ public function process(Generator $rows, Backend $backend): Generator */ private function boundTo(Schema $input): BoundWindow { - $resolved = (new ReferenceResolver())->bind($this->function, $input, 'over'); + $resolved = new ReferenceResolver()->bind($this->function, $input, 'over'); self::assertWindowReferences($resolved, $input); $derived = $this->column instanceof Definition diff --git a/src/core/etl/src/Flow/ETL/Operators/Transformer/DerivedColumns.php b/src/core/etl/src/Flow/ETL/Operators/Transformer/DerivedColumns.php index fae7aade6a..5ee707dce1 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Transformer/DerivedColumns.php +++ b/src/core/etl/src/Flow/ETL/Operators/Transformer/DerivedColumns.php @@ -26,7 +26,7 @@ */ public function stored(Definition $derived, Column $column, Backend $backend): Column { - (new ColumnRetyping())->notNull($derived, $column); + new ColumnRetyping()->notNull($derived, $column); if (type_bare($column->type())->normalize() === type_bare($derived->type())->normalize()) { return $backend->adopt($derived, $column->withType($derived->type())); diff --git a/src/core/etl/src/Flow/ETL/Operators/Transformer/DuplicateRowTransformer.php b/src/core/etl/src/Flow/ETL/Operators/Transformer/DuplicateRowTransformer.php index 9b1bb7c3bb..88ff77d868 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Transformer/DuplicateRowTransformer.php +++ b/src/core/etl/src/Flow/ETL/Operators/Transformer/DuplicateRowTransformer.php @@ -22,7 +22,7 @@ use Flow\Types\Type\Unifier\PromotingUnifier; use SensitiveParameter; -use function array_key_last; +use function array_last; use function Flow\Types\DSL\type_equals; use function Flow\Types\DSL\type_instance_of; @@ -71,7 +71,7 @@ public function transform(Rows $rows, Backend $backend): Rows $output = $this->output ?? $this->declare($rows->schema(), $steps); $duplicated = []; - foreach ((new Parameter($condition))->asBooleans($rows, $backend) as $position => $duplicate) { + foreach (new Parameter($condition)->asBooleans($rows, $backend) as $position => $duplicate) { if ($duplicate ?? false) { $duplicated[] = $position; } @@ -119,7 +119,7 @@ private function steps(Schema $input): array $schema = $input; foreach ($this->columns as $column) { - (new ExpandingFunctions())->refuse($column->function, 'duplicateRow'); + new ExpandingFunctions()->refuse($column->function, 'duplicateRow'); $step = $column->bind($schema); $steps[] = $step; $schema = $step->output; @@ -135,7 +135,7 @@ private function steps(Schema $input): array */ private function declare(Schema $input, array $steps): Schema { - $duplicated = $steps === [] ? $input : $steps[array_key_last($steps)]->output; + $duplicated = $steps === [] ? $input : array_last($steps)->output; $output = $input; foreach ($duplicated->definitions() as $name => $definition) { @@ -155,7 +155,7 @@ private function declare(Schema $input, array $steps): Schema $output = $output->replace($name, Definitions::of( $name, - (new PromotingUnifier())->unifyAll( + new PromotingUnifier()->unifyAll( NullabilityRule::ALL, $existing->type(), $definition->type(), @@ -172,6 +172,6 @@ private function resolve(Schema $input): mixed return $this->condition; } - return (new ReferenceResolver())->bind($this->condition, $input, 'duplicateRow'); + return new ReferenceResolver()->bind($this->condition, $input, 'duplicateRow'); } } diff --git a/src/core/etl/src/Flow/ETL/Operators/Transformer/Expansion.php b/src/core/etl/src/Flow/ETL/Operators/Transformer/Expansion.php index 0ebc9a5da9..63a5a54d1b 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Transformer/Expansion.php +++ b/src/core/etl/src/Flow/ETL/Operators/Transformer/Expansion.php @@ -49,7 +49,7 @@ public static function of(ScalarFunction $resolved, Schema $input): ?self { $distinct = []; - foreach ((new ExpandingFunctions())->in($resolved) as $expand) { + foreach (new ExpandingFunctions()->in($resolved) as $expand) { $distinct[spl_object_id($expand)] = $expand; } @@ -69,7 +69,7 @@ public static function of(ScalarFunction $resolved, Schema $input): ?self $name = "\0expand:" . $suffix++; } while ($input->findDefinition($name) !== null); - $type = $pads ? (new TypeWidener())->nullable($expand->returns()) : $expand->returns(); + $type = $pads ? new TypeWidener()->nullable($expand->returns()) : $expand->returns(); $references[$id] = new ResolvedReference($name, $type); $expandDefinitions[$name] = Definitions::of( $name, @@ -114,7 +114,7 @@ public function positions(Rows $rows, Backend $backend): array $lists = []; foreach ($this->expands as $name => $expand) { - $lists[$name] = (new Parameter($expand))->values($rows, $backend); + $lists[$name] = new Parameter($expand)->values($rows, $backend); } $sources = []; diff --git a/src/core/etl/src/Flow/ETL/Operators/Transformer/JoinEachRowsTransformer.php b/src/core/etl/src/Flow/ETL/Operators/Transformer/JoinEachRowsTransformer.php index e5f7b83fd7..48d5999f88 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Transformer/JoinEachRowsTransformer.php +++ b/src/core/etl/src/Flow/ETL/Operators/Transformer/JoinEachRowsTransformer.php @@ -103,7 +103,7 @@ public function transform(Rows $rows, Backend $backend): Rows $schema->output($rows->schema(), $rightRows->schema()), $backend, ...iterator_to_array( - (new Joiner($this->type, $schema, $this->expression->keys(), $this->expression, $backend))->join( + new Joiner($this->type, $schema, $this->expression->keys(), $this->expression, $backend)->join( JoinSide::of($single($rows), $rows->schema()), JoinSide::of($single($rightRows), $rightRows->schema()), ), diff --git a/src/core/etl/src/Flow/ETL/Operators/Transformer/ScalarFunctionTransformer.php b/src/core/etl/src/Flow/ETL/Operators/Transformer/ScalarFunctionTransformer.php index b90a09c807..72a834c818 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Transformer/ScalarFunctionTransformer.php +++ b/src/core/etl/src/Flow/ETL/Operators/Transformer/ScalarFunctionTransformer.php @@ -120,7 +120,7 @@ private function derived(ScalarFunction $source): Definition */ private function resolve(Schema $input): ScalarFunction { - return (new ReferenceResolver())->bind($this->function, $input, 'transform'); + return new ReferenceResolver()->bind($this->function, $input, 'transform'); } public function columnName(): string diff --git a/src/core/etl/src/Flow/ETL/Operators/Transformer/UnserializeTransformer.php b/src/core/etl/src/Flow/ETL/Operators/Transformer/UnserializeTransformer.php index 2c74488b6c..d41b0d7af8 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Transformer/UnserializeTransformer.php +++ b/src/core/etl/src/Flow/ETL/Operators/Transformer/UnserializeTransformer.php @@ -33,7 +33,7 @@ public function __construct( public function bind(Schema $input): BoundStep { - return new BoundStep($this, (new UnpackedColumns())->of($input, $this->mergePrefix, $this->target)); + return new BoundStep($this, new UnpackedColumns()->of($input, $this->mergePrefix, $this->target)); } public static function fromDescription(#[SensitiveParameter] array $data, Rebuild $rebuild): static diff --git a/src/core/etl/src/Flow/ETL/Operators/Transformer/UntilTransformer.php b/src/core/etl/src/Flow/ETL/Operators/Transformer/UntilTransformer.php index 8faadc7e1a..b53079a176 100644 --- a/src/core/etl/src/Flow/ETL/Operators/Transformer/UntilTransformer.php +++ b/src/core/etl/src/Flow/ETL/Operators/Transformer/UntilTransformer.php @@ -79,6 +79,6 @@ public function reached(): bool */ private function resolve(Schema $input): ScalarFunction { - return (new ReferenceResolver())->bind($this->function, $input, 'until', type_boolean()); + return new ReferenceResolver()->bind($this->function, $input, 'until', type_boolean()); } } diff --git a/src/core/etl/src/Flow/ETL/Planning/Logical/Explain.php b/src/core/etl/src/Flow/ETL/Planning/Logical/Explain.php index 5beb3a9a4f..71c1bfc73d 100644 --- a/src/core/etl/src/Flow/ETL/Planning/Logical/Explain.php +++ b/src/core/etl/src/Flow/ETL/Planning/Logical/Explain.php @@ -17,7 +17,7 @@ public function of(LogicalPlan $plan, Format $format = Format::tree): string { return $this->render( - (new LogicalOutline(declarations: $format === Format::declarations))->of($plan->root), + new LogicalOutline(declarations: $format === Format::declarations)->of($plan->root), $format, ); } @@ -27,7 +27,7 @@ public function of(LogicalPlan $plan, Format $format = Format::tree): string */ public function physical(PhysicalPlan $plan, Format $format = Format::tree): string { - return $this->render((new PhysicalOutline())->of($plan), $format); + return $this->render(new PhysicalOutline()->of($plan), $format); } public function render(RenderedNode $root, Format $format): string diff --git a/src/core/etl/src/Flow/ETL/Planning/Logical/LogicalPlan.php b/src/core/etl/src/Flow/ETL/Planning/Logical/LogicalPlan.php index f910b332ff..82bd27c8b4 100644 --- a/src/core/etl/src/Flow/ETL/Planning/Logical/LogicalPlan.php +++ b/src/core/etl/src/Flow/ETL/Planning/Logical/LogicalPlan.php @@ -145,7 +145,7 @@ public function consumerInputs(): array */ public function transformUp(Rewrite $rewrite): self { - $root = (new TransformUp())->of($this->root, $rewrite); + $root = new TransformUp()->of($this->root, $rewrite); return $root === $this->root ? $this : new self($root); } diff --git a/src/core/etl/src/Flow/ETL/Planning/Logical/Node/Filter.php b/src/core/etl/src/Flow/ETL/Planning/Logical/Node/Filter.php index b51718f8c0..8cbcc5baea 100644 --- a/src/core/etl/src/Flow/ETL/Planning/Logical/Node/Filter.php +++ b/src/core/etl/src/Flow/ETL/Planning/Logical/Node/Filter.php @@ -49,6 +49,6 @@ public function redefines(): Redefined public function requiredInputColumns(RequiredColumns $output): RequiredColumns { - return $output->with(...(new ReferencedColumns())->in($this->function)->names()); + return $output->with(...new ReferencedColumns()->in($this->function)->names()); } } diff --git a/src/core/etl/src/Flow/ETL/Planning/Logical/Plan.php b/src/core/etl/src/Flow/ETL/Planning/Logical/Plan.php index b006e3066a..f720b2ed15 100644 --- a/src/core/etl/src/Flow/ETL/Planning/Logical/Plan.php +++ b/src/core/etl/src/Flow/ETL/Planning/Logical/Plan.php @@ -28,10 +28,10 @@ public static function of(LogicalPlan $logical, Planner $planner): self public function toString(Stage $stage = Stage::optimized, Format $format = Format::tree): string { if ($stage === Stage::physical) { - return (new Explain())->physical($this->planner->plan($this->logical), $format); + return new Explain()->physical($this->planner->plan($this->logical), $format); } - return (new Explain())->of(match ($stage) { + return new Explain()->of(match ($stage) { Stage::unoptimized => $this->logical, Stage::optimized => $this->planner->optimize($this->logical), }, $format); diff --git a/src/core/etl/src/Flow/ETL/Planning/Optimizer/Rule/PushFilterIntoSource.php b/src/core/etl/src/Flow/ETL/Planning/Optimizer/Rule/PushFilterIntoSource.php index 34f72eaf26..de775b8e57 100644 --- a/src/core/etl/src/Flow/ETL/Planning/Optimizer/Rule/PushFilterIntoSource.php +++ b/src/core/etl/src/Flow/ETL/Planning/Optimizer/Rule/PushFilterIntoSource.php @@ -143,7 +143,7 @@ public function predicateAtLeaf(Node\Filter $filter, Read $leaf, ScalarFunction } $below = $redefined->aliasOf($name); - $renamed = $below === null ? null : (new ReferenceRename($name, $below))->in($predicate); + $renamed = $below === null ? null : new ReferenceRename($name, $below)->in($predicate); if (!$renamed instanceof ScalarFunction) { return null; diff --git a/src/core/etl/src/Flow/ETL/Planning/Physical/WritePlanner.php b/src/core/etl/src/Flow/ETL/Planning/Physical/WritePlanner.php index abbcbb6736..71a741585e 100644 --- a/src/core/etl/src/Flow/ETL/Planning/Physical/WritePlanner.php +++ b/src/core/etl/src/Flow/ETL/Planning/Physical/WritePlanner.php @@ -14,7 +14,7 @@ use SplObjectStorage; use function array_key_exists; -use function array_key_last; +use function array_last; use function array_reverse; use function array_slice; use function count; @@ -54,7 +54,7 @@ public function attach(Writes $writes, SplObjectStorage $onSpine): SplObjectStor foreach ($root instanceof Transaction ? $root->children() : [$root] as $write) { $chain = $this->chain($write, $onSpine); - $bottom = $chain[array_key_last($chain)]->children()[0]; + $bottom = array_last($chain)->children()[0]; if ($at !== null && $bottom !== $at) { throw InvalidLogicException::because('Every write of one transaction must attach to the same node'); @@ -262,7 +262,7 @@ public function write(array $group, Node $host): Loader|BranchPipeline $rest[] = [...$leaf, 'path' => array_slice($leaf['path'], count($shared))]; } - return $this->branch($shared, $this->writes($rest, $shared[array_key_last($shared)]), $host); + return $this->branch($shared, $this->writes($rest, array_last($shared)), $host); } /** diff --git a/src/core/etl/src/Flow/ETL/Runtime/Executor/Executor.php b/src/core/etl/src/Flow/ETL/Runtime/Executor/Executor.php index 869ac29cf1..5aff19e5fe 100644 --- a/src/core/etl/src/Flow/ETL/Runtime/Executor/Executor.php +++ b/src/core/etl/src/Flow/ETL/Runtime/Executor/Executor.php @@ -216,7 +216,7 @@ private function run( $started = false; // the root of the source's `yield from` chain: a throw() into a delegate inside the chain is lost $batches = $runner->started( - $launch->rows ?? (new AdoptedBatches($context->backend()))->of($source->extract( + $launch->rows ?? new AdoptedBatches($context->backend())->of($source->extract( $context->backend(), $criteria, )), diff --git a/src/core/etl/src/Flow/ETL/Runtime/Executor/StepRunner.php b/src/core/etl/src/Flow/ETL/Runtime/Executor/StepRunner.php index 63cbba2185..0d2af70f9f 100644 --- a/src/core/etl/src/Flow/ETL/Runtime/Executor/StepRunner.php +++ b/src/core/etl/src/Flow/ETL/Runtime/Executor/StepRunner.php @@ -339,7 +339,7 @@ private function loadRejects(Loader $rejects, array $records, FlowContext $conte { $this->load( $rejects, - (new RowsBuilder( + new RowsBuilder( new Schema( new StringDefinition('uri', nullable: true), new IntegerDefinition('offset'), @@ -349,7 +349,7 @@ private function loadRejects(Loader $rejects, array $records, FlowContext $conte new ListDefinition('fields', type_list(type_string()), nullable: true), ), $context->backend(), - )) + ) ->appendRecords($records) ->finish(), $context, @@ -515,9 +515,9 @@ public function unwind(Generator $input, Throwable $failure, FlowContext $contex } if ($input->valid()) { - $function = (new ReflectionGenerator( - (new ReflectionGenerator($input))->getExecutingGenerator(), - ))->getFunction(); + $function = new ReflectionGenerator( + new ReflectionGenerator($input)->getExecutingGenerator(), + )->getFunction(); $context ->telemetry() ->logger() diff --git a/src/core/etl/src/Flow/ETL/Runtime/Executor/TransactionLoader.php b/src/core/etl/src/Flow/ETL/Runtime/Executor/TransactionLoader.php index fe03ff8e8c..aaa316daa8 100644 --- a/src/core/etl/src/Flow/ETL/Runtime/Executor/TransactionLoader.php +++ b/src/core/etl/src/Flow/ETL/Runtime/Executor/TransactionLoader.php @@ -52,7 +52,7 @@ public function load(Rows $rows): LoadingError|TransformationError|null $this->writes->offsetGet($child)->advanced($rows->count()); } - (new StepTelemetry())->load($child, $rows, $this->context); + new StepTelemetry()->load($child, $rows, $this->context); } else { $error = $child->load($rows); } diff --git a/src/core/etl/src/Flow/ETL/Runtime/Executor/WholeOutputHasher.php b/src/core/etl/src/Flow/ETL/Runtime/Executor/WholeOutputHasher.php index c7ef549d12..ae4f3ce224 100644 --- a/src/core/etl/src/Flow/ETL/Runtime/Executor/WholeOutputHasher.php +++ b/src/core/etl/src/Flow/ETL/Runtime/Executor/WholeOutputHasher.php @@ -60,13 +60,13 @@ public function absorb(DatasetHash $partial): void public function hash(): DatasetHash { - return (new DatasetHash( + return new DatasetHash( new Hash( $this->rows, type_string()->assert($this->hasher?->hashes()->physicals()[0] ?? MultisetDigest::empty()->hex()), ), [], $this->algorithm, - ))->plus($this->absorbed); + )->plus($this->absorbed); } } diff --git a/src/core/etl/src/Flow/ETL/Runtime/Metrics/Statistics/Column.php b/src/core/etl/src/Flow/ETL/Runtime/Metrics/Statistics/Column.php index 05933478bd..d75f0b2eb3 100644 --- a/src/core/etl/src/Flow/ETL/Runtime/Metrics/Statistics/Column.php +++ b/src/core/etl/src/Flow/ETL/Runtime/Metrics/Statistics/Column.php @@ -96,7 +96,7 @@ public function add(Definition $definition, ColumnData $column): void }; // every non-null value of the batch, typed: -0.0 is 0.0, NaN is NaN, datetimes keep their microseconds - $keys = (new KeyEncoder([$definition->name()]))->of(Rows::fromColumns( + $keys = new KeyEncoder([$definition->name()])->of(Rows::fromColumns( new Schema($definition), [$definition->name() => $column], $column->count(), diff --git a/src/core/etl/src/Flow/ETL/Storage/Floe/FloeFiles.php b/src/core/etl/src/Flow/ETL/Storage/Floe/FloeFiles.php index a8f21d0470..ec943e0cb0 100644 --- a/src/core/etl/src/Flow/ETL/Storage/Floe/FloeFiles.php +++ b/src/core/etl/src/Flow/ETL/Storage/Floe/FloeFiles.php @@ -53,7 +53,7 @@ public function append(Path $path, Schema $schema, ?Metadata $metadata = null): return $this->create($path, $schema, $metadata); } - $location = (new FooterReader())->read($source, $this->options->codec); + $location = new FooterReader()->read($source, $this->options->codec); $source->close(); return FloeStreamWriter::resume( diff --git a/src/core/etl/src/Flow/ETL/Storage/Floe/FloeMerger.php b/src/core/etl/src/Flow/ETL/Storage/Floe/FloeMerger.php index dbf3d8f9fa..ffc0e72734 100644 --- a/src/core/etl/src/Flow/ETL/Storage/Floe/FloeMerger.php +++ b/src/core/etl/src/Flow/ETL/Storage/Floe/FloeMerger.php @@ -107,7 +107,7 @@ private function reconcile(array $sources): array } if ($merged !== null) { - $validation = (new EvolvingValidator())->validate($merged, $schema); + $validation = new EvolvingValidator()->validate($merged, $schema); if (!$validation->isValid()) { throw new IncompatibleSchemaException(sprintf( @@ -211,14 +211,14 @@ private function mergeSplice(array $sources, array $layouts, ?Schema $merged, Pa $schema = $merged?->normalize() ?? []; $frameWriter->footer( - (new Footer( + new Footer( Format::VERSION, FloeStreamWriter::writerVersion(), $schema, $sections, new FooterStatistics($totalRows, $frameWriter->position() - Format::HEADER_LENGTH), $mergedMetadata->merge($metadata), - ))->toJson(), + )->toJson(), ); $frameWriter->close(); } @@ -235,7 +235,7 @@ private function readLayout(Path $source): FooterLocation $stream = $this->filesystem->readFrom($source); try { - return (new FooterReader())->read($stream, $this->codec); + return new FooterReader()->read($stream, $this->codec); } finally { $stream->close(); } diff --git a/src/core/etl/src/Flow/ETL/Storage/Floe/FloeStreamReader.php b/src/core/etl/src/Flow/ETL/Storage/Floe/FloeStreamReader.php index 6f45ff3bc8..e366aadbd3 100644 --- a/src/core/etl/src/Flow/ETL/Storage/Floe/FloeStreamReader.php +++ b/src/core/etl/src/Flow/ETL/Storage/Floe/FloeStreamReader.php @@ -51,7 +51,7 @@ public function close(): void */ public function footer(): Footer { - return $this->footer ??= (new FooterReader())->read($this->source, $this->codec)->footer; + return $this->footer ??= new FooterReader()->read($this->source, $this->codec)->footer; } /** diff --git a/src/core/etl/src/Flow/ETL/Storage/Floe/FloeStreamWriter.php b/src/core/etl/src/Flow/ETL/Storage/Floe/FloeStreamWriter.php index bf09e8933e..a27cc5410b 100644 --- a/src/core/etl/src/Flow/ETL/Storage/Floe/FloeStreamWriter.php +++ b/src/core/etl/src/Flow/ETL/Storage/Floe/FloeStreamWriter.php @@ -143,14 +143,14 @@ public function close(): void $schema = $this->sessionSchema->normalize(); $this->frameWriter->footer( - (new Footer( + new Footer( Format::VERSION, self::writerVersion(), $schema, $this->sections, new FooterStatistics($this->totalRows, $this->frameWriter->position() - Format::HEADER_LENGTH), $this->metadata, - ))->toJson(), + )->toJson(), ); $this->frameWriter->close(); $this->closed = true; @@ -208,7 +208,7 @@ private function assertBatchFitsSession(Schema $batch): void } } - $validation = (new EvolvingValidator())->validate($this->sessionSchema, $batch); + $validation = new EvolvingValidator()->validate($this->sessionSchema, $batch); if (!$validation->isValid()) { throw new IncompatibleSchemaException(sprintf(self::BATCH_MISMATCH, $validation->toString())); diff --git a/src/core/etl/src/Flow/ETL/Values/Column/CanonicalEncoding.php b/src/core/etl/src/Flow/ETL/Values/Column/CanonicalEncoding.php index ab84f36801..8fbd1aa656 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/CanonicalEncoding.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/CanonicalEncoding.php @@ -300,13 +300,10 @@ private function writer(Type $type): Closure $base instanceof EnumType => $this->text(self::ENUM), $base instanceof XMLType => $this->text(self::XML), $base instanceof HTMLType => $this->text(self::HTML), - $base instanceof XMLElementType => $this->element( - self::XML_ELEMENT, - (new XmlElementPhysical())->markup(...), - ), + $base instanceof XMLElementType => $this->element(self::XML_ELEMENT, new XmlElementPhysical()->markup(...)), $base instanceof HTMLElementType => $this->element( self::HTML_ELEMENT, - (new HtmlElementPhysical())->markup(...), + new HtmlElementPhysical()->markup(...), ), $base instanceof TimeZoneType => $this->text(self::TIMEZONE), $base instanceof UuidType => static fn(string $physical): string => self::UUID . $physical, diff --git a/src/core/etl/src/Flow/ETL/Values/Column/ComparableValues.php b/src/core/etl/src/Flow/ETL/Values/Column/ComparableValues.php index 987e71af05..e5259adb13 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/ComparableValues.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/ComparableValues.php @@ -112,7 +112,7 @@ public function equalities(Type $type, array $physicals): array } return $element instanceof HTMLElementType || $element instanceof XMLElementType - ? (new TextValues())->of($type, $physicals) + ? new TextValues()->of($type, $physicals) : $physicals; } diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Layout/BufferLayout.php b/src/core/etl/src/Flow/ETL/Values/Column/Layout/BufferLayout.php index 4dbe26eaf8..d969c4cb8b 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Layout/BufferLayout.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Layout/BufferLayout.php @@ -82,7 +82,7 @@ public function bufferCount(Type $type): int return $buffers; } - return (new PhysicalFor())->layout($type) instanceof Utf8Layout ? 3 : 2; + return new PhysicalFor()->layout($type) instanceof Utf8Layout ? 3 : 2; } /** @@ -158,7 +158,7 @@ public function nodes(Type $type, int $length, int $nullCount, array $buffers): $childLength, ($childType instanceof OptionalType ? $childType->base() : $childType) instanceof NullType ? $childLength - : (new Validity())->nullCount($childBuffers[0], $childLength), + : new Validity()->nullCount($childBuffers[0], $childLength), $childBuffers, )); } diff --git a/src/core/etl/src/Flow/ETL/Values/Column/MultisetDigest.php b/src/core/etl/src/Flow/ETL/Values/Column/MultisetDigest.php index 0cccf8dce1..385e19ba37 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/MultisetDigest.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/MultisetDigest.php @@ -46,7 +46,7 @@ public static function fromHex(string $hex): self */ public static function ofHalfSums(int $lowLow, int $lowHigh, int $highLow, int $highHigh): self { - return (new self($lowLow, $highLow))->plus(new self($lowHigh << 32, $highHigh << 32)); + return new self($lowLow, $highLow)->plus(new self($lowHigh << 32, $highHigh << 32)); } public function plus(self $other): self diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Php/ColumnDecoder.php b/src/core/etl/src/Flow/ETL/Values/Column/Php/ColumnDecoder.php index 824aa7e26e..963dafeb7c 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Php/ColumnDecoder.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Php/ColumnDecoder.php @@ -80,7 +80,7 @@ public function decode(Type $type, Buffers $buffers, int $count, int $nullCount) } if ($base instanceof ListType) { - $offsets = (new Offsets())->unpack($own->next(), $count, 'List'); + $offsets = new Offsets()->unpack($own->next(), $count, 'List'); $element = $base->element(); [$length, $nulls] = $nodes[1]; @@ -101,7 +101,7 @@ public function decode(Type $type, Buffers $buffers, int $count, int $nullCount) } if ($base instanceof MapType) { - $offsets = (new Offsets())->unpack($own->next(), $count, 'Map'); + $offsets = new Offsets()->unpack($own->next(), $count, 'Map'); $own->next(); $key = $base->key(); $value = $base->value(); @@ -148,8 +148,8 @@ public function decode(Type $type, Buffers $buffers, int $count, int $nullCount) return new ScalarColumn( $type, - (new PhysicalFor())->physical($type), - (new PhysicalFor()) + new PhysicalFor()->physical($type), + new PhysicalFor() ->layout($type) ->decode($own, $count, $valid), $derived, diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Php/ConstantColumn.php b/src/core/etl/src/Flow/ETL/Values/Column/Php/ConstantColumn.php index e36948cc6b..4aaffb0701 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Php/ConstantColumn.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Php/ConstantColumn.php @@ -66,7 +66,7 @@ public function expand(): Column return $this; } - $builder = (new PhysicalFor())->builder($this->type); + $builder = new PhysicalFor()->builder($this->type); $builder->appendPhysicals($this->physicals()); return $builder->finish(); @@ -121,8 +121,8 @@ public function values(): array public function withType(Type $type): Column { - (new Retype())->assert($this->type, $type, $this->nullCount()); + new Retype()->assert($this->type, $type, $this->nullCount()); - return new self($type, (new PhysicalFor())->physical($type), $this->physicalValue, $this->count); + return new self($type, new PhysicalFor()->physical($type), $this->physicalValue, $this->count); } } diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Php/ListColumn.php b/src/core/etl/src/Flow/ETL/Values/Column/Php/ListColumn.php index 8884f4419e..3aa131ca44 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Php/ListColumn.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Php/ListColumn.php @@ -80,8 +80,8 @@ public function count(): int public function encode(): array { return [ - (new Validity())->fromNulls($this->nulls, $this->count()), - (new Offsets())->pack($this->offsets), + new Validity()->fromNulls($this->nulls, $this->count()), + new Offsets()->pack($this->offsets), ...$this->element->encode(), ]; } @@ -166,7 +166,7 @@ public function values(): array public function withType(Type $type): Column { - (new Retype())->assert($this->type, $type, count($this->nulls)); + new Retype()->assert($this->type, $type, count($this->nulls)); $list = $type instanceof OptionalType ? $type->base() : $type; assert($list instanceof ListType); diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Php/MapColumn.php b/src/core/etl/src/Flow/ETL/Values/Column/Php/MapColumn.php index e9e96d7131..f97cac6902 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Php/MapColumn.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Php/MapColumn.php @@ -95,8 +95,8 @@ public function count(): int public function encode(): array { return [ - (new Validity())->fromNulls($this->nulls, $this->count()), - (new Offsets())->pack($this->offsets), + new Validity()->fromNulls($this->nulls, $this->count()), + new Offsets()->pack($this->offsets), '', ...$this->keys->encode(), ...$this->values->encode(), @@ -212,7 +212,7 @@ public function values(): array public function withType(Type $type): Column { - (new Retype())->assert($this->type, $type, count($this->nulls)); + new Retype()->assert($this->type, $type, count($this->nulls)); $map = $type instanceof OptionalType ? $type->base() : $type; assert($map instanceof MapType); diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Php/PhpGroupedCounts.php b/src/core/etl/src/Flow/ETL/Values/Column/Php/PhpGroupedCounts.php index ff943f7849..24c854dca6 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Php/PhpGroupedCounts.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Php/PhpGroupedCounts.php @@ -48,7 +48,7 @@ public function add(Column $values, Column $ids): void public function counts(): Column { - return new ScalarColumn(type_integer(), (new PhysicalFor())->physical(type_integer()), $this->counts, 0); + return new ScalarColumn(type_integer(), new PhysicalFor()->physical(type_integer()), $this->counts, 0); } public function partials(): array diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Php/PhpGroupedMultisetHashes.php b/src/core/etl/src/Flow/ETL/Values/Column/Php/PhpGroupedMultisetHashes.php index 28dbbd689d..e8e9de71a1 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Php/PhpGroupedMultisetHashes.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Php/PhpGroupedMultisetHashes.php @@ -75,7 +75,7 @@ public function hashes(): Column { return new ScalarColumn( type_string(), - (new PhysicalFor())->physical(type_string()), + new PhysicalFor()->physical(type_string()), array_map(static fn(MultisetDigest $digest): string => $digest->hex(), $this->digests), 0, ); diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Php/PhpGroupedTotals.php b/src/core/etl/src/Flow/ETL/Values/Column/Php/PhpGroupedTotals.php index 64aa35daa4..8f98378868 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Php/PhpGroupedTotals.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Php/PhpGroupedTotals.php @@ -57,7 +57,7 @@ public function sums(): Column $sums[] = is_float($sum) && is_finite($sum) ? $sum + $this->compensations[$id] : (float) $sum; } - return new ScalarColumn(type_float(), (new PhysicalFor())->physical(type_float()), $sums, $nulls); + return new ScalarColumn(type_float(), new PhysicalFor()->physical(type_float()), $sums, $nulls); } public function absorbEarlier(GroupedTotals $earlier, array $into): void diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Php/ScalarColumn.php b/src/core/etl/src/Flow/ETL/Values/Column/Php/ScalarColumn.php index 972159c98f..b96366cc8d 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Php/ScalarColumn.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Php/ScalarColumn.php @@ -61,8 +61,8 @@ public function count(): int public function encode(): array { return [ - (new Validity())->fromValues($this->values), - ...(new PhysicalFor()) + new Validity()->fromValues($this->values), + ...new PhysicalFor() ->layout($this->type) ->encode($this->values), ]; @@ -91,7 +91,7 @@ public function slice(int $offset, int $length): Column $this->type, $this->physical, $values, - $this->nullCount === 0 ? 0 : (new NullCount())->of($values), + $this->nullCount === 0 ? 0 : new NullCount()->of($values), ); } @@ -107,7 +107,7 @@ public function take(array $indices): Column $this->type, $this->physical, $values, - $this->nullCount === 0 ? 0 : (new NullCount())->of($values), + $this->nullCount === 0 ? 0 : new NullCount()->of($values), ); } @@ -128,8 +128,8 @@ public function values(): array public function withType(Type $type): Column { - (new Retype())->assert($this->type, $type, $this->nullCount); + new Retype()->assert($this->type, $type, $this->nullCount); - return new self($type, (new PhysicalFor())->physical($type), $this->values, $this->nullCount); + return new self($type, new PhysicalFor()->physical($type), $this->values, $this->nullCount); } } diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Php/StructColumn.php b/src/core/etl/src/Flow/ETL/Values/Column/Php/StructColumn.php index c39717e0c5..ffec0bef5a 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Php/StructColumn.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Php/StructColumn.php @@ -12,8 +12,8 @@ use Flow\Types\Type\Logical\OptionalType; use Flow\Types\Type\Logical\StructureType; +use function array_first; use function array_key_exists; -use function array_key_first; use function assert; use function count; use function range; @@ -90,12 +90,12 @@ public function concat(Column ...$others): Column public function count(): int { - return $this->children[array_key_first($this->children)]->count(); + return array_first($this->children)->count(); } public function encode(): array { - $buffers = [(new Validity())->fromNulls($this->nulls, $this->count())]; + $buffers = [new Validity()->fromNulls($this->nulls, $this->count())]; foreach ($this->children as $child) { foreach ($child->encode() as $buffer) { @@ -255,7 +255,7 @@ public function values(): array public function withType(Type $type): Column { - (new Retype())->assert($this->type, $type, count($this->nulls)); + new Retype()->assert($this->type, $type, count($this->nulls)); $structure = $type instanceof OptionalType ? $type->base() : $type; assert($structure instanceof StructureType); diff --git a/src/core/etl/src/Flow/ETL/Values/Column/PhpBackend.php b/src/core/etl/src/Flow/ETL/Values/Column/PhpBackend.php index c020f4067f..ac85b87167 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/PhpBackend.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/PhpBackend.php @@ -96,14 +96,14 @@ public function builder(Definition $definition): ColumnBuilder { return new CastingColumnBuilder( $definition, - (new PhysicalFor())->definition($definition), - (new PhysicalFor())->builder($definition->type()), + new PhysicalFor()->definition($definition), + new PhysicalFor()->builder($definition->type()), ); } public function constant(Definition $definition, mixed $value, int $count): Column { - $physical = (new PhysicalFor())->definition($definition); + $physical = new PhysicalFor()->definition($definition); if ($value === null) { if (!$definition->isNullable() && !$definition instanceof NullDefinition) { @@ -128,7 +128,7 @@ public function constant(Definition $definition, mixed $value, int $count): Colu public function decode(Definition $definition, array $buffers, int $count, int $nullCount): Column { $cursor = new Buffers($buffers); - $column = (new ColumnDecoder())->decode($definition->type(), $cursor, $count, $nullCount); + $column = new ColumnDecoder()->decode($definition->type(), $cursor, $count, $nullCount); if ($cursor->remaining() !== 0) { throw new InvalidArgumentException(sprintf( @@ -370,8 +370,8 @@ public function compare( $order = new ValueOrder($left->type(), $right->type()); $comparable = new ComparableValues(); $results = match ($operator) { - Operator::EQUAL, Operator::NOT_EQUAL => (new ValueEquality())->equal($left, $right, $leftName, $rightName), - Operator::IDENTICAL, Operator::NOT_IDENTICAL => (new ValueEquality())->identical($left, $right), + Operator::EQUAL, Operator::NOT_EQUAL => new ValueEquality()->equal($left, $right, $leftName, $rightName), + Operator::IDENTICAL, Operator::NOT_IDENTICAL => new ValueEquality()->identical($left, $right), Operator::GREATER_THAN => $order->lessThan(...$comparable->orderings($right, $left)), Operator::GREATER_THAN_EQUAL => $order->lessThanOrEqual(...$comparable->orderings($right, $left)), Operator::LESS_THAN => $order->lessThan(...$comparable->orderings($left, $right)), @@ -391,7 +391,7 @@ public function compare( return new ScalarColumn( $definition->type(), - (new PhysicalFor())->definition($definition), + new PhysicalFor()->definition($definition), $results, count(array_keys($results, null, true)), ); @@ -537,7 +537,7 @@ public function modulo(Column $left, Column $right): Column $definition = Definitions::of('value', type_integer()); - return new ScalarColumn($definition->type(), (new PhysicalFor())->definition($definition), $results, 0); + return new ScalarColumn($definition->type(), new PhysicalFor()->definition($definition), $results, 0); } public function startsWith(Column $haystack, Column $needle): Column @@ -645,7 +645,7 @@ public function orderedBytes(Column $column): int return ($perRow * $column->count()) + match (true) { - (new ComparableValues())->equalByPhysical($column->type()) => 0, + new ComparableValues()->equalByPhysical($column->type()) => 0, // values() builds a PHP array per row: packed (8 slots at least) for a list, hashed for a map or a structure $column instanceof ListColumn => (192 * $column->count()) + (32 * $column->element->count()) @@ -675,10 +675,10 @@ public function rowHashes(array $columns, int $count): Column { return new ScalarColumn( type_string(), - (new PhysicalFor())->physical(type_string()), + new PhysicalFor()->physical(type_string()), array_map( static fn(string $bytes): string => hash(HashAlgorithm::xxh128->value, $bytes), - (new CanonicalEncoding())->named($columns, $count), + new CanonicalEncoding()->named($columns, $count), ), 0, ); @@ -690,7 +690,7 @@ public function hash(Column $strings, HashAlgorithm $algorithm): Column return new ScalarColumn( $definition->type(), - (new PhysicalFor())->definition($definition), + new PhysicalFor()->definition($definition), array_map(static fn(?string $text): ?string => $text === null ? null : hash($algorithm->value, $text), $strings->physicals()), @@ -800,7 +800,7 @@ private function arithmeticResult(Column $left, Column $right, array $results): : type_float(), ); - return new ScalarColumn($definition->type(), (new PhysicalFor())->definition($definition), $results, 0); + return new ScalarColumn($definition->type(), new PhysicalFor()->definition($definition), $results, 0); } /** @@ -812,7 +812,7 @@ private function booleans(array $results): Column return new ScalarColumn( $definition->type(), - (new PhysicalFor())->definition($definition), + new PhysicalFor()->definition($definition), $results, count(array_keys($results, null, true)), ); @@ -833,6 +833,6 @@ private function nullTest(Column $column, bool $isNull): Column $definition = Definitions::of('value', type_boolean()); - return new ScalarColumn($definition->type(), (new PhysicalFor())->definition($definition), $results, 0); + return new ScalarColumn($definition->type(), new PhysicalFor()->definition($definition), $results, 0); } } diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Physical/DatePhysical.php b/src/core/etl/src/Flow/ETL/Values/Column/Physical/DatePhysical.php index 1590bb50ff..8219ceb4ad 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Physical/DatePhysical.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Physical/DatePhysical.php @@ -42,7 +42,7 @@ public function fromPhysical(mixed $physical): mixed { assert(is_int($physical)); - return (new DateTimeImmutable('@' . ($physical * 86_400)))->setTimezone($this->utc); + return new DateTimeImmutable('@' . ($physical * 86_400))->setTimezone($this->utc); } public function fromPhysicalAll(array $physicals): array @@ -58,7 +58,7 @@ public function fromPhysicalAll(array $physicals): array } assert(is_int($physical)); - $values[] = (new DateTimeImmutable('@' . ($physical * 86_400)))->setTimezone($this->utc); + $values[] = new DateTimeImmutable('@' . ($physical * 86_400))->setTimezone($this->utc); } return $values; diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Physical/DateTimePhysical.php b/src/core/etl/src/Flow/ETL/Values/Column/Physical/DateTimePhysical.php index 4fc2db678e..ed9efea73e 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Physical/DateTimePhysical.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Physical/DateTimePhysical.php @@ -9,14 +9,10 @@ use DateTimeZone; use Flow\Types\Exception\CastingException; -use function abs; use function assert; use function Flow\Types\DSL\type_datetime; use function intdiv; use function is_int; -use function sprintf; - -use const PHP_VERSION_ID; final readonly class DateTimePhysical implements Physical { @@ -47,34 +43,20 @@ public function fromPhysical(mixed $physical): mixed { assert(is_int($physical)); - if (PHP_VERSION_ID >= 80400) { - $seconds = intdiv($physical, 1_000_000); - $micros = $physical % 1_000_000; - - if ($micros < 0) { - $micros += 1_000_000; - $seconds--; - } - - // @mago-ignore analysis:unavailable-method - $instant = DateTimeImmutable::createFromTimestamp($seconds); + $seconds = intdiv($physical, 1_000_000); + $micros = $physical % 1_000_000; - // @mago-ignore analysis:unavailable-method - return $instant->setMicrosecond($micros)->setTimezone($this->zone); + if ($micros < 0) { + $micros += 1_000_000; + $seconds--; } - return (new DateTimeImmutable(sprintf( - '@%s%d.%06d', - $physical < 0 ? '-' : '', - intdiv(abs($physical), 1_000_000), - abs($physical) % 1_000_000, - )))->setTimezone($this->zone); + return DateTimeImmutable::createFromTimestamp($seconds)->setMicrosecond($micros)->setTimezone($this->zone); } public function fromPhysicalAll(array $physicals): array { $values = []; - $modern = PHP_VERSION_ID >= 80400; // @mago-ignore analysis:mixed-assignment foreach ($physicals as $physical) { @@ -86,29 +68,17 @@ public function fromPhysicalAll(array $physicals): array assert(is_int($physical)); - if ($modern) { - $seconds = intdiv($physical, 1_000_000); - $micros = $physical % 1_000_000; - - if ($micros < 0) { - $micros += 1_000_000; - $seconds--; - } - - // @mago-ignore analysis:unavailable-method - $instant = DateTimeImmutable::createFromTimestamp($seconds); - // @mago-ignore analysis:unavailable-method - $values[] = $instant->setMicrosecond($micros)->setTimezone($this->zone); + $seconds = intdiv($physical, 1_000_000); + $micros = $physical % 1_000_000; - continue; + if ($micros < 0) { + $micros += 1_000_000; + $seconds--; } - $values[] = (new DateTimeImmutable(sprintf( - '@%s%d.%06d', - $physical < 0 ? '-' : '', - intdiv(abs($physical), 1_000_000), - abs($physical) % 1_000_000, - )))->setTimezone($this->zone); + $values[] = DateTimeImmutable::createFromTimestamp($seconds) + ->setMicrosecond($micros) + ->setTimezone($this->zone); } return $values; diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Physical/HtmlDocumentPhysical.php b/src/core/etl/src/Flow/ETL/Values/Column/Physical/HtmlDocumentPhysical.php index f9ffe38bf5..19c6eb4705 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Physical/HtmlDocumentPhysical.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Physical/HtmlDocumentPhysical.php @@ -5,10 +5,8 @@ namespace Flow\ETL\Values\Column\Physical; use Dom\HTMLDocument; -use Flow\ETL\Foundation\Exception\InvalidArgumentException; use function assert; -use function class_exists; use function is_object; use function is_string; @@ -21,7 +19,6 @@ public function toPhysical(mixed $value): mixed assert(is_object($value)); /** @var \Dom\HTMLDocument $value */ - // @mago-ignore analysis:unavailable-method return $value->saveHtml(); } @@ -29,11 +26,6 @@ public function fromPhysical(mixed $physical): mixed { assert(is_string($physical)); - if (!class_exists('\Dom\HTMLDocument')) { - throw new InvalidArgumentException('Floe cannot restore HTML values, \Dom\HTMLDocument requires PHP 8.4+'); - } - - // @mago-expect analysis:unavailable-method return HTMLDocument::createFromString($physical, LIBXML_NOERROR); } diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Physical/HtmlElementPhysical.php b/src/core/etl/src/Flow/ETL/Values/Column/Physical/HtmlElementPhysical.php index ff1a01e130..4c8664265d 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Physical/HtmlElementPhysical.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Physical/HtmlElementPhysical.php @@ -8,7 +8,6 @@ use Flow\ETL\Foundation\Exception\InvalidArgumentException; use function assert; -use function class_exists; use function is_object; use function is_string; use function sprintf; @@ -53,20 +52,14 @@ public function fromPhysical(mixed $physical): mixed { assert(is_string($physical)); - if (!class_exists('\Dom\HTMLDocument')) { - throw new InvalidArgumentException('Floe cannot restore HTML values, \Dom\HTMLDocument requires PHP 8.4+'); - } - $path = $this->position->pathOf($physical); - // @mago-expect analysis:unavailable-method $element = $path === null ? HTMLDocument::createFromString( '' . $physical . '', LIBXML_NOERROR, )->body?->firstElementChild : $this->position->element( - // @mago-expect analysis:unavailable-method HTMLDocument::createFromString( $this->position->documentOf($physical), LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR, diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Physical/XmlDocumentPhysical.php b/src/core/etl/src/Flow/ETL/Values/Column/Physical/XmlDocumentPhysical.php index 0b89736f70..8700368fab 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Physical/XmlDocumentPhysical.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Physical/XmlDocumentPhysical.php @@ -56,7 +56,7 @@ public function toPhysical(mixed $value): mixed throw new InvalidArgumentException('Floe failed to convert DOMDocument to XML string'); } - return (new XmlCharacterReferences())->decoded($xml); + return new XmlCharacterReferences()->decoded($xml); } public function fromPhysical(mixed $physical): mixed diff --git a/src/core/etl/src/Flow/ETL/Values/Column/Physical/XmlElementPhysical.php b/src/core/etl/src/Flow/ETL/Values/Column/Physical/XmlElementPhysical.php index e7ea111a6a..041cf7b94e 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/Physical/XmlElementPhysical.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/Physical/XmlElementPhysical.php @@ -16,7 +16,7 @@ use function sprintf; /** - * A \Dom\Element (PHP 8.4) is stored by its markup too and reads back as the DOMElement XMLElementType::cast() builds + * A \Dom\Element is stored by its markup too and reads back as the DOMElement XMLElementType::cast() builds * from a string. */ final readonly class XmlElementPhysical implements Physical @@ -45,7 +45,7 @@ public function toPhysical(mixed $value): mixed return $this->position->physical( $path, $this->canonical($value), - (new XmlCharacterReferences())->decoded($xml), + new XmlCharacterReferences()->decoded($xml), ); } @@ -57,7 +57,7 @@ public function toPhysical(mixed $value): mixed return $this->position->physical( $path, $this->canonical($value), - (new XmlCharacterReferences())->decoded($markup), + new XmlCharacterReferences()->decoded($markup), ); } @@ -113,7 +113,6 @@ private function rooted(object $element): object )->assert($document->importNode($element, true)))); } - // @mago-ignore analysis:unavailable-method $document = XMLDocument::createEmpty(); return type_instance_of(Element::class)->assert($document->appendChild($document->importNode($element, true))); diff --git a/src/core/etl/src/Flow/ETL/Values/Column/TextValues.php b/src/core/etl/src/Flow/ETL/Values/Column/TextValues.php index 9629b8a9d0..a0e3d82af0 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/TextValues.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/TextValues.php @@ -119,7 +119,7 @@ public function of(Type $type, array $physicals): array } if ($bare instanceof XMLType) { - $nodes = (new PhysicalFor())->physical($bare); + $nodes = new PhysicalFor()->physical($bare); $documents = new XmlDocumentPhysical(); $references = new XmlCharacterReferences(); $values = []; @@ -344,7 +344,7 @@ public function dateTimes(DateTimeType|DateType $type, array $physicals, string return $texts; } - $values = (new PhysicalFor())->physical($type); + $values = new PhysicalFor()->physical($type); foreach ($physicals as $physical) { $texts[] = $physical === null diff --git a/src/core/etl/src/Flow/ETL/Values/Column/ValueEquality.php b/src/core/etl/src/Flow/ETL/Values/Column/ValueEquality.php index c116b8b4db..c6ddffeae3 100644 --- a/src/core/etl/src/Flow/ETL/Values/Column/ValueEquality.php +++ b/src/core/etl/src/Flow/ETL/Values/Column/ValueEquality.php @@ -83,7 +83,7 @@ public function cast(Column $column, Type $type, string $name): Column ); } - $builder = (new PhpBackend())->builder(Definitions::of($name, $target, $column->nullCount() > 0)); + $builder = new PhpBackend()->builder(Definitions::of($name, $target, $column->nullCount() > 0)); $builder->appendMany($values); return $builder->finish(); @@ -154,7 +154,7 @@ public function in(Column $needles, array $candidates, string $needleName, strin foreach ($groups as ['type' => $candidateType, 'values' => $values, 'rows' => $rows]) { $type = $this->type($needles->type(), $candidateType); $needleRows = array_values(array_unique($rows)); - $builder = (new PhpBackend())->builder(Definitions::of($haystackName, $candidateType, false)); + $builder = new PhpBackend()->builder(Definitions::of($haystackName, $candidateType, false)); $builder->appendMany($values); try { diff --git a/src/core/etl/src/Flow/ETL/Values/Grouping/KeyEncoder.php b/src/core/etl/src/Flow/ETL/Values/Grouping/KeyEncoder.php index 74bbfdab72..ced7697844 100644 --- a/src/core/etl/src/Flow/ETL/Values/Grouping/KeyEncoder.php +++ b/src/core/etl/src/Flow/ETL/Values/Grouping/KeyEncoder.php @@ -64,7 +64,7 @@ public function of(Rows $rows): array return ( $rows->isEmpty() ? [] - : (new CanonicalEncoding())->ordered($this->columns($rows, new PhpBackend()), $rows->count()) + : new CanonicalEncoding()->ordered($this->columns($rows, new PhpBackend()), $rows->count()) ); } @@ -75,7 +75,7 @@ public function of(Rows $rows): array */ public static function ofColumns(array $columns, int $count): array { - return $count < 1 ? [] : (new CanonicalEncoding())->ordered($columns, $count); + return $count < 1 ? [] : new CanonicalEncoding()->ordered($columns, $count); } public static function bucketOf(string $key, int $buckets, int $hashOffset): int diff --git a/src/core/etl/src/Flow/ETL/Values/Grouping/PhpGroupTable.php b/src/core/etl/src/Flow/ETL/Values/Grouping/PhpGroupTable.php index 9e0d03e020..c9b4cba539 100644 --- a/src/core/etl/src/Flow/ETL/Values/Grouping/PhpGroupTable.php +++ b/src/core/etl/src/Flow/ETL/Values/Grouping/PhpGroupTable.php @@ -51,7 +51,7 @@ public function assign(Rows $rows): GroupIds } return new GroupIds( - new ScalarColumn(type_integer(), (new PhysicalFor())->physical(type_integer()), $byRow, 0), + new ScalarColumn(type_integer(), new PhysicalFor()->physical(type_integer()), $byRow, 0), $firstRows, ); } @@ -70,7 +70,7 @@ public function lookup(Rows $rows): Column } } - return new ScalarColumn(type_integer(), (new PhysicalFor())->physical(type_integer()), $byRow, $nullCount); + return new ScalarColumn(type_integer(), new PhysicalFor()->physical(type_integer()), $byRow, $nullCount); } public function count(): int diff --git a/src/core/etl/src/Flow/ETL/Values/Rows.php b/src/core/etl/src/Flow/ETL/Values/Rows.php index 52abd4e4f2..e48c01aa4e 100644 --- a/src/core/etl/src/Flow/ETL/Values/Rows.php +++ b/src/core/etl/src/Flow/ETL/Values/Rows.php @@ -116,7 +116,7 @@ public function column(string $name): Column return $this->columns[$name]; } - $suggestions = (new SimilarNames())->closestTo($name, array_values($this->schema->names())); + $suggestions = new SimilarNames()->closestTo($name, $this->schema->names()); throw new InvalidArgumentException( $suggestions === [] @@ -391,7 +391,7 @@ public function project(Schema $schema, Backend $backend): self } } - return (new self(new Schema(...$definitions), $columns, $this->count))->matchTo($schema, $backend); + return new self(new Schema(...$definitions), $columns, $this->count)->matchTo($schema, $backend); } /** diff --git a/src/core/etl/src/Flow/ETL/Values/Rows/ColumnRetyping.php b/src/core/etl/src/Flow/ETL/Values/Rows/ColumnRetyping.php index cfebec3b4c..f487d9acd3 100644 --- a/src/core/etl/src/Flow/ETL/Values/Rows/ColumnRetyping.php +++ b/src/core/etl/src/Flow/ETL/Values/Rows/ColumnRetyping.php @@ -110,7 +110,7 @@ public function restamped(Column $column, Definition $own, Definition $definitio return null; } - return (new Retype())->proves($column->type(), $definition->type()) + return new Retype()->proves($column->type(), $definition->type()) ? $column->withType($definition->type()) : null; } diff --git a/src/core/etl/src/Flow/ETL/Values/Rows/RecordBatch.php b/src/core/etl/src/Flow/ETL/Values/Rows/RecordBatch.php index ba5207fc9c..2836334696 100644 --- a/src/core/etl/src/Flow/ETL/Values/Rows/RecordBatch.php +++ b/src/core/etl/src/Flow/ETL/Values/Rows/RecordBatch.php @@ -197,7 +197,7 @@ public function flush(): array } try { - $rows = (new RowsBuilder($this->schema, $this->backend)) + $rows = new RowsBuilder($this->schema, $this->backend) ->appendRows($this->records) ->finish(); } catch (SchemaMismatchException $mismatch) { @@ -293,7 +293,7 @@ private function recordByRecord(): array ); if ($accepted !== []) { - $handed[] = (new RowsBuilder($this->schema, $this->backend)) + $handed[] = new RowsBuilder($this->schema, $this->backend) ->appendRows($accepted) ->finish(); } diff --git a/src/core/etl/src/Flow/ETL/Values/Schema/Definition/ListDefinition.php b/src/core/etl/src/Flow/ETL/Values/Schema/Definition/ListDefinition.php index 049551639d..02ad93993c 100644 --- a/src/core/etl/src/Flow/ETL/Values/Schema/Definition/ListDefinition.php +++ b/src/core/etl/src/Flow/ETL/Values/Schema/Definition/ListDefinition.php @@ -39,7 +39,7 @@ public function __construct( ) { $this->name = $name; $this->metadata = $metadata ?? Metadata::empty(); - $this->type = (new TypeProjection($this->name))->list($type); + $this->type = new TypeProjection($this->name)->list($type); } /** diff --git a/src/core/etl/src/Flow/ETL/Values/Schema/Definition/MapDefinition.php b/src/core/etl/src/Flow/ETL/Values/Schema/Definition/MapDefinition.php index 94134c6e5a..17d68402b7 100644 --- a/src/core/etl/src/Flow/ETL/Values/Schema/Definition/MapDefinition.php +++ b/src/core/etl/src/Flow/ETL/Values/Schema/Definition/MapDefinition.php @@ -40,7 +40,7 @@ public function __construct( ) { $this->name = $name; $this->metadata = $metadata ?? Metadata::empty(); - $this->type = (new TypeProjection($this->name))->map($type); + $this->type = new TypeProjection($this->name)->map($type); } /** diff --git a/src/core/etl/src/Flow/ETL/Values/Schema/Definition/StructureDefinition.php b/src/core/etl/src/Flow/ETL/Values/Schema/Definition/StructureDefinition.php index 1ed392755b..c3a70b53bc 100644 --- a/src/core/etl/src/Flow/ETL/Values/Schema/Definition/StructureDefinition.php +++ b/src/core/etl/src/Flow/ETL/Values/Schema/Definition/StructureDefinition.php @@ -39,7 +39,7 @@ public function __construct( ) { $this->name = $name; $this->metadata = $metadata ?? Metadata::empty(); - $this->type = (new TypeProjection($this->name))->structure($type); + $this->type = new TypeProjection($this->name)->structure($type); } /** diff --git a/src/core/etl/src/Flow/ETL/Values/Sort/RowOrder.php b/src/core/etl/src/Flow/ETL/Values/Sort/RowOrder.php index 57de83e9c0..b51d3a2d66 100644 --- a/src/core/etl/src/Flow/ETL/Values/Sort/RowOrder.php +++ b/src/core/etl/src/Flow/ETL/Values/Sort/RowOrder.php @@ -181,7 +181,7 @@ public static function flag(Type $type): int $bare instanceof HTMLType, $bare instanceof HTMLElementType, => SORT_STRING, - (new ComparableValues())->equalByPhysical($bare) => SORT_NUMERIC, + new ComparableValues()->equalByPhysical($bare) => SORT_NUMERIC, default => SORT_REGULAR, }; } diff --git a/src/core/etl/src/Flow/Floe/DSL/functions.php b/src/core/etl/src/Flow/Floe/DSL/functions.php index 4478cfdbd3..b69106ab51 100644 --- a/src/core/etl/src/Flow/Floe/DSL/functions.php +++ b/src/core/etl/src/Flow/Floe/DSL/functions.php @@ -71,7 +71,7 @@ function merge_floe( ?Metadata $metadata = null, Filesystem $filesystem = new NativeLocalFilesystem(), ): void { - (new FloeMerger($filesystem, $backend))->merge( + new FloeMerger($filesystem, $backend)->merge( array_map(static fn(string|Path $source): Path => is_string($source) ? path_real($source) : $source, $sources), is_string($dest) ? path($dest) : $dest, $compact, diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/AggregatorFixtures.php b/src/core/etl/tests/Flow/ETL/Tests/Context/AggregatorFixtures.php index cc1dab6026..e5405d3672 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/AggregatorFixtures.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/AggregatorFixtures.php @@ -96,7 +96,7 @@ public static function instance(string $class): AggregatingFunction */ public static function resolved(string $class): AggregatingFunction { - return type_instance_of(AggregatingFunction::class)->assert((new ReferenceResolver())->resolve( + return type_instance_of(AggregatingFunction::class)->assert(new ReferenceResolver()->resolve( self::instance($class), self::schema(), )); @@ -107,7 +107,7 @@ public static function resolved(string $class): AggregatingFunction */ public static function bound(AggregatingFunction $function, Schema $schema): AggregatingFunction { - return type_instance_of(AggregatingFunction::class)->assert((new ReferenceResolver())->resolve( + return type_instance_of(AggregatingFunction::class)->assert(new ReferenceResolver()->resolve( $function, $schema, )); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/AggregatorRoundTrip.php b/src/core/etl/tests/Flow/ETL/Tests/Context/AggregatorRoundTrip.php index 9528426c1d..04a5e3ef9c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/AggregatorRoundTrip.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/AggregatorRoundTrip.php @@ -32,12 +32,12 @@ public static function aggregated(AggregatingFunction $aggregator): array $rebuilt = DescribeRoundTrip::rebuilt($aggregator); $rows = AggregatorFixtures::rows(new PhpBackend()); - $resolved = type_instance_of(AggregatingFunction::class)->assert((new ReferenceResolver())->resolve( + $resolved = type_instance_of(AggregatingFunction::class)->assert(new ReferenceResolver()->resolve( $aggregator, AggregatorFixtures::schema(), )); $resolved->aggregate($rows, range(0, 5), flow_context()->backend()); - $copy = type_instance_of(AggregatingFunction::class)->assert((new ReferenceResolver())->resolve( + $copy = type_instance_of(AggregatingFunction::class)->assert(new ReferenceResolver()->resolve( $rebuilt, AggregatorFixtures::schema(), )); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/DecimalDivisionContext.php b/src/core/etl/tests/Flow/ETL/Tests/Context/DecimalDivisionContext.php index 97fe0c6d79..dc2f26c68b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/DecimalDivisionContext.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/DecimalDivisionContext.php @@ -9,7 +9,6 @@ use Flow\ETL\Foundation\Calculator\Calculator; use Flow\ETL\Foundation\Calculator\Rounding; -use function defined; use function pack; use function sprintf; use function unpack; @@ -23,30 +22,18 @@ public static function bigDecimalQuotientOfStringForms( int $scale, Rounding $rounding, ): float { - $modern = defined('Brick\Math\RoundingMode::Up'); - // @mago-ignore analysis:possibly-invalid-argument return BigDecimal::of((string) $a)->dividedBy(BigDecimal::of((string) $b), $scale, match ($rounding) { - // @mago-ignore analysis:non-existent-class-constant - Rounding::UP => $modern ? RoundingMode::Up : RoundingMode::UP, - // @mago-ignore analysis:non-existent-class-constant - Rounding::DOWN => $modern ? RoundingMode::Down : RoundingMode::DOWN, - // @mago-ignore analysis:non-existent-class-constant - Rounding::CEILING => $modern ? RoundingMode::Ceiling : RoundingMode::CEILING, - // @mago-ignore analysis:non-existent-class-constant - Rounding::FLOOR => $modern ? RoundingMode::Floor : RoundingMode::FLOOR, - // @mago-ignore analysis:non-existent-class-constant - Rounding::HALF_UP => $modern ? RoundingMode::HalfUp : RoundingMode::HALF_UP, - // @mago-ignore analysis:non-existent-class-constant - Rounding::HALF_DOWN => $modern ? RoundingMode::HalfDown : RoundingMode::HALF_DOWN, - // @mago-ignore analysis:non-existent-class-constant - Rounding::HALF_CEILING => $modern ? RoundingMode::HalfCeiling : RoundingMode::HALF_CEILING, - // @mago-ignore analysis:non-existent-class-constant - Rounding::HALF_FLOOR => $modern ? RoundingMode::HalfFloor : RoundingMode::HALF_FLOOR, - // @mago-ignore analysis:non-existent-class-constant - Rounding::HALF_EVEN => $modern ? RoundingMode::HalfEven : RoundingMode::HALF_EVEN, - // @mago-ignore analysis:non-existent-class-constant - Rounding::UNNECESSARY => $modern ? RoundingMode::Unnecessary : RoundingMode::UNNECESSARY, + Rounding::UP => RoundingMode::Up, + Rounding::DOWN => RoundingMode::Down, + Rounding::CEILING => RoundingMode::Ceiling, + Rounding::FLOOR => RoundingMode::Floor, + Rounding::HALF_UP => RoundingMode::HalfUp, + Rounding::HALF_DOWN => RoundingMode::HalfDown, + Rounding::HALF_CEILING => RoundingMode::HalfCeiling, + Rounding::HALF_FLOOR => RoundingMode::HalfFloor, + Rounding::HALF_EVEN => RoundingMode::HalfEven, + Rounding::UNNECESSARY => RoundingMode::Unnecessary, })->toFloat(); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/DescribableFixtures.php b/src/core/etl/tests/Flow/ETL/Tests/Context/DescribableFixtures.php index 0e980fb420..a10db5ce23 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/DescribableFixtures.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/DescribableFixtures.php @@ -326,7 +326,7 @@ public static function others(): array ProgressUnit::rows, 7, 'memory://in/orders.floe', - (new HeartbeatContext())->throttle(new ScheduledHeartbeat(new RecordingHeartbeat(), 1)), + new HeartbeatContext()->throttle(new ScheduledHeartbeat(new RecordingHeartbeat(), 1)), 0, ), IgnoreError::class => static fn(): Describable => new IgnoreError(), @@ -372,7 +372,7 @@ public static function others(): array ), ScalarFunctionTransformer::class => static fn(): Describable => type_instance_of( ScalarFunctionTransformer::class, - )->assert((new ScalarFunctionTransformer('double', ref('id')->multiply(lit(2))))->bind(schema(int_schema( + )->assert(new ScalarFunctionTransformer('double', ref('id')->multiply(lit(2)))->bind(schema(int_schema( 'id', )))->step), SchemaValidationLoader::class => static fn(): Describable => new SchemaValidationLoader( @@ -413,7 +413,7 @@ public static function others(): array ), UntilTransformer::class => static fn(): Describable => type_instance_of( UntilTransformer::class, - )->assert((new UntilTransformer(ref('id')->lessThan(lit(10))))->bind(schema(int_schema('id')))->step), + )->assert(new UntilTransformer(ref('id')->lessThan(lit(10)))->bind(schema(int_schema('id')))->step), Window::class => self::window(...), WholePartitionFrame::class => static fn(): Describable => new WholePartitionFrame(), BatchingByProcessor::class => static fn(): Describable => new BatchingByProcessor(ref('country'), 5), @@ -427,25 +427,25 @@ public static function others(): array CountingProcessor::class => static fn(): Describable => new CountingProcessor(), DistinctProcessor::class => static fn(): Describable => type_instance_of( DistinctProcessor::class, - )->assert((new DistinctProcessor(['country', ref('day')]))->bind(schema( + )->assert(new DistinctProcessor(['country', ref('day')])->bind(schema( str_schema('country'), int_schema('day'), ))->step), ExpandingProcessor::class => static fn(): Describable => type_instance_of( ExpandingProcessor::class, - )->assert((new ExpandingProcessor( + )->assert(new ExpandingProcessor( 'tag', ref('tags')->expand(), RequiredColumns::allBut('tags'), new BatchSize(9), - ))->bind(schema(int_schema('id'), list_schema('tags', type_list(type_string()))))->step), + )->bind(schema(int_schema('id'), list_schema('tags', type_list(type_string()))))->step), GroupByAggregationProcessor::class => static fn(): Describable => type_instance_of( GroupByAggregationProcessor::class, - )->assert((new GroupByAggregationProcessor( + )->assert(new GroupByAggregationProcessor( new GroupBy(refs('country'), new Aggregators(sum(ref('amount')))), self::bucketing(), new NativePHPRandomValueGenerator(), - ))->bind(schema(str_schema('country'), int_schema('amount')))->step), + )->bind(schema(str_schema('country'), int_schema('amount')))->step), HashJoin::class => self::hashJoin(...), MemorySortProcessor::class => static fn(): Describable => new MemorySortProcessor([ref( 'id', @@ -458,14 +458,14 @@ public static function others(): array OffsetProcessor::class => static fn(): Describable => new OffsetProcessor(3), PivotProcessor::class => static fn(): Describable => type_instance_of( PivotProcessor::class, - )->assert((new PivotProcessor( + )->assert(new PivotProcessor( new GroupBy( refs('name'), new Aggregators(sum(ref('id'))), new Pivot(ref('country'), new DeclaredPivotValues('USA', 'China')), ), self::bucketing(), - ))->bind(schema(str_schema('name'), int_schema('id'), str_schema('country')))->step), + )->bind(schema(str_schema('name'), int_schema('id'), str_schema('country')))->step), RepartitionProcessor::class => static fn(): Describable => new RepartitionProcessor( refs('country'), self::bucketing(), @@ -482,7 +482,7 @@ public static function others(): array VoidProgress::class => static fn(): Describable => new VoidProgress(), WindowProcessor::class => static fn(): Describable => type_instance_of( WindowProcessor::class, - )->assert((new WindowProcessor('rank', new Rank(self::window())))->bind(schema( + )->assert(new WindowProcessor('rank', new Rank(self::window()))->bind(schema( str_schema('country'), int_schema('id'), ))->step), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/ExecutedPipelines.php b/src/core/etl/tests/Flow/ETL/Tests/Context/ExecutedPipelines.php index 635365ce4a..d7a49b6d72 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/ExecutedPipelines.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/ExecutedPipelines.php @@ -29,6 +29,6 @@ final class ExecutedPipelines */ public static function of(Extractor $source, array $steps, ?FlowContext $context = null): Generator { - return (new Executor())->executePipeline(PipelinesMother::root($source, $steps), $context ?? flow_context()); + return new Executor()->executePipeline(PipelinesMother::root($source, $steps), $context ?? flow_context()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/ExpansionContext.php b/src/core/etl/tests/Flow/ETL/Tests/Context/ExpansionContext.php index 06991575c0..047d03d762 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/ExpansionContext.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/ExpansionContext.php @@ -19,7 +19,7 @@ public static function of(ScalarFunction $tree, ?Schema $input = null): Expansio $schema = $input ?? ListColumnsMother::schema(); return type_instance_of(Expansion::class)->assert(Expansion::of( - (new ReferenceResolver())->resolve($tree, $schema), + new ReferenceResolver()->resolve($tree, $schema), $schema, )); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/FileFormatContract.php b/src/core/etl/tests/Flow/ETL/Tests/Context/FileFormatContract.php index 3a72ba5804..8de1e5db6a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/FileFormatContract.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/FileFormatContract.php @@ -205,7 +205,7 @@ public function theSplitsReadEveryRowOnce(FileFormat $format): void foreach (FlowTestCase::extracted( $extractor->reader(), flow_context()->backend(), - (new Criteria())->withSplit(type_instance_of(FileSplit::class)->assert($split)), + new Criteria()->withSplit(type_instance_of(FileSplit::class)->assert($split)), ) as $rows) { $read += $rows->count(); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/FloeFilesContext.php b/src/core/etl/tests/Flow/ETL/Tests/Context/FloeFilesContext.php index 39ba877e99..09c4653447 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/FloeFilesContext.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/FloeFilesContext.php @@ -38,7 +38,7 @@ final class FloeFilesContext public static function columns(Filesystem $filesystem, Path $file): array { return Schema::fromArray( - (new FooterReader())->read($filesystem->readFrom($file), new NoopCodec())->footer->schema, + new FooterReader()->read($filesystem->readFrom($file), new NoopCodec())->footer->schema, )->names(); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/FloeStreamReaderContext.php b/src/core/etl/tests/Flow/ETL/Tests/Context/FloeStreamReaderContext.php index 646bfe396c..21fd51c0d4 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/FloeStreamReaderContext.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/FloeStreamReaderContext.php @@ -55,7 +55,7 @@ public static function footer(Filesystem $filesystem, Path $path): Footer public static function dataBytes(Filesystem $filesystem, Path $path): int { return ( - (new FooterReader())->read($filesystem->readFrom($path), new NoopCodec())->footerFrameStart + new FooterReader()->read($filesystem->readFrom($path), new NoopCodec())->footerFrameStart - Format::HEADER_LENGTH ); } @@ -86,12 +86,12 @@ public static function roundTrip(Rows $rows): Rows $filesystem = memory_filesystem(); $path = path('memory://round-trip.floe'); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $rows->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $rows->schema()); $writer->write($rows); $writer->close(); $batches = iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(), ); @@ -118,7 +118,7 @@ public static function frameTypes(Filesystem $filesystem, Path $path): array */ public static function reconstruct(Filesystem $filesystem, Path $path): Rows { - $file = (new FloeFiles($filesystem, new AdaptiveBackend()))->read($path); + $file = new FloeFiles($filesystem, new AdaptiveBackend())->read($path); $rows = rows($file->footer()->schema()); foreach ($file->rows() as $batch) { @@ -140,7 +140,7 @@ public static function readAll(Filesystem $filesystem, Path $path): Rows { $merged = null; - foreach ((new FloeFiles($filesystem, new AdaptiveBackend())) + foreach (new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows() as $batch) { $merged = $merged === null ? $batch : Rows::concat($merged->schema(), new PhpBackend(), $merged, $batch); @@ -159,7 +159,7 @@ public static function write( array $metadata = [], Codec $codec = new NoopCodec(), ): void { - $writer = (new FloeFiles($filesystem, new AdaptiveBackend(), new Options(codec: $codec)))->create( + $writer = new FloeFiles($filesystem, new AdaptiveBackend(), new Options(codec: $codec))->create( $path, $rows->schema(), Metadata::fromArray($metadata), @@ -180,14 +180,14 @@ public static function writeFrames( ): void { /** @var array> $normalized */ $normalized = $schema->normalize(); - $footerJson = (new Footer( + $footerJson = new Footer( Format::VERSION, 'test', $normalized, [new Section(Format::HEADER_LENGTH, $rowCount)], new FooterStatistics($rowCount, strlen($frames)), Metadata::empty(), - ))->toJson(); + )->toJson(); $stream = $filesystem->writeTo($path); $stream->append( @@ -228,7 +228,7 @@ public static function truncatedAt(int $bytesLeft): FloeStreamReader public static function writeWithoutFooter(Filesystem $filesystem, Path $path, Rows $rows): void { - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $rows->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $rows->schema()); $writer->write($rows); $writer->close(); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/FunctionContext.php b/src/core/etl/tests/Flow/ETL/Tests/Context/FunctionContext.php index fdf0ca2ce3..0163b27dbe 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/FunctionContext.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/FunctionContext.php @@ -34,7 +34,7 @@ public function exported(ScalarFunction $function, Rows $rows, Schema $schema): { try { return var_export( - (new ReferenceResolver()) + new ReferenceResolver() ->resolve($function, $schema) ->eval($rows, $this->context->backend()) ->values(), @@ -50,7 +50,7 @@ public function exported(ScalarFunction $function, Rows $rows, Schema $schema): */ public function columnOf(ScalarFunction $function, Rows $rows, Schema $schema): Column { - return (new ReferenceResolver()) + return new ReferenceResolver() ->resolve($function, $schema) ->eval($rows, $this->context->backend()); } @@ -60,7 +60,7 @@ public function columnOf(ScalarFunction $function, Rows $rows, Schema $schema): */ public function column(ScalarFunction $function, array $rows, Schema $schema): Column { - return (new ReferenceResolver()) + return new ReferenceResolver() ->resolve($function, $schema) ->eval(array_to_rows($rows, $schema, $this->context->backend()), $this->context->backend()); } @@ -73,7 +73,7 @@ public function column(ScalarFunction $function, array $rows, Schema $schema): C */ public function eval(ScalarFunction $function, array $row, Schema $schema): mixed { - return (new Parameter((new ReferenceResolver())->resolve($function, $schema)))->values( + return new Parameter(new ReferenceResolver()->resolve($function, $schema))->values( array_to_rows([$row], $schema, $this->context->backend()), $this->context->backend(), )[0]; diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/HeartbeatContext.php b/src/core/etl/tests/Flow/ETL/Tests/Context/HeartbeatContext.php index 543a079f01..7b19b14494 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/HeartbeatContext.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/HeartbeatContext.php @@ -52,7 +52,7 @@ public function __construct() { $this->clock = new FakeClock(); $this->logs = new MemoryLogProcessor(new VoidExporter()); - $this->logger = (new LoggerProvider($this->logs, $this->clock, new MemoryContextStorage()))->logger( + $this->logger = new LoggerProvider($this->logs, $this->clock, new MemoryContextStorage())->logger( Resource::create(['service.name' => 'flow-test']), 'flow_php_dataframe', ); @@ -138,7 +138,7 @@ public static function stoppable(ArrayObject $signals): Generator public static function stageWithId(StageName $name, int $id): HeartbeatStage { - return (new self()) + return new self() ->throttle(new ScheduledHeartbeat(new RecordingHeartbeat(), 120)) ->stage($name, ProgressUnit::rows, $id); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/KeyGroupingContext.php b/src/core/etl/tests/Flow/ETL/Tests/Context/KeyGroupingContext.php index 9a18ddc404..116f17bc77 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/KeyGroupingContext.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/KeyGroupingContext.php @@ -27,7 +27,7 @@ final class KeyGroupingContext public static function groups(array $by, Generator $input): array { return iterator_to_array( - (new KeyGrouping(new KeyEncoder((new References(...$by))->names()), new AdaptiveBackend()))->group($input), + new KeyGrouping(new KeyEncoder(new References(...$by)->names()), new AdaptiveBackend())->group($input), preserve_keys: false, ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/MetadataColumnsContract.php b/src/core/etl/tests/Flow/ETL/Tests/Context/MetadataColumnsContract.php index f2678dcf36..41dbb394cb 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/MetadataColumnsContract.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/MetadataColumnsContract.php @@ -18,7 +18,7 @@ final class MetadataColumnsContract */ public static function declares(string $class): void { - Assert::assertTrue((new ReflectionClass($class))->implementsInterface(MetadataColumnsExtractor::class), $class); + Assert::assertTrue(new ReflectionClass($class)->implementsInterface(MetadataColumnsExtractor::class), $class); Assert::assertTrue(method_exists($class, 'withMetadataColumns'), $class); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/PartitionRoutingContext.php b/src/core/etl/tests/Flow/ETL/Tests/Context/PartitionRoutingContext.php index a693cc1885..8bf6dae22c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/PartitionRoutingContext.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/PartitionRoutingContext.php @@ -21,7 +21,7 @@ final class PartitionRoutingContext */ public static function route(Partitioning $partitioning, Rows $rows): array { - $groups = iterator_to_array((new PartitionRouter($partitioning))->route($rows), preserve_keys: false); + $groups = iterator_to_array(new PartitionRouter($partitioning)->route($rows), preserve_keys: false); usort($groups, static fn(array $a, array $b): int => self::sortKey($a[0]) <=> self::sortKey($b[0])); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/ProjectionContext.php b/src/core/etl/tests/Flow/ETL/Tests/Context/ProjectionContext.php index 353bd2506a..ee5e38fa54 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/ProjectionContext.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/ProjectionContext.php @@ -15,7 +15,7 @@ final class ProjectionContext { public static function pushed(Node $root, Trigger $trigger = Trigger::rows): Read { - return (new PushProjectionIntoSource()) + return new PushProjectionIntoSource() ->apply($trigger->plan($root), config()->backend()) ->source(); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/ReversedSniffing.php b/src/core/etl/tests/Flow/ETL/Tests/Context/ReversedSniffing.php index d00f3dd482..53139cff4b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/ReversedSniffing.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/ReversedSniffing.php @@ -26,7 +26,7 @@ public static function schema(Sniffer $sniffer, SchemaInference $inference): Sch ksort($samples); - return (new SchemaInferrer($inference))->infer( + return new SchemaInferrer($inference)->infer( new PresniffedSniffer($sniffer->names(), array_values($samples)), new VoidProgress(), )->schema; diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/ScalarFunctionContract.php b/src/core/etl/tests/Flow/ETL/Tests/Context/ScalarFunctionContract.php index 2032a1e9f6..1bb6f248bb 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/ScalarFunctionContract.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/ScalarFunctionContract.php @@ -32,7 +32,7 @@ final class ScalarFunctionContract { public static function returnsItsDeclaredType(ScalarFunction $function, Type $expected): void { - $returns = (new ReferenceResolver()) + $returns = new ReferenceResolver() ->resolve($function, ScalarFunctionFixtures::schema()) ->returns(); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/ScalarFunctionFixtures.php b/src/core/etl/tests/Flow/ETL/Tests/Context/ScalarFunctionFixtures.php index b08b620c8d..ca169443e9 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/ScalarFunctionFixtures.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/ScalarFunctionFixtures.php @@ -8,7 +8,6 @@ use DateTimeZone; use DOMDocument; use Flow\ETL\Foundation\Calculator\Rounding; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Foundation\Exception\SchemaNotDerivableException; use Flow\ETL\Foundation\Hash\HashAlgorithm; use Flow\ETL\Functions; @@ -208,26 +207,17 @@ final class ScalarFunctionFixtures * Every declaring class resolved against schema() and split by type_is_nullable() of its * returns() answer; the one designed SchemaNotDerivableException refusal counts as NOT NULL. * - * @return array{list>, list>, list>} + * @return array{list>, list>} */ public static function nullabilitySplit(): array { $nullable = []; $notNull = []; - $unavailable = []; foreach (ScalarFunctionClasses::declaring(ExtractorClasses::root('core/etl')) as $class) { try { - $function = self::instance($class); - } catch (RequiredPHPVersionException) { - $unavailable[] = $class; - - continue; - } - - try { - $type = (new ReferenceResolver()) - ->resolve($function, self::schema()) + $type = new ReferenceResolver() + ->resolve(self::instance($class), self::schema()) ->returns(); } catch (SchemaNotDerivableException) { $notNull[] = $class; @@ -242,7 +232,7 @@ public static function nullabilitySplit(): array } } - return [$nullable, $notNull, $unavailable]; + return [$nullable, $notNull]; } /** @@ -322,8 +312,6 @@ public static function rows(Backend $backend): Rows /** * @param class-string $class - * - * @throws RequiredPHPVersionException when the class needs a newer PHP than the runtime */ public static function instance(string $class): ScalarFunction { diff --git a/src/core/etl/tests/Flow/ETL/Tests/Context/WindowProcessorContext.php b/src/core/etl/tests/Flow/ETL/Tests/Context/WindowProcessorContext.php index e6800c0dde..7e703f840f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Context/WindowProcessorContext.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Context/WindowProcessorContext.php @@ -28,7 +28,7 @@ public static function batches(string|Definition $column, WindowFunction $functi $batches = []; - foreach ((new WindowProcessor($column, $function))->process($input, flow_context()->backend()) as $batch) { + foreach (new WindowProcessor($column, $function)->process($input, flow_context()->backend()) as $batch) { $batches[] = $batch; } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/AcceptingBackend.php b/src/core/etl/tests/Flow/ETL/Tests/Double/AcceptingBackend.php index dfb0cc4bb3..4a16f493aa 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/AcceptingBackend.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/AcceptingBackend.php @@ -37,52 +37,52 @@ public function compare( string $leftName, string $rightName, ): Column { - return (new PhpBackend())->compare($left, $operator, $right, $leftName, $rightName); + return new PhpBackend()->compare($left, $operator, $right, $leftName, $rightName); } public function isNull(Column $column): Column { - return (new PhpBackend())->isNull($column); + return new PhpBackend()->isNull($column); } public function isNotNull(Column $column): Column { - return (new PhpBackend())->isNotNull($column); + return new PhpBackend()->isNotNull($column); } public function add(Column $left, Column $right): Column { - return (new PhpBackend())->add($left, $right); + return new PhpBackend()->add($left, $right); } public function subtract(Column $left, Column $right): Column { - return (new PhpBackend())->subtract($left, $right); + return new PhpBackend()->subtract($left, $right); } public function multiply(Column $left, Column $right): Column { - return (new PhpBackend())->multiply($left, $right); + return new PhpBackend()->multiply($left, $right); } public function modulo(Column $left, Column $right): Column { - return (new PhpBackend())->modulo($left, $right); + return new PhpBackend()->modulo($left, $right); } public function startsWith(Column $haystack, Column $needle): Column { - return (new PhpBackend())->startsWith($haystack, $needle); + return new PhpBackend()->startsWith($haystack, $needle); } public function endsWith(Column $haystack, Column $needle): Column { - return (new PhpBackend())->endsWith($haystack, $needle); + return new PhpBackend()->endsWith($haystack, $needle); } public function contains(Column $haystack, Column $needle): Column { - return (new PhpBackend())->contains($haystack, $needle); + return new PhpBackend()->contains($haystack, $needle); } /** @@ -90,7 +90,7 @@ public function contains(Column $haystack, Column $needle): Column */ public function sort(Rows $rows, array $columns): Rows { - return (new PhpBackend())->sort($rows, $columns); + return new PhpBackend()->sort($rows, $columns); } /** @@ -98,32 +98,32 @@ public function sort(Rows $rows, array $columns): Rows */ public function sortWorkingBytes(Rows $rows, array $columns): int { - return (new PhpBackend())->sortWorkingBytes($rows, $columns); + return new PhpBackend()->sortWorkingBytes($rows, $columns); } public function groupedTotals(): GroupedTotals { - return (new PhpBackend())->groupedTotals(); + return new PhpBackend()->groupedTotals(); } public function groupedCounts(): GroupedCounts { - return (new PhpBackend())->groupedCounts(); + return new PhpBackend()->groupedCounts(); } public function rowHashes(array $columns, int $count): Column { - return (new PhpBackend())->rowHashes($columns, $count); + return new PhpBackend()->rowHashes($columns, $count); } public function hash(Column $strings, HashAlgorithm $algorithm): Column { - return (new PhpBackend())->hash($strings, $algorithm); + return new PhpBackend()->hash($strings, $algorithm); } public function groupedMultisetHashes(HashAlgorithm $algorithm): GroupedMultisetHashes { - return (new PhpBackend())->groupedMultisetHashes($algorithm); + return new PhpBackend()->groupedMultisetHashes($algorithm); } /** @@ -131,32 +131,32 @@ public function groupedMultisetHashes(HashAlgorithm $algorithm): GroupedMultiset */ public function groupTable(array $columns, Schema $declared): GroupTable { - return (new PhpBackend())->groupTable($columns, $declared); + return new PhpBackend()->groupTable($columns, $declared); } public function partition(Rows $rows, array $keys, int $buckets, int $hashOffset): array { - return (new PhpBackend())->partition($rows, $keys, $buckets, $hashOffset); + return new PhpBackend()->partition($rows, $keys, $buckets, $hashOffset); } public function constant(Definition $definition, mixed $value, int $count): Column { - return (new PhpBackend())->constant($definition, $value, $count); + return new PhpBackend()->constant($definition, $value, $count); } public function decode(Definition $definition, array $buffers, int $count, int $nullCount): Column { - return (new PhpBackend())->decode($definition, $buffers, $count, $nullCount); + return new PhpBackend()->decode($definition, $buffers, $count, $nullCount); } public function decodeFrame(string $body, Schema $schema, Codec $codec): Rows { - return (new PhpBackend())->decodeFrame($body, $schema, $codec); + return new PhpBackend()->decodeFrame($body, $schema, $codec); } public function encodeFrame(Rows $rows, Codec $codec): string { - return (new PhpBackend())->encodeFrame($rows, $codec); + return new PhpBackend()->encodeFrame($rows, $codec); } public function adopt(Definition $definition, Column $column): Column diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/CountingFrameAccumulating.php b/src/core/etl/tests/Flow/ETL/Tests/Double/CountingFrameAccumulating.php index a46b3dcfc7..39698a75ec 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/CountingFrameAccumulating.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/CountingFrameAccumulating.php @@ -41,7 +41,7 @@ public function frameValues(Rows $partition, array $bounds, Backend $backend, Pr { $this->counters()->bounds[] = $bounds; - return (new Sum($this->ref, false))->frameValues($partition, $bounds, $backend, $progress); + return new Sum($this->ref, false)->frameValues($partition, $bounds, $backend, $progress); } public static function fromDescription(#[SensitiveParameter] array $data, Rebuild $rebuild): static @@ -56,7 +56,7 @@ public function describe(): ?Description public function values(Rows $partition, Backend $backend, Progress $progress): array { - return (new FrameAccumulation($this->window()->frame()))->values($this, $partition, $backend, $progress); + return new FrameAccumulation($this->window()->frame())->values($this, $partition, $backend, $progress); } /** diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/DelegatingLauncher.php b/src/core/etl/tests/Flow/ETL/Tests/Double/DelegatingLauncher.php index d08cefa31d..3df69e40b3 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/DelegatingLauncher.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/DelegatingLauncher.php @@ -41,7 +41,7 @@ public function read( return new Launch( 1, $this->rest, - $this->delegated($this->delegated((new StepRunner())->steps( + $this->delegated($this->delegated(new StepRunner()->steps( new PipelineSteps(), $source->extract($context->backend(), $criteria), $context, diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/FailingOnValuesFunction.php b/src/core/etl/tests/Flow/ETL/Tests/Double/FailingOnValuesFunction.php index bcff854cb4..93817151aa 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/FailingOnValuesFunction.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/FailingOnValuesFunction.php @@ -79,7 +79,7 @@ public function eval(Rows $rows, Backend $backend): Column { $this->counters()->evals++; $this->counters()->seen[] = $rows; - $values = (new Parameter($this->operand))->asInts($rows, $backend); + $values = new Parameter($this->operand)->asInts($rows, $backend); foreach ($values as $i => $value) { if (!in_array($value, $this->failing, true)) { @@ -95,7 +95,7 @@ public function eval(Rows $rows, Backend $backend): Column }; } - return (new ResultColumn($backend))->of($this, $values); + return new ResultColumn($backend)->of($this, $values); } /** diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/ReportsResolvedOperand.php b/src/core/etl/tests/Flow/ETL/Tests/Double/ReportsResolvedOperand.php index 3c7c7836ba..c48d282f25 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/ReportsResolvedOperand.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/ReportsResolvedOperand.php @@ -61,7 +61,7 @@ public function withChildren(array $children): static public function eval(Rows $rows, Backend $backend): Column { // @mago-ignore analysis:possibly-invalid-argument - return (new ResultColumn($backend))->of($this, array_fill(0, $rows->count(), $this->operand->resolved())); + return new ResultColumn($backend)->of($this, array_fill(0, $rows->count(), $this->operand->resolved())); } /** diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/ReturnsSpyFunction.php b/src/core/etl/tests/Flow/ETL/Tests/Double/ReturnsSpyFunction.php index 0f74d3e988..7c85a64822 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/ReturnsSpyFunction.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/ReturnsSpyFunction.php @@ -56,7 +56,7 @@ public function describe(): ?Description public function eval(Rows $rows, Backend $backend): Column { // @mago-ignore analysis:possibly-invalid-argument - return (new ResultColumn($backend))->of($this, $rows->isEmpty() ? [] : array_fill(0, $rows->count(), 1)); + return new ResultColumn($backend)->of($this, $rows->isEmpty() ? [] : array_fill(0, $rows->count(), 1)); } /** diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/SpineCopyingRule.php b/src/core/etl/tests/Flow/ETL/Tests/Double/SpineCopyingRule.php index 867115e3c8..5fa53b4255 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/SpineCopyingRule.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/SpineCopyingRule.php @@ -16,7 +16,7 @@ { public function apply(LogicalPlan $plan, Backend $backend): LogicalPlan { - return new LogicalPlan((new TransformUp())->of($plan->root, $this)); + return new LogicalPlan(new TransformUp()->of($plan->root, $this)); } public function of(Node $original, Node $rebuilt): Node diff --git a/src/core/etl/tests/Flow/ETL/Tests/Double/StubLauncher.php b/src/core/etl/tests/Flow/ETL/Tests/Double/StubLauncher.php index b17148aa76..0c28296c33 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Double/StubLauncher.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Double/StubLauncher.php @@ -41,7 +41,7 @@ public function read( FlowContext $context, ?RunCounts $counts = null, ): Launch { - $batches = (new AdoptedBatches($context->backend()))->of($source->extract($context->backend(), $criteria)); + $batches = new AdoptedBatches($context->backend())->of($source->extract($context->backend(), $criteria)); foreach ($this->workers as $pid => $peakBytes) { $counts?->worker($pid, $peakBytes); @@ -50,7 +50,7 @@ public function read( return new Launch( $this->consumed, $this->rest, - (new StepRunner())->steps( + new StepRunner()->steps( $this->steps, $counts === null ? $batches : $counts->count($source, $batches, $criteria->narrows()), $context, diff --git a/src/core/etl/tests/Flow/ETL/Tests/Fixtures/Floe/v2/all-column-types.floe b/src/core/etl/tests/Flow/ETL/Tests/Fixtures/Floe/v2/all-column-types.floe index 14876f23ea..a024f72bb6 100644 Binary files a/src/core/etl/tests/Flow/ETL/Tests/Fixtures/Floe/v2/all-column-types.floe and b/src/core/etl/tests/Flow/ETL/Tests/Fixtures/Floe/v2/all-column-types.floe differ diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/API/Config/Bucketing/BucketingConfigBuilderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/API/Config/Bucketing/BucketingConfigBuilderTest.php index 8424e7d547..7c43596278 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/API/Config/Bucketing/BucketingConfigBuilderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/API/Config/Bucketing/BucketingConfigBuilderTest.php @@ -20,7 +20,7 @@ public function test_build_uses_the_given_spill_root_for_the_default_storage(): { $spillRoot = $this->cacheDir->suffix('/spill-root'); - (new BucketingConfigBuilder('/flow-php-sort/', 64)) + new BucketingConfigBuilder('/flow-php-sort/', 64) ->build($spillRoot, new PhpBackend()) ->storage->append('bucket-1', array_to_rows([['id' => 1]], schema(int_schema('id')))); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/GroupByAggregationTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/GroupByAggregationTest.php index 735e283e90..0794e0a68b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/GroupByAggregationTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/GroupByAggregationTest.php @@ -306,7 +306,7 @@ public function test_partition_count_does_not_affect_a_realistic_dataset(): void 'email' => $order['email'], 'discount' => $order['discount'], ], - iterator_to_array((new FakeRandomOrdersExtractor(1000))->rawData(), false), + iterator_to_array(new FakeRandomOrdersExtractor(1000)->rawData(), false), ); // one schema per spill file: declare the source schema so a null discount carries a diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/JoinCrossTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/JoinCrossTest.php index 9e700db115..cccd7d9f78 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/JoinCrossTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/JoinCrossTest.php @@ -152,9 +152,7 @@ public function test_the_runtime_reads_the_right_plan_once_over_every_left_batch static::assertCount( 3, df() - ->read((new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)))->withBatchSize( - 1, - )) + ->read(new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))->withBatchSize(1)) ->crossJoin(df()->read($right)) ->fetch(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/JoinTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/JoinTest.php index 51fd9e7c62..e1851d3ded 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/JoinTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/JoinTest.php @@ -80,9 +80,7 @@ public function test_a_limit_after_a_resident_join_closes_the_loaders_before_it( static::assertCount( 2, df() - ->read((new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(10)))->withBatchSize( - 1, - )) + ->read(new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(10))->withBatchSize(1)) ->write($loader) ->join( df()->read(from_rows(RowsMother::sequentialIds(10))), @@ -583,9 +581,7 @@ public function test_the_runtime_reads_the_right_plan_once(): void static::assertCount( 3, df() - ->read((new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)))->withBatchSize( - 1, - )) + ->read(new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))->withBatchSize(1)) ->join(df()->read($right), join_on(['id' => 'id'], 'r_'), JoinType::inner) ->fetch(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/LimitBatchingTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/LimitBatchingTest.php index dd6284950d..09ada743a7 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/LimitBatchingTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/DataFrame/LimitBatchingTest.php @@ -29,10 +29,9 @@ public function test_limit_returns_exactly_n_rows_for_any_batch_size(int $batchS static::assertSame( min($limit, 2000), data_frame() - ->read((new CountingExtractor( - schema(int_schema('id')), - RowsMother::sequentialIds(2000), - ))->withBatchSize($batchSize)) + ->read(new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(2000))->withBatchSize( + $batchSize, + )) ->limit($limit) ->fetch() ->count(), @@ -48,7 +47,7 @@ public function test_limit_returns_exactly_n_rows_for_any_batch_size(int $batchS #[TestWith([1000, 1001])] public function test_limit_stops_the_source_within_one_batch(int $batchSize, int $limit): void { - $extractor = (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(2000)))->withBatchSize( + $extractor = new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(2000))->withBatchSize( $batchSize, ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/ArrayExpandTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/ArrayExpandTest.php index 258dcb79ff..71b21b16ef 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/ArrayExpandTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/ArrayExpandTest.php @@ -218,10 +218,7 @@ public function test_explain_shows_the_columns_an_expand_keeps(): void ->select('item') ->explain(); - static::assertStringContainsString( - 'Keeps: item', - (new Explain())->of($plan->planner->optimize($plan->logical)), - ); + static::assertStringContainsString('Keeps: item', new Explain()->of($plan->planner->optimize($plan->logical))); } public function test_expand_nested_in_a_structure_gives_one_row_per_element(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/ArrayKeysStyleConvertTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/ArrayKeysStyleConvertTest.php index 88ebdd2b52..928d1a705e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/ArrayKeysStyleConvertTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/ArrayKeysStyleConvertTest.php @@ -44,7 +44,7 @@ public function test_array_keys_style_convert_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "string".'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( array_keys_style_convert(ref('string'), 'camel'), [ 'string' => 'test', diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/DOMElementNextSiblingTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/DOMElementNextSiblingTest.php index 102347d595..b844916785 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/DOMElementNextSiblingTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/DOMElementNextSiblingTest.php @@ -7,7 +7,6 @@ use DOMDocument; use DOMElement; use Flow\ETL\Tests\FlowTestCase; -use PHPUnit\Framework\Attributes\RequiresPhp; use function Flow\ETL\DSL\array_to_rows; use function Flow\ETL\DSL\df; @@ -22,7 +21,6 @@ final class DOMElementNextSiblingTest extends FlowTestCase { - #[RequiresPhp('>= 8.4.0')] public function test_dom_element_sibling_text_value(): void { static::assertSame( @@ -47,7 +45,6 @@ public function test_dom_element_sibling_text_value(): void ); } - #[RequiresPhp('>= 8.4.0')] public function test_dom_element_sibling_text_value_when_only_element_is_allowed(): void { static::assertSame( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/DOMElementParentTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/DOMElementParentTest.php index 0e790b1518..f27dfced2f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/DOMElementParentTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/DOMElementParentTest.php @@ -5,7 +5,6 @@ namespace Flow\ETL\Tests\Integration\Functions; use Flow\ETL\Tests\FlowTestCase; -use PHPUnit\Framework\Attributes\RequiresPhp; use function Flow\ETL\DSL\array_to_rows; use function Flow\ETL\DSL\df; @@ -17,7 +16,6 @@ final class DOMElementParentTest extends FlowTestCase { - #[RequiresPhp('>= 8.4.0')] public function test_dom_element_value_from_dom_document(): void { static::assertSame( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/DOMElementPreviousSiblingTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/DOMElementPreviousSiblingTest.php index 3b347127b3..4c6297f9b2 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/DOMElementPreviousSiblingTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/DOMElementPreviousSiblingTest.php @@ -6,7 +6,6 @@ use DOMDocument; use Flow\ETL\Tests\FlowTestCase; -use PHPUnit\Framework\Attributes\RequiresPhp; use function Flow\ETL\DSL\array_to_rows; use function Flow\ETL\DSL\df; @@ -20,7 +19,6 @@ final class DOMElementPreviousSiblingTest extends FlowTestCase { - #[RequiresPhp('>= 8.4.0')] public function test_dom_element_sibling_text_value(): void { static::assertSame( @@ -45,7 +43,6 @@ public function test_dom_element_sibling_text_value(): void ); } - #[RequiresPhp('>= 8.4.0')] public function test_dom_element_sibling_text_value_when_only_element_is_allowed(): void { static::assertSame( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/HTMLQuerySelectorAllTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/HTMLQuerySelectorAllTest.php index ec3fd9c7c1..2a3c61d216 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/HTMLQuerySelectorAllTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/HTMLQuerySelectorAllTest.php @@ -5,7 +5,6 @@ namespace Flow\ETL\Tests\Integration\Functions; use Dom\HTMLDocument; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\ETL\DSL\array_to_rows; @@ -18,8 +17,6 @@ use const LIBXML_HTML_NOIMPLIED; use const LIBXML_NOERROR; -// @mago-ignore analysis:unavailable-method -#[RequiresPhp('>= 8.4.0')] final class HTMLQuerySelectorAllTest extends TestCase { public function test_invalid_query_all_on_html_document(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/HTMLQuerySelectorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/HTMLQuerySelectorTest.php index 25fb8585e8..f209403213 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/HTMLQuerySelectorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/HTMLQuerySelectorTest.php @@ -5,7 +5,6 @@ namespace Flow\ETL\Tests\Integration\Functions; use Dom\HTMLDocument; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\ETL\DSL\array_to_rows; @@ -15,8 +14,6 @@ use function Flow\ETL\DSL\ref; use function Flow\ETL\DSL\schema; -// @mago-ignore analysis:unavailable-method -#[RequiresPhp('>= 8.4.0')] final class HTMLQuerySelectorTest extends TestCase { public function test_invalid_query_on_html_document(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/ListSelectTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/ListSelectTest.php index 184e82a0b1..3dfec1e078 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/ListSelectTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/ListSelectTest.php @@ -24,7 +24,7 @@ public function test_selection_order_and_optional_flags_are_preserved(): void { static::assertSame( '?list', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( list_ref('list')->select('b', 'a'), schema(list_schema( @@ -45,7 +45,7 @@ public function test_selecting_a_numeric_element_name_by_its_string_form(): void { static::assertSame( '?list', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( list_ref('list')->select('0'), schema(list_schema('list', type_list(type_structure([0 => type_integer(), 'b' => type_string()])))), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/StructureSelectTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/StructureSelectTest.php index 5449c0dfa1..0d5164ca47 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/StructureSelectTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Functions/StructureSelectTest.php @@ -23,7 +23,7 @@ public function test_selection_order_and_optional_flags_are_preserved(): void { static::assertSame( '?structure{b?: string, a: integer}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( structure_ref('user')->select('b', 'a'), schema(structure_schema('user', type_structure([ @@ -41,7 +41,7 @@ public function test_selecting_a_numeric_element_name_by_its_string_form(): void { static::assertSame( '?structure{0: integer}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( structure_ref('user')->select('0'), schema(structure_schema('user', type_structure([0 => type_integer(), 'b' => type_string()]))), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/FileFormatContractTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/FileFormatContractTest.php index 251a818ff4..9a754da322 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/FileFormatContractTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/FileFormatContractTest.php @@ -30,109 +30,109 @@ public static function formats(): Generator #[DataProvider('formats')] public function test_overwrite_replaces_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->overwriteReplacesWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->overwriteReplacesWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_append_keeps_what_the_destination_held(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->appendKeepsWhatTheDestinationHeld($format); + new FileFormatContract($this->cacheDir)->appendKeepsWhatTheDestinationHeld($format); } #[DataProvider('formats')] public function test_ignore_leaves_an_existing_destination_untouched(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->ignoreLeavesAnExistingDestinationUntouched($format); + new FileFormatContract($this->cacheDir)->ignoreLeavesAnExistingDestinationUntouched($format); } #[DataProvider('formats')] public function test_exception_if_exists_refuses_an_existing_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->exceptionIfExistsRefusesAnExistingDestination($format); + new FileFormatContract($this->cacheDir)->exceptionIfExistsRefusesAnExistingDestination($format); } #[DataProvider('formats')] public function test_a_batch_of_zero_rows_creates_no_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aBatchOfZeroRowsCreatesNoFile($format); + new FileFormatContract($this->cacheDir)->aBatchOfZeroRowsCreatesNoFile($format); } #[DataProvider('formats')] public function test_a_write_that_ends_reports_its_file_operations(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aWriteThatEndsReportsItsFileOperations($format); + new FileFormatContract($this->cacheDir)->aWriteThatEndsReportsItsFileOperations($format); } #[DataProvider('formats')] public function test_a_partitioned_write_reads_back_every_partition(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPartitionedWriteReadsBackEveryPartition($format); + new FileFormatContract($this->cacheDir)->aPartitionedWriteReadsBackEveryPartition($format); } #[DataProvider('formats')] public function test_a_loader_in_a_task_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderInATaskSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->aLoaderInATaskSurvivesDescribe($format); } #[DataProvider('formats')] public function test_an_extractor_reader_survives_describe(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorReaderSurvivesDescribe($format); + new FileFormatContract($this->cacheDir)->anExtractorReaderSurvivesDescribe($format); } #[DataProvider('formats')] public function test_the_splits_read_every_row_once(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theSplitsReadEveryRowOnce($format); + new FileFormatContract($this->cacheDir)->theSplitsReadEveryRowOnce($format); } #[DataProvider('formats')] public function test_metadata_columns_name_the_source_file(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->metadataColumnsNameTheSourceFile($format); + new FileFormatContract($this->cacheDir)->metadataColumnsNameTheSourceFile($format); } #[DataProvider('formats')] public function test_the_batch_size_bounds_every_batch(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->theBatchSizeBoundsEveryBatch($format); + new FileFormatContract($this->cacheDir)->theBatchSizeBoundsEveryBatch($format); } #[DataProvider('formats')] public function test_refresh_lists_the_files_written_after_a_read(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->refreshListsTheFilesWrittenAfterARead($format); + new FileFormatContract($this->cacheDir)->refreshListsTheFilesWrittenAfterARead($format); } #[DataProvider('formats')] public function test_a_failed_run_leaves_no_file_at_the_destination(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aFailedRunLeavesNoFileAtTheDestination($format); + new FileFormatContract($this->cacheDir)->aFailedRunLeavesNoFileAtTheDestination($format); } #[DataProvider('formats')] public function test_an_extractor_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->anExtractorRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_a_loader_rejects_a_path_its_filesystem_does_not_serve(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); + new FileFormatContract($this->cacheDir)->aLoaderRejectsAPathItsFilesystemDoesNotServe($format); } #[DataProvider('formats')] public function test_reads_back_through_the_same_filesystem_instance(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->readsBackThroughTheSameFilesystemInstance($format); + new FileFormatContract($this->cacheDir)->readsBackThroughTheSameFilesystemInstance($format); } #[DataProvider('formats')] public function test_a_pushed_filter_returns_what_the_filter_node_returns(FileFormat $format): void { - (new FileFormatContract($this->cacheDir))->aPushedFilterReturnsWhatTheFilterNodeReturns( + new FileFormatContract($this->cacheDir)->aPushedFilterReturnsWhatTheFilterNodeReturns( $format, ref('id')->notEquals(lit('b')), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/Floe/FloeSplitReadTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/Floe/FloeSplitReadTest.php index 5da3906962..4d85ac93be 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/Floe/FloeSplitReadTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/Floe/FloeSplitReadTest.php @@ -68,7 +68,7 @@ public function test_a_sized_split_is_read_without_listing(): void FlowTestCase::extracted( $reader, flow_context()->backend(), - (new Criteria())->withSplit(new FileSplit($file, 0, null, $size)), + new Criteria()->withSplit(new FileSplit($file, 0, null, $size)), ), false, ), @@ -90,7 +90,7 @@ public function test_an_unsized_split_lists_its_path(): void iterator_to_array(FlowTestCase::extracted( $reader, flow_context()->backend(), - (new Criteria())->withSplit(new FileSplit(path('memory://a.floe'), 0, null)), + new Criteria()->withSplit(new FileSplit(path('memory://a.floe'), 0, null)), )); static::assertSame($listedBySchema + 1, $counting->listCalls); @@ -131,7 +131,7 @@ public function test_the_limit_travels_with_the_split(): void FlowTestCase::extracted( from_floe(path('memory://a.floe'), filesystem: $memory)->reader(), flow_context()->backend(), - (new Criteria(3))->withSplit(new FileSplit(path('memory://a.floe'), 0, null)), + new Criteria(3)->withSplit(new FileSplit(path('memory://a.floe'), 0, null)), ), false, )[0]->count(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/Loader/File/FileCommit/FileCommitTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/Loader/File/FileCommit/FileCommitTest.php index 3d83149a2f..e0af4b3b39 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/Loader/File/FileCommit/FileCommitTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/Loader/File/FileCommit/FileCommitTest.php @@ -210,7 +210,7 @@ public function test_scan(): void ]); static::assertCount(4, iterator_to_array( - (new FileListing($this->fs))->list($this->context->path(__FUNCTION__ . '/**/*.txt'), new KeepAll()), + new FileListing($this->fs)->list($this->context->path(__FUNCTION__ . '/**/*.txt'), new KeepAll()), false, )); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/Loader/File/FileCommit/Partitioned/PartitionPlaceholdersTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/Loader/File/FileCommit/Partitioned/PartitionPlaceholdersTest.php index dd42050fad..75a690cfb5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/Loader/File/FileCommit/Partitioned/PartitionPlaceholdersTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/IO/Loader/File/FileCommit/Partitioned/PartitionPlaceholdersTest.php @@ -64,7 +64,7 @@ public function test_list_attaches_partitions_from_placeholders(): void ]); $listed = iterator_to_array( - (new FileListing($this->fs))->list( + new FileListing($this->fs)->list( $this->context->path(__FUNCTION__ . '/order-year=*/{order-name}.csv'), new OnlyFiles(), ), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/FilesystemRowsStorageTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/FilesystemRowsStorageTest.php index a33e1dc4b2..da9ca37aa8 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/FilesystemRowsStorageTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/FilesystemRowsStorageTest.php @@ -82,9 +82,7 @@ public function test_remove_of_a_missing_bucket_is_a_no_op(): void { $cacheDir = path(__DIR__ . '/var/buckets_remove_missing'); $this->fs()->rm($cacheDir); - (new FilesystemRowsStorage($this->fs(), cacheDir: $cacheDir, backend: new PhpBackend()))->remove( - 'never-written', - ); + new FilesystemRowsStorage($this->fs(), cacheDir: $cacheDir, backend: new PhpBackend())->remove('never-written'); static::assertNull($this->fs()->status($cacheDir)); } @@ -267,11 +265,11 @@ public function test_get_missing_bucket_yields_nothing(): void static::assertSame( [], - RowsStorageContext::rows((new FilesystemRowsStorage( + RowsStorageContext::rows(new FilesystemRowsStorage( $this->fs(), cacheDir: $cacheDir, backend: new PhpBackend(), - ))->get('nope')), + )->get('nope')), ); } @@ -481,7 +479,7 @@ public function test_append_resume_with_a_genuinely_different_column_set_still_t { $path = $this->cacheDir->suffix('resume-different-columns.floe'); - $writer = (new FloeFiles($this->fs(), new AdaptiveBackend()))->create( + $writer = new FloeFiles($this->fs(), new AdaptiveBackend())->create( $path, ($first = array_to_rows( [['id' => 1, 'name' => 'x']], @@ -493,10 +491,7 @@ public function test_append_resume_with_a_genuinely_different_column_set_still_t $this->expectException(IncompatibleSchemaException::class); - (new FloeFiles($this->fs(), new AdaptiveBackend()))->append($path, schema( - int_schema('id'), - str_schema('city'), - )); + new FloeFiles($this->fs(), new AdaptiveBackend())->append($path, schema(int_schema('id'), str_schema('city'))); } public function test_datetime_values_read_back_as_admitted(): void @@ -547,11 +542,11 @@ public function test_close_finishes_a_bucket_so_a_fresh_store_can_read_it(): voi static::assertCount( 2, - RowsStorageContext::rows((new FilesystemRowsStorage( + RowsStorageContext::rows(new FilesystemRowsStorage( $this->fs(), cacheDir: $cacheDir, backend: new PhpBackend(), - ))->get('bucket')), + )->get('bucket')), ); $this->fs()->rm($cacheDir); @@ -560,12 +555,12 @@ public function test_close_finishes_a_bucket_so_a_fresh_store_can_read_it(): voi public function test_a_store_over_the_local_filesystem_describes_its_root_and_batch_size(): void { $cacheDir = path(__DIR__ . '/var/buckets_describe'); - $description = (new FilesystemRowsStorage( + $description = new FilesystemRowsStorage( $this->fs(), cacheDir: $cacheDir, backend: new PhpBackend(), batchSize: 7, - ))->describe(); + )->describe(); static::assertNotNull($description); static::assertTrue($description->sensitive()); @@ -576,22 +571,22 @@ public function test_a_store_over_the_local_filesystem_describes_its_root_and_ba public function test_a_backend_that_does_not_describe_makes_the_storage_undescribable(): void { static::assertNull( - (new FilesystemRowsStorage( + new FilesystemRowsStorage( $this->fs(), cacheDir: path(__DIR__ . '/var/buckets_describe'), backend: new AcceptingBackend(), - ))->describe(), + )->describe(), ); } public function test_a_store_over_a_memory_filesystem_does_not_describe(): void { static::assertNull( - (new FilesystemRowsStorage( + new FilesystemRowsStorage( memory_filesystem(), cacheDir: path('memory://cache'), backend: new PhpBackend(), - ))->describe(), + )->describe(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/Floe/FloeStatisticsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/Floe/FloeStatisticsTest.php index 691f2ecb31..48eb84579e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/Floe/FloeStatisticsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/Floe/FloeStatisticsTest.php @@ -74,7 +74,7 @@ public function test_a_multi_section_file_sums_its_sections(): void FloeStreamReaderContext::write($this->fs(), $path, array_to_rows([['id' => 1]], schema(int_schema('id')))); foreach ([[2, 3], [4, 5, 6]] as $ids) { - $writer = (new FloeFiles($this->fs(), new AdaptiveBackend()))->append($path, schema(int_schema('id'))); + $writer = new FloeFiles($this->fs(), new AdaptiveBackend())->append($path, schema(int_schema('id'))); foreach ($ids as $id) { $writer->write(array_to_rows([['id' => $id]], schema(int_schema('id')))); @@ -117,7 +117,7 @@ public function test_an_appended_file_reports_the_combined_totals(): void FloeStreamReaderContext::write($this->fs(), $path, array_to_rows([['id' => 1]], schema(int_schema('id')))); $before = FloeStreamReaderContext::footer($this->fs(), $path)->statistics->byteSize; - $writer = (new FloeFiles($this->fs(), new AdaptiveBackend()))->append($path, schema(int_schema('id'))); + $writer = new FloeFiles($this->fs(), new AdaptiveBackend())->append($path, schema(int_schema('id'))); $writer->write(array_to_rows([['id' => 2], ['id' => 3]], schema(int_schema('id')))); $writer->close(); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/Floe/FloeStreamReaderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/Floe/FloeStreamReaderTest.php index 2bf6a471f1..a259409b05 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/Floe/FloeStreamReaderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/Floe/FloeStreamReaderTest.php @@ -28,7 +28,7 @@ public function test_merged_multi_schema_file_reads_seamlessly(): void $fileThree = $this->cacheDir->suffix('evolving-3.floe'); $rowsOne = array_to_rows([['id' => 1]], schema(int_schema('id'))); - $writer = (new FloeFiles($this->fs(), new AdaptiveBackend()))->create($fileOne, $rowsOne->schema()); + $writer = new FloeFiles($this->fs(), new AdaptiveBackend())->create($fileOne, $rowsOne->schema()); $writer->write($rowsOne); $writer->close(); @@ -36,7 +36,7 @@ public function test_merged_multi_schema_file_reads_seamlessly(): void [['id' => 2, 'email' => null]], schema(int_schema('id'), str_schema('email', nullable: true)), ); - $writer = (new FloeFiles($this->fs(), new AdaptiveBackend()))->create($fileTwo, $rowsTwo->schema()); + $writer = new FloeFiles($this->fs(), new AdaptiveBackend())->create($fileTwo, $rowsTwo->schema()); $writer->write($rowsTwo); $writer->close(); @@ -44,13 +44,13 @@ public function test_merged_multi_schema_file_reads_seamlessly(): void [['id' => 3, 'email' => 'third@flow.php']], schema(int_schema('id'), str_schema('email')), ); - $writer = (new FloeFiles($this->fs(), new AdaptiveBackend()))->create($fileThree, $rowsThree->schema()); + $writer = new FloeFiles($this->fs(), new AdaptiveBackend())->create($fileThree, $rowsThree->schema()); $writer->write($rowsThree); $writer->close(); - (new FloeMerger($this->fs(), new AdaptiveBackend()))->merge([$fileOne, $fileTwo, $fileThree], $path); + new FloeMerger($this->fs(), new AdaptiveBackend())->merge([$fileOne, $fileTwo, $fileThree], $path); - $reader = (new FloeFiles($this->fs(), new AdaptiveBackend()))->read($path); + $reader = new FloeFiles($this->fs(), new AdaptiveBackend())->read($path); static::assertSame(3, $reader->totalRows()); @@ -74,7 +74,7 @@ public function test_a_file_of_many_frames_round_trips(): void [['id' => 0, 'payload' => str_pad('row_0', 300, 'x')]], schema(int_schema('id'), str_schema('payload')), )->schema(); - $writer = (new FloeFiles($this->fs(), new AdaptiveBackend()))->create($path, $schema); + $writer = new FloeFiles($this->fs(), new AdaptiveBackend())->create($path, $schema); $written = 0; for ($i = 0; $i < 4000; $i++) { @@ -89,7 +89,7 @@ public function test_a_file_of_many_frames_round_trips(): void $read = 0; - foreach ((new FloeFiles($this->fs(), new AdaptiveBackend(), chunkSize: 4096)) + foreach (new FloeFiles($this->fs(), new AdaptiveBackend(), chunkSize: 4096) ->read($path) ->rows(500) as $batch) { foreach ($batch->toArray() as $row) { @@ -106,12 +106,12 @@ public function test_round_trip_of_all_column_types_through_local_filesystem(): $rows = RowsMother::withAllColumnTypes(); $path = $this->cacheDir->suffix('all-types.floe'); - $writer = (new FloeFiles($this->fs(), new AdaptiveBackend()))->create($path, $rows->schema()); + $writer = new FloeFiles($this->fs(), new AdaptiveBackend())->create($path, $rows->schema()); $writer->write($rows); $writer->close(); $batches = iterator_to_array( - (new FloeFiles($this->fs(), new AdaptiveBackend())) + new FloeFiles($this->fs(), new AdaptiveBackend()) ->read($path) ->rows(), ); @@ -125,13 +125,13 @@ public function test_round_trip_of_heterogeneous_rows_through_local_filesystem() $rows = RowsMother::heterogeneous(); $path = $this->cacheDir->suffix('heterogeneous.floe'); - $writer = (new FloeFiles($this->fs(), new AdaptiveBackend()))->create($path, $rows->schema()); + $writer = new FloeFiles($this->fs(), new AdaptiveBackend())->create($path, $rows->schema()); $writer->write($rows); $writer->close(); $read = 0; - foreach ((new FloeFiles($this->fs(), new AdaptiveBackend())) + foreach (new FloeFiles($this->fs(), new AdaptiveBackend()) ->read($path) ->rows() as $batch) { $read += $batch->count(); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/Floe/FloeWriteContractTest.php b/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/Floe/FloeWriteContractTest.php index 674e567a89..58ffc8be88 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/Floe/FloeWriteContractTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Integration/Storage/Floe/FloeWriteContractTest.php @@ -60,7 +60,7 @@ public function test_the_writer_rejects_the_value_with_the_message( string $expectedMessage, ): void { $path = $this->cacheDir->suffix('contract-' . md5($expectedMessage) . '.floe'); - $writer = (new FloeFiles($this->fs(), new AdaptiveBackend(), new Options()))->create($path, $schema); + $writer = new FloeFiles($this->fs(), new AdaptiveBackend(), new Options())->create($path, $schema); try { $writer->write($batch); @@ -81,7 +81,7 @@ public function test_the_writer_rejects_the_value_with_the_message( public function test_a_rejected_batch_leaves_previously_written_rows_readable(): void { $path = $this->cacheDir->suffix('contract-survivor.floe'); - $writer = (new FloeFiles($this->fs(), new AdaptiveBackend(), new Options()))->create( + $writer = new FloeFiles($this->fs(), new AdaptiveBackend(), new Options())->create( $path, schema(int_schema('id')), ); @@ -101,7 +101,7 @@ public function test_a_rejected_batch_leaves_previously_written_rows_readable(): public function test_a_batch_omitting_a_nullable_column_still_writes(): void { $path = $this->cacheDir->suffix('contract-absent.floe'); - $writer = (new FloeFiles($this->fs(), new AdaptiveBackend(), new Options()))->create($path, schema( + $writer = new FloeFiles($this->fs(), new AdaptiveBackend(), new Options())->create($path, schema( int_schema('id'), str_schema('name', nullable: true), )); @@ -125,7 +125,7 @@ public function test_a_batch_omitting_a_nullable_column_still_writes(): void public function test_a_batch_omitting_a_not_null_column_is_refused(): void { $path = $this->cacheDir->suffix('contract-absent-not-null.floe'); - $writer = (new FloeFiles($this->fs(), new AdaptiveBackend(), new Options()))->create($path, schema( + $writer = new FloeFiles($this->fs(), new AdaptiveBackend(), new Options())->create($path, schema( int_schema('id'), str_schema('name'), )); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Mother/ColumnMother.php b/src/core/etl/tests/Flow/ETL/Tests/Mother/ColumnMother.php index 01fb06f3c7..0e13d45201 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Mother/ColumnMother.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Mother/ColumnMother.php @@ -16,7 +16,7 @@ final class ColumnMother */ public static function of(Definition $definition, array $values): Column { - $builder = (new PhpBackend())->builder($definition); + $builder = new PhpBackend()->builder($definition); $builder->appendMany($values); return $builder->finish(); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Mother/PartitionedSourceMother.php b/src/core/etl/tests/Flow/ETL/Tests/Mother/PartitionedSourceMother.php index c84d9e4526..5a18d541b7 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Mother/PartitionedSourceMother.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Mother/PartitionedSourceMother.php @@ -23,13 +23,13 @@ public static function partitions(): Schema public static function yearMonth(): RecordingFileExtractor { - return (new RecordingFileExtractor( + return new RecordingFileExtractor( schema(int_schema('year'), str_schema('month'), str_schema('value')), array_to_rows( [['year' => 2023, 'month' => '07', 'value' => 'a'], ['year' => 2024, 'month' => '08', 'value' => 'b']], schema(int_schema('year'), str_schema('month'), str_schema('value')), ), - ))->withPartitionSchema(self::partitions()); + )->withPartitionSchema(self::partitions()); } public static function file(string $partitions): FileStatus diff --git a/src/core/etl/tests/Flow/ETL/Tests/Mother/RowsMother.php b/src/core/etl/tests/Flow/ETL/Tests/Mother/RowsMother.php index 2ab2c06645..8753baf69a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Mother/RowsMother.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Mother/RowsMother.php @@ -19,6 +19,8 @@ use function Flow\ETL\DSL\datetime_schema; use function Flow\ETL\DSL\enum_schema; use function Flow\ETL\DSL\float_schema; +use function Flow\ETL\DSL\html_element_schema; +use function Flow\ETL\DSL\html_schema; use function Flow\ETL\DSL\int_schema; use function Flow\ETL\DSL\json_schema; use function Flow\ETL\DSL\list_schema; @@ -34,6 +36,8 @@ use function Flow\ETL\DSL\xml_schema; use function Flow\Types\DSL\structure_element; use function Flow\Types\DSL\type_boolean; +use function Flow\Types\DSL\type_html; +use function Flow\Types\DSL\type_html_element; use function Flow\Types\DSL\type_integer; use function Flow\Types\DSL\type_json; use function Flow\Types\DSL\type_list; @@ -150,7 +154,7 @@ public static function numbered(int $count): Rows static fn(int $id) => [ 'id' => $id, 'name' => ($id % 4) === 0 ? null : 'user_' . $id, - 'at' => (new DateTimeImmutable('2026-01-01 00:00:00.000001 +00:00'))->modify("+{$id} hours"), + 'at' => new DateTimeImmutable('2026-01-01 00:00:00.000001 +00:00')->modify("+{$id} hours"), ], range(1, $count), ), @@ -166,9 +170,6 @@ public static function heterogeneous(): Rows ); } - /** - * Every column type except html/html_element, which require PHP 8.4. - */ public static function withAllColumnTypes(): Rows { $structure = type_structure([ @@ -212,6 +213,8 @@ public static function withAllColumnTypes(): Rows 'structure_interleaved' => $interleaved->cast(['z' => 1, 'b' => 'x']), 'xml' => type_xml()->cast('text & entity'), 'xml_element' => type_xml_element()->cast('value'), + 'html' => type_html()->cast('

hi

'), + 'html_element' => type_html_element()->cast('

hi

'), ]], schema( int_schema('int'), @@ -240,6 +243,8 @@ enum_schema('enum_basic', BasicEnum::class), structure_schema('structure_interleaved', $interleaved), xml_schema('xml'), xml_element_schema('xml_element'), + html_schema('html'), + html_element_schema('html_element'), ), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/API/Config/Bucketing/BucketingConfigBuilderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/API/Config/Bucketing/BucketingConfigBuilderTest.php index 9a1f65d352..926c274a9f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/API/Config/Bucketing/BucketingConfigBuilderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/API/Config/Bucketing/BucketingConfigBuilderTest.php @@ -25,12 +25,12 @@ public function test_batch_size_below_one_is_rejected(): void $this->expectExceptionMessage('Batch size must be at least 1'); // @mago-ignore analysis:invalid-argument - (new BucketingConfigBuilder('/flow-php-join/', 64))->batchSize(0); + new BucketingConfigBuilder('/flow-php-join/', 64)->batchSize(0); } public function test_buckets_count_and_batch_size_are_set(): void { - $config = (new BucketingConfigBuilder('/flow-php-join/', 64)) + $config = new BucketingConfigBuilder('/flow-php-join/', 64) ->bucketsCount(4) ->batchSize(250) ->build(Path::realpath(__DIR__), new PhpBackend()); @@ -45,12 +45,12 @@ public function test_buckets_count_below_one_is_rejected(): void $this->expectExceptionMessage('Buckets count must be greater than 0'); // @mago-ignore analysis:invalid-argument - (new BucketingConfigBuilder('/flow-php-join/', 64))->bucketsCount(0); + new BucketingConfigBuilder('/flow-php-join/', 64)->bucketsCount(0); } public function test_default_builds_a_filesystem_buckets_storage(): void { - $config = (new BucketingConfigBuilder('/flow-php-join/', 64))->build(Path::realpath(__DIR__), new PhpBackend()); + $config = new BucketingConfigBuilder('/flow-php-join/', 64)->build(Path::realpath(__DIR__), new PhpBackend()); static::assertInstanceOf(FilesystemRowsStorage::class, $config->storage); static::assertSame(64, $config->bucketsCount); @@ -61,7 +61,7 @@ public function test_default_buckets_count_comes_from_the_constructor(): void { static::assertSame( 100, - (new BucketingConfigBuilder('/flow-php-sort/', 100))->build( + new BucketingConfigBuilder('/flow-php-sort/', 100)->build( Path::realpath(__DIR__), new PhpBackend(), )->bucketsCount, @@ -72,7 +72,7 @@ public function test_memory_limit_defaults_to_the_process_default(): void { static::assertSame( MemoryLimit::default()->inBytes(), - (new BucketingConfigBuilder('/flow-php-join/', 64)) + new BucketingConfigBuilder('/flow-php-join/', 64) ->build(Path::realpath(__DIR__), new PhpBackend()) ->memoryLimit->inBytes(), ); @@ -82,7 +82,7 @@ public function test_memory_limit_is_set(): void { static::assertSame( Unit::fromMb(128)->inBytes(), - (new BucketingConfigBuilder('/flow-php-join/', 64)) + new BucketingConfigBuilder('/flow-php-join/', 64) ->memoryLimit(Unit::fromMb(128)) ->build(Path::realpath(__DIR__), new PhpBackend()) ->memoryLimit->inBytes(), @@ -94,7 +94,7 @@ public function test_memory_limit_below_one_byte_is_rejected(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Bucketing memory limit must be greater than 0 bytes'); - (new BucketingConfigBuilder('/flow-php-join/', 64))->memoryLimit(Unit::fromBytes(0)); + new BucketingConfigBuilder('/flow-php-join/', 64)->memoryLimit(Unit::fromBytes(0)); } public function test_group_by_and_repartition_defaults_are_64_buckets_of_1000_rows_on_the_filesystem(): void @@ -114,7 +114,7 @@ public function test_injected_storage_wins_over_the_default(): void static::assertSame( $storage, - (new BucketingConfigBuilder('/flow-php-join/', 64)) + new BucketingConfigBuilder('/flow-php-join/', 64) ->storage($storage) ->build(Path::realpath(__DIR__), new PhpBackend()) ->storage, diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/API/DataFrameTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/API/DataFrameTest.php index 802934b9e7..8a140ecc68 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/API/DataFrameTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/API/DataFrameTest.php @@ -1486,7 +1486,7 @@ public function test_for_each_receives_every_batch(): void public function test_explain_prints_the_logical_plan_without_reading_a_row(): void { - $extractor = (new RecordingFileExtractor(schema(int_schema('id'))))->withPruning(); + $extractor = new RecordingFileExtractor(schema(int_schema('id')))->withPruning(); static::assertSame(<<<'PLAN' #2 Write preserving · opaque diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/API/TransformationsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/API/TransformationsTest.php index 743b5f3fe0..19444c0516 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/API/TransformationsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/API/TransformationsTest.php @@ -25,7 +25,7 @@ public function test_transformations(): void $transformation1->expects(self::once())->method('__invoke')->with($dataFrame)->willReturn($dataFrame); $transformation2->expects(self::once())->method('__invoke')->with($dataFrame)->willReturn($dataFrame); - static::assertSame($dataFrame, (new Transformations($transformation1, $transformation2))($dataFrame)); + static::assertSame($dataFrame, new Transformations($transformation1, $transformation2)($dataFrame)); } public function test_invoking_transformations_gives_the_rows_of_with(): void @@ -33,7 +33,7 @@ public function test_invoking_transformations_gives_the_rows_of_with(): void $dataFrame = df()->read(from_array([['id' => 1, 'name' => 'a'], ['id' => 2, 'name' => 'b']])); $expected = [['id' => 1]]; - static::assertSame($expected, (new Transformations(select('id'), limit(1)))($dataFrame)->fetch()->toArray()); + static::assertSame($expected, new Transformations(select('id'), limit(1))($dataFrame)->fetch()->toArray()); static::assertSame( $expected, $dataFrame diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Comparator/ColumnComparatorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Comparator/ColumnComparatorTest.php index 97c176ba42..bbfe7e9895 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Comparator/ColumnComparatorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Comparator/ColumnComparatorTest.php @@ -21,16 +21,16 @@ public function test_accepts_only_two_columns(): void { $column = ColumnMother::of(int_schema('a'), [1]); - static::assertTrue((new ColumnComparator())->accepts($column, $column)); - static::assertFalse((new ColumnComparator())->accepts($column, [1])); - static::assertFalse((new ColumnComparator())->accepts([1], $column)); + static::assertTrue(new ColumnComparator()->accepts($column, $column)); + static::assertFalse(new ColumnComparator()->accepts($column, [1])); + static::assertFalse(new ColumnComparator()->accepts([1], $column)); } public function test_columns_of_both_backends_with_equal_values_pass(): void { $comparator = new ColumnComparator(); $comparator->setFactory(Factory::getInstance()); - $default = (new AdaptiveBackend())->builder(int_schema('a', nullable: true)); + $default = new AdaptiveBackend()->builder(int_schema('a', nullable: true)); $default->appendMany([1, null]); $comparator->assertEquals(ColumnMother::of(int_schema('a', nullable: true), [1, null]), $default->finish()); @@ -47,7 +47,7 @@ public function test_different_values_fail(): void $this->expectExceptionMessage('Failed asserting that two columns are equal.'); $comparator->assertEquals( - (new PhpBackend())->constant(int_schema('a'), 1, 2), + new PhpBackend()->constant(int_schema('a'), 1, 2), ColumnMother::of(int_schema('a'), [1, 3]), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Comparator/RowsComparatorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Comparator/RowsComparatorTest.php index 9238522891..793031d5c1 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Comparator/RowsComparatorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Comparator/RowsComparatorTest.php @@ -49,7 +49,7 @@ public function test_equal_across_column_classes(): void $comparator->assertEquals( Rows::fromColumns( schema(int_schema('id')), - ['id' => (new PhpBackend())->constant(int_schema('id'), 7, 2)], + ['id' => new PhpBackend()->constant(int_schema('id'), 7, 2)], 2, ), array_to_rows([['id' => 7], ['id' => 7]], schema(int_schema('id'))), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/DSL/DefinitionFromTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/DSL/DefinitionFromTypeTest.php index 3f2127d5f1..9ceaa7b0e6 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/DSL/DefinitionFromTypeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/DSL/DefinitionFromTypeTest.php @@ -112,7 +112,7 @@ public function test_the_string_narrower_output_can_always_be_typed(): void foreach (['+02:00', 'Europe/Warsaw', 'UTC'] as $value) { static::assertInstanceOf(TimeZoneDefinition::class, definition_from_type( 'tz', - (new StringTypeNarrower())->narrow($value), + new StringTypeNarrower()->narrow($value), )); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Calculator/CalculatorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Calculator/CalculatorTest.php index b1c8776cb0..6dedf5fd50 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Calculator/CalculatorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Calculator/CalculatorTest.php @@ -50,7 +50,7 @@ public function test_modulus_by_zero_is_refused_for_ints(): void { $this->expectException(MathException::class); - (new Calculator())->modulus(7, 0); + new Calculator()->modulus(7, 0); } #[TestWith(['1', '1', 2.0])] @@ -77,7 +77,7 @@ public function test_add(string|int|float $a, string|int|float $b, int|float $ou assert(is_numeric($b), 'String parameter $b must be numeric'); } - static::assertSame($output, (new Calculator())->add($a, $b)); + static::assertSame($output, new Calculator()->add($a, $b)); } #[TestWith(['1', '1', 1.0])] @@ -105,14 +105,14 @@ public function test_divide(string|int|float $a, string|int|float $b, int|float assert(is_numeric($b), 'String parameter $b must be numeric'); } - static::assertSame($output, (new Calculator())->divide($a, $b, rounding: Rounding::HALF_UP)); + static::assertSame($output, new Calculator()->divide($a, $b, rounding: Rounding::HALF_UP)); } #[TestWith([4, 2, 2.0])] #[TestWith([4.0, 2, 2.0])] public function test_divide_always_yields_float(int|float $a, int|float $b, float $output): void { - static::assertSame($output, (new Calculator())->divide($a, $b)); + static::assertSame($output, new Calculator()->divide($a, $b)); } public function test_divide_by_zero(): void @@ -120,7 +120,7 @@ public function test_divide_by_zero(): void $this->expectException(DivisionByZeroError::class); $this->expectExceptionMessage('Division by zero'); - (new Calculator())->divide(1, 0); + new Calculator()->divide(1, 0); } public function test_divide_by_zero_with_a_scale_and_a_rounding(): void @@ -128,24 +128,24 @@ public function test_divide_by_zero_with_a_scale_and_a_rounding(): void $this->expectException(DivisionByZeroError::class); $this->expectExceptionMessage('Division by zero.'); - (new Calculator())->divide(1, 0, 2, Rounding::HALF_UP); + new Calculator()->divide(1, 0, 2, Rounding::HALF_UP); } public function test_divide_with_unnecessary_rounding_refuses_an_inexact_quotient(): void { $this->expectException(RoundingNecessaryException::class); - (new Calculator())->divide(1, 3, 2, Rounding::UNNECESSARY); + new Calculator()->divide(1, 3, 2, Rounding::UNNECESSARY); } public function test_divide_a_numeric_string_with_a_scale_and_a_rounding(): void { - static::assertSame(0.33, (new Calculator())->divide('1', 3, 2, Rounding::HALF_UP)); + static::assertSame(0.33, new Calculator()->divide('1', 3, 2, Rounding::HALF_UP)); } public function test_modulus_of_a_numeric_string_beyond_the_int_range(): void { - static::assertSame(1, (new Calculator())->modulus('99999999999999999999', 7)); + static::assertSame(1, new Calculator()->modulus('99999999999999999999', 7)); } public function test_divide_by_zero_as_float(): void @@ -153,7 +153,7 @@ public function test_divide_by_zero_as_float(): void $this->expectException(DivisionByZeroError::class); $this->expectExceptionMessage('Division by zero'); - (new Calculator())->divide(1, 0.0); + new Calculator()->divide(1, 0.0); } public function test_divide_by_zero_as_string(): void @@ -161,7 +161,7 @@ public function test_divide_by_zero_as_string(): void $this->expectException(DivisionByZeroError::class); $this->expectExceptionMessage('Division by zero'); - (new Calculator())->divide(1, '0'); + new Calculator()->divide(1, '0'); } public function test_float_operand_always_yields_float(): void @@ -186,7 +186,7 @@ public function test_multiply_refuses_an_int_product_that_overflows(): void { $this->expectException(IntegerOverflowException::class); - (new Calculator())->multiply(3_037_000_500, 3_037_000_500); + new Calculator()->multiply(3_037_000_500, 3_037_000_500); } #[TestWith([PHP_INT_MAX, 2])] @@ -195,14 +195,14 @@ public function test_multiply_refuses_an_overflowing_product_of_a_large_and_a_sm { $this->expectException(IntegerOverflowException::class); - (new Calculator())->multiply($a, $b); + new Calculator()->multiply($a, $b); } public function test_divide_with_a_scale_and_no_rounding_refuses_an_inexact_quotient(): void { $this->expectException(RoundingNecessaryException::class); - (new Calculator())->divide(1, 3, 2); + new Calculator()->divide(1, 3, 2); } public function test_divide_refuses_a_negative_scale(): void @@ -210,12 +210,12 @@ public function test_divide_refuses_a_negative_scale(): void $this->expectException(PhpInvalidArgumentException::class); $this->expectExceptionMessageMatches('/scale (cannot|must not) be negative/i'); - (new Calculator())->divide(10, 3, -1, Rounding::HALF_UP); + new Calculator()->divide(10, 3, -1, Rounding::HALF_UP); } public function test_divide_rounds_the_decimal_form_of_a_float_not_its_binary_value(): void { - static::assertSame(0.1, (new Calculator())->divide(0.10000000000000041, 1, 15, Rounding::UP)); + static::assertSame(0.1, new Calculator()->divide(0.10000000000000041, 1, 15, Rounding::UP)); } public function test_divide_under_a_zero_float_precision_rounds_the_decimal_form(): void @@ -225,7 +225,7 @@ public function test_divide_under_a_zero_float_precision_rounds_the_decimal_form try { ini_set('precision', '0'); - static::assertSame(0.67, (new Calculator())->divide(1.5, 3, 2, Rounding::HALF_UP)); + static::assertSame(0.67, new Calculator()->divide(1.5, 3, 2, Rounding::HALF_UP)); } finally { ini_set('precision', $precision); } @@ -262,7 +262,7 @@ public function test_modulus(string|int $a, string|int $b, int|float $output): v assert(is_numeric($b), 'String parameter $b must be numeric'); } - static::assertSame($output, (new Calculator())->modulus($a, $b)); + static::assertSame($output, new Calculator()->modulus($a, $b)); } #[TestWith(['2', '3', 6.0])] @@ -284,7 +284,7 @@ public function test_multiply(string|int|float $a, string|int|float $b, int|floa assert(is_numeric($b), 'String parameter $b must be numeric'); } - static::assertSame($output, (new Calculator())->multiply($a, $b)); + static::assertSame($output, new Calculator()->multiply($a, $b)); } #[TestWith(['1', '1', 1.0])] @@ -308,7 +308,7 @@ public function test_power(string|int|float $a, string|int $b, int|float $output assert(is_numeric($b), 'String parameter $b must be numeric'); } - static::assertSame($output, (new Calculator())->power($a, $b)); + static::assertSame($output, new Calculator()->power($a, $b)); } #[TestWith(['1', '1', 0.0])] @@ -336,7 +336,7 @@ public function test_subtract(string|int|float $a, string|int|float $b, int|floa assert(is_numeric($b), 'String parameter $b must be numeric'); } - static::assertSame($output, (new Calculator())->subtract($a, $b)); + static::assertSame($output, new Calculator()->subtract($a, $b)); } public function test_divide_answers_the_decimal_division_at_every_rounding_edge(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Calculator/RunningSumTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Calculator/RunningSumTest.php index 1604b0f7b1..a1b8db2fd8 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Calculator/RunningSumTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Calculator/RunningSumTest.php @@ -18,7 +18,7 @@ final class RunningSumTest extends TestCase { public function test_empty_partial_is_the_partial_of_a_fresh_sum(): void { - static::assertSame(RunningSum::emptyPartial(), (new RunningSum())->partial()); + static::assertSame(RunningSum::emptyPartial(), new RunningSum()->partial()); static::assertSame(0, RunningSum::fromPartial(RunningSum::emptyPartial())->value()); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Clock/HighResolutionTimeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Clock/HighResolutionTimeTest.php index efea6ccfb5..5ac452fb86 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Clock/HighResolutionTimeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Clock/HighResolutionTimeTest.php @@ -70,7 +70,7 @@ public function test_now_reads_the_monotonic_clock_into_seconds_and_nanoseconds( public function test_to_string_shows_every_nanosecond_by_default(): void { - static::assertSame('1.123456789s', (new HighResolutionTime(1, 123456789))->toString()); + static::assertSame('1.123456789s', new HighResolutionTime(1, 123456789)->toString()); } public function test_to_formatted_string_removes_trailing_zeroes(): void @@ -90,7 +90,7 @@ public function test_to_formatted_string_removes_trailing_zeroes(): void public function test_to_string_keeps_every_nanosecond_of_a_large_second_count(): void { - static::assertSame('1073741824.123456789s', (new HighResolutionTime(1_073_741_824, 123_456_789))->toString()); + static::assertSame('1073741824.123456789s', new HighResolutionTime(1_073_741_824, 123_456_789)->toString()); } #[TestWith([10, 'Precision must be between 0 and 9, got 10.'])] @@ -100,7 +100,7 @@ public function test_to_string_refuses_a_precision_outside_zero_to_nine(int $pre $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage($message); - (new HighResolutionTime(1, 5))->toString($precision); + new HighResolutionTime(1, 5)->toString($precision); } #[TestWith([1, 123_456_789, 3, '1.123s'])] @@ -116,11 +116,11 @@ public function test_to_string_rounds_half_up_to_the_precision( int $precision, string $expected, ): void { - static::assertSame($expected, (new HighResolutionTime($seconds, $nanoseconds))->toString($precision)); + static::assertSame($expected, new HighResolutionTime($seconds, $nanoseconds)->toString($precision)); } public function test_to_string_of_a_negative_time_keeps_its_sign(): void { - static::assertSame('-0.5s', (new HighResolutionTime(-1, 500_000_000))->toString()); + static::assertSame('-0.5s', new HighResolutionTime(-1, 500_000_000)->toString()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/ConfiguredFilesystemTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/ConfiguredFilesystemTest.php index 5d643704fa..1595d1fdeb 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/ConfiguredFilesystemTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/ConfiguredFilesystemTest.php @@ -16,7 +16,7 @@ final class ConfiguredFilesystemTest extends FlowTestCase { public function test_a_configurable_filesystem_round_trips_as_a_secret(): void { - $description = (new ConfiguredFilesystem(new NativeLocalFilesystem()))->describe(); + $description = new ConfiguredFilesystem(new NativeLocalFilesystem())->describe(); static::assertNotNull($description); static::assertTrue($description->sensitive()); @@ -29,13 +29,13 @@ public function test_a_configurable_filesystem_round_trips_as_a_secret(): void ); static::assertEquals( new NativeLocalFilesystem(), - (new Rebuild())->of($description->normalize(), ConfiguredFilesystem::class)->filesystem(), + new Rebuild()->of($description->normalize(), ConfiguredFilesystem::class)->filesystem(), ); } public function test_a_filesystem_with_live_state_does_not_describe(): void { - static::assertNull((new ConfiguredFilesystem(new MemoryFilesystem()))->describe()); + static::assertNull(new ConfiguredFilesystem(new MemoryFilesystem())->describe()); } public function test_a_class_that_is_not_a_filesystem_is_refused(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/DescribableRoundTripTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/DescribableRoundTripTest.php index 54c8e04287..1e22ec675e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/DescribableRoundTripTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/DescribableRoundTripTest.php @@ -6,7 +6,6 @@ use Flow\ETL\Foundation\Describe\Describable; use Flow\ETL\Foundation\Exception\InvalidArgumentException; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Foundation\Exception\RuntimeException; use Flow\ETL\Tests\Context\DescribableFixtures; use Flow\ETL\Tests\Context\DescribeRoundTrip; @@ -56,11 +55,7 @@ public function test_a_rebuilt_describable_equals_the_described_one(string $clas $this->expectException(RuntimeException::class); } - try { - $describable = DescribableFixtures::all()[$class](); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $describable = DescribableFixtures::all()[$class](); if (in_array($class, DescribableFixtures::undescribable(), true)) { static::assertNull($describable->describe()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/DescriptionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/DescriptionTest.php index 90bb2b89f8..7d9dc381d9 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/DescriptionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/DescriptionTest.php @@ -18,15 +18,15 @@ public function test_a_description_is_sensitive_when_any_nested_description_is() { $secret = new Description(Described::class, ['token' => 'x'], secret: true); - static::assertFalse((new Description(Described::class, ['a' => 1]))->sensitive()); - static::assertTrue((new Description(Described::class, ['nested' => ['deep' => [$secret]]]))->sensitive()); + static::assertFalse(new Description(Described::class, ['a' => 1])->sensitive()); + static::assertTrue(new Description(Described::class, ['nested' => ['deep' => [$secret]]])->sensitive()); } public function test_normalize_nests_descriptions_and_reports_the_derived_secrecy(): void { - $normalized = (new Description(Described::class, [ + $normalized = new Description(Described::class, [ 'nested' => new Description(Described::class, ['v' => 1], secret: true), - ]))->normalize(); + ])->normalize(); static::assertSame( [ @@ -47,19 +47,19 @@ public function test_extensions_union_nested_descriptions_sorted_and_unique(): v ); static::assertSame(['snappy', 'zlib'], $description?->extensions()); - static::assertSame([], (new Description(Described::class, ['a' => 1]))->extensions()); + static::assertSame([], new Description(Described::class, ['a' => 1])->extensions()); } public function test_normalize_does_not_carry_extensions_or_settings(): void { static::assertSame( ['class' => Described::class, 'secret' => false, 'data' => ['a' => 1]], - (new Description( + new Description( Described::class, ['a' => 1], extensions: ['zlib'], settings: ['precision' => '17'], - ))->normalize(), + )->normalize(), ); } @@ -90,11 +90,11 @@ public function test_two_descriptions_declaring_different_values_for_one_setting . ' declares it as "14"', ); - (new Description( + new Description( Described::class, ['nested' => new Description(NotDescribed::class, [], settings: ['precision' => '14'])], settings: ['precision' => '17'], - ))->settings(); + )->settings(); } public function test_from_array_does_not_recurse_into_data(): void @@ -128,11 +128,11 @@ public function test_debug_info_redacts_sensitive_data(): void { static::assertSame( ['class' => Described::class, 'secret' => true, 'data' => '[redacted]'], - (new Description(Described::class, ['token' => 'x'], secret: true))->__debugInfo(), + new Description(Described::class, ['token' => 'x'], secret: true)->__debugInfo(), ); static::assertSame( ['class' => Described::class, 'secret' => false, 'data' => ['a' => 1]], - (new Description(Described::class, ['a' => 1]))->__debugInfo(), + new Description(Described::class, ['a' => 1])->__debugInfo(), ); } @@ -140,8 +140,8 @@ public function test_compose_replaces_nested_describables(): void { static::assertEquals( new Description(Described::class, [ - 'a' => (new Described('x'))->describe(), - 'list' => [(new Described('y'))->describe()], + 'a' => new Described('x')->describe(), + 'list' => [new Described('y')->describe()], ]), Description::compose(Described::class, ['a' => new Described('x'), 'list' => [new Described('y')]]), ); @@ -216,14 +216,14 @@ public function test_extensions_keep_every_nested_description(): void { static::assertSame( ['apcu', 'snappy', 'zlib'], - (new Description( + new Description( Described::class, [ 'a' => new Description(Described::class, [], extensions: ['snappy']), 'b' => new Description(Described::class, [], extensions: ['zlib']), ], extensions: ['apcu'], - ))->extensions(), + )->extensions(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/RebuildTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/RebuildTest.php index 9c49f033c1..536ccc8941 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/RebuildTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Describe/RebuildTest.php @@ -42,7 +42,7 @@ public function test_an_unknown_class_is_refused(): void /** @var class-string $class */ $class = 'Flow\\Nope\\Missing'; - (new Rebuild())->object(new Description($class, []), Describable::class); + new Rebuild()->object(new Description($class, []), Describable::class); } public function test_a_class_that_is_none_of_the_three_kinds_is_refused(): void @@ -50,7 +50,7 @@ public function test_a_class_that_is_none_of_the_three_kinds_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Flow\\ETL\\Foundation\\Describe\\Rebuild is not Describable'); - (new Rebuild())->object(new Description(Rebuild::class, []), Describable::class); + new Rebuild()->object(new Description(Rebuild::class, []), Describable::class); } public function test_an_interface_name_is_refused(): void @@ -58,7 +58,7 @@ public function test_an_interface_name_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Flow\\ETL\\Foundation\\Describe\\Describable is not a concrete class'); - (new Rebuild())->object(new Description(Describable::class, []), Describable::class); + new Rebuild()->object(new Description(Describable::class, []), Describable::class); } public function test_the_wrong_type_is_refused(): void @@ -68,14 +68,14 @@ public function test_the_wrong_type_is_refused(): void 'Flow\\ETL\\Tests\\Double\\Described is not a Flow\\ETL\\Foundation\\Describe\\ConfiguredFilesystem', ); - (new Rebuild())->object((new Described('x'))->describe(), ConfiguredFilesystem::class); + new Rebuild()->object(new Described('x')->describe(), ConfiguredFilesystem::class); } public function test_a_describable_is_rebuilt_from_its_description(): void { static::assertEquals( new Described('x'), - (new Rebuild())->object((new Described('x'))->describe(), Described::class), + new Rebuild()->object(new Described('x')->describe(), Described::class), ); } @@ -83,15 +83,15 @@ public function test_of_rebuilds_a_normalized_description(): void { static::assertEquals( new Described('x'), - (new Rebuild())->of((new Described('x'))->describe()->normalize(), Described::class), + new Rebuild()->of(new Described('x')->describe()->normalize(), Described::class), ); } public function test_all_keeps_keys(): void { - $rebuilt = (new Rebuild())->all([ - 'first' => (new Described('a'))->describe()->normalize(), - 7 => (new Described('b'))->describe()->normalize(), + $rebuilt = new Rebuild()->all([ + 'first' => new Described('a')->describe()->normalize(), + 7 => new Described('b')->describe()->normalize(), ], Described::class); static::assertEquals(['first' => new Described('a'), 7 => new Described('b')], $rebuilt); @@ -101,19 +101,19 @@ public function test_of_refuses_a_non_array(): void { $this->expectException(InvalidTypeException::class); - (new Rebuild())->of('not a description', Described::class); + new Rebuild()->of('not a description', Described::class); } public function test_progress_is_void_by_default(): void { - static::assertInstanceOf(VoidProgress::class, (new Rebuild())->progress(StageName::sort)); + static::assertInstanceOf(VoidProgress::class, new Rebuild()->progress(StageName::sort)); } public function test_progress_is_bound_by_the_given_stages(): void { $spy = new ProgressSpy(); - (new Rebuild($spy))->progress(StageName::join); + new Rebuild($spy)->progress(StageName::join); static::assertSame(['join'], $spy->stages()); } @@ -121,16 +121,16 @@ public function test_progress_is_bound_by_the_given_stages(): void public function test_progress_from_a_stage_description_reports_into_its_id(): void { $spy = new ProgressSpy(); - (new Rebuild($spy))->progress( + new Rebuild($spy)->progress( StageName::sort, - (new HeartbeatStage( + new HeartbeatStage( StageName::sort, ProgressUnit::rows, 7, 'memory://in/x.floe', - (new HeartbeatContext())->throttle(new ScheduledHeartbeat(new RecordingHeartbeat(), 1)), + new HeartbeatContext()->throttle(new ScheduledHeartbeat(new RecordingHeartbeat(), 1)), 0, - )) + ) ->describe() ?->normalize(), ); @@ -142,8 +142,8 @@ public function test_progress_without_a_description_is_a_new_stage_of_the_name() { $spy = new ProgressSpy(); - (new Rebuild($spy))->progress(StageName::group_by); - (new Rebuild($spy))->progress(StageName::sort, (new VoidProgress())->describe()?->normalize()); + new Rebuild($spy)->progress(StageName::group_by); + new Rebuild($spy)->progress(StageName::sort, new VoidProgress()->describe()?->normalize()); static::assertSame( [ diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/CorruptedRecordExceptionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/CorruptedRecordExceptionTest.php index 5819ecb83c..479ac92757 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/CorruptedRecordExceptionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/CorruptedRecordExceptionTest.php @@ -20,7 +20,7 @@ public function test_the_message_names_the_record_where_it_is_why_and_the_way_ou static::assertSame( 'Corrupted record at offset 12, line 3, of file:///a.csv: 3 fields, the header has 2: "1,a,x". Route ' . 'corrupted records to a loader with ->withCorruptedRecords($loader).', - (new CorruptedRecordException('file:///a.csv', 12, 3, '3 fields, the header has 2', '1,a,x'))->getMessage(), + new CorruptedRecordException('file:///a.csv', 12, 3, '3 fields, the header has 2', '1,a,x')->getMessage(), ); } @@ -31,7 +31,7 @@ public function test_a_record_without_a_line_or_a_uri_and_too_long_to_show_whole . str_repeat('ü', 120) . '…". Route corrupted ' . 'records to a loader with ->withCorruptedRecords($loader).', - (new CorruptedRecordException(null, 4, null, 'reason', str_repeat('ü', 121)))->getMessage(), + new CorruptedRecordException(null, 4, null, 'reason', str_repeat('ü', 121))->getMessage(), ); } @@ -42,7 +42,7 @@ public function test_a_record_of_exactly_the_shown_length_is_shown_whole(): void . str_repeat('ü', 120) . '". Route corrupted ' . 'records to a loader with ->withCorruptedRecords($loader).', - (new CorruptedRecordException(null, 4, null, 'reason', str_repeat('ü', 120)))->getMessage(), + new CorruptedRecordException(null, 4, null, 'reason', str_repeat('ü', 120))->getMessage(), ); } @@ -53,7 +53,7 @@ public function test_a_too_long_record_is_shown_from_its_first_character(): void . str_repeat('ü', 119) . '…". Route corrupted ' . 'records to a loader with ->withCorruptedRecords($loader).', - (new CorruptedRecordException(null, 4, null, 'reason', 'a' . str_repeat('ü', 120)))->getMessage(), + new CorruptedRecordException(null, 4, null, 'reason', 'a' . str_repeat('ü', 120))->getMessage(), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/RequiredPHPVersionExceptionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/RequiredPHPVersionExceptionTest.php deleted file mode 100644 index c8c78fb22e..0000000000 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/RequiredPHPVersionExceptionTest.php +++ /dev/null @@ -1,24 +0,0 @@ -getMessage(), - ); - static::assertSame($previous, $exception->getPrevious()); - } -} diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/SchemaDefinitionNotFoundExceptionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/SchemaDefinitionNotFoundExceptionTest.php index 40e4dd790b..dfd5071731 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/SchemaDefinitionNotFoundExceptionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/SchemaDefinitionNotFoundExceptionTest.php @@ -25,7 +25,7 @@ public function test_the_single_argument_form_keeps_its_message(): void { static::assertSame( 'Schema definition for column "scoree" not found.', - (new SchemaDefinitionNotFoundException('scoree'))->getMessage(), + new SchemaDefinitionNotFoundException('scoree')->getMessage(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/SchemaMismatchExceptionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/SchemaMismatchExceptionTest.php index 483de23ffc..16c54aa4b7 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/SchemaMismatchExceptionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/SchemaMismatchExceptionTest.php @@ -14,14 +14,14 @@ public function test_it_keeps_the_row_violation_as_the_cause(): void { $cause = ColumnMismatchException::unexpectedColumn('extra'); - static::assertSame($cause, (new SchemaMismatchException(2, $cause))->getPrevious()); + static::assertSame($cause, new SchemaMismatchException(2, $cause)->getPrevious()); } public function test_it_places_a_column_violation_at_its_row(): void { static::assertSame( 'Rows do not match their schema: column "extra" (row 2) is not declared by the schema', - (new SchemaMismatchException(2, ColumnMismatchException::unexpectedColumn('extra')))->getMessage(), + new SchemaMismatchException(2, ColumnMismatchException::unexpectedColumn('extra'))->getMessage(), ); } @@ -29,11 +29,11 @@ public function test_it_places_a_value_violation_at_its_row(): void { static::assertSame( 'Rows do not match their schema: column "code" (row 1): could not convert 1000 (integer) to string', - (new SchemaMismatchException(1, ColumnMismatchException::valueDoesNotMatch( + new SchemaMismatchException(1, ColumnMismatchException::valueDoesNotMatch( 'code', 'string', 1000, - )))->getMessage(), + ))->getMessage(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/SchemaValidationExceptionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/SchemaValidationExceptionTest.php index a8430f4d09..d92bdd8ed4 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/SchemaValidationExceptionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Exception/SchemaValidationExceptionTest.php @@ -57,12 +57,12 @@ public function test_diff_message_renders_nullable_marker_on_expected_type(): vo { static::assertStringContainsString( 'expected: deleted_at, given: deleted_at', - (new SchemaValidationException( + new SchemaValidationException( schema_validate( schema(datetime_schema('deleted_at', nullable: true)), schema(integer_schema('deleted_at')), )->toString(), - ))->getMessage(), + )->getMessage(), ); } @@ -70,7 +70,7 @@ public function test_the_message_prefixes_the_mismatches(): void { static::assertSame( "Schema validation failed: \n Unexpected Definitions: \n", - (new SchemaValidationException(" Unexpected Definitions: \n"))->getMessage(), + new SchemaValidationException(" Unexpected Definitions: \n")->getMessage(), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/FlowPhpExtensionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/FlowPhpExtensionTest.php index 400253b1d5..17d34a9501 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/FlowPhpExtensionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/FlowPhpExtensionTest.php @@ -14,12 +14,12 @@ final class FlowPhpExtensionTest extends TestCase { public function test_an_extension_that_is_not_loaded_is_not_available(): void { - static::assertFalse((new FlowPhpExtension(false, null))->available()); + static::assertFalse(new FlowPhpExtension(false, null)->available()); } public function test_a_loaded_extension_of_the_expected_abi_is_available(): void { - static::assertTrue((new FlowPhpExtension(true, FlowPhpExtension::ABI))->available()); + static::assertTrue(new FlowPhpExtension(true, FlowPhpExtension::ABI)->available()); } public function test_a_loaded_extension_of_another_abi_is_refused(): void @@ -34,7 +34,7 @@ public function test_a_loaded_extension_of_another_abi_is_refused(): void . 'flow_php to the version of flow-php/etl, or stop loading it to use the PHP implementation.', ); - (new FlowPhpExtension(true, FlowPhpExtension::ABI + 1, '0.46.0'))->available(); + new FlowPhpExtension(true, FlowPhpExtension::ABI + 1, '0.46.0')->available(); } public function test_a_loaded_extension_without_an_abi_is_refused(): void @@ -42,7 +42,7 @@ public function test_a_loaded_extension_without_an_abi_is_refused(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('The loaded flow_php extension (0.44.1, ABI none) does not match flow-php/etl'); - (new FlowPhpExtension(true, null, '0.44.1'))->available(); + new FlowPhpExtension(true, null, '0.44.1')->available(); } public function test_detect_reports_whether_flow_php_is_loaded(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/NativePHPRandomValueGeneratorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/NativePHPRandomValueGeneratorTest.php index 71c4c77c40..12fea028d1 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/NativePHPRandomValueGeneratorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/NativePHPRandomValueGeneratorTest.php @@ -44,9 +44,9 @@ public static function valid_range_provider(): array public function test_can_create_random_int_from_given_range(): void { - static::assertSame(1, (new NativePHPRandomValueGenerator())->int(1, 1)); + static::assertSame(1, new NativePHPRandomValueGenerator()->int(1, 1)); static::assertThat( - (new NativePHPRandomValueGenerator())->int(1, 2), + new NativePHPRandomValueGenerator()->int(1, 2), static::logicalOr(static::equalTo(1), static::equalTo(2)), ); } @@ -54,27 +54,27 @@ public function test_can_create_random_int_from_given_range(): void #[DataProvider('integers_provider')] public function test_can_create_random_string_with_given_length(int $expectedLength): void { - static::assertSame($expectedLength, mb_strlen((new NativePHPRandomValueGenerator())->string($expectedLength))); + static::assertSame($expectedLength, mb_strlen(new NativePHPRandomValueGenerator()->string($expectedLength))); } public function test_empty_string_on_length_below_1(): void { - static::assertSame('', (new NativePHPRandomValueGenerator())->string(0)); - static::assertSame('', (new NativePHPRandomValueGenerator())->string(-1)); + static::assertSame('', new NativePHPRandomValueGenerator()->string(0)); + static::assertSame('', new NativePHPRandomValueGenerator()->string(-1)); } #[DataProvider('invalid_range_provider')] public function test_fail_on_invalid_range(int $min, int $max): void { self::expectException(ValueError::class); - (new NativePHPRandomValueGenerator())->int($min, $max); + new NativePHPRandomValueGenerator()->int($min, $max); } #[DataProvider('valid_range_provider')] public function test_return_random_int_on_valid_range(int $min, int $max): void { static::assertThat( - (new NativePHPRandomValueGenerator())->int($min, $max), + new NativePHPRandomValueGenerator()->int($min, $max), static::logicalOr(static::greaterThanOrEqual($min), static::lessThanOrEqual($max)), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/SimilarNamesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/SimilarNamesTest.php index 48133cde71..ae20c4bc4d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/SimilarNamesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/SimilarNamesTest.php @@ -11,47 +11,44 @@ final class SimilarNamesTest extends FlowTestCase { public function test_a_candidate_containing_the_searched_name_is_always_close(): void { - static::assertSame( - ['region_code'], - (new SimilarNames())->closestTo('region', ['month', 'sales', 'region_code']), - ); + static::assertSame(['region_code'], new SimilarNames()->closestTo('region', ['month', 'sales', 'region_code'])); } public function test_an_empty_candidate_list_stays_empty(): void { - static::assertSame([], (new SimilarNames())->closestTo('id', [])); + static::assertSame([], new SimilarNames()->closestTo('id', [])); } public function test_nothing_close_enough_suggests_nothing(): void { - static::assertSame([], (new SimilarNames())->closestTo('nope', ['id', 'seller', 'amount'])); + static::assertSame([], new SimilarNames()->closestTo('nope', ['id', 'seller', 'amount'])); } public function test_a_candidate_a_third_of_the_name_away_or_more_is_not_close(): void { - static::assertSame([], (new SimilarNames())->closestTo('abcdef', ['abcxyz'])); + static::assertSame([], new SimilarNames()->closestTo('abcdef', ['abcxyz'])); } public function test_the_cap_is_configurable(): void { - static::assertSame(['scorea'], (new SimilarNames())->closestTo('score', ['scorea', 'scoreb'], 1)); + static::assertSame(['scorea'], new SimilarNames()->closestTo('score', ['scorea', 'scoreb'], 1)); } public function test_the_closest_candidate_comes_first(): void { static::assertSame( ['score', 'scoreid'], - (new SimilarNames())->closestTo('scoree', ['scoreid', 'score', 'name', 'id']), + new SimilarNames()->closestTo('scoree', ['scoreid', 'score', 'name', 'id']), ); } public function test_the_list_is_capped(): void { - static::assertCount(3, (new SimilarNames())->closestTo('score', ['scorea', 'scoreb', 'scorec', 'scored'])); + static::assertCount(3, new SimilarNames()->closestTo('score', ['scorea', 'scoreb', 'scorec', 'scored'])); } public function test_a_typo_finds_its_column(): void { - static::assertSame(['score'], (new SimilarNames())->closestTo('scoree', ['id', 'score', 'name'])); + static::assertSame(['score'], new SimilarNames()->closestTo('scoree', ['id', 'score', 'name'])); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Telemetry/TelemetryAttributesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Telemetry/TelemetryAttributesTest.php index 82d9359b22..ea5eab1d66 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Telemetry/TelemetryAttributesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/Telemetry/TelemetryAttributesTest.php @@ -13,7 +13,7 @@ final class TelemetryAttributesTest extends FlowTestCase public function test_all_custom_keys_use_the_flow_etl_prefix(): void { // @mago-expect analysis:mixed-assignment - foreach ((new ReflectionClass(TelemetryAttributes::class))->getConstants() as $name => $value) { + foreach (new ReflectionClass(TelemetryAttributes::class)->getConstants() as $name => $value) { static::assertIsString($value); static::assertStringStartsWith( 'flow.etl.', diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/VoidProgressTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/VoidProgressTest.php index bca6565520..ef658fb340 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/VoidProgressTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Foundation/VoidProgressTest.php @@ -42,7 +42,7 @@ public function test_busy_and_done_do_nothing(): void public function test_describes_as_itself(): void { - static::assertEquals(Description::compose(VoidProgress::class, []), (new VoidProgress())->describe()); + static::assertEquals(Description::compose(VoidProgress::class, []), new VoidProgress()->describe()); } public function test_counts_in_does_nothing(): void @@ -56,6 +56,6 @@ public function test_counts_in_does_nothing(): void public function test_nobody_listens_to_it(): void { - static::assertNull((new VoidProgress())->reportsEverySeconds()); + static::assertNull(new VoidProgress()->reportsEverySeconds()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllAggregatesDeclareTheirTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllAggregatesDeclareTheirTypeTest.php index 8369e6a467..b8d5907921 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllAggregatesDeclareTheirTypeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllAggregatesDeclareTheirTypeTest.php @@ -85,7 +85,7 @@ public function test_every_producer_declares_and_round_trips(): void $bare = 0; foreach ($factories as $class => $factory) { - $returns = (new ReferenceResolver()) + $returns = new ReferenceResolver() ->resolve($factory(), self::inputSchema()) ->returns(); definition_from_type('out', $returns); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllAggregatorsPartialTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllAggregatorsPartialTest.php index df23ef69c4..404c893434 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllAggregatorsPartialTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllAggregatorsPartialTest.php @@ -68,16 +68,16 @@ public function test_partials_merged_in_order_equal_one_pass(string $class): voi $merged = AggregatorFixtures::resolved($class); foreach ([[0, 1], [2, 3], [4, 5]] as $part => $indices) { - $aggregator = (new Aggregators(AggregatorFixtures::resolved($class)))->fresh()->first(); + $aggregator = new Aggregators(AggregatorFixtures::resolved($class))->fresh()->first(); $aggregator->aggregate($rows, $indices, $context->backend()); $schema = schema(structure_schema('partial', $aggregator->partialType())); $path = $scratch->suffix('part-' . $part . '.floe'); - $writer = (new FloeFiles($filesystem, new PhpBackend()))->create($path, $schema); + $writer = new FloeFiles($filesystem, new PhpBackend())->create($path, $schema); $writer->write(array_to_rows([['partial' => $aggregator->partial()]], $schema)); $writer->close(); - foreach ((new FloeFiles($filesystem, new PhpBackend())) + foreach (new FloeFiles($filesystem, new PhpBackend()) ->read($path) ->rows() as $batch) { $merged->merge( @@ -118,7 +118,7 @@ public function test_fresh_has_no_state(AggregatingFunction $aggregator): void $untouched = $aggregator->withChildren($aggregator->children()); $aggregator->aggregate(AggregatorFixtures::rows(new PhpBackend()), range(0, 5), flow_context()->backend()); - $fresh = (new Aggregators($aggregator))->fresh()->first(); + $fresh = new Aggregators($aggregator)->fresh()->first(); static::assertNotSame($aggregator, $fresh); static::assertSame(var_export($untouched->value(), true), var_export($fresh->value(), true)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsDeclareTheirDeterminismTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsDeclareTheirDeterminismTest.php index 0f8855d893..03f0e69660 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsDeclareTheirDeterminismTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsDeclareTheirDeterminismTest.php @@ -5,7 +5,6 @@ namespace Flow\ETL\Tests\Unit\Functions; use DateTimeImmutable; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Functions\CallUserFunc; use Flow\ETL\Functions\Now; use Flow\ETL\Functions\RandomString; @@ -44,14 +43,8 @@ public static function scalar_functions_provider(): Generator #[DataProvider('scalar_functions_provider')] public function test_every_scalar_function_is_deterministic_except_the_declared_generators(string $class): void { - try { - $function = ScalarFunctionFixtures::instance($class); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } - ScalarFunctionContract::declaresDeterminism( - $function, + ScalarFunctionFixtures::instance($class), !in_array( $class, [ diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsDeclareTheirTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsDeclareTheirTypeTest.php index 7a310272be..5e0e052a6e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsDeclareTheirTypeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsDeclareTheirTypeTest.php @@ -4,7 +4,6 @@ namespace Flow\ETL\Tests\Unit\Functions; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Functions\All; use Flow\ETL\Functions\Any; use Flow\ETL\Functions\ArrayGetCollection; @@ -65,7 +64,6 @@ use PHPUnit\Framework\Attributes\DataProvider; use function array_diff; -use function array_intersect; use function array_keys; use function array_values; use function Flow\Types\DSL\type_is_nullable; @@ -178,16 +176,10 @@ public function test_the_fixture_schema_is_entirely_nullable(): void #[DataProvider('declaring_classes_provider')] public function test_every_function_answers_returns_with_a_column_representable_type(string $class): void { - try { - $function = ScalarFunctionFixtures::instance($class); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } - $expected = ScalarFunctionFixtures::expectedReturns($class); static::assertNotNull($expected); - ScalarFunctionContract::returnsItsDeclaredType($function, $expected); + ScalarFunctionContract::returnsItsDeclaredType(ScalarFunctionFixtures::instance($class), $expected); } /** @@ -196,27 +188,21 @@ public function test_every_function_answers_returns_with_a_column_representable_ #[DataProvider('declaring_classes_provider')] public function test_with_children_round_trips(string $class): void { - try { - $fn = ScalarFunctionFixtures::instance($class); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } - - ScalarFunctionContract::withChildrenRoundTrips($fn); + ScalarFunctionContract::withChildrenRoundTrips(ScalarFunctionFixtures::instance($class)); } public function test_exactly_49_of_the_128_declare_themselves_nullable(): void { - [$nullable, $notNull, $unavailable] = ScalarFunctionFixtures::nullabilitySplit(); + [$nullable, $notNull] = ScalarFunctionFixtures::nullabilitySplit(); static::assertCount(128, ScalarFunctionClasses::declaring(ExtractorClasses::root('core/etl'))); static::assertCount(49, self::declared_nullable_classes()); static::assertCount( 49, - [...$nullable, ...array_intersect($unavailable, self::declared_nullable_classes())], + $nullable, 'nullable set drifted: ' . implode(', ', array_diff($nullable, self::declared_nullable_classes())), ); - static::assertCount(79, [...$notNull, ...array_diff($unavailable, self::declared_nullable_classes())]); + static::assertCount(79, $notNull); } /** @@ -225,34 +211,27 @@ public function test_exactly_49_of_the_128_declare_themselves_nullable(): void #[DataProvider('declared_nullable_provider')] public function test_the_nullable_set_is_exactly_the_declared_49(string $class): void { - try { - $function = ScalarFunctionFixtures::instance($class); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } - $expected = ScalarFunctionFixtures::expectedReturns($class); static::assertNotNull($expected); static::assertTrue(type_is_nullable($expected)); - ScalarFunctionContract::returnsItsDeclaredType($function, $expected); + ScalarFunctionContract::returnsItsDeclaredType(ScalarFunctionFixtures::instance($class), $expected); } public function test_the_not_null_set_is_the_complement(): void { - [$nullable, $notNull, $unavailable] = ScalarFunctionFixtures::nullabilitySplit(); + [$nullable, $notNull] = ScalarFunctionFixtures::nullabilitySplit(); $expectedNotNull = array_values(array_diff( ScalarFunctionClasses::declaring(ExtractorClasses::root('core/etl')), self::declared_nullable_classes(), - $unavailable, )); sort($expectedNotNull); sort($notNull); static::assertSame($expectedNotNull, $notNull); - $expectedNullable = array_values(array_diff(self::declared_nullable_classes(), $unavailable)); + $expectedNullable = self::declared_nullable_classes(); sort($expectedNullable); sort($nullable); @@ -263,6 +242,6 @@ public function test_an_unresolved_reference_refuses_to_describe_itself(): void { $this->expectExceptionMessage('Invalid call to returns() on unresolved reference'); - (new UnresolvedReference('a'))->returns(); + new UnresolvedReference('a')->returns(); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsDescribeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsDescribeTest.php index c271b4505b..2988efb2fc 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsDescribeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsDescribeTest.php @@ -4,7 +4,6 @@ namespace Flow\ETL\Tests\Unit\Functions; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Functions\ScalarFunction; use Flow\ETL\Tests\Context\ExtractorClasses; use Flow\ETL\Tests\Context\ScalarFunctionClasses; @@ -34,13 +33,7 @@ public static function functions(): Generator #[DataProvider('functions')] public function test_every_function_round_trips(string $class): void { - try { - $function = ScalarFunctionFixtures::instance($class); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } - - ScalarFunctionContract::describesItself($function, self::undescribable()); + ScalarFunctionContract::describesItself(ScalarFunctionFixtures::instance($class), self::undescribable()); } public function test_only_dom_literals_refuse_to_describe(): void @@ -48,13 +41,7 @@ public function test_only_dom_literals_refuse_to_describe(): void $refusing = []; foreach (ScalarFunctionClasses::all(ExtractorClasses::root('core/etl')) as $class) { - try { - $function = ScalarFunctionFixtures::instance($class); - } catch (RequiredPHPVersionException) { - continue; - } - - if ($function->describe() === null) { + if (ScalarFunctionFixtures::instance($class)->describe() === null) { $refusing[] = $class; } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsEvaluateOnTheConfiguredBackendTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsEvaluateOnTheConfiguredBackendTest.php index 89198b82a4..4ebbca9c5f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsEvaluateOnTheConfiguredBackendTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllFunctionsEvaluateOnTheConfiguredBackendTest.php @@ -4,7 +4,6 @@ namespace Flow\ETL\Tests\Unit\Functions; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Functions\ScalarFunction; use Flow\ETL\Tests\Context\ScalarFunctionContract; use Flow\ETL\Tests\Context\ScalarFunctionFixtures; @@ -32,15 +31,11 @@ public static function functions(): Generator #[DataProvider('functions')] public function test_a_function_gives_the_same_values_and_a_column_of_the_configured_backend(string $class): void { - try { - // a fresh function per run: a function may keep what it evaluated (Literal keeps its column) - $onPhp = ScalarFunctionFixtures::instance($class); - $onAdaptive = ScalarFunctionFixtures::instance($class); - $adaptiveUnderPhp = ScalarFunctionFixtures::instance($class); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } - - ScalarFunctionContract::evaluatesOnTheConfiguredBackend($onPhp, $onAdaptive, $adaptiveUnderPhp); + // a fresh function per run: a function may keep what it evaluated (Literal keeps its column) + ScalarFunctionContract::evaluatesOnTheConfiguredBackend( + ScalarFunctionFixtures::instance($class), + ScalarFunctionFixtures::instance($class), + ScalarFunctionFixtures::instance($class), + ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllTest.php index f9541fa4db..fbcd14788a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AllTest.php @@ -49,7 +49,7 @@ public static function three_valued_and(): Generator #[DataProvider('three_valued_and')] public function test_three_valued_truth_table(?bool $left, ?bool $right, ?bool $expected): void { - static::assertSame($expected, (new FunctionContext(flow_context()))->eval( + static::assertSame($expected, new FunctionContext(flow_context())->eval( new All(lit($left), lit($right)), [], schema(), @@ -58,7 +58,7 @@ public function test_three_valued_truth_table(?bool $left, ?bool $right, ?bool $ public function test_all_expression_on_is_null_expression(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( all(ref('value')->isNull()), ['value' => null], schema(str_schema('value', nullable: true)), @@ -67,7 +67,7 @@ public function test_all_expression_on_is_null_expression(): void public function test_all_expression_on_multiple_boolean_values(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( all(lit(true), lit(true), lit(true)), [], schema(), @@ -76,7 +76,7 @@ public function test_all_expression_on_multiple_boolean_values(): void public function test_all_expression_on_multiple_random_boolean_values(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( all(lit(true), lit(false), lit(true)), [], schema(), @@ -85,12 +85,12 @@ public function test_all_expression_on_multiple_random_boolean_values(): void public function test_all_function_on_boolean_false_value(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval(all(lit(false)), [], schema())); + static::assertFalse(new FunctionContext(flow_context())->eval(all(lit(false)), [], schema())); } public function test_all_function_on_boolean_true_value(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval(all(lit(true)), [], schema())); + static::assertTrue(new FunctionContext(flow_context())->eval(all(lit(true)), [], schema())); } public function test_an_undecided_row_only_reaches_the_next_argument(): void @@ -102,8 +102,8 @@ public function test_an_undecided_row_only_reaches_the_next_argument(): void static::assertSame( [false, true], - (new ReferenceResolver()) - ->resolve(all(ref('c'), (new FailingOnValuesFunction(ref('v'), [99]))->isNotNull()), $rows->schema()) + new ReferenceResolver() + ->resolve(all(ref('c'), new FailingOnValuesFunction(ref('v'), [99])->isNotNull()), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), ); @@ -113,7 +113,7 @@ public function test_a_non_boolean_conjunct_counts_by_its_truthiness(): void { static::assertSame( [false, true, false, null], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( all(ref('i')), [['i' => 0], ['i' => 2], ['i' => 0], ['i' => null]], @@ -138,7 +138,7 @@ public function test_a_row_decided_by_the_second_argument_keeps_its_index(): voi static::assertSame( [false, true, false], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(all(ref('a'), ref('b')), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AnyTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AnyTest.php index 22b54ee0db..6f2e1f5406 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AnyTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AnyTest.php @@ -50,7 +50,7 @@ public static function three_valued_or(): Generator #[DataProvider('three_valued_or')] public function test_three_valued_truth_table(?bool $left, ?bool $right, ?bool $expected): void { - static::assertSame($expected, (new FunctionContext(flow_context()))->eval( + static::assertSame($expected, new FunctionContext(flow_context())->eval( new Any(lit($left), lit($right)), [], schema(), @@ -59,17 +59,17 @@ public function test_three_valued_truth_table(?bool $left, ?bool $right, ?bool $ public function test_any_expression_on_boolean_false_value(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval(any(lit(false)), [], schema())); + static::assertFalse(new FunctionContext(flow_context())->eval(any(lit(false)), [], schema())); } public function test_any_expression_on_boolean_true_value(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval(any(lit(true)), [], schema())); + static::assertTrue(new FunctionContext(flow_context())->eval(any(lit(true)), [], schema())); } public function test_any_expression_on_is_null_expression(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( any(ref('value')->isNull()), ['value' => null], schema(str_schema('value', nullable: true)), @@ -78,7 +78,7 @@ public function test_any_expression_on_is_null_expression(): void public function test_any_expression_on_multiple_boolean_values(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( any(lit(false), lit(true), lit(false)), [], schema(), @@ -94,8 +94,8 @@ public function test_an_undecided_row_only_reaches_the_next_argument(): void static::assertSame( [true, true], - (new ReferenceResolver()) - ->resolve(any(ref('c'), (new FailingOnValuesFunction(ref('v'), [99]))->isNotNull()), $rows->schema()) + new ReferenceResolver() + ->resolve(any(ref('c'), new FailingOnValuesFunction(ref('v'), [99])->isNotNull()), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), ); @@ -105,7 +105,7 @@ public function test_a_non_boolean_conjunct_counts_by_its_truthiness(): void { static::assertSame( [false, true, false, null], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( any(ref('i')), [['i' => 0], ['i' => 2], ['i' => 0], ['i' => null]], diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AppendTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AppendTest.php index 2ef836689f..e7b8438a3a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AppendTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AppendTest.php @@ -18,7 +18,7 @@ final class AppendTest extends FlowTestCase { public function test_append_empty_string_to_content(): void { - static::assertEquals('hello', (new FunctionContext(flow_context()))->eval( + static::assertEquals('hello', new FunctionContext(flow_context())->eval( ref('str')->append(''), ['str' => 'hello'], schema(str_schema('str')), @@ -27,7 +27,7 @@ public function test_append_empty_string_to_content(): void public function test_append_to_empty_string(): void { - static::assertEquals('hello', (new FunctionContext(flow_context()))->eval( + static::assertEquals('hello', new FunctionContext(flow_context())->eval( ref('str')->append('hello'), ['str' => ''], schema(str_schema('str')), @@ -36,7 +36,7 @@ public function test_append_to_empty_string(): void public function test_append_to_non_empty_string(): void { - static::assertEquals('hello world', (new FunctionContext(flow_context()))->eval( + static::assertEquals('hello world', new FunctionContext(flow_context())->eval( ref('str')->append(' world'), ['str' => 'hello'], schema(str_schema('str')), @@ -45,7 +45,7 @@ public function test_append_to_non_empty_string(): void public function test_append_with_null_suffix(): void { - static::assertEquals('hello', (new FunctionContext(flow_context()))->eval( + static::assertEquals('hello', new FunctionContext(flow_context())->eval( ref('str')->append(ref('suffix')), ['str' => 'hello', 'suffix' => null], schema(str_schema('str'), str_schema('suffix', nullable: true)), @@ -56,7 +56,7 @@ public function test_a_null_suffix_leaves_the_next_row_appended(): void { static::assertSame( ['hello', 'worldx'], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('str')->append(ref('suffix')), [['str' => 'hello', 'suffix' => null], ['str' => 'world', 'suffix' => 'x']], @@ -71,7 +71,7 @@ public function test_append_with_null_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Append function requires non-null value'); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->append(' world'), ['str' => null], schema(str_schema('str', nullable: true)), @@ -83,7 +83,7 @@ public function test_append_with_null_value_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Append function requires non-null value'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( ref('str')->append(' world'), ['str' => null], schema(str_schema('str', nullable: true)), @@ -92,7 +92,7 @@ public function test_append_with_null_value_in_strict_mode(): void public function test_append_with_scalar_function_parameter(): void { - static::assertEquals('hello world', (new FunctionContext(flow_context()))->eval( + static::assertEquals('hello world', new FunctionContext(flow_context())->eval( ref('str')->append(ref('suffix')), ['str' => 'hello', 'suffix' => ' world'], schema(str_schema('str'), str_schema('suffix')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayExpandTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayExpandTest.php index 5323941e43..b5f7e4576f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayExpandTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayExpandTest.php @@ -39,7 +39,7 @@ public function test_expand_both(): void ['b' => 2], ['c' => 3], ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_expand(ref('array'), ArrayExpand::BOTH), ['array' => [ 'a' => 1, @@ -55,7 +55,7 @@ public function test_expand_keys(): void { static::assertSame( ['a', 'b', 'c'], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_expand(ref('array'), ArrayExpand::KEYS), ['array' => [ 'a' => 1, @@ -72,7 +72,7 @@ public function test_expand_values(): void // an expand hands the step a list: the keys never reached the exploded column static::assertSame( [1, 2, 3], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_expand(ref('array')), ['array' => [ 'a' => 1, @@ -89,7 +89,7 @@ public function test_for_not_array_entry(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "integer".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_expand(ref('integer_entry')), ['integer_entry' => 1], schema(int_schema('integer_entry')), @@ -101,7 +101,7 @@ public function test_for_not_array_entry_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "integer".'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( array_expand(ref('integer_entry')), ['integer_entry' => 1], schema(int_schema('integer_entry')), @@ -112,7 +112,7 @@ public function test_values_over_a_structure_declare_the_unified_field_type(): v { static::assertSame( 'integer', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( array_expand(ref('structure')), schema(structure_schema('structure', type_structure([ @@ -134,14 +134,14 @@ public function test_keys_declare_the_key_type(): void static::assertSame( 'string', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(array_expand(ref('structure'), ArrayExpand::KEYS), $schema) ->returns() ->toString(), ); static::assertSame( 'integer', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(array_expand(ref('list'), ArrayExpand::KEYS), $schema) ->returns() ->toString(), @@ -152,7 +152,7 @@ public function test_both_declares_a_one_pair_map(): void { static::assertSame( 'map', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( array_expand(ref('list'), ArrayExpand::BOTH), schema(list_schema('list', type_list(type_string()))), @@ -168,21 +168,21 @@ public function test_a_map_operand_declares_its_value_and_key_types(): void static::assertSame( 'integer', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(array_expand(ref('map')), $schema) ->returns() ->toString(), ); static::assertSame( 'string', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(array_expand(ref('map'), ArrayExpand::KEYS), $schema) ->returns() ->toString(), ); static::assertSame( 'map', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(array_expand(ref('map'), ArrayExpand::BOTH), $schema) ->returns() ->toString(), @@ -193,7 +193,7 @@ public function test_keys_of_an_integer_keyed_map_declare_integer(): void { static::assertSame( 'integer', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( array_expand(ref('map'), ArrayExpand::KEYS), schema(map_schema('map', type_map(type_integer(), type_string()))), @@ -207,7 +207,7 @@ public function test_a_null_array_does_not_stop_the_next_row(): void { static::assertSame( [[], [1, 2]], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( array_expand(ref('list')), [['list' => null], ['list' => [1, 2]]], @@ -221,7 +221,7 @@ public function test_keys_over_a_structure_with_non_unifying_fields_still_declar { static::assertSame( 'string', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( array_expand(ref('structure'), ArrayExpand::KEYS), schema(structure_schema('structure', type_structure([ @@ -238,7 +238,7 @@ public function test_values_over_a_structure_with_non_unifying_fields_refuse_to_ { $this->expectException(SchemaNotDerivableException::class); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( array_expand(ref('structure')), schema(structure_schema('structure', type_structure([ @@ -256,7 +256,7 @@ public function test_a_null_array_expands_to_nothing(ArrayExpand $expand): void { static::assertSame( [], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_expand(ref('list'), $expand), [ 'list' => null, diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayFilterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayFilterTest.php index 0a0f5d83df..5076968575 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayFilterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayFilterTest.php @@ -25,7 +25,7 @@ public function test_array_filter(): void { static::assertSame( [1], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('list')->arrayFilter(lit(2)), ['list' => [ 1, @@ -40,7 +40,7 @@ public function test_array_filter_by_entry_reference(): void { static::assertSame( [1], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('list')->arrayFilter(ref('int')), ['list' => [1, 2], 'int' => 2], schema(list_schema('list', type_list(type_integer())), int_schema('int')), @@ -53,7 +53,7 @@ public function test_array_filter_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "string".'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( ref('map')->arrayFilter(lit(1)), ['map' => 'test'], schema(str_schema('map')), @@ -64,7 +64,7 @@ public function test_array_filter_not_existing_value(): void { static::assertSame( [1, 2], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('list')->arrayFilter(lit(5)), ['list' => [ 1, @@ -80,7 +80,7 @@ public function test_array_filter_on_non_array(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "string".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('map')->arrayFilter(lit(1)), ['map' => 'test'], schema(str_schema('map')), @@ -92,7 +92,7 @@ public function test_array_filter_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayFilter function requires non-null array'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('list')->arrayFilter(lit(2)), ['list' => null], schema(list_schema('list', type_list(type_integer()), nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayGetCollectionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayGetCollectionTest.php index 72ea400be0..2b23d996a6 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayGetCollectionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayGetCollectionTest.php @@ -43,7 +43,7 @@ public function test_array_get_collection_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayGetCollection function failed to evaluate parameters'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( array_get_collection(ref('invalid_entry'), ['id']), ['invalid_entry' => 1], schema(int_schema('invalid_entry')), @@ -55,7 +55,7 @@ public function test_for_not_array_entry(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayGetCollection function failed to evaluate parameters.'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_get_collection(ref('invalid_entry'), ['id']), ['invalid_entry' => 1], schema(int_schema('invalid_entry')), @@ -65,7 +65,7 @@ public function test_for_not_array_entry(): void public function test_null_keys_are_refused(): void { try { - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_get_collection(ref('array_entry'), ref('keys')), ['array_entry' => [['id' => 1]], 'keys' => null], schema( @@ -89,7 +89,7 @@ public function test_getting_keys_from_simple_array(): void $rows = RowsMother::arrayColumn(); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_get_collection(ref('array_entry'), ['id']), $rows->values(0), $rows->schema(), @@ -103,7 +103,7 @@ public function test_getting_specific_keys_from_collection_of_array(): void ['id' => 1, 'status' => 'PENDING'], ['id' => 2, 'status' => 'NEW'], ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_get_collection(ref('array_entry'), ['id', 'status']), [ 'array_entry' => [ @@ -140,7 +140,7 @@ public function test_getting_specific_keys_from_first_element_in_collection_of_a [ 'parent_id' => 1, ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('array_entry')->arrayGetCollectionFirst('parent_id'), [ 'array_entry' => [ @@ -180,7 +180,7 @@ public function test_getting_specific_keys_from_first_element_in_collection_of_a [ 'parent_id' => 1, ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_get_collection_first(ref('array_entry'), 'parent_id'), [ 'array_entry' => [ @@ -221,7 +221,7 @@ public function test_getting_specific_keys_from_first_element_in_collection_of_a #[TestWith([['a.b'], [['a' => ['b' => 1]]], [['a.b' => null]]])] public function test_keys_are_literal_keys(array $keys, array $collection, array $expected): void { - static::assertSame($expected, (new FunctionContext(flow_context()))->eval( + static::assertSame($expected, new FunctionContext(flow_context())->eval( array_get_collection(ref('array_entry'), $keys), [ 'array_entry' => $collection, @@ -235,7 +235,7 @@ public function test_a_non_scalar_key_fails(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayGetCollection function failed to evaluate parameters.'); - (new FunctionContext(flow_context()))->eval(array_get_collection(ref('array_entry'), [[ + new FunctionContext(flow_context())->eval(array_get_collection(ref('array_entry'), [[ 'x', ]]), ['array_entry' => [['x' => 1]]], schema(list_schema('array_entry', type_list(type_structure(['x' => type_integer()]))))); } @@ -244,7 +244,7 @@ public function test_an_empty_element_reads_null_keys(): void { static::assertSame( [['id' => null], ['id' => null]], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_get_collection(ref('array_entry'), ['id']), [ 'array_entry' => [['name' => 'a'], []], @@ -284,7 +284,7 @@ public function test_describe_round_trips(): void public function test_a_null_array_with_keys_is_refused(): void { try { - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_get_collection(ref('array_entry'), ['id']), ['array_entry' => null], schema(json_schema('array_entry', nullable: true)), @@ -303,7 +303,7 @@ public function test_an_index_of_several_steps_walks_each_step(): void { static::assertSame( [['id' => 1], ['id' => 2]], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new ArrayGetCollection(ref('array_entry'), lit(['id']), lit('items.*')), ['array_entry' => ['items' => [['id' => 1, 'name' => 'a'], ['id' => 2, 'name' => 'b']]]], schema(json_schema('array_entry')), @@ -314,7 +314,7 @@ public function test_an_index_of_several_steps_walks_each_step(): void public function test_an_invalid_index_path_keeps_the_path_failure(): void { try { - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new ArrayGetCollection(ref('array_entry'), lit(['id']), lit('items.{id}')), ['array_entry' => ['items' => [['id' => 1]]]], schema(json_schema('array_entry')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayGetTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayGetTest.php index 1e07601020..487f56a88f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayGetTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayGetTest.php @@ -117,14 +117,14 @@ public function test_array_access_for_not_array_entry(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayGet function failed to get value from array.'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_get(ref('integer_entry'), 'invalid_path'), [ 'integer_entry' => 1, ], schema(int_schema('integer_entry')), ); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_exists(ref('integer_entry'), 'invalid_path'), [ 'integer_entry' => 1, @@ -139,7 +139,7 @@ public function test_array_access_for_not_array_entry_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayGet function failed to get value from array'); - (new FunctionContext($context))->eval( + new FunctionContext($context)->eval( array_get(ref('integer_entry'), 'invalid_path'), [ 'integer_entry' => 1, @@ -151,12 +151,12 @@ public function test_array_access_for_not_array_entry_strict_mode(): void public function test_array_accessor_transformer(): void { $rows = RowsMother::arrayColumn(); - static::assertEquals('bar', (new FunctionContext(flow_context()))->eval( + static::assertEquals('bar', new FunctionContext(flow_context())->eval( array_get(ref('array_entry'), 'array.foo'), $rows->values(0), $rows->schema(), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( array_exists(ref('array_entry'), 'array.foo'), $rows->values(0), $rows->schema(), @@ -165,7 +165,7 @@ public function test_array_accessor_transformer(): void public function test_array_accessor_transformer_with_invalid_and_without_strict_path(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( array_get(ref('array_entry'), '?invalid_path'), [ 'array_entry' => [ @@ -184,7 +184,7 @@ public function test_array_accessor_transformer_with_invalid_and_without_strict_ 'array' => type_structure(['foo' => type_string()]), ]))), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( array_exists(ref('array_entry'), '?invalid_path'), [ 'array_entry' => [ @@ -203,7 +203,7 @@ public function test_array_accessor_transformer_with_invalid_and_without_strict_ 'array' => type_structure(['foo' => type_string()]), ]))), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( array_exists(ref('array_entry'), 'invalid_path'), [ 'array_entry' => [ @@ -227,7 +227,7 @@ public function test_array_accessor_transformer_with_invalid_and_without_strict_ public function test_array_accessor_transformer_with_invalid_but_strict_path(): void { try { - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_get(ref('array_entry'), 'invalid_path'), [ 'array_entry' => [ @@ -256,7 +256,7 @@ public function test_array_accessor_transformer_with_invalid_but_strict_path(): public function test_array_get_with_null_array(): void { try { - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_get(ref('array_entry'), 'id'), ['array_entry' => null], schema(structure_schema('array_entry', type_structure(['id' => type_integer()]), nullable: true)), @@ -274,7 +274,7 @@ public function test_array_get_with_null_array(): void public function test_returns_rejects_a_non_structure_input(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( array_get(ref('list'), 'field'), schema(list_schema('list', type_list(type_string()))), ); @@ -290,7 +290,7 @@ public function test_returns_rejects_a_non_structure_input(): void public function test_returns_rejects_an_undeclared_path_segment(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( array_get(ref('data'), 'missing'), schema(structure_schema('data', type_structure(['field' => type_integer()]))), ); @@ -304,7 +304,7 @@ public function test_returns_rejects_an_undeclared_path_segment(): void public function test_returns_resolves_the_element_type_for_a_declared_path(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( array_get(ref('data'), 'field'), schema(structure_schema('data', type_structure(['field' => type_integer()]))), ); @@ -315,7 +315,7 @@ public function test_returns_resolves_the_element_type_for_a_declared_path(): vo public function test_returns_resolves_a_numeric_path_segment_to_an_integer_named_element(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( array_get(ref('data'), '0'), schema(structure_schema('data', type_structure([0 => type_integer(), 'b' => type_string()]))), ); @@ -333,7 +333,7 @@ public function test_returns_follows_the_path_grammar( string $expected, ): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( array_get(ref('data'), $path), schema(structure_schema('data', $structure)), ); @@ -344,7 +344,7 @@ public function test_returns_follows_the_path_grammar( public function test_returns_names_the_key_of_an_undeclared_nullsafe_segment(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( array_get(ref('data'), '?missing'), schema(structure_schema('data', type_structure(['field' => type_integer()]))), ); @@ -398,6 +398,6 @@ public function test_a_description_rebuilds_through_the_constructor_checks(): vo $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('selects more than one value'); - (new Rebuild())->of($data, ScalarFunction::class); + new Rebuild()->of($data, ScalarFunction::class); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeepTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeepTest.php index ef4bb7d2dd..b136e70d55 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeepTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeepTest.php @@ -25,7 +25,7 @@ public function test_array_keep(): void { static::assertSame( [1 => 2], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('list')->arrayKeep(lit(2)), ['list' => [ 1, @@ -40,7 +40,7 @@ public function test_array_keep_by_entry_reference(): void { static::assertSame( [1 => 2], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('list')->arrayKeep(ref('int')), ['list' => [1, 2], 'int' => 2], schema(list_schema('list', type_list(type_integer())), int_schema('int')), @@ -53,7 +53,7 @@ public function test_array_keep_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "string".'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( ref('map')->arrayKeep(lit(1)), ['map' => 'test'], schema(str_schema('map')), @@ -64,7 +64,7 @@ public function test_array_keep_not_existing_value(): void { static::assertSame( [], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('list')->arrayKeep(lit(5)), ['list' => [ 1, @@ -80,7 +80,7 @@ public function test_array_keep_on_non_array(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "string".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('map')->arrayKeep(lit(1)), ['map' => 'test'], schema(str_schema('map')), @@ -92,7 +92,7 @@ public function test_array_keep_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayKeep function requires non-null array'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('list')->arrayKeep(lit(2)), ['list' => null], schema(list_schema('list', type_list(type_integer()), nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeyRenameTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeyRenameTest.php index 0b613e1b0b..283d40dc00 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeyRenameTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeyRenameTest.php @@ -28,7 +28,7 @@ public function test_array_key_rename_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "integer".'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( array_key_rename(ref('integer_entry'), 'invalid_path', 'new_name'), ['integer_entry' => 1], schema(int_schema('integer_entry')), @@ -40,7 +40,7 @@ public function test_for_not_array_entry(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "integer".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_key_rename(ref('integer_entry'), 'invalid_path', 'new_name'), ['integer_entry' => 1], schema(int_schema('integer_entry')), @@ -54,7 +54,7 @@ public function test_renames_array_entry_keys_in_multiple_array_entry(): void 'first_name' => 'John', 'last' => 'Snow', ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_key_rename(ref('customer'), 'first', 'first_name'), [ 'customer' => [ @@ -87,7 +87,7 @@ public function test_renames_array_entry_keys_in_multiple_array_entry(): void ], 'estimated_delivery_date' => '2023-04-01T10:00:00+00:00', ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_key_rename(ref('shipping'), 'address.line', 'street'), [ 'customer' => [ @@ -124,7 +124,7 @@ public function test_renames_array_entry_keys_in_single_array_entry(): void 'enabled' => true, 'array' => ['new_name' => 'bar'], ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_key_rename(ref('array_entry'), 'array.foo', 'new_name'), $rows->values(0), $rows->schema(), @@ -137,7 +137,7 @@ public function test_throws_exception_for_invalid_path(): void $rows = RowsMother::arrayColumn(); try { - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_key_rename(ref('array_entry'), 'invalid_path', 'new_name'), $rows->values(0), $rows->schema(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeysStyleConverterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeysStyleConverterTest.php index 5cc9bec3f8..906732c41d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeysStyleConverterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeysStyleConverterTest.php @@ -33,7 +33,7 @@ public function test_for_invalid_style(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Unrecognized style invalid, please use one of following:'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_keys_style_convert(ref('invalid_entry'), 'invalid'), ['invalid_entry' => []], schema(json_schema('invalid_entry')), @@ -45,7 +45,7 @@ public function test_for_not_array_entry(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "integer".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_keys_style_convert(ref('invalid_entry'), 'snake'), ['invalid_entry' => 1], schema(int_schema('invalid_entry')), @@ -57,7 +57,7 @@ public function test_for_null_array_entry(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayKeysStyleConvert function requires non-null array'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_keys_style_convert(ref('array_entry'), 'snake'), ['array_entry' => null], schema(map_schema('array_entry', type_map(type_string(), type_integer()), nullable: true)), @@ -85,7 +85,7 @@ public function test_transforms_case_style_for_all_keys_in_array_entry(): void 'variant_name' => 'Variant Name', ], ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_keys_style_convert(ref('arrayEntry'), 'snake'), [ 'arrayEntry' => [ @@ -130,7 +130,7 @@ public function test_colliding_converted_field_names_are_refused_instead_of_sile 'fields "foo_bar" and "fooBar" of "structure{foo_bar: integer, fooBar: string}" both convert to "fooBar"', ); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( array_keys_style_convert(ref('structure'), StringStyles::CAMEL), schema(structure_schema('structure', type_structure([ diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeysTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeysTest.php index 3d38a884f6..7dae2ca5da 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeysTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayKeysTest.php @@ -31,7 +31,7 @@ final class ArrayKeysTest extends FlowTestCase public function test_a_structure_operand_declares_a_list_of_string_keys(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( ref('structure')->arrayKeys(), schema(structure_schema('structure', type_structure(['field' => type_integer()]))), ); @@ -42,7 +42,7 @@ public function test_a_structure_operand_declares_a_list_of_string_keys(): void public function test_a_list_operand_declares_a_list_of_integer_keys(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( ref('list')->arrayKeys(), schema(list_schema('list', type_list(type_string()))), ); @@ -53,7 +53,7 @@ public function test_a_list_operand_declares_a_list_of_integer_keys(): void public function test_an_operand_without_a_key_type_is_refused_at_bind(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve(ref('json')->arrayKeys(), schema(json_schema('json'))); + $resolved = new ReferenceResolver()->resolve(ref('json')->arrayKeys(), schema(json_schema('json'))); $this->expectException(SchemaNotDerivableException::class); $this->expectExceptionMessage('which has no key type'); @@ -65,7 +65,7 @@ public function test_array_keys(): void { static::assertSame( ['a', 'b'], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('map')->arrayKeys(), ['map' => [ 'a' => 1, @@ -81,7 +81,7 @@ public function test_array_keys_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "string".'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( ref('map')->arrayKeys(), ['map' => 'test'], schema(str_schema('map')), @@ -93,7 +93,7 @@ public function test_array_keys_on_non_array(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "string".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('map')->arrayKeys(), ['map' => 'test'], schema(str_schema('map')), @@ -105,7 +105,7 @@ public function test_array_keys_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayKeys function requires non-null array'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('map')->arrayKeys(), ['map' => null], schema(map_schema('map', type_map(type_string(), type_integer()), nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayMergeCollectionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayMergeCollectionTest.php index e6573d38f3..05402483d8 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayMergeCollectionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayMergeCollectionTest.php @@ -32,7 +32,7 @@ public function test_array_merge_collection_in_strict_mode_with_non_array(): voi $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "integer".'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( array_merge_collection(ref('invalid_entry')), ['invalid_entry' => 1], schema(int_schema('invalid_entry')), @@ -44,7 +44,7 @@ public function test_array_merge_collection_in_strict_mode_with_non_array_elemen $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayMergeCollection function requires array elements to be arrays'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( array_merge_collection(ref('array_entry')), [ 'array_entry' => [ @@ -61,7 +61,7 @@ public function test_attempt_of_merging_collection_where_not_every_element_is_ar $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayMergeCollection function requires array elements to be arrays'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_merge_collection(ref('array_entry')), [ 'array_entry' => [ @@ -78,7 +78,7 @@ public function test_for_not_array_entry(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "integer".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_merge_collection(ref('invalid_entry')), ['invalid_entry' => 1], schema(int_schema('invalid_entry')), @@ -89,7 +89,7 @@ public function test_merging_collection_of_arrays(): void { static::assertEquals( [1, 2], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_merge_collection(ref('array_entry')), [ 'array_entry' => [ @@ -111,7 +111,7 @@ public function test_merging_a_string_keyed_collection(): void { static::assertSame( [1, 2], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( array_merge_collection(ref('array_entry')), ['array_entry' => ['a' => [1], 'b' => [2]]], schema(map_schema('array_entry', type_map(type_string(), type_list(type_integer())))), @@ -123,7 +123,7 @@ public function test_a_list_of_structures_declares_the_structure(): void { static::assertSame( 'structure{a?: integer}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('collection')->arrayMergeCollection(), schema(list_schema( @@ -140,7 +140,7 @@ public function test_an_interleaved_structure_keeps_its_order_and_every_field_co { static::assertSame( 'structure{z?: integer, a?: string, b?: integer}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('collection')->arrayMergeCollection(), schema(list_schema( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayMergeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayMergeTest.php index bcffadf27d..b2f1e8e7ec 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayMergeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayMergeTest.php @@ -34,7 +34,7 @@ public function test_array_merge_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "integer".'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( ref('a')->arrayMerge(ref('b')), ['a' => 1, 'b' => ['b' => 2]], schema(int_schema('a'), map_schema('b', type_map(type_string(), type_integer()))), @@ -45,7 +45,7 @@ public function test_array_merge_two_array_row_entries(): void { static::assertSame( ['a' => 1, 'b' => 2], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->arrayMerge(ref('b')), ['a' => ['a' => 1], 'b' => ['b' => 2]], schema( @@ -60,7 +60,7 @@ public function test_array_merge_two_lit_functions(): void { static::assertSame( ['a' => 1, 'b' => 2], - (new FunctionContext(flow_context()))->eval(new ArrayMerge(lit(['a' => 1]), lit(['b' => 2])), [], schema()), + new FunctionContext(flow_context())->eval(new ArrayMerge(lit(['a' => 1]), lit(['b' => 2])), [], schema()), ); } @@ -69,7 +69,7 @@ public function test_array_merge_when_left_side_is_not_an_array(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "integer".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->arrayMerge(ref('b')), ['a' => 1, 'b' => ['b' => 2]], schema(int_schema('a'), map_schema('b', type_map(type_string(), type_integer()))), @@ -81,7 +81,7 @@ public function test_array_merge_when_right_side_is_not_an_array(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "integer".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->arrayMerge(ref('b')), ['a' => ['a' => 1], 'b' => 2], schema(map_schema('a', type_map(type_string(), type_integer())), int_schema('b')), @@ -92,7 +92,7 @@ public function test_a_list_merged_with_a_map_declares_an_array(): void { static::assertEquals( type_array(), - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('a')->arrayMerge(ref('b')), schema( @@ -109,7 +109,7 @@ public function test_lists_without_a_common_element_type_refuse_to_declare(): vo $this->expectException(InvalidTypeException::class); $this->expectExceptionMessage('Cannot combine types "boolean", "datetime"'); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('a')->arrayMerge(ref('b')), schema(list_schema('a', type_list(type_boolean())), list_schema('b', type_list(type_datetime()))), @@ -122,7 +122,7 @@ public function test_array_merge_when_left_side_is_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayMerge function requires two non-null arrays'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->arrayMerge(ref('b')), ['a' => null, 'b' => ['b' => 2]], schema( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayPathExistsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayPathExistsTest.php index 18f632ebf0..61fc6ff3c6 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayPathExistsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayPathExistsTest.php @@ -22,7 +22,7 @@ public function test_a_null_array_is_null_and_does_not_stop_the_next_row(): void { static::assertSame( [null, true], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( array_exists(ref('array'), 'a'), [['array' => null], ['array' => ['a' => 1]]], diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayReverseTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayReverseTest.php index 5065e0c1e4..e1afcf305a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayReverseTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayReverseTest.php @@ -28,7 +28,7 @@ public function test_array_reverse_array_entry(): void { static::assertSame( [5, 3, 10, 4], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->arrayReverse(), ['a' => [ 4, @@ -46,7 +46,7 @@ public function test_array_reverse_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "integer".'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( ref('a')->arrayReverse(), ['a' => 123], schema(int_schema('a')), @@ -58,14 +58,14 @@ public function test_array_reverse_non_array_entry(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "integer".'); - (new FunctionContext(flow_context()))->eval(ref('a')->arrayReverse(), ['a' => 123], schema(int_schema('a'))); + new FunctionContext(flow_context())->eval(ref('a')->arrayReverse(), ['a' => 123], schema(int_schema('a'))); } public function test_a_structure_operand_declares_reversed_fields(): void { static::assertSame( 'structure{b: string, a: integer}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->arrayReverse(), schema(structure_schema('structure', type_structure([ @@ -82,7 +82,7 @@ public function test_optional_structure_fields_are_reversed_too(): void { static::assertSame( 'structure{y?: string, x?: string, a: integer}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->arrayReverse(), schema(structure_schema('structure', type_structure([ @@ -100,7 +100,7 @@ public function test_reversal_crosses_the_required_and_optional_buckets(): void { static::assertSame( 'structure{x?: string, b: integer, a: integer}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->arrayReverse(), schema(structure_schema('structure', type_structure([ @@ -119,7 +119,7 @@ public function test_array_reverse_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayReverse function requires non-null array'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('list')->arrayReverse(), ['list' => null], schema(list_schema('list', type_list(type_integer()), nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArraySortTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArraySortTest.php index 5cef64bf99..70a80e4552 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArraySortTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArraySortTest.php @@ -38,7 +38,7 @@ public function test_array_sort_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "string".'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( ref('array')->arraySort(), ['array' => 'string'], schema(str_schema('array')), @@ -158,7 +158,7 @@ public function test_sorting_big_arrays(string $json): void ]], ]], type_instance_of(Json::class) - ->assert((new FunctionContext(flow_context()))->eval( + ->assert(new FunctionContext(flow_context())->eval( ref('array')->arraySort(), ['array' => type_array()->assert(json_decode($json, true, 512, JSON_THROW_ON_ERROR))], schema(json_schema('array')), @@ -181,7 +181,7 @@ public function test_sorting_nested_array_using_asort_algo(): void ], ], type_instance_of(Json::class) - ->assert((new FunctionContext(flow_context()))->eval( + ->assert(new FunctionContext(flow_context())->eval( ref('array')->arraySort(Sort::asort), [ 'array' => [ @@ -214,7 +214,7 @@ public function test_sorting_nested_associative_array(): void ], ], type_instance_of(Json::class) - ->assert((new FunctionContext(flow_context()))->eval( + ->assert(new FunctionContext(flow_context())->eval( ref('array')->arraySort(Sort::ksort), [ 'array' => [ @@ -238,7 +238,7 @@ public function test_sorting_non_array_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "string".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('array')->arraySort(), ['array' => 'string'], schema(str_schema('array')), @@ -250,7 +250,7 @@ public function test_sorting_null_array(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArraySort function requires non-null array'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('array')->arraySort(), ['array' => null], schema(map_schema('array', type_map(type_string(), type_integer()), nullable: true)), @@ -261,7 +261,7 @@ public function test_a_null_recursive_flag_leaves_nested_arrays_unsorted(): void { static::assertSame( ['a' => ['d' => 1, 'c' => 2], 'b' => ['z' => 1, 'y' => 2]], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('array')->arraySort(Sort::ksort, recursive: ref('recursive')), ['array' => ['b' => ['z' => 1, 'y' => 2], 'a' => ['d' => 1, 'c' => 2]], 'recursive' => null], schema( @@ -276,7 +276,7 @@ public function test_ksort_declares_key_sorted_structure_fields(): void { static::assertSame( 'structure{a: integer, b: integer}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->arraySort(Sort::ksort), schema(structure_schema('structure', type_structure([ @@ -293,7 +293,7 @@ public function test_a_value_sort_keeps_the_declared_field_order(): void { static::assertSame( 'structure{b: integer, a: integer}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->arraySort(Sort::asort), schema(structure_schema('structure', type_structure([ @@ -310,7 +310,7 @@ public function test_krsort_declares_reverse_key_sorted_structure_fields(): void { static::assertSame( 'structure{b: integer, a: integer}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->arraySort(Sort::krsort), schema(structure_schema('structure', type_structure([ @@ -327,7 +327,7 @@ public function test_ksort_orders_across_the_required_and_optional_buckets(): vo { static::assertSame( 'structure{a?: integer, z: integer}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->arraySort(Sort::ksort), schema(structure_schema('structure', type_structure([ @@ -344,7 +344,7 @@ public function test_ksort_reproduces_php_key_order_for_numeric_element_names(): { static::assertSame( 'structure{9: integer, 10: integer, b: integer}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->arraySort(Sort::ksort), schema(structure_schema('structure', type_structure([ diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayUnpackTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayUnpackTest.php index 5dcb77c4bf..476b151ebf 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayUnpackTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayUnpackTest.php @@ -38,7 +38,7 @@ public function test_array_unpack(): void 'status' => 'PENDING', 'enabled' => true, ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new ArrayUnpack(ref('array_entry'), schema(str_schema('status'), bool_schema('enabled'))), [ 'id' => 1, @@ -65,7 +65,7 @@ public function test_array_unpack_with_null_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('array_unpack() requires a non-null array'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( new ArrayUnpack(ref('array_entry'), schema(str_schema('status'))), [ 'id' => 1, @@ -90,7 +90,7 @@ public function test_returns_the_declared_structure_with_every_column_nullable() 'status' => structure_element('status', type_optional(type_string())), 'enabled' => structure_element('enabled', type_optional(type_boolean())), ]), - (new ArrayUnpack(ref('array_entry'), schema(str_schema('status'), bool_schema('enabled'))))->returns(), + new ArrayUnpack(ref('array_entry'), schema(str_schema('status'), bool_schema('enabled')))->returns(), ); } @@ -98,7 +98,7 @@ public function test_the_declared_columns_are_readable_through_returns(): void { static::assertEquals( type_structure(['payload' => structure_element('payload', type_optional(type_json()))]), - (new ArrayUnpack(ref('array_entry'), schema(json_schema('payload'))))->returns(), + new ArrayUnpack(ref('array_entry'), schema(json_schema('payload')))->returns(), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayValuesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayValuesTest.php index d5655463fa..e94a381b43 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayValuesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ArrayValuesTest.php @@ -30,7 +30,7 @@ public function test_array_values(): void { static::assertSame( [1, 2], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('map')->arrayValues(), ['map' => [ 'a' => 1, @@ -46,7 +46,7 @@ public function test_array_values_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "string".'); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( ref('map')->arrayValues(), ['map' => 'test'], schema(str_schema('map')), @@ -58,7 +58,7 @@ public function test_array_values_on_non_array(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "string".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('map')->arrayValues(), ['map' => 'test'], schema(str_schema('map')), @@ -69,7 +69,7 @@ public function test_a_structure_operand_declares_the_unified_field_type(): void { static::assertSame( 'list', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->arrayValues(), schema(structure_schema('structure', type_structure([ @@ -86,7 +86,7 @@ public function test_a_structure_whose_fields_do_not_unify_refuses_to_declare(): { $this->expectException(SchemaNotDerivableException::class); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->arrayValues(), schema(structure_schema('structure', type_structure([ @@ -102,7 +102,7 @@ public function test_array_values_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ArrayValues function requires non-null array'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('map')->arrayValues(), ['map' => null], schema(map_schema('map', type_map(type_string(), type_integer()), nullable: true)), @@ -113,7 +113,7 @@ public function test_a_map_operand_declares_the_map_value_type(): void { static::assertSame( 'list', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('map')->arrayValues(), schema(map_schema('map', type_map(type_string(), type_integer())))) ->returns() ->toString(), @@ -125,7 +125,7 @@ public function test_a_scalar_operand_refuses_to_declare(): void $this->expectException(SchemaNotDerivableException::class); $this->expectExceptionMessage('the array operand declares "string", which has no element type'); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('map')->arrayValues(), schema(str_schema('map'))) ->returns(); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AsciiTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AsciiTest.php index 28b9779e96..4fb2ff48b5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AsciiTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/AsciiTest.php @@ -17,7 +17,7 @@ final class AsciiTest extends FlowTestCase { public function test_ascii(): void { - static::assertSame('azcz', (new FunctionContext(flow_context()))->eval( + static::assertSame('azcz', new FunctionContext(flow_context())->eval( ref('str')->ascii(), ['str' => 'ąźćż'], schema(str_schema('str')), @@ -29,7 +29,7 @@ public function test_ascii_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Ascii function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->ascii(), ['str' => null], schema(str_schema('str', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/BetweenTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/BetweenTest.php index c4c25c32d9..9a9d3c674f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/BetweenTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/BetweenTest.php @@ -25,7 +25,7 @@ final class BetweenTest extends FlowTestCase { public function test_a_definite_false_short_circuits_past_a_null(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( ref('value')->between(lit(10), lit(null)), ['value' => 5], schema(int_schema('value')), @@ -34,7 +34,7 @@ public function test_a_definite_false_short_circuits_past_a_null(): void public function test_a_null_bound_that_could_change_the_answer_is_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('value')->between(lit(10), lit(null)), ['value' => 50], schema(int_schema('value')), @@ -43,28 +43,28 @@ public function test_a_null_bound_that_could_change_the_answer_is_null(): void public function test_between_exclusive(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( between(ref('value'), lit(10), lit(50), Boundary::EXCLUSIVE), [ 'value' => 11, ], schema(int_schema('value')), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( between(ref('value'), lit(10), lit(50), Boundary::EXCLUSIVE), [ 'value' => 49, ], schema(int_schema('value')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( between(ref('value'), lit(10), lit(50), Boundary::EXCLUSIVE), [ 'value' => 10, ], schema(int_schema('value')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( between(ref('value'), lit(10), lit(50), Boundary::EXCLUSIVE), [ 'value' => 50, @@ -75,28 +75,28 @@ public function test_between_exclusive(): void public function test_between_inclusive(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( between(ref('value'), lit(10), lit(50), Boundary::INCLUSIVE), [ 'value' => 10, ], schema(int_schema('value')), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( between(ref('value'), lit(10), lit(50), Boundary::INCLUSIVE), [ 'value' => 50, ], schema(int_schema('value')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( between(ref('value'), lit(10), lit(50), Boundary::INCLUSIVE), [ 'value' => 9, ], schema(int_schema('value')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( between(ref('value'), lit(10), lit(50), Boundary::INCLUSIVE), [ 'value' => 51, @@ -107,14 +107,14 @@ public function test_between_inclusive(): void public function test_between_left_inclusive(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( between(ref('value'), lit(10), lit(50)), [ 'value' => 10, ], schema(int_schema('value')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( between(ref('value'), lit(10), lit(50)), [ 'value' => 9, @@ -125,14 +125,14 @@ public function test_between_left_inclusive(): void public function test_between_right_inclusive(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( between(ref('value'), lit(10), lit(50), Boundary::RIGHT_INCLUSIVE), [ 'value' => 50, ], schema(int_schema('value')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( between(ref('value'), lit(10), lit(50), Boundary::RIGHT_INCLUSIVE), [ 'value' => 51, @@ -146,7 +146,7 @@ public function test_between_with_invalid_boundary_in_strict_mode(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "object", got "string".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( between(ref('value'), lit(10), lit(50), lit('invalid')), [ 'value' => 20, @@ -178,7 +178,7 @@ public function test_between_refuses_a_value_incomparable_with_its_bounds(): voi public function test_with_operands_keeps_value_lower_and_upper_bound_in_order(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( between(lit(0), lit(0), lit(0), Boundary::EXCLUSIVE)->withOperands([lit(5), lit(1), lit(10)]), [], schema(), @@ -187,7 +187,7 @@ public function test_with_operands_keeps_value_lower_and_upper_bound_in_order(): public function test_between_orders_strings_by_bytes(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('a')->between(lit('10'), lit('9')), ['a' => '100'], schema(str_schema('a')), @@ -198,17 +198,17 @@ public function test_between_orders_a_numeric_string_column_numerically(): void { $context = flow_context(); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('a')->between(lit('10'), lit('9')), ['a' => '100'], schema(definition_from_type('a', type_numeric_string())), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('a')->between(lit('9'), lit('18446744073709551615'), lit(Boundary::INCLUSIVE)), ['a' => '18446744073709551615'], schema(definition_from_type('a', type_numeric_string())), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('a')->between(lit('9'), lit('18446744073709551614'), lit(Boundary::INCLUSIVE)), ['a' => '18446744073709551615'], schema(definition_from_type('a', type_numeric_string())), @@ -217,7 +217,7 @@ public function test_between_orders_a_numeric_string_column_numerically(): void public function test_a_null_value_is_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('value')->between(lit(1), lit(10)), ['value' => null], schema(int_schema('value', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/BinaryComparisonsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/BinaryComparisonsTest.php index 658a8d95ce..8de7041ad5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/BinaryComparisonsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/BinaryComparisonsTest.php @@ -36,7 +36,7 @@ final class BinaryComparisonsTest extends FlowTestCase { public function test_equals(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::EQUAL, ref('b')), [ 'a' => 100, @@ -47,7 +47,7 @@ public function test_equals(): void ], schema(int_schema('a'), int_schema('b'), int_schema('c'), datetime_schema('d'), datetime_schema('e')), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Comparison(ref('d'), Operator::EQUAL, ref('e')), [ 'a' => 100, @@ -58,7 +58,7 @@ public function test_equals(): void ], schema(int_schema('a'), int_schema('b'), int_schema('c'), datetime_schema('d'), datetime_schema('e')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::EQUAL, ref('c')), [ 'a' => 100, @@ -73,7 +73,7 @@ public function test_equals(): void public function test_greater_than(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::GREATER_THAN, ref('c')), [ 'a' => 100, @@ -92,7 +92,7 @@ public function test_greater_than(): void str_schema('f', nullable: true), ), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::GREATER_THAN, ref('f')), [ 'a' => 100, @@ -111,7 +111,7 @@ public function test_greater_than(): void str_schema('f', nullable: true), ), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('f'), Operator::GREATER_THAN, ref('c')), [ 'a' => 100, @@ -130,7 +130,7 @@ public function test_greater_than(): void str_schema('f', nullable: true), ), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('f'), Operator::GREATER_THAN, ref('f')), [ 'a' => 100, @@ -149,7 +149,7 @@ public function test_greater_than(): void str_schema('f', nullable: true), ), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::GREATER_THAN, ref('b')), [ 'a' => 100, @@ -168,7 +168,7 @@ public function test_greater_than(): void str_schema('f', nullable: true), ), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::GREATER_THAN_EQUAL, ref('c')), [ 'a' => 100, @@ -187,7 +187,7 @@ public function test_greater_than(): void str_schema('f', nullable: true), ), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::GREATER_THAN_EQUAL, ref('b')), [ 'a' => 100, @@ -206,7 +206,7 @@ public function test_greater_than(): void str_schema('f', nullable: true), ), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Comparison(ref('e'), Operator::GREATER_THAN_EQUAL, ref('d')), [ 'a' => 100, @@ -225,7 +225,7 @@ public function test_greater_than(): void str_schema('f', nullable: true), ), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Comparison( ref('e'), Operator::GREATER_THAN_EQUAL, @@ -248,7 +248,7 @@ public function test_greater_than(): void str_schema('f', nullable: true), ), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new Comparison( ref('e'), Operator::GREATER_THAN_EQUAL, @@ -271,7 +271,7 @@ public function test_greater_than(): void str_schema('f', nullable: true), ), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::GREATER_THAN_EQUAL, ref('f')), [ 'a' => 100, @@ -290,7 +290,7 @@ public function test_greater_than(): void str_schema('f', nullable: true), ), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('f'), Operator::GREATER_THAN_EQUAL, ref('c')), [ 'a' => 100, @@ -309,7 +309,7 @@ public function test_greater_than(): void str_schema('f', nullable: true), ), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('f'), Operator::GREATER_THAN_EQUAL, ref('f')), [ 'a' => 100, @@ -332,7 +332,7 @@ public function test_greater_than(): void public function test_greater_than_equal_with_null_in_strict_mode(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::GREATER_THAN_EQUAL, ref('f')), ['a' => 100, 'f' => null], schema(int_schema('a'), str_schema('f', nullable: true)), @@ -341,7 +341,7 @@ public function test_greater_than_equal_with_null_in_strict_mode(): void public function test_greater_than_with_null_in_strict_mode(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::GREATER_THAN, ref('f')), ['a' => 100, 'f' => null], schema(int_schema('a'), str_schema('f', nullable: true)), @@ -350,7 +350,7 @@ public function test_greater_than_with_null_in_strict_mode(): void public function test_is_in(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new IsIn(ref('a'), lit(1)), [ 'a' => [1, 2, 3, 4, 5], @@ -367,7 +367,7 @@ public function test_is_in(): void str_schema('e'), ), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new IsIn(ref('a'), lit(10)), [ 'a' => [1, 2, 3, 4, 5], @@ -384,7 +384,7 @@ public function test_is_in(): void str_schema('e'), ), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new IsIn(ref('a'), ref('d')), [ 'a' => [1, 2, 3, 4, 5], @@ -401,7 +401,7 @@ public function test_is_in(): void str_schema('e'), ), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new IsIn(ref('b'), ref('e')), [ 'a' => [1, 2, 3, 4, 5], @@ -422,7 +422,7 @@ public function test_is_in(): void public function test_is_in_with_null_array_in_strict_mode(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new IsIn(ref('a'), ref('d')), ['a' => null, 'd' => 1], schema(str_schema('a', nullable: true), int_schema('d')), @@ -431,32 +431,32 @@ public function test_is_in_with_null_array_in_strict_mode(): void public function test_is_numeric(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new IsNumeric(ref('a')), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new IsNumeric(ref('b')), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new IsNotNumeric(ref('a')), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new IsNotNumeric(ref('b')), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new IsNotNumeric(lit(null)), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new IsNumeric(lit(1000)), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), @@ -465,12 +465,12 @@ public function test_is_numeric(): void public function test_is_type(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new IsType(ref('a'), 'integer', 'string'), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new IsType(ref('a'), type_string()), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), @@ -481,7 +481,7 @@ public function test_is_type_with_non_existing_type_class(): void { $this->expectExceptionMessage('Unknown type \'aaa\''); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new IsType(ref('a'), 'aaa'), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), @@ -490,52 +490,52 @@ public function test_is_type_with_non_existing_type_class(): void public function test_less_than(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::LESS_THAN, ref('c')), ['a' => 100, 'b' => 100, 'c' => 10, 'd' => null], schema(int_schema('a'), int_schema('b'), int_schema('c'), str_schema('d', nullable: true)), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::LESS_THAN, ref('d')), ['a' => 100, 'b' => 100, 'c' => 10, 'd' => null], schema(int_schema('a'), int_schema('b'), int_schema('c'), str_schema('d', nullable: true)), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('d'), Operator::LESS_THAN, ref('d')), ['a' => 100, 'b' => 100, 'c' => 10, 'd' => null], schema(int_schema('a'), int_schema('b'), int_schema('c'), str_schema('d', nullable: true)), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('d'), Operator::LESS_THAN, ref('c')), ['a' => 100, 'b' => 100, 'c' => 10, 'd' => null], schema(int_schema('a'), int_schema('b'), int_schema('c'), str_schema('d', nullable: true)), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::LESS_THAN, ref('b')), ['a' => 100, 'b' => 100, 'c' => 10, 'd' => null], schema(int_schema('a'), int_schema('b'), int_schema('c'), str_schema('d', nullable: true)), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Comparison(ref('c'), Operator::LESS_THAN_EQUAL, ref('a')), ['a' => 100, 'b' => 100, 'c' => 10, 'd' => null], schema(int_schema('a'), int_schema('b'), int_schema('c'), str_schema('d', nullable: true)), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::LESS_THAN_EQUAL, ref('b')), ['a' => 100, 'b' => 100, 'c' => 10, 'd' => null], schema(int_schema('a'), int_schema('b'), int_schema('c'), str_schema('d', nullable: true)), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::LESS_THAN_EQUAL, ref('d')), ['a' => 100, 'b' => 100, 'c' => 10, 'd' => null], schema(int_schema('a'), int_schema('b'), int_schema('c'), str_schema('d', nullable: true)), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('d'), Operator::LESS_THAN_EQUAL, ref('c')), ['a' => 100, 'b' => 100, 'c' => 10, 'd' => null], schema(int_schema('a'), int_schema('b'), int_schema('c'), str_schema('d', nullable: true)), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('d'), Operator::LESS_THAN_EQUAL, ref('d')), ['a' => 100, 'b' => 100, 'c' => 10, 'd' => null], schema(int_schema('a'), int_schema('b'), int_schema('c'), str_schema('d', nullable: true)), @@ -544,7 +544,7 @@ public function test_less_than(): void public function test_less_than_equal_with_null_in_strict_mode(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::LESS_THAN_EQUAL, ref('d')), ['a' => 100, 'd' => null], schema(int_schema('a'), str_schema('d', nullable: true)), @@ -553,7 +553,7 @@ public function test_less_than_equal_with_null_in_strict_mode(): void public function test_less_than_with_null_in_strict_mode(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::LESS_THAN, ref('d')), ['a' => 100, 'd' => null], schema(int_schema('a'), str_schema('d', nullable: true)), @@ -562,12 +562,12 @@ public function test_less_than_with_null_in_strict_mode(): void public function test_not_equals(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::NOT_EQUAL, ref('b')), ['a' => 100, 'b' => 100, 'c' => 10], schema(int_schema('a'), int_schema('b'), int_schema('c')), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::NOT_EQUAL, ref('c')), ['a' => 100, 'b' => 100, 'c' => 10], schema(int_schema('a'), int_schema('b'), int_schema('c')), @@ -576,12 +576,12 @@ public function test_not_equals(): void public function test_not_same(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::NOT_IDENTICAL, ref('c')), ['a' => 100, 'b' => 100, 'c' => 10], schema(int_schema('a'), int_schema('b'), int_schema('c')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::NOT_IDENTICAL, ref('b')), ['a' => 100, 'b' => 100, 'c' => 10], schema(int_schema('a'), int_schema('b'), int_schema('c')), @@ -590,32 +590,32 @@ public function test_not_same(): void public function test_null(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new IsNull(ref('a')), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new IsNull(ref('b')), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new IsNotNull(ref('a')), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new IsNotNull(ref('b')), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new IsNull(lit(null)), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new IsNotNull(lit(1000)), ['a' => 100, 'b' => null], schema(int_schema('a'), str_schema('b', nullable: true)), @@ -624,7 +624,7 @@ public function test_null(): void public function test_same(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::IDENTICAL, ref('b')), [ 'a' => 100, @@ -636,7 +636,7 @@ public function test_same(): void schema(int_schema('a'), int_schema('b'), int_schema('c'), datetime_schema('d'), datetime_schema('e')), )); // two datetimes of the same instant are the same value - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Comparison(ref('d'), Operator::IDENTICAL, ref('e')), [ 'a' => 100, @@ -647,7 +647,7 @@ public function test_same(): void ], schema(int_schema('a'), int_schema('b'), int_schema('c'), datetime_schema('d'), datetime_schema('e')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new Comparison(ref('a'), Operator::IDENTICAL, ref('c')), [ 'a' => 100, @@ -662,7 +662,7 @@ public function test_same(): void public function test_starts_ends_with(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new StartsWith(ref('a'), lit('some not')), [ 'a' => 'some not too long string', @@ -672,7 +672,7 @@ public function test_starts_ends_with(): void ], schema(str_schema('a'), str_schema('b'), str_schema('c'), str_schema('d')), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new EndsWith(ref('a'), lit('long string')), [ 'a' => 'some not too long string', @@ -682,7 +682,7 @@ public function test_starts_ends_with(): void ], schema(str_schema('a'), str_schema('b'), str_schema('c'), str_schema('d')), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new StartsWith(ref('b'), ref('c')), [ 'a' => 'some not too long string', @@ -692,7 +692,7 @@ public function test_starts_ends_with(): void ], schema(str_schema('a'), str_schema('b'), str_schema('c'), str_schema('d')), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new EndsWith(ref('b'), ref('d')), [ 'a' => 'some not too long string', @@ -702,7 +702,7 @@ public function test_starts_ends_with(): void ], schema(str_schema('a'), str_schema('b'), str_schema('c'), str_schema('d')), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( new Contains(ref('a'), lit('too long')), [ 'a' => 'some not too long string', @@ -712,7 +712,7 @@ public function test_starts_ends_with(): void ], schema(str_schema('a'), str_schema('b'), str_schema('c'), str_schema('d')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new Contains(ref('a'), lit('blablabla')), [ 'a' => 'some not too long string', diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/BinaryLengthTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/BinaryLengthTest.php index 8853decdae..1fdf4e5efa 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/BinaryLengthTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/BinaryLengthTest.php @@ -17,7 +17,7 @@ final class BinaryLengthTest extends FlowTestCase { public function test_binary_length_ascii_string(): void { - static::assertSame(5, (new FunctionContext(flow_context()))->eval( + static::assertSame(5, new FunctionContext(flow_context())->eval( ref('str')->binaryLength(), ['str' => 'hello'], schema(str_schema('str')), @@ -26,7 +26,7 @@ public function test_binary_length_ascii_string(): void public function test_binary_length_binary_data(): void { - static::assertSame(5, (new FunctionContext(flow_context()))->eval( + static::assertSame(5, new FunctionContext(flow_context())->eval( ref('str')->binaryLength(), ['str' => "\x00\x01\x02\x03\xFF"], schema(str_schema('str')), @@ -35,7 +35,7 @@ public function test_binary_length_binary_data(): void public function test_binary_length_empty_string(): void { - static::assertSame(0, (new FunctionContext(flow_context()))->eval( + static::assertSame(0, new FunctionContext(flow_context())->eval( ref('str')->binaryLength(), ['str' => ''], schema(str_schema('str')), @@ -47,7 +47,7 @@ public function test_binary_length_throws_on_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('BinaryLength function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->binaryLength(), ['str' => null], schema(str_schema('str', nullable: true)), @@ -56,7 +56,7 @@ public function test_binary_length_throws_on_null_input(): void public function test_binary_length_string_with_newlines_and_tabs(): void { - static::assertSame(12, (new FunctionContext(flow_context()))->eval( + static::assertSame(12, new FunctionContext(flow_context())->eval( ref('str')->binaryLength(), ['str' => "hello\nworld\t"], schema(str_schema('str')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CallUserFuncTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CallUserFuncTest.php index 4c4d2efc36..3f9b5817f5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CallUserFuncTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CallUserFuncTest.php @@ -31,9 +31,9 @@ final class CallUserFuncTest extends FlowTestCase { public function test_children_are_a_list_for_named_parameters(): void { - static::assertEquals([lit('strval'), ref('integer')], (new CallUserFunc(lit('strval'), type_string(), [ + static::assertEquals([lit('strval'), ref('integer')], new CallUserFunc(lit('strval'), type_string(), [ 'value' => ref('integer'), - ]))->children()); + ])->children()); } public function test_it_is_never_deterministic(): void @@ -50,19 +50,15 @@ public function test_named_parameters_survive_a_rebuild(): void $rebuilt = $function->withChildren($function->children()); static::assertEquals( - (new FunctionContext(flow_context()))->eval($function, [], schema()), - (new FunctionContext(flow_context()))->eval($rebuilt, [], schema()), + new FunctionContext(flow_context())->eval($function, [], schema()), + new FunctionContext(flow_context())->eval($rebuilt, [], schema()), ); - static::assertEquals(['1', '2', '3'], (new FunctionContext(flow_context()))->eval($rebuilt, [], schema())); + static::assertEquals(['1', '2', '3'], new FunctionContext(flow_context())->eval($rebuilt, [], schema())); } public function test_call_user_func_as_dsl(): void { - static::assertIsInt((new FunctionContext(flow_context()))->eval( - call(lit('time'), type_integer()), - [], - schema(), - )); + static::assertIsInt(new FunctionContext(flow_context())->eval(call(lit('time'), type_integer()), [], schema())); } public function test_a_non_scalar_function_cannot_replace_the_callable_child(): void @@ -77,7 +73,7 @@ public function test_a_non_scalar_function_cannot_replace_the_callable_child(): public function test_call_user_func_with_array_callable(): void { - static::assertSame(3, (new FunctionContext(flow_context()))->eval( + static::assertSame(3, new FunctionContext(flow_context())->eval( ref('list')->call(lit([new StaticCalculator(), 'count']), type_integer()), ['list' => [ 1, @@ -90,7 +86,7 @@ public function test_call_user_func_with_array_callable(): void public function test_call_user_func_with_native_function(): void { - static::assertSame(3, (new FunctionContext(flow_context()))->eval( + static::assertSame(3, new FunctionContext(flow_context())->eval( ref('list')->call(lit('count'), type_integer()), ['list' => [1, 2, 3]], schema(list_schema('list', type_list(type_integer()))), @@ -101,7 +97,7 @@ public function test_call_user_func_with_ref_alias_and_optional_arguments(): voi { static::assertEquals( ['1', '2', '3'], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('item_ids')->call( lit('explode'), type_list(type_string()), @@ -118,7 +114,7 @@ public function test_call_user_func_with_ref_alias_and_optional_arguments_and_re { static::assertEquals( [1, 2, 3], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('item_ids')->call( lit('explode'), type_list(type_integer()), @@ -133,7 +129,7 @@ public function test_call_user_func_with_ref_alias_and_optional_arguments_and_re public function test_call_user_func_with_static_method(): void { - static::assertSame(3, (new FunctionContext(flow_context()))->eval( + static::assertSame(3, new FunctionContext(flow_context())->eval( ref('list')->call(lit(StaticCalculator::class . '::count'), type_integer()), ['list' => [1, 2, 3]], schema(list_schema('list', type_list(type_integer()))), @@ -142,17 +138,17 @@ public function test_call_user_func_with_static_method(): void public function test_a_callable_that_can_return_null_declares_a_nullable_column(): void { - static::assertSame('?string', (new CallUserFunc(lit('strtoupper'), type_string(), [ref( + static::assertSame('?string', new CallUserFunc(lit('strtoupper'), type_string(), [ref( 'name', - )]))->returns()->toString()); + )])->returns()->toString()); } public function test_a_null_return_lands_in_a_nullable_column(): void { - $result = (new ScalarFunctionTransformer( + $result = new ScalarFunctionTransformer( 'out', new CallUserFunc(lit([StaticCalculator::class, 'alwaysNull']), type_string(), []), - ))->transform(array_to_rows([['name' => 'a']], schema(str_schema('name'))), flow_context()->backend()); + )->transform(array_to_rows([['name' => 'a']], schema(str_schema('name'))), flow_context()->backend()); static::assertTrue($result->schema()->get('out')->isNullable()); static::assertNull($result->column('out')->value(0)); @@ -178,7 +174,7 @@ public function test_named_parameters_out_of_signature_order_survive_a_rebuild() static::assertEquals( ['1', '2', '3'], - (new FunctionContext(flow_context()))->eval($function->withChildren($function->children()), [], schema()), + new FunctionContext(flow_context())->eval($function->withChildren($function->children()), [], schema()), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CapitalizeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CapitalizeTest.php index bd6b5d571d..96ecd333da 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CapitalizeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CapitalizeTest.php @@ -18,7 +18,7 @@ final class CapitalizeTest extends FlowTestCase { public function test_capitalize_valid_string(): void { - static::assertSame('This Is A Value', (new FunctionContext(flow_context()))->eval( + static::assertSame('This Is A Value', new FunctionContext(flow_context())->eval( ref('string')->capitalize(), ['string' => 'this is a value'], schema(str_schema('string')), @@ -27,7 +27,7 @@ public function test_capitalize_valid_string(): void public function test_capitalize_multibyte_words(): void { - static::assertSame('Żółw Ćma', (new FunctionContext(flow_context()))->eval( + static::assertSame('Żółw Ćma', new FunctionContext(flow_context())->eval( ref('string')->capitalize(), ['string' => 'żółw ćma'], schema(str_schema('string')), @@ -36,7 +36,7 @@ public function test_capitalize_multibyte_words(): void public function test_capitalize_an_integer(): void { - static::assertSame('12', (new FunctionContext(flow_context()))->eval( + static::assertSame('12', new FunctionContext(flow_context())->eval( ref('number')->capitalize(), ['number' => 12], schema(int_schema('number')), @@ -48,7 +48,7 @@ public function test_capitalize_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Capitalize function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('string')->capitalize(), ['string' => null], schema(str_schema('string', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CastTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CastTest.php index 3449ef799d..c5349433d5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CastTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CastTest.php @@ -58,7 +58,7 @@ public function test_cast_of_a_null_value_throws(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Cast function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( cast(ref('value'), 'int'), [ 'value' => null, @@ -80,7 +80,7 @@ public function test_casting_a_datetime_column_to_string_equals_casting_each_val type_string()->cast($rows[0]['at']->setTimezone(new DateTimeZone($zone))), type_string()->cast($rows[1]['at']->setTimezone(new DateTimeZone($zone))), ], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column(cast(ref('at'), 'string'), $rows, schema(datetime_schema('at', zone: $zone))) ->values(), ); @@ -91,7 +91,7 @@ public function test_casting_a_date_column_to_string(): void { static::assertSame( ['2026-01-02T00:00:00+00:00', null], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( cast(ref('on'), type_optional(type_string())), [['on' => new DateTimeImmutable('2026-01-02')], ['on' => null]], @@ -104,7 +104,7 @@ public function test_casting_a_date_column_to_string(): void public function test_casting_a_null_datetime_to_string_is_refused_with_its_row_index(): void { try { - (new FunctionContext(flow_context()))->column( + new FunctionContext(flow_context())->column( cast(ref('at'), 'string'), [['at' => new DateTimeImmutable('2026-01-02')], ['at' => null]], schema(datetime_schema('at', nullable: true)), @@ -121,7 +121,7 @@ public function test_casting_a_string_column_to_string_keeps_its_values(): void { static::assertSame( ['a', ''], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column(cast(ref('s'), 'string'), [['s' => 'a'], ['s' => '']], schema(str_schema('s'))) ->values(), ); @@ -131,7 +131,7 @@ public function test_casting_a_nullable_string_column_to_an_optional_string(): v { static::assertSame( ['a', null], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( cast(ref('s'), type_optional(type_string())), [['s' => 'a'], ['s' => null]], @@ -144,7 +144,7 @@ public function test_casting_a_nullable_string_column_to_an_optional_string(): v public function test_casting_a_null_string_to_string_is_refused_with_its_row_index(): void { try { - (new FunctionContext(flow_context()))->column( + new FunctionContext(flow_context())->column( cast(ref('s'), 'string'), [['s' => 'a'], ['s' => null]], schema(str_schema('s', nullable: true)), @@ -163,7 +163,7 @@ public function test_casting_a_uuid_column_to_string_equals_casting_each_value() static::assertSame( [type_string()->cast($uuids[0]), type_string()->cast($uuids[1])], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column(cast(ref('u'), 'string'), [['u' => $uuids[0]], ['u' => $uuids[1]]], schema(uuid_schema('u'))) ->values(), ); @@ -173,7 +173,7 @@ public function test_casting_a_null_uuid_to_an_optional_string_is_null(): void { static::assertSame( ['9b9b7c1e-0d4f-4a0b-8f3a-1b2c3d4e5f60', null], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( cast(ref('u'), type_optional(type_string())), [['u' => new Uuid('9b9b7c1e-0d4f-4a0b-8f3a-1b2c3d4e5f60')], ['u' => null]], @@ -186,7 +186,7 @@ public function test_casting_a_null_uuid_to_an_optional_string_is_null(): void public function test_casting_a_null_uuid_to_string_is_refused_with_its_row_index(): void { try { - (new FunctionContext(flow_context()))->column( + new FunctionContext(flow_context())->column( cast(ref('u'), 'string'), [['u' => new Uuid('9b9b7c1e-0d4f-4a0b-8f3a-1b2c3d4e5f60')], ['u' => null]], schema(uuid_schema('u', nullable: true)), @@ -203,7 +203,7 @@ public function test_casting_a_string_column_to_string_asks_the_backend_for_no_b { $schema = schema(str_schema('s')); $backend = new SpyBackend(); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(cast(ref('s'), 'string'), $schema) ->eval(array_to_rows([['s' => 'a']], $schema, new PhpBackend()), $backend); @@ -217,7 +217,7 @@ public function test_a_cast_to_string_evaluates_its_child_once(): void static::assertSame( ['1', '2'], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column(cast($spy, 'string'), [['v' => 1], ['v' => 2]], schema(int_schema('v'))) ->values(), ); @@ -226,7 +226,7 @@ public function test_a_cast_to_string_evaluates_its_child_once(): void public function test_cast_of_a_null_value_to_an_optional_target_is_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( cast(ref('value'), type_optional(type_integer())), [ 'value' => null, @@ -238,7 +238,7 @@ public function test_cast_of_a_null_value_to_an_optional_target_is_null(): void public function test_a_refused_cast_keeps_the_casting_error_as_the_cause(): void { try { - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( cast(ref('value'), type_optional(type_datetime())), ['value' => 'abc'], schema(str_schema('value')), @@ -254,7 +254,7 @@ public function test_casting_an_unconvertible_value_to_an_optional_target_throws $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Cast function failed: Can\'t cast "string" into "datetime" type'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( cast(ref('value'), type_optional(type_datetime())), [ 'value' => 'abc', @@ -273,14 +273,14 @@ public function test_constructor_rejects_a_non_representable_target(): void public function test_double_and_real_resolve_to_float(): void { - static::assertSame(1.0, (new FunctionContext(flow_context()))->eval( + static::assertSame(1.0, new FunctionContext(flow_context())->eval( cast(ref('value'), 'double'), [ 'value' => '1', ], schema(str_schema('value')), )); - static::assertSame(1.0, (new FunctionContext(flow_context()))->eval( + static::assertSame(1.0, new FunctionContext(flow_context())->eval( cast(ref('value'), 'real'), [ 'value' => '1', @@ -401,13 +401,13 @@ public static function cast_provider(): array public function test_cast(mixed $from, Definition $definition, string $to, mixed $expected): void { // @mago-ignore analysis:mixed-assignment - $resultRefCast = (new FunctionContext(flow_context()))->eval( + $resultRefCast = new FunctionContext(flow_context())->eval( ref('value')->cast($to), ['value' => $from], schema($definition), ); // @mago-ignore analysis:mixed-assignment - $resultCastRef = (new FunctionContext(flow_context()))->eval( + $resultCastRef = new FunctionContext(flow_context())->eval( cast(ref('value'), $to), ['value' => $from], schema($definition), @@ -429,7 +429,7 @@ public function test_casting_a_scalar_to_array_names_the_remedy(): void 'Cast function failed: Can\'t cast "string" into "array" type: wrap the value first, e.g. type_list(type_string())', ); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->cast('array'), ['value' => '1'], schema(str_schema('value')), @@ -441,7 +441,7 @@ public function test_casting_integer_to_timezone(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Cast function failed: Can\'t cast "int" into "timezone" type'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->cast('timezone'), ['value' => 123], schema(int_schema('value')), @@ -453,7 +453,7 @@ public function test_casting_integer_to_xml(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Cast function failed: Can\'t cast "int" into "xml" type'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->cast('xml'), ['value' => 1], schema(int_schema('value')), @@ -465,7 +465,7 @@ public function test_casting_invalid_string_to_timezone(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Cast function failed: Can\'t cast "string" into "timezone" type'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->cast('timezone'), ['value' => 'invalid-timezone'], schema(str_schema('value')), @@ -477,7 +477,7 @@ public function test_casting_non_xml_string_to_xml(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Cast function failed: Can\'t cast "string" into "xml" type'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->cast('xml'), ['value' => 'foo'], schema(str_schema('value')), @@ -512,7 +512,7 @@ public function test_a_rejected_target_keeps_the_definition_error_as_the_cause() public function test_casting_an_xml_column_to_string_keeps_the_document_text(): void { - static::assertSame('a', (new FunctionContext(flow_context()))->eval( + static::assertSame('a', new FunctionContext(flow_context())->eval( ref('value')->cast('string'), ['value' => 'a'], schema(xml_schema('value')), @@ -521,7 +521,7 @@ public function test_casting_an_xml_column_to_string_keeps_the_document_text(): public function test_casting_a_json_column_to_string_keeps_the_json_text(): void { - static::assertSame('{"a":1}', (new FunctionContext(flow_context()))->eval( + static::assertSame('{"a":1}', new FunctionContext(flow_context())->eval( ref('value')->cast('string'), ['value' => '{"a":1}'], schema(json_schema('value')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ChunkTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ChunkTest.php index 297bd17126..2eaa35cebe 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ChunkTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ChunkTest.php @@ -20,7 +20,7 @@ public function test_chunk_empty_string(): void { static::assertSame( [], - (new FunctionContext(flow_context()))->eval(ref('str')->chunk(3), ['str' => ''], schema(str_schema('str'))), + new FunctionContext(flow_context())->eval(ref('str')->chunk(3), ['str' => ''], schema(str_schema('str'))), ); } @@ -28,7 +28,7 @@ public function test_chunk_equal_to_string_length(): void { static::assertSame( ['hello'], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->chunk(5), ['str' => 'hello'], schema(str_schema('str')), @@ -40,7 +40,7 @@ public function test_chunk_larger_than_string_length(): void { static::assertSame( ['hello'], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->chunk(10), ['str' => 'hello'], schema(str_schema('str')), @@ -53,11 +53,7 @@ public function test_chunk_negative_size(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Chunk function requires non-null, positive size'); - (new FunctionContext(flow_context()))->eval( - ref('str')->chunk(-1), - ['str' => 'hello'], - schema(str_schema('str')), - ); + new FunctionContext(flow_context())->eval(ref('str')->chunk(-1), ['str' => 'hello'], schema(str_schema('str'))); } public function test_chunk_null_input(): void @@ -65,7 +61,7 @@ public function test_chunk_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Chunk function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->chunk(3), ['str' => null], schema(str_schema('str', nullable: true)), @@ -76,7 +72,7 @@ public function test_chunk_string_basic_functionality(): void { static::assertSame( ['hel', 'lo '], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->chunk(3), ['str' => 'hello '], schema(str_schema('str')), @@ -89,7 +85,7 @@ public function test_chunk_with_null_size(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Chunk function requires non-null, positive size'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->chunk(ref('size')), ['str' => 'hello', 'size' => null], schema(str_schema('str'), str_schema('size', nullable: true)), @@ -100,7 +96,7 @@ public function test_chunk_with_scalar_function_size(): void { static::assertSame( ['he', 'll', 'o'], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->chunk(ref('size')), ['str' => 'hello', 'size' => 2], schema(str_schema('str'), int_schema('size')), @@ -113,10 +109,6 @@ public function test_chunk_zero_size(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Chunk function requires non-null, positive size'); - (new FunctionContext(flow_context()))->eval( - ref('str')->chunk(0), - ['str' => 'hello'], - schema(str_schema('str')), - ); + new FunctionContext(flow_context())->eval(ref('str')->chunk(0), ['str' => 'hello'], schema(str_schema('str'))); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CoalesceTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CoalesceTest.php index 332e393317..8302ab9725 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CoalesceTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CoalesceTest.php @@ -33,13 +33,13 @@ final class CoalesceTest extends FlowTestCase { public function test_children_of_named_values_are_a_list(): void { - static::assertTrue(array_is_list((new Coalesce(...['a' => lit(1), 'b' => lit(2)]))->children())); + static::assertTrue(array_is_list(new Coalesce(...['a' => lit(1), 'b' => lit(2)])->children())); } public function test_a_non_nullable_branch_makes_the_result_not_nullable(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( coalesce(ref('name'), lit('N/A')), schema(str_schema('name', nullable: true)), ); @@ -50,7 +50,7 @@ public function test_a_non_nullable_branch_makes_the_result_not_nullable(): void public function test_coalesce_entries(): void { // coalesce() of string and integer declares string: the value is cast to it - static::assertSame('1', (new FunctionContext(flow_context()))->eval( + static::assertSame('1', new FunctionContext(flow_context())->eval( coalesce(ref('name'), ref('id'), lit('N/A')), [ 'name' => null, @@ -62,7 +62,7 @@ public function test_coalesce_entries(): void public function test_coalesce_on_null_entries_falls_through_to_lit(): void { - static::assertSame('N/A', (new FunctionContext(flow_context()))->eval( + static::assertSame('N/A', new FunctionContext(flow_context())->eval( coalesce(ref('name'), ref('string'), lit('N/A')), [ 'name' => null, @@ -75,7 +75,7 @@ public function test_coalesce_on_null_entries_falls_through_to_lit(): void public function test_coalesce_on_ref(): void { // coalesce() of string and integer declares string: the value is cast to it - static::assertSame('1', (new FunctionContext(flow_context()))->eval( + static::assertSame('1', new FunctionContext(flow_context())->eval( ref('name')->coalesce(ref('id'), lit('N/A')), ['name' => null, 'id' => 1], schema(str_schema('name', nullable: true), int_schema('id')), @@ -86,7 +86,7 @@ public function test_a_throwing_branch_is_not_swallowed(): void { $this->expectException(InvalidArgumentException::class); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( coalesce(ref('a')->upper(), ref('b')->upper()), ['a' => 1, 'b' => 2], schema(int_schema('a'), int_schema('b')), @@ -102,7 +102,7 @@ public function test_an_unreached_argument_that_would_throw_is_not_evaluated(): static::assertSame( [1, 2], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(coalesce(ref('a'), new FailingOnValuesFunction(ref('v'), [99])), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -118,7 +118,7 @@ public function test_a_null_row_keeps_later_rows_of_the_first_argument(): void static::assertSame( [5, 1], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(coalesce(ref('a'), ref('b')), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -130,7 +130,7 @@ public function test_branches_without_a_common_type_refuse_to_declare(): void $this->expectException(InvalidTypeException::class); $this->expectExceptionMessage('Cannot combine types "integer", "list" - an explicit cast is required.'); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( coalesce(ref('integer'), ref('list')), schema(int_schema('integer'), list_schema('list', type_list(type_string()))), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CodePointLengthTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CodePointLengthTest.php index 7df8be093a..a0de3d8082 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CodePointLengthTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CodePointLengthTest.php @@ -17,7 +17,7 @@ final class CodePointLengthTest extends FlowTestCase { public function test_code_point_length_ascii_string(): void { - static::assertSame(5, (new FunctionContext(flow_context()))->eval( + static::assertSame(5, new FunctionContext(flow_context())->eval( ref('str')->codePointLength(), ['str' => 'hello'], schema(str_schema('str')), @@ -26,7 +26,7 @@ public function test_code_point_length_ascii_string(): void public function test_code_point_length_empty_string(): void { - static::assertSame(0, (new FunctionContext(flow_context()))->eval( + static::assertSame(0, new FunctionContext(flow_context())->eval( ref('str')->codePointLength(), ['str' => ''], schema(str_schema('str')), @@ -38,7 +38,7 @@ public function test_code_point_length_throws_on_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('CodePointLength function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->codePointLength(), ['str' => null], schema(str_schema('str', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CollapseWhitespaceTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CollapseWhitespaceTest.php index 257e45e3a5..923ca18e2c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CollapseWhitespaceTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CollapseWhitespaceTest.php @@ -17,7 +17,7 @@ final class CollapseWhitespaceTest extends FlowTestCase { public function test_empty_string(): void { - static::assertEquals('', (new FunctionContext(flow_context()))->eval( + static::assertEquals('', new FunctionContext(flow_context())->eval( ref('str')->collapseWhitespace(), ['str' => ''], schema(str_schema('str')), @@ -26,7 +26,7 @@ public function test_empty_string(): void public function test_leading_and_trailing_whitespace(): void { - static::assertEquals('Hello world', (new FunctionContext(flow_context()))->eval( + static::assertEquals('Hello world', new FunctionContext(flow_context())->eval( ref('str')->collapseWhitespace(), ['str' => ' Hello world '], schema(str_schema('str')), @@ -35,7 +35,7 @@ public function test_leading_and_trailing_whitespace(): void public function test_leading_whitespace(): void { - static::assertEquals('Hello world', (new FunctionContext(flow_context()))->eval( + static::assertEquals('Hello world', new FunctionContext(flow_context())->eval( ref('str')->collapseWhitespace(), ['str' => ' Hello world'], schema(str_schema('str')), @@ -44,7 +44,7 @@ public function test_leading_whitespace(): void public function test_mixed_whitespace_types(): void { - static::assertEquals('Hello world test', (new FunctionContext(flow_context()))->eval( + static::assertEquals('Hello world test', new FunctionContext(flow_context())->eval( ref('str')->collapseWhitespace(), ['str' => "Hello\t\tworld\n\ntest"], schema(str_schema('str')), @@ -53,7 +53,7 @@ public function test_mixed_whitespace_types(): void public function test_multiple_spaces_between_words(): void { - static::assertEquals('Hello world test', (new FunctionContext(flow_context()))->eval( + static::assertEquals('Hello world test', new FunctionContext(flow_context())->eval( ref('str')->collapseWhitespace(), ['str' => 'Hello world test'], schema(str_schema('str')), @@ -65,7 +65,7 @@ public function test_null_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('CollapseWhitespace function requires non-null value'); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->collapseWhitespace(), ['str' => null], schema(str_schema('str', nullable: true)), @@ -74,7 +74,7 @@ public function test_null_value(): void public function test_single_spaces(): void { - static::assertEquals('Hello world test', (new FunctionContext(flow_context()))->eval( + static::assertEquals('Hello world test', new FunctionContext(flow_context())->eval( ref('str')->collapseWhitespace(), ['str' => 'Hello world test'], schema(str_schema('str')), @@ -83,7 +83,7 @@ public function test_single_spaces(): void public function test_single_word(): void { - static::assertEquals('Hello', (new FunctionContext(flow_context()))->eval( + static::assertEquals('Hello', new FunctionContext(flow_context())->eval( ref('str')->collapseWhitespace(), ['str' => 'Hello'], schema(str_schema('str')), @@ -92,7 +92,7 @@ public function test_single_word(): void public function test_trailing_whitespace(): void { - static::assertEquals('Hello world', (new FunctionContext(flow_context()))->eval( + static::assertEquals('Hello world', new FunctionContext(flow_context())->eval( ref('str')->collapseWhitespace(), ['str' => 'Hello world '], schema(str_schema('str')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CollectTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CollectTest.php index f6e31249ab..75113de76c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CollectTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CollectTest.php @@ -89,7 +89,7 @@ public function test_a_nullable_source_column_yields_a_nullable_element_type(): { static::assertSame( '?list', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(collect(ref('v')), schema(int_schema('v', true))) ->returns() ->toString(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CombineTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CombineTest.php index 02cab70399..9388e28e5f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CombineTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CombineTest.php @@ -27,7 +27,7 @@ final class CombineTest extends FlowTestCase public function test_operands_that_are_not_lists_are_refused_at_bind(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( combine(ref('keys'), ref('values')), schema(list_schema('keys', type_list(type_string())), str_schema('values')), ); @@ -42,20 +42,20 @@ public function test_array_combine(): void { static::assertSame( ['a' => 1, 'b' => 2, 'c' => 3], - (new FunctionContext(flow_context()))->eval(combine(lit(['a', 'b', 'c']), lit([1, 2, 3])), [], schema()), + new FunctionContext(flow_context())->eval(combine(lit(['a', 'b', 'c']), lit([1, 2, 3])), [], schema()), ); } public function test_array_combine_when_arrays_are_empty(): void { - static::assertSame([], (new FunctionContext(flow_context()))->eval(combine(lit([]), lit([])), [], schema())); + static::assertSame([], new FunctionContext(flow_context())->eval(combine(lit([]), lit([])), [], schema())); } public function test_an_empty_row_keeps_the_rows_after_it(): void { static::assertSame( [[], ['a' => 1]], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( combine(ref('keys'), ref('values')), [['keys' => [], 'values' => []], ['keys' => ['a'], 'values' => [1]]], @@ -73,14 +73,14 @@ public function test_array_combine_when_keys_are_not_array(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "array", got "string".'); - (new FunctionContext(flow_context()))->eval(combine(lit('a'), lit([1, 2, 3])), [], schema()); + new FunctionContext(flow_context())->eval(combine(lit('a'), lit([1, 2, 3])), [], schema()); } public function test_array_combine_when_keys_are_not_unique(): void { static::assertSame( ['a' => 4, 'b' => 2, 'c' => 3], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( combine(lit(['a', 'b', 'c', 'a']), lit([1, 2, 3, 4])), [], schema(), @@ -93,14 +93,14 @@ public function test_array_combine_when_one_of_arrays_is_empty(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Combine function requires keys and values arrays to have the same length'); - (new FunctionContext(flow_context()))->eval(combine(lit(['a', 'b', 'c']), lit([])), [], schema()); + new FunctionContext(flow_context())->eval(combine(lit(['a', 'b', 'c']), lit([])), [], schema()); } public function test_array_combine_with_a_single_key(): void { static::assertSame( ['a' => 1], - (new FunctionContext(flow_context()))->eval(combine(lit(['a']), lit([1])), [], schema()), + new FunctionContext(flow_context())->eval(combine(lit(['a']), lit([1])), [], schema()), ); } @@ -109,7 +109,7 @@ public function test_array_combine_when_keys_are_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Combine function requires non-null arrays'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( combine(ref('keys'), ref('values')), ['keys' => null, 'values' => [1]], schema( @@ -124,7 +124,7 @@ public function test_array_combine_when_first_key_is_a_float_and_second_an_integ $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Combine function requires keys to be strings or integers'); - (new FunctionContext(flow_context()))->eval(combine(lit([1.5, 2]), lit([1, 2])), [], schema()); + new FunctionContext(flow_context())->eval(combine(lit([1.5, 2]), lit([1, 2])), [], schema()); } public function test_array_combine_when_the_only_key_is_a_float(): void @@ -132,7 +132,7 @@ public function test_array_combine_when_the_only_key_is_a_float(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Combine function requires keys to be strings or integers'); - (new FunctionContext(flow_context()))->eval(combine(lit([1.5]), lit([1])), [], schema()); + new FunctionContext(flow_context())->eval(combine(lit([1.5]), lit([1])), [], schema()); } public function test_array_combine_when_a_later_key_is_a_float(): void @@ -140,7 +140,7 @@ public function test_array_combine_when_a_later_key_is_a_float(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Combine function requires keys to be strings or integers'); - (new FunctionContext(flow_context()))->eval(combine(lit(['a', 1.5]), lit([1, 2])), [], schema()); + new FunctionContext(flow_context())->eval(combine(lit(['a', 1.5]), lit([1, 2])), [], schema()); } public function test_array_combine_when_a_later_key_is_a_boolean(): void @@ -148,6 +148,6 @@ public function test_array_combine_when_a_later_key_is_a_boolean(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Combine function requires keys to be strings or integers'); - (new FunctionContext(flow_context()))->eval(combine(lit(['a', true]), lit([1, 2])), [], schema()); + new FunctionContext(flow_context())->eval(combine(lit(['a', true]), lit([1, 2])), [], schema()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ComparisonTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ComparisonTest.php index d0c82fa5a5..b9c983cdf7 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ComparisonTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ComparisonTest.php @@ -66,12 +66,12 @@ public function test_refuses_an_operator_that_does_not_compare_two_values(Operat public function test_equality_casts_a_temporal_string(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('d')->equals(lit('2024-01-01')), ['d' => new DateTimeImmutable('2024-01-01')], schema(date_schema('d')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( ref('d')->notEquals(lit('2024-01-01')), ['d' => new DateTimeImmutable('2024-01-01')], schema(date_schema('d')), @@ -89,7 +89,7 @@ public function test_identity_refuses_a_temporal_string(Operator $operator): voi . " string)' due to data type mismatch - an explicit cast is required.", ); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(new Comparison(ref('d'), $operator, lit('2024-01-01')), schema(date_schema('d'))) ->returns(); } @@ -99,7 +99,7 @@ public function test_a_cast_error_names_the_column_read_never_the_alias(): void $this->expectException(EvaluationException::class); $this->expectExceptionMessage("Column \"a\" value 'x' cannot be cast to integer to compare"); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->as('b')->equals(lit(1)), ['a' => 'x'], schema(str_schema('a')), @@ -110,7 +110,7 @@ public function test_a_cast_error_names_the_column_read_never_the_alias(): void public function test_a_cast_error_message(Backend $backend): void { try { - (new FunctionContext(flow_context(config_builder()->backend($backend)->build())))->eval( + new FunctionContext(flow_context(config_builder()->backend($backend)->build()))->eval( ref('a')->equals(lit(1)), ['a' => 'x'], schema(str_schema('a')), @@ -126,12 +126,12 @@ public function test_a_cast_error_message(Backend $backend): void public function test_negations_keep_null_unknown_and_identity_defined(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('a')->notEquals(lit(1)), ['a' => null], schema(int_schema('a', nullable: true)), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('a')->notSame(lit(1)), ['a' => null], schema(int_schema('a', nullable: true)), @@ -140,12 +140,12 @@ public function test_negations_keep_null_unknown_and_identity_defined(): void public function test_null_operand_yields_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('a')->equals(lit(1)), ['a' => null], schema(str_schema('a', nullable: true)), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('a')->equals(ref('b')), ['a' => null, 'b' => null], schema(str_schema('a', nullable: true), str_schema('b', nullable: true)), @@ -154,17 +154,17 @@ public function test_null_operand_yields_null(): void public function test_equal_values(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('a')->equals(lit(1)), ['a' => 1], schema(int_schema('a')), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('a')->equals(lit('x')), ['a' => 'x'], schema(str_schema('a')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( ref('a')->equals(lit(2)), ['a' => 1], schema(int_schema('a')), @@ -219,7 +219,7 @@ public static function values_of_one_type(): Generator #[DataProvider('values_of_one_type')] public function test_values_of_one_type_compare_by_value(Type $type, mixed $left, mixed $right, bool $equal): void { - static::assertSame($equal, (new FunctionContext(flow_context()))->eval( + static::assertSame($equal, new FunctionContext(flow_context())->eval( ref('a')->equals(ref('b')), ['a' => $left, 'b' => $right], schema(definition_from_type('a', $type), definition_from_type('b', $type)), @@ -228,7 +228,7 @@ public function test_values_of_one_type_compare_by_value(Type $type, mixed $left public function test_a_datetime_equals_a_literal_of_the_same_instant_in_another_zone(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('a')->equals(lit(new DateTimeImmutable('2024-01-01 13:00:00', new DateTimeZone('Europe/Warsaw')))), ['a' => new DateTimeImmutable('2024-01-01 12:00:00', new DateTimeZone('UTC'))], schema(definition_from_type('a', type_datetime())), @@ -240,7 +240,7 @@ public function test_a_uuid_is_not_comparable_with_a_string(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage("Can't compare '(uuid == string)' due to data type mismatch"); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('u')->equals(lit('00000000-0000-4000-8000-000000000001')), schema(definition_from_type('u', type_uuid())), @@ -251,12 +251,12 @@ public function test_a_uuid_is_not_comparable_with_a_string(): void public function test_null_is_identical_to_null(): void { // PHP identity, not SQL equality - ->same() is the migration path for both-null checks. - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('a')->same(lit(null)), ['a' => null], schema(str_schema('a', nullable: true)), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( ref('a')->same(lit(1)), ['a' => null], schema(str_schema('a', nullable: true)), @@ -303,7 +303,7 @@ public function test_identical_values_of_one_type_are_the_same_by_value( mixed $right, bool $same, ): void { - static::assertSame($same, (new FunctionContext(flow_context()))->eval( + static::assertSame($same, new FunctionContext(flow_context())->eval( ref('a')->same(ref('b')), ['a' => $left, 'b' => $right], schema(definition_from_type('a', $type), definition_from_type('b', $type)), @@ -313,7 +313,7 @@ public function test_identical_values_of_one_type_are_the_same_by_value( public function test_an_integer_column_compared_to_a_string_literal_still_works(): void { // Comparator::comparable(integer, string) stays deliberately loose - 5 > '3' keeps working. - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('a')->greaterThan(lit('3')), ['a' => 5], schema(int_schema('a')), @@ -324,17 +324,17 @@ public function test_greater_than_arrays(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThan(lit([1, 0])), ['v' => [1, 9]], schema(list_schema('v', type_list(type_integer()))), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThan(lit([1, 9])), ['v' => [1, 0]], schema(list_schema('v', type_list(type_integer()))), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThan(lit([1, 0])), ['v' => [1, 0]], schema(list_schema('v', type_list(type_integer()))), @@ -345,21 +345,21 @@ public function test_greater_than_datetimes(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThan(lit(new DateTimeImmutable('2024-01-01'))), [ 'v' => new DateTimeImmutable('2024-06-01'), ], schema(datetime_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThan(lit(new DateTimeImmutable('2024-01-01'))), [ 'v' => new DateTimeImmutable('2023-06-01'), ], schema(datetime_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThan(lit(new DateTimeImmutable('2024-01-01'))), [ 'v' => new DateTimeImmutable('2024-01-01'), @@ -372,17 +372,17 @@ public function test_greater_than_floats(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThan(lit(1.5)), ['v' => 2.5], schema(float_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThan(lit(2.5)), ['v' => 1.5], schema(float_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThan(lit(1.5)), ['v' => 1.5], schema(float_schema('v')), @@ -393,17 +393,17 @@ public function test_greater_than_integers(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThan(lit(10)), ['v' => 20], schema(int_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThan(lit(20)), ['v' => 10], schema(int_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThan(lit(10)), ['v' => 10], schema(int_schema('v')), @@ -412,7 +412,7 @@ public function test_greater_than_integers(): void public function test_greater_than_returns_null_for_null_left(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->greaterThan(lit(10)), ['v' => null], schema(str_schema('v', nullable: true)), @@ -421,7 +421,7 @@ public function test_greater_than_returns_null_for_null_left(): void public function test_greater_than_returns_null_for_null_right(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->greaterThan(ref('other')), ['v' => 10, 'other' => null], schema(int_schema('v'), str_schema('other', nullable: true)), @@ -430,7 +430,7 @@ public function test_greater_than_returns_null_for_null_right(): void public function test_greater_than_returns_null_for_null_string(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->greaterThan(lit('a')), ['v' => null], schema(str_schema('v', nullable: true)), @@ -439,7 +439,7 @@ public function test_greater_than_returns_null_for_null_string(): void public function test_greater_than_returns_null_for_null_datetime(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->greaterThan(lit(new DateTimeImmutable('2024-01-01'))), ['v' => null], schema(datetime_schema('v', nullable: true)), @@ -448,7 +448,7 @@ public function test_greater_than_returns_null_for_null_datetime(): void public function test_greater_than_returns_null_for_null_time_interval(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->greaterThan(lit(new DateInterval('PT1H'))), ['v' => null], schema(time_schema('v', nullable: true)), @@ -457,7 +457,7 @@ public function test_greater_than_returns_null_for_null_time_interval(): void public function test_greater_than_returns_null_for_null_array(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->greaterThan(lit([1, 0])), ['v' => null], schema(list_schema('v', type_list(type_integer()), nullable: true)), @@ -468,17 +468,17 @@ public function test_greater_than_strings(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThan(lit('apple')), ['v' => 'banana'], schema(str_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThan(lit('banana')), ['v' => 'apple'], schema(str_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThan(lit('apple')), ['v' => 'apple'], schema(str_schema('v')), @@ -496,17 +496,17 @@ public function test_greater_than_time_intervals(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThan(lit(new DateInterval('PT1H'))), ['v' => new DateInterval('PT5H')], schema(time_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThan(lit(new DateInterval('PT5H'))), ['v' => new DateInterval('PT1H')], schema(time_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThan(lit(new DateInterval('PT1H'))), ['v' => new DateInterval('PT1H')], schema(time_schema('v')), @@ -515,7 +515,7 @@ public function test_greater_than_time_intervals(): void public function test_greater_than_orders_strings_by_bytes(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('a')->greaterThan(lit('10')), ['a' => '9'], schema(str_schema('a')), @@ -526,12 +526,12 @@ public function test_greater_than_orders_a_numeric_string_column_numerically(): { $context = flow_context(); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('a')->greaterThan(lit('10')), ['a' => '9'], schema(definition_from_type('a', type_numeric_string())), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('a')->greaterThan(lit('18446744073709551614')), ['a' => '18446744073709551615'], schema(definition_from_type('a', type_numeric_string())), @@ -542,12 +542,12 @@ public function test_greater_than_ranks_nan_above_every_number(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('a')->greaterThan(lit(1.0)), ['a' => NAN], schema(float_schema('a')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( lit(1.0)->greaterThan(ref('a')), ['a' => NAN], schema(float_schema('a')), @@ -558,17 +558,17 @@ public function test_greater_than_equal_arrays(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit([1, 0])), ['v' => [1, 9]], schema(list_schema('v', type_list(type_integer()))), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit([1, 0])), ['v' => [1, 0]], schema(list_schema('v', type_list(type_integer()))), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit([1, 9])), ['v' => [1, 0]], schema(list_schema('v', type_list(type_integer()))), @@ -579,21 +579,21 @@ public function test_greater_than_equal_datetimes(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit(new DateTimeImmutable('2024-01-01'))), [ 'v' => new DateTimeImmutable('2024-06-01'), ], schema(datetime_schema('v')), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit(new DateTimeImmutable('2024-01-01'))), [ 'v' => new DateTimeImmutable('2024-01-01'), ], schema(datetime_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit(new DateTimeImmutable('2024-06-01'))), [ 'v' => new DateTimeImmutable('2024-01-01'), @@ -606,17 +606,17 @@ public function test_greater_than_equal_floats(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit(1.5)), ['v' => 2.5], schema(float_schema('v')), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit(1.5)), ['v' => 1.5], schema(float_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit(2.5)), ['v' => 1.5], schema(float_schema('v')), @@ -627,17 +627,17 @@ public function test_greater_than_equal_integers(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit(10)), ['v' => 20], schema(int_schema('v')), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit(10)), ['v' => 10], schema(int_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit(20)), ['v' => 10], schema(int_schema('v')), @@ -646,7 +646,7 @@ public function test_greater_than_equal_integers(): void public function test_greater_than_equal_returns_null_for_null_array(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->greaterThanEqual(lit([1, 0])), ['v' => null], schema(list_schema('v', type_list(type_integer()), nullable: true)), @@ -655,7 +655,7 @@ public function test_greater_than_equal_returns_null_for_null_array(): void public function test_greater_than_equal_returns_null_for_null_datetime(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->greaterThanEqual(lit(new DateTimeImmutable('2024-01-01'))), ['v' => null], schema(datetime_schema('v', nullable: true)), @@ -664,7 +664,7 @@ public function test_greater_than_equal_returns_null_for_null_datetime(): void public function test_greater_than_equal_returns_null_for_null_left(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->greaterThanEqual(lit(10)), ['v' => null], schema(str_schema('v', nullable: true)), @@ -673,7 +673,7 @@ public function test_greater_than_equal_returns_null_for_null_left(): void public function test_greater_than_equal_returns_null_for_null_right(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->greaterThanEqual(ref('other')), ['v' => 10, 'other' => null], schema(int_schema('v'), str_schema('other', nullable: true)), @@ -682,7 +682,7 @@ public function test_greater_than_equal_returns_null_for_null_right(): void public function test_greater_than_equal_returns_null_for_null_string(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->greaterThanEqual(lit('a')), ['v' => null], schema(str_schema('v', nullable: true)), @@ -691,7 +691,7 @@ public function test_greater_than_equal_returns_null_for_null_string(): void public function test_greater_than_equal_returns_null_for_null_time_interval(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->greaterThanEqual(lit(new DateInterval('PT1H'))), ['v' => null], schema(time_schema('v', nullable: true)), @@ -702,17 +702,17 @@ public function test_greater_than_equal_strings(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit('apple')), ['v' => 'banana'], schema(str_schema('v')), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit('apple')), ['v' => 'apple'], schema(str_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit('banana')), ['v' => 'apple'], schema(str_schema('v')), @@ -730,17 +730,17 @@ public function test_greater_than_equal_time_intervals(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit(new DateInterval('PT1H'))), ['v' => new DateInterval('PT5H')], schema(time_schema('v')), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit(new DateInterval('PT1H'))), ['v' => new DateInterval('PT1H')], schema(time_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->greaterThanEqual(lit(new DateInterval('PT5H'))), ['v' => new DateInterval('PT1H')], schema(time_schema('v')), @@ -749,7 +749,7 @@ public function test_greater_than_equal_time_intervals(): void public function test_greater_than_equal_orders_strings_by_bytes(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('a')->greaterThanEqual(lit('10')), ['a' => '9'], schema(str_schema('a')), @@ -760,12 +760,12 @@ public function test_greater_than_equal_orders_a_numeric_string_column_numerical { $context = flow_context(); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('a')->greaterThanEqual(lit('10')), ['a' => '9'], schema(definition_from_type('a', type_numeric_string())), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('a')->greaterThanEqual(lit('18446744073709551614')), ['a' => '18446744073709551615'], schema(definition_from_type('a', type_numeric_string())), @@ -776,12 +776,12 @@ public function test_greater_than_equal_ranks_nan_above_every_number(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('a')->greaterThanEqual(lit(1.0)), ['a' => NAN], schema(float_schema('a')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( lit(1.0)->greaterThanEqual(ref('a')), ['a' => NAN], schema(float_schema('a')), @@ -792,17 +792,17 @@ public function test_less_than_arrays(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThan(lit([1, 9])), ['v' => [1, 0]], schema(list_schema('v', type_list(type_integer()))), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThan(lit([1, 0])), ['v' => [1, 9]], schema(list_schema('v', type_list(type_integer()))), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThan(lit([1, 0])), ['v' => [1, 0]], schema(list_schema('v', type_list(type_integer()))), @@ -813,21 +813,21 @@ public function test_less_than_datetimes(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThan(lit(new DateTimeImmutable('2024-06-01'))), [ 'v' => new DateTimeImmutable('2024-01-01'), ], schema(datetime_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThan(lit(new DateTimeImmutable('2024-01-01'))), [ 'v' => new DateTimeImmutable('2024-06-01'), ], schema(datetime_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThan(lit(new DateTimeImmutable('2024-01-01'))), [ 'v' => new DateTimeImmutable('2024-01-01'), @@ -840,17 +840,17 @@ public function test_less_than_floats(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThan(lit(2.5)), ['v' => 1.5], schema(float_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThan(lit(1.5)), ['v' => 2.5], schema(float_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThan(lit(1.5)), ['v' => 1.5], schema(float_schema('v')), @@ -861,17 +861,17 @@ public function test_less_than_integers(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThan(lit(20)), ['v' => 10], schema(int_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThan(lit(10)), ['v' => 20], schema(int_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThan(lit(10)), ['v' => 10], schema(int_schema('v')), @@ -880,7 +880,7 @@ public function test_less_than_integers(): void public function test_less_than_returns_null_for_null_array(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->lessThan(lit([1, 0])), ['v' => null], schema(list_schema('v', type_list(type_integer()), nullable: true)), @@ -889,7 +889,7 @@ public function test_less_than_returns_null_for_null_array(): void public function test_less_than_returns_null_for_null_datetime(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->lessThan(lit(new DateTimeImmutable('2024-01-01'))), ['v' => null], schema(datetime_schema('v', nullable: true)), @@ -898,7 +898,7 @@ public function test_less_than_returns_null_for_null_datetime(): void public function test_less_than_returns_null_for_null_left(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->lessThan(lit(10)), ['v' => null], schema(str_schema('v', nullable: true)), @@ -907,7 +907,7 @@ public function test_less_than_returns_null_for_null_left(): void public function test_less_than_returns_null_for_null_right(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->lessThan(ref('other')), ['v' => 10, 'other' => null], schema(int_schema('v'), str_schema('other', nullable: true)), @@ -916,7 +916,7 @@ public function test_less_than_returns_null_for_null_right(): void public function test_less_than_returns_null_for_null_string(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->lessThan(lit('a')), ['v' => null], schema(str_schema('v', nullable: true)), @@ -925,7 +925,7 @@ public function test_less_than_returns_null_for_null_string(): void public function test_less_than_returns_null_for_null_time_interval(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->lessThan(lit(new DateInterval('PT1H'))), ['v' => null], schema(time_schema('v', nullable: true)), @@ -936,17 +936,17 @@ public function test_less_than_strings(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThan(lit('banana')), ['v' => 'apple'], schema(str_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThan(lit('apple')), ['v' => 'banana'], schema(str_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThan(lit('apple')), ['v' => 'apple'], schema(str_schema('v')), @@ -964,17 +964,17 @@ public function test_less_than_time_intervals(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThan(lit(new DateInterval('PT5H'))), ['v' => new DateInterval('PT1H')], schema(time_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThan(lit(new DateInterval('PT1H'))), ['v' => new DateInterval('PT5H')], schema(time_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThan(lit(new DateInterval('PT1H'))), ['v' => new DateInterval('PT1H')], schema(time_schema('v')), @@ -983,7 +983,7 @@ public function test_less_than_time_intervals(): void public function test_less_than_orders_strings_by_bytes(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( ref('a')->lessThan(lit('10')), ['a' => '9'], schema(str_schema('a')), @@ -994,12 +994,12 @@ public function test_less_than_orders_a_numeric_string_column_numerically(): voi { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('a')->lessThan(lit('10')), ['a' => '9'], schema(definition_from_type('a', type_numeric_string())), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('a')->lessThan(lit('18446744073709551614')), ['a' => '18446744073709551615'], schema(definition_from_type('a', type_numeric_string())), @@ -1010,12 +1010,12 @@ public function test_less_than_ranks_nan_above_every_number(): void { $context = flow_context(); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('a')->lessThan(lit(1.0)), ['a' => NAN], schema(float_schema('a')), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( lit(1.0)->lessThan(ref('a')), ['a' => NAN], schema(float_schema('a')), @@ -1026,17 +1026,17 @@ public function test_less_than_equal_arrays(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit([1, 9])), ['v' => [1, 0]], schema(list_schema('v', type_list(type_integer()))), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit([1, 0])), ['v' => [1, 0]], schema(list_schema('v', type_list(type_integer()))), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit([1, 0])), ['v' => [1, 9]], schema(list_schema('v', type_list(type_integer()))), @@ -1047,21 +1047,21 @@ public function test_less_than_equal_datetimes(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit(new DateTimeImmutable('2024-06-01'))), [ 'v' => new DateTimeImmutable('2024-01-01'), ], schema(datetime_schema('v')), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit(new DateTimeImmutable('2024-01-01'))), [ 'v' => new DateTimeImmutable('2024-01-01'), ], schema(datetime_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit(new DateTimeImmutable('2024-01-01'))), [ 'v' => new DateTimeImmutable('2024-06-01'), @@ -1074,17 +1074,17 @@ public function test_less_than_equal_floats(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit(2.5)), ['v' => 1.5], schema(float_schema('v')), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit(1.5)), ['v' => 1.5], schema(float_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit(1.5)), ['v' => 2.5], schema(float_schema('v')), @@ -1095,17 +1095,17 @@ public function test_less_than_equal_integers(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit(20)), ['v' => 10], schema(int_schema('v')), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit(10)), ['v' => 10], schema(int_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit(10)), ['v' => 20], schema(int_schema('v')), @@ -1114,7 +1114,7 @@ public function test_less_than_equal_integers(): void public function test_less_than_equal_returns_null_for_null_array(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->lessThanEqual(lit([1, 0])), ['v' => null], schema(list_schema('v', type_list(type_integer()), nullable: true)), @@ -1123,7 +1123,7 @@ public function test_less_than_equal_returns_null_for_null_array(): void public function test_less_than_equal_returns_null_for_null_datetime(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->lessThanEqual(lit(new DateTimeImmutable('2024-01-01'))), ['v' => null], schema(datetime_schema('v', nullable: true)), @@ -1132,7 +1132,7 @@ public function test_less_than_equal_returns_null_for_null_datetime(): void public function test_less_than_equal_returns_null_for_null_left(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->lessThanEqual(lit(10)), ['v' => null], schema(str_schema('v', nullable: true)), @@ -1141,7 +1141,7 @@ public function test_less_than_equal_returns_null_for_null_left(): void public function test_less_than_equal_returns_null_for_null_right(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->lessThanEqual(ref('other')), ['v' => 10, 'other' => null], schema(int_schema('v'), str_schema('other', nullable: true)), @@ -1150,7 +1150,7 @@ public function test_less_than_equal_returns_null_for_null_right(): void public function test_less_than_equal_returns_null_for_null_string(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->lessThanEqual(lit('a')), ['v' => null], schema(str_schema('v', nullable: true)), @@ -1159,7 +1159,7 @@ public function test_less_than_equal_returns_null_for_null_string(): void public function test_less_than_equal_returns_null_for_null_time_interval(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('v')->lessThanEqual(lit(new DateInterval('PT1H'))), ['v' => null], schema(time_schema('v', nullable: true)), @@ -1170,17 +1170,17 @@ public function test_less_than_equal_strings(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit('banana')), ['v' => 'apple'], schema(str_schema('v')), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit('apple')), ['v' => 'apple'], schema(str_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit('apple')), ['v' => 'banana'], schema(str_schema('v')), @@ -1198,17 +1198,17 @@ public function test_less_than_equal_time_intervals(): void { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit(new DateInterval('PT5H'))), ['v' => new DateInterval('PT1H')], schema(time_schema('v')), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit(new DateInterval('PT1H'))), ['v' => new DateInterval('PT1H')], schema(time_schema('v')), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('v')->lessThanEqual(lit(new DateInterval('PT1H'))), ['v' => new DateInterval('PT5H')], schema(time_schema('v')), @@ -1217,7 +1217,7 @@ public function test_less_than_equal_time_intervals(): void public function test_less_than_equal_orders_strings_by_bytes(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( ref('a')->lessThanEqual(lit('10')), ['a' => '9'], schema(str_schema('a')), @@ -1228,12 +1228,12 @@ public function test_less_than_equal_orders_a_numeric_string_column_numerically( { $context = flow_context(); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( ref('a')->lessThanEqual(lit('10')), ['a' => '9'], schema(definition_from_type('a', type_numeric_string())), )); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('a')->lessThanEqual(lit('18446744073709551614')), ['a' => '18446744073709551615'], schema(definition_from_type('a', type_numeric_string())), @@ -1244,12 +1244,12 @@ public function test_less_than_equal_ranks_nan_above_every_number(): void { $context = flow_context(); - static::assertFalse((new FunctionContext($context))->eval( + static::assertFalse(new FunctionContext($context)->eval( ref('a')->lessThanEqual(lit(1.0)), ['a' => NAN], schema(float_schema('a')), )); - static::assertTrue((new FunctionContext($context))->eval( + static::assertTrue(new FunctionContext($context)->eval( lit(1.0)->lessThanEqual(ref('a')), ['a' => NAN], schema(float_schema('a')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ConcatTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ConcatTest.php index 8d433f9039..42c7f2ef75 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ConcatTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ConcatTest.php @@ -26,12 +26,12 @@ final class ConcatTest extends FlowTestCase { public function test_children_of_named_parts_are_a_list(): void { - static::assertTrue(array_is_list((new Concat(...['p' => 'a', 'q' => lit('b')]))->children())); + static::assertTrue(array_is_list(new Concat(...['p' => 'a', 'q' => lit('b')])->children())); } public function test_concat_arrays(): void { - static::assertSame('["a"]["b","c"]', (new FunctionContext(flow_context()))->eval( + static::assertSame('["a"]["b","c"]', new FunctionContext(flow_context())->eval( concat(ref('array_1'), ref('array_2')), [ 'array_1' => ['a'], @@ -43,7 +43,7 @@ public function test_concat_arrays(): void public function test_concat_different_types_of_values(): void { - static::assertSame('1abc["a","b"]', (new FunctionContext(flow_context()))->eval( + static::assertSame('1abc["a","b"]', new FunctionContext(flow_context())->eval( concat(lit(1), lit('a'), lit('b'), lit('c'), lit(['a', 'b'])), [], schema(), @@ -52,7 +52,7 @@ public function test_concat_different_types_of_values(): void public function test_concat_string_values(): void { - static::assertSame('abc', (new FunctionContext(flow_context()))->eval( + static::assertSame('abc', new FunctionContext(flow_context())->eval( concat(lit('a'), lit('b'), lit('c')), [], schema(), @@ -61,7 +61,7 @@ public function test_concat_string_values(): void public function test_concat_skips_nulls(): void { - static::assertSame('ac', (new FunctionContext(flow_context()))->eval( + static::assertSame('ac', new FunctionContext(flow_context())->eval( concat(ref('a'), ref('b'), lit('c')), ['a' => 'a', 'b' => null], schema(str_schema('a'), str_schema('b', true)), @@ -70,7 +70,7 @@ public function test_concat_skips_nulls(): void public function test_concat_without_arguments_is_an_empty_string(): void { - static::assertSame('', (new FunctionContext(flow_context()))->eval(concat(), [], schema())); + static::assertSame('', new FunctionContext(flow_context())->eval(concat(), [], schema())); } public function test_concat_without_arguments_gives_one_empty_string_per_row(): void @@ -86,7 +86,7 @@ public function test_concat_without_arguments_gives_one_empty_string_per_row(): public function test_string_parts_are_literals(): void { - static::assertSame('ab', (new FunctionContext(flow_context()))->eval(concat('a', lit('b')), [], schema())); + static::assertSame('ab', new FunctionContext(flow_context())->eval(concat('a', lit('b')), [], schema())); } public function test_describe_round_trips(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ConcatWithSeparatorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ConcatWithSeparatorTest.php index ce2a757007..5e4a840e79 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ConcatWithSeparatorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ConcatWithSeparatorTest.php @@ -24,12 +24,12 @@ final class ConcatWithSeparatorTest extends FlowTestCase { public function test_children_of_named_parts_are_a_list(): void { - static::assertTrue(array_is_list((new ConcatWithSeparator('-', ...['p' => 'a', 'q' => lit('b')]))->children())); + static::assertTrue(array_is_list(new ConcatWithSeparator('-', ...['p' => 'a', 'q' => lit('b')])->children())); } public function test_concat_with_separator(): void { - static::assertSame('a,1', (new FunctionContext(flow_context()))->eval( + static::assertSame('a,1', new FunctionContext(flow_context())->eval( concat_ws(lit(','), ref('string'), ref('integer')), [ 'string' => 'a', @@ -41,7 +41,7 @@ public function test_concat_with_separator(): void public function test_a_null_value_is_skipped(): void { - static::assertSame('a', (new FunctionContext(flow_context()))->eval( + static::assertSame('a', new FunctionContext(flow_context())->eval( concat_ws(lit(','), ref('string'), ref('missing_value')), [ 'string' => 'a', @@ -53,7 +53,7 @@ public function test_a_null_value_is_skipped(): void public function test_string_parts_are_literals(): void { - static::assertSame('a,b', (new FunctionContext(flow_context()))->eval( + static::assertSame('a,b', new FunctionContext(flow_context())->eval( concat_ws(',', 'a', lit('b')), [], schema(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ConjunctsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ConjunctsTest.php index b4785ca7a5..c797b1b129 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ConjunctsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ConjunctsTest.php @@ -18,7 +18,7 @@ public function test_a_function_that_is_not_an_and_is_its_only_conjunct(): void { $function = ref('id')->greaterThan(lit(1)); - static::assertSame([$function], (new Conjuncts())->of($function)); + static::assertSame([$function], new Conjuncts()->of($function)); } public function test_a_nested_and_is_flattened(): void @@ -28,7 +28,7 @@ public function test_a_nested_and_is_flattened(): void $c = ref('c')->equals(lit(3)); $d = ref('d')->equals(lit(4)); - static::assertSame([$a, $b, $c, $d], (new Conjuncts())->of(new All($a, new All($b, new All($c)), $d))); + static::assertSame([$a, $b, $c, $d], new Conjuncts()->of(new All($a, new All($b, new All($c)), $d))); } public function test_an_or_is_kept_whole(): void @@ -36,6 +36,6 @@ public function test_an_or_is_kept_whole(): void $a = ref('a')->equals(lit(1)); $or = new Any(ref('b')->equals(lit(2)), new All(ref('c')->equals(lit(3)), ref('d')->equals(lit(4)))); - static::assertSame([$a, $or], (new Conjuncts())->of(new All($a, $or))); + static::assertSame([$a, $or], new Conjuncts()->of(new All($a, $or))); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ContainsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ContainsTest.php index 8170077e43..bca334d7e4 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ContainsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ContainsTest.php @@ -29,7 +29,7 @@ public function test_a_column_needle(): void { static::assertSame( [true, null, null, true, true, true, false], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('h')->contains(ref('n')), [ @@ -51,7 +51,7 @@ public function test_a_literal_needle(): void { static::assertSame( [true, null, false, false, false, false, true], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('h')->contains(lit('x')), [ @@ -71,7 +71,7 @@ public function test_a_literal_needle(): void public function test_the_result_is_a_boolean_column(): void { - $column = (new FunctionContext(flow_context()))->column( + $column = new FunctionContext(flow_context())->column( ref('h')->contains(ref('n')), [ ['h' => 'abcx', 'n' => 'x'], @@ -90,7 +90,7 @@ public function test_an_empty_batch_gives_an_empty_column(): void { static::assertSame( [], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column(ref('h')->contains(lit('x')), [], schema(str_schema('h', nullable: true))) ->values(), ); @@ -99,7 +99,7 @@ public function test_an_empty_batch_gives_an_empty_column(): void public function test_a_haystack_that_is_not_a_string_is_refused_with_its_row(): void { try { - (new FunctionContext(flow_context()))->column( + new FunctionContext(flow_context())->column( ref('i')->contains(lit('1')), [['i' => null], ['i' => 12]], schema(int_schema('i', nullable: true)), @@ -115,7 +115,7 @@ public function test_a_haystack_that_is_not_a_string_is_refused_with_its_row(): public function test_a_needle_that_is_not_a_string_is_refused_with_its_row(): void { try { - (new FunctionContext(flow_context()))->column( + new FunctionContext(flow_context())->column( ref('h')->contains(ref('i')), [['h' => 'a1', 'i' => 1]], schema(str_schema('h'), int_schema('i')), @@ -132,7 +132,7 @@ public function test_a_list_haystack_holds_the_needle(): void { static::assertSame( [true, false, null], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('l')->contains(lit('b')), [['l' => ['a', 'b']], ['l' => ['c']], ['l' => null]], @@ -146,7 +146,7 @@ public function test_string_columns_are_matched_by_the_backend_without_a_builder { $schema = schema(str_schema('h'), str_schema('n')); $backend = new SpyBackend(); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('h')->contains(ref('n')), $schema) ->eval(array_to_rows([['h' => 'ax', 'n' => 'x']], $schema, new PhpBackend()), $backend); @@ -157,7 +157,7 @@ public function test_a_null_list_haystack_keeps_the_rows_after_it(): void { static::assertSame( [null, true], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('l')->contains(lit('b')), [['l' => null], ['l' => ['a', 'b']]], diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CountsByGroupTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CountsByGroupTest.php index 6609b1bfb6..6f2ea2c2e8 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CountsByGroupTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/CountsByGroupTest.php @@ -76,8 +76,8 @@ public function test_it_absorbs_only_other_grouped_counts(): void { $this->expectException(InvalidArgumentException::class); - (new CountsByGroup(null, (new PhpBackend())->groupedCounts()))->absorbEarlier( - new TotalsByGroup(sum(ref('v')), (new PhpBackend())->groupedTotals()), + new CountsByGroup(null, new PhpBackend()->groupedCounts())->absorbEarlier( + new TotalsByGroup(sum(ref('v')), new PhpBackend()->groupedTotals()), [], new PhpBackend(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementAttributeValueTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementAttributeValueTest.php index 809afb29ad..54ec6b2ff6 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementAttributeValueTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementAttributeValueTest.php @@ -10,7 +10,6 @@ use DOMElement; use Flow\ETL\Foundation\Exception\InvalidArgumentException; use Flow\ETL\Tests\Context\FunctionContext; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\ETL\DSL\flow_context; @@ -24,17 +23,15 @@ final class DOMElementAttributeValueTest extends TestCase { - #[RequiresPhp('>= 8.4.0')] public function test_html_extracting_attribute_from_dom_element_entry(): void { - // @mago-ignore analysis:unavailable-method $element = HTMLDocument::createFromString( 'foobar', LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR, ); static::assertInstanceOf(HTMLElement::class, $element->documentElement); - static::assertEquals('foobar', (new FunctionContext(flow_context()))->eval( + static::assertEquals('foobar', new FunctionContext(flow_context())->eval( ref('value')->domElementAttributeValue('id'), [ 'value' => $element->documentElement, @@ -43,14 +40,12 @@ public function test_html_extracting_attribute_from_dom_element_entry(): void )); } - #[RequiresPhp('>= 8.4.0')] public function test_html_extracting_non_existing_attribute_from_dom_element_entry(): void { - // @mago-ignore analysis:unavailable-method $element = HTMLDocument::createFromString('foobar', LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR); static::assertInstanceOf(HTMLElement::class, $element->documentElement); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('value')->domElementAttributeValue('id'), [ 'value' => $element->documentElement, @@ -65,7 +60,7 @@ public function test_xml_extracting_attribute_from_dom_element_entry(): void $xml->loadXML('bar'); static::assertInstanceOf(DOMElement::class, $xml->documentElement); - static::assertEquals('buz', (new FunctionContext(flow_context()))->eval( + static::assertEquals('buz', new FunctionContext(flow_context())->eval( ref('value')->domElementAttributeValue('baz'), [ 'value' => $xml->documentElement->firstChild, @@ -80,7 +75,7 @@ public function test_xml_extracting_non_existing_attribute_from_dom_element_entr $xml->loadXML('bar'); static::assertInstanceOf(DOMElement::class, $xml->documentElement); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('value')->domElementAttributeValue('bar'), [ 'value' => $xml->documentElement->firstChild, @@ -97,7 +92,7 @@ public function test_a_missing_attribute_keeps_the_rows_after_it(): void static::assertInstanceOf(DOMElement::class, $xml->documentElement); static::assertSame( [null, 'buz'], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('value')->domElementAttributeValue('baz'), [['value' => $xml->documentElement->firstChild], ['value' => $xml->documentElement->lastChild]], @@ -112,7 +107,7 @@ public function test_xml_extracting_attribute_from_null_entry(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('DOMElementAttributeValue requires non-null DOMNode'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->domElementAttributeValue('baz'), ['value' => null], schema(xml_element_schema('value', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementAttributesCountTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementAttributesCountTest.php index 541c992734..de7f147695 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementAttributesCountTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementAttributesCountTest.php @@ -10,7 +10,6 @@ use DOMElement; use Flow\ETL\Foundation\Exception\InvalidArgumentException; use Flow\ETL\Tests\Context\FunctionContext; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\ETL\DSL\flow_context; @@ -24,17 +23,15 @@ final class DOMElementAttributesCountTest extends TestCase { - #[RequiresPhp('>= 8.4.0')] public function test_html_attributes_count_on_element_with_multiple_attributes(): void { - // @mago-ignore analysis:unavailable-method $element = HTMLDocument::createFromString( 'foobar', LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR, ); static::assertInstanceOf(HTMLElement::class, $element->documentElement); - static::assertSame(3, (new FunctionContext(flow_context()))->eval( + static::assertSame(3, new FunctionContext(flow_context())->eval( ref('value')->domElementAttributesCount(), [ 'value' => $element->documentElement, @@ -43,17 +40,15 @@ public function test_html_attributes_count_on_element_with_multiple_attributes() )); } - #[RequiresPhp('>= 8.4.0')] public function test_html_attributes_count_on_element_with_one_attribute(): void { - // @mago-ignore analysis:unavailable-method $element = HTMLDocument::createFromString( 'foobar', LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR, ); static::assertInstanceOf(HTMLElement::class, $element->documentElement); - static::assertSame(1, (new FunctionContext(flow_context()))->eval( + static::assertSame(1, new FunctionContext(flow_context())->eval( ref('value')->domElementAttributesCount(), [ 'value' => $element->documentElement, @@ -62,14 +57,12 @@ public function test_html_attributes_count_on_element_with_one_attribute(): void )); } - #[RequiresPhp('>= 8.4.0')] public function test_html_attributes_count_on_element_with_zero_attributes(): void { - // @mago-ignore analysis:unavailable-method $element = HTMLDocument::createFromString('foobar', LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR); static::assertInstanceOf(HTMLElement::class, $element->documentElement); - static::assertSame(0, (new FunctionContext(flow_context()))->eval( + static::assertSame(0, new FunctionContext(flow_context())->eval( ref('value')->domElementAttributesCount(), [ 'value' => $element->documentElement, @@ -84,7 +77,7 @@ public function test_xml_attributes_count_on_element_with_multiple_attributes(): $xml->loadXML('bar'); static::assertInstanceOf(DOMElement::class, $xml->documentElement); - static::assertSame(3, (new FunctionContext(flow_context()))->eval( + static::assertSame(3, new FunctionContext(flow_context())->eval( ref('value')->domElementAttributesCount(), [ 'value' => $xml->documentElement->firstChild, @@ -99,7 +92,7 @@ public function test_xml_attributes_count_on_element_with_one_attribute(): void $xml->loadXML('bar'); static::assertInstanceOf(DOMElement::class, $xml->documentElement); - static::assertSame(1, (new FunctionContext(flow_context()))->eval( + static::assertSame(1, new FunctionContext(flow_context())->eval( ref('value')->domElementAttributesCount(), [ 'value' => $xml->documentElement->firstChild, @@ -114,7 +107,7 @@ public function test_xml_attributes_count_on_element_with_zero_attributes(): voi $xml->loadXML('bar'); static::assertInstanceOf(DOMElement::class, $xml->documentElement); - static::assertSame(0, (new FunctionContext(flow_context()))->eval( + static::assertSame(0, new FunctionContext(flow_context())->eval( ref('value')->domElementAttributesCount(), [ 'value' => $xml->documentElement->firstChild, @@ -128,7 +121,7 @@ public function test_xml_attributes_count_on_null_entry(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('DOMElementAttributesCount requires non-null DOMElement'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->domElementAttributesCount(), ['value' => null], schema(xml_element_schema('value', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementNamespaceValueTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementNamespaceValueTest.php index 8234e253f4..a9be211d6f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementNamespaceValueTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementNamespaceValueTest.php @@ -10,7 +10,6 @@ use DOMElement; use Flow\ETL\Foundation\Exception\InvalidArgumentException; use Flow\ETL\Tests\Context\FunctionContext; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\ETL\DSL\flow_context; @@ -33,16 +32,14 @@ final class DOMElementNamespaceValueTest extends TestCase XML; - #[RequiresPhp('>= 8.4.0')] public function test_html_getting_element_namespace(): void { - // @mago-ignore analysis:unavailable-method $element = XMLDocument::createFromString(self::XML, LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR); static::assertInstanceOf(Element::class, $element->documentElement); - static::assertSame('urn:oasis:names:specification:ubl:schema:xsd:Invoice-2', (new FunctionContext( + static::assertSame('urn:oasis:names:specification:ubl:schema:xsd:Invoice-2', new FunctionContext( flow_context(), - ))->eval( + )->eval( ref('node')->domElementNamespace(), [ 'node' => $element->documentElement, @@ -57,9 +54,9 @@ public function test_xml_getting_element_namespace(): void $xml->loadXML(self::XML); static::assertInstanceOf(DOMElement::class, $xml->documentElement); - static::assertSame('urn:oasis:names:specification:ubl:schema:xsd:Invoice-2', (new FunctionContext( + static::assertSame('urn:oasis:names:specification:ubl:schema:xsd:Invoice-2', new FunctionContext( flow_context(), - ))->eval( + )->eval( ref('node')->domElementNamespace(), [ 'node' => $xml->documentElement, @@ -74,9 +71,9 @@ public function test_xml_getting_element_non_default_namespace(): void $xml->loadXML(self::XML); static::assertInstanceOf(DOMElement::class, $xml->documentElement); - static::assertSame('http://www.unece.org/cefact/nodes/StandardBusinessDocumentHeader', (new FunctionContext( + static::assertSame('http://www.unece.org/cefact/nodes/StandardBusinessDocumentHeader', new FunctionContext( flow_context(), - ))->eval( + )->eval( ref('node')->domElementNamespace('xmlns:sh'), [ 'node' => $xml->documentElement, @@ -90,7 +87,7 @@ public function test_xml_getting_namespace_of_null_entry(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('DOMElementNamespaceValue requires non-null DOMNode'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('node')->domElementNamespace(), ['node' => null], schema(xml_element_schema('node', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementParentTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementParentTest.php index d61cdd56c9..79663dc8c9 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementParentTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementParentTest.php @@ -8,7 +8,6 @@ use DOMDocument; use Flow\ETL\Foundation\Exception\InvalidArgumentException; use Flow\ETL\Tests\Context\FunctionContext; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\ETL\DSL\config; @@ -25,15 +24,13 @@ final class DOMElementParentTest extends TestCase { - #[RequiresPhp('>= 8.4.0')] public function test_html_fails_when_parent_not_available_in_strict_mode(): void { - // @mago-ignore analysis:unavailable-method $element = HTMLDocument::createFromString('bar', LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR); $context = flow_context(config()); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('DOMElementParent requires non-null DOMNode or HTMLElement.'); - (new FunctionContext($context))->eval( + new FunctionContext($context)->eval( ref('value')->domElementParent(), [ // @mago-ignore analysis:possibly-null-property-access @@ -43,17 +40,15 @@ public function test_html_fails_when_parent_not_available_in_strict_mode(): void ); } - #[RequiresPhp('>= 8.4.0')] public function test_html_getting_parent_element(): void { - // @mago-ignore analysis:unavailable-method $element = HTMLDocument::createFromString( '
foo

bar

', LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR, ); static::assertEquals( $element->documentElement, - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( lit($element->querySelector('span'))->domElementParent(), [], schema(), @@ -61,12 +56,10 @@ public function test_html_getting_parent_element(): void ); } - #[RequiresPhp('>= 8.4.0')] public function test_html_getting_parent_element_when_not_available(): void { - // @mago-ignore analysis:unavailable-method $element = HTMLDocument::createFromString('bar', LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( lit($element->documentElement)->domElementParent(), [], schema(), @@ -80,7 +73,7 @@ public function test_xml_fails_when_parent_not_available_in_strict_mode(): void $context = flow_context(config()); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('DOMElementParent requires non-null DOMNode or HTMLElement.'); - static::assertEquals($xml, (new FunctionContext($context))->eval( + static::assertEquals($xml, new FunctionContext($context)->eval( ref('value')->domElementParent(), [ 'value' => $xml->parentNode, @@ -97,7 +90,7 @@ public function test_xml_getting_parent_element(): void $xml->documentElement, // a batch stores the element's markup, so the parent is only reachable on the live node // @mago-ignore analysis:possibly-null-property-access - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( lit($xml->documentElement->firstChild)->domElementParent(), [], schema(), @@ -109,7 +102,7 @@ public function test_xml_getting_parent_element_when_not_available(): void { $xml = new DOMDocument(); $xml->loadXML('foobar'); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('value')->domElementParent(), [ 'value' => $xml->documentElement, @@ -122,7 +115,7 @@ public function test_xml_getting_parent_element_when_passing_document(): void { $xml = new DOMDocument(); $xml->loadXML('foobar'); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('value')->domElementParent(), ['value' => $xml], schema(xml_schema('value')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementValueTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementValueTest.php index 4163942ca4..aca3ce6dec 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementValueTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DOMElementValueTest.php @@ -11,7 +11,6 @@ use Flow\ETL\Functions\ReferenceResolver; use Flow\ETL\Tests\Context\FunctionContext; use Flow\ETL\Tests\FlowTestCase; -use PHPUnit\Framework\Attributes\RequiresPhp; use function Flow\ETL\DSL\array_to_rows; use function Flow\ETL\DSL\flow_context; @@ -39,21 +38,19 @@ public function test_xml_getting_element_values_over_two_rows(): void static::assertSame( ['x', 'y'], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('value')->domElementValue(), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), ); } - #[RequiresPhp('>= 8.4.0')] public function test_html_getting_element_value_with_children(): void { - // @mago-ignore analysis:unavailable-method $element = HTMLDocument::createFromString('

foobar

', LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR); static::assertInstanceOf(HTMLElement::class, $element->documentElement); - static::assertEquals('foobar', (new FunctionContext(flow_context()))->eval( + static::assertEquals('foobar', new FunctionContext(flow_context())->eval( ref('value')->domElementValue(), [ 'value' => $element->documentElement, @@ -62,14 +59,12 @@ public function test_html_getting_element_value_with_children(): void )); } - #[RequiresPhp('>= 8.4.0')] public function test_html_getting_simple_element_value(): void { - // @mago-ignore analysis:unavailable-method $element = HTMLDocument::createFromString('bar', LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR); static::assertInstanceOf(HTMLElement::class, $element->documentElement); - static::assertEquals('bar', (new FunctionContext(flow_context()))->eval( + static::assertEquals('bar', new FunctionContext(flow_context())->eval( ref('value')->domElementValue(), [ 'value' => $element->documentElement, @@ -84,7 +79,7 @@ public function test_xml_getting_element_value_with_children(): void $xml->loadXML('baz'); static::assertInstanceOf(DOMElement::class, $xml->documentElement); - static::assertEquals('baz', (new FunctionContext(flow_context()))->eval( + static::assertEquals('baz', new FunctionContext(flow_context())->eval( ref('value')->domElementValue(), [ 'value' => $xml->documentElement->firstChild, @@ -99,7 +94,7 @@ public function test_xml_getting_simple_element_value(): void $xml->loadXML('bar'); static::assertInstanceOf(DOMElement::class, $xml->documentElement); - static::assertEquals('bar', (new FunctionContext(flow_context()))->eval( + static::assertEquals('bar', new FunctionContext(flow_context())->eval( ref('value')->domElementValue(), [ 'value' => $xml->documentElement->firstChild, diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DateTimeFormatTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DateTimeFormatTest.php index 6003a681ca..c8a464b316 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DateTimeFormatTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/DateTimeFormatTest.php @@ -25,7 +25,7 @@ final class DateTimeFormatTest extends FlowTestCase { public function test_date_time_format(): void { - static::assertEquals('2020-01-01 00:00:00', (new FunctionContext(flow_context()))->eval( + static::assertEquals('2020-01-01 00:00:00', new FunctionContext(flow_context())->eval( date_time_format(ref('date_time'), 'Y-m-d H:i:s'), ['date_time' => new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('UTC'))], schema(datetime_schema('date_time')), @@ -36,7 +36,7 @@ public function test_a_format_read_from_a_column_formats_each_row_with_its_own_f { static::assertSame( ['2020', '01'], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( new DateTimeFormat(ref('date_time'), ref('format')), [ @@ -62,7 +62,7 @@ public function test_a_literal_format_over_a_zoned_column_equals_formatting_each $rows[0]['at']->setTimezone(new DateTimeZone($zone))->format('Y-m-d\TH:i:s.uP T e'), $rows[1]['at']->setTimezone(new DateTimeZone($zone))->format('Y-m-d\TH:i:s.uP T e'), ], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( date_time_format(ref('at'), 'Y-m-d\TH:i:s.uP T e'), $rows, @@ -77,7 +77,7 @@ public function test_a_literal_format_over_a_date_column(): void { static::assertSame( ['02/01/2026 00:00', '01/01/1970 00:00'], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( date_time_format(ref('on'), 'd/m/Y H:i'), [['on' => new DateTimeImmutable('2026-01-02')], ['on' => new DateTimeImmutable('1970-01-01')]], @@ -90,7 +90,7 @@ public function test_a_literal_format_over_a_date_column(): void public function test_a_null_in_a_datetime_column_is_refused_with_its_row_index(): void { try { - (new FunctionContext(flow_context()))->column( + new FunctionContext(flow_context())->column( date_time_format(ref('at'), 'Y-m-d'), [['at' => new DateTimeImmutable('2026-01-02')], ['at' => null], ['at' => null]], schema(datetime_schema('at', nullable: true)), @@ -106,7 +106,7 @@ public function test_a_null_in_a_datetime_column_is_refused_with_its_row_index() public function test_a_null_datetime_with_a_column_format_is_refused(): void { try { - (new FunctionContext(flow_context()))->column( + new FunctionContext(flow_context())->column( new DateTimeFormat(ref('at'), ref('format')), [['at' => null, 'format' => 'Y']], schema(datetime_schema('at', nullable: true), str_schema('format')), @@ -119,7 +119,7 @@ public function test_a_null_datetime_with_a_column_format_is_refused(): void public function test_formatting_now(): void { - static::assertInstanceOf(DateTimeImmutable::class, (new FunctionContext(flow_context()))->eval( + static::assertInstanceOf(DateTimeImmutable::class, new FunctionContext(flow_context())->eval( now(), ['date_time' => new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('UTC'))], schema(datetime_schema('date_time')), @@ -131,7 +131,7 @@ public function test_invalid_date_time_format(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "object", got "string".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( date_time_format(ref('date_time'), 'Y-m-d H:i:s'), [ 'date_time' => '2020-01-01 00:00:00', diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EndsWithTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EndsWithTest.php index 4029f9f217..aa4afa6ea5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EndsWithTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EndsWithTest.php @@ -26,7 +26,7 @@ public function test_a_column_needle(): void { static::assertSame( [true, null, null, true, true, true, false], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('h')->endsWith(ref('n')), [ @@ -48,7 +48,7 @@ public function test_a_literal_needle(): void { static::assertSame( [true, null, false, false, false, false, true], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('h')->endsWith(lit('x')), [ @@ -68,7 +68,7 @@ public function test_a_literal_needle(): void public function test_the_result_is_a_boolean_column(): void { - $column = (new FunctionContext(flow_context()))->column( + $column = new FunctionContext(flow_context())->column( ref('h')->endsWith(ref('n')), [ ['h' => 'abcx', 'n' => 'x'], @@ -87,7 +87,7 @@ public function test_an_empty_batch_gives_an_empty_column(): void { static::assertSame( [], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column(ref('h')->endsWith(lit('x')), [], schema(str_schema('h', nullable: true))) ->values(), ); @@ -96,7 +96,7 @@ public function test_an_empty_batch_gives_an_empty_column(): void public function test_a_haystack_that_is_not_a_string_is_refused_with_its_row(): void { try { - (new FunctionContext(flow_context()))->column( + new FunctionContext(flow_context())->column( ref('i')->endsWith(lit('1')), [['i' => null], ['i' => 12]], schema(int_schema('i', nullable: true)), @@ -112,7 +112,7 @@ public function test_a_haystack_that_is_not_a_string_is_refused_with_its_row(): public function test_a_needle_that_is_not_a_string_is_refused_with_its_row(): void { try { - (new FunctionContext(flow_context()))->column( + new FunctionContext(flow_context())->column( ref('h')->endsWith(ref('i')), [['h' => 'a1', 'i' => 1]], schema(str_schema('h'), int_schema('i')), @@ -129,7 +129,7 @@ public function test_string_columns_are_matched_by_the_backend_without_a_builder { $schema = schema(str_schema('h'), str_schema('n')); $backend = new SpyBackend(); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('h')->endsWith(ref('n')), $schema) ->eval(array_to_rows([['h' => 'ax', 'n' => 'x']], $schema, new PhpBackend()), $backend); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnsureEndTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnsureEndTest.php index 98741690fa..2200a38d0b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnsureEndTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnsureEndTest.php @@ -26,7 +26,7 @@ public function test_a_null_suffix_row_does_not_stop_later_rows(): void static::assertSame( ['a', 'ax'], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('str')->ensureEnd(ref('suffix')), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -35,7 +35,7 @@ public function test_a_null_suffix_row_does_not_stop_later_rows(): void public function test_empty_string_with_suffix(): void { - static::assertEquals('_suffix', (new FunctionContext(flow_context()))->eval( + static::assertEquals('_suffix', new FunctionContext(flow_context())->eval( ref('str')->ensureEnd('_suffix'), ['str' => ''], schema(str_schema('str')), @@ -44,7 +44,7 @@ public function test_empty_string_with_suffix(): void public function test_null_suffix(): void { - static::assertEquals('hello', (new FunctionContext(flow_context()))->eval( + static::assertEquals('hello', new FunctionContext(flow_context())->eval( ref('str')->ensureEnd(ref('suffix')), ['str' => 'hello', 'suffix' => null], schema(str_schema('str'), str_schema('suffix', nullable: true)), @@ -56,7 +56,7 @@ public function test_null_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('EnsureEnd function requires non-null value'); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->ensureEnd('_suffix'), ['str' => null], schema(str_schema('str', nullable: true)), @@ -65,7 +65,7 @@ public function test_null_value(): void public function test_string_already_ends_with_suffix(): void { - static::assertEquals('document.txt', (new FunctionContext(flow_context()))->eval( + static::assertEquals('document.txt', new FunctionContext(flow_context())->eval( ref('str')->ensureEnd('.txt'), ['str' => 'document.txt'], schema(str_schema('str')), @@ -74,7 +74,7 @@ public function test_string_already_ends_with_suffix(): void public function test_string_doesnt_end_with_suffix(): void { - static::assertEquals('document.txt', (new FunctionContext(flow_context()))->eval( + static::assertEquals('document.txt', new FunctionContext(flow_context())->eval( ref('str')->ensureEnd('.txt'), ['str' => 'document'], schema(str_schema('str')), @@ -83,7 +83,7 @@ public function test_string_doesnt_end_with_suffix(): void public function test_string_with_empty_suffix(): void { - static::assertEquals('hello', (new FunctionContext(flow_context()))->eval( + static::assertEquals('hello', new FunctionContext(flow_context())->eval( ref('str')->ensureEnd(''), ['str' => 'hello'], schema(str_schema('str')), @@ -92,7 +92,7 @@ public function test_string_with_empty_suffix(): void public function test_with_scalar_function_parameter(): void { - static::assertEquals('document.pdf', (new FunctionContext(flow_context()))->eval( + static::assertEquals('document.pdf', new FunctionContext(flow_context())->eval( ref('str')->ensureEnd(ref('suffix')), ['str' => 'document', 'suffix' => '.pdf'], schema(str_schema('str'), str_schema('suffix')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnsureStartTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnsureStartTest.php index cb08068df1..12b32bd8aa 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnsureStartTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnsureStartTest.php @@ -26,7 +26,7 @@ public function test_a_null_prefix_row_does_not_stop_later_rows(): void static::assertSame( ['a', 'xa'], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('str')->ensureStart(ref('prefix')), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -35,7 +35,7 @@ public function test_a_null_prefix_row_does_not_stop_later_rows(): void public function test_empty_string_with_prefix(): void { - static::assertEquals('prefix_', (new FunctionContext(flow_context()))->eval( + static::assertEquals('prefix_', new FunctionContext(flow_context())->eval( ref('str')->ensureStart('prefix_'), ['str' => ''], schema(str_schema('str')), @@ -44,7 +44,7 @@ public function test_empty_string_with_prefix(): void public function test_null_prefix(): void { - static::assertEquals('hello', (new FunctionContext(flow_context()))->eval( + static::assertEquals('hello', new FunctionContext(flow_context())->eval( ref('str')->ensureStart(ref('prefix')), ['str' => 'hello', 'prefix' => null], schema(str_schema('str'), str_schema('prefix', nullable: true)), @@ -56,7 +56,7 @@ public function test_null_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('EnsureStart function requires non-null value'); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->ensureStart('prefix_'), ['str' => null], schema(str_schema('str', nullable: true)), @@ -65,7 +65,7 @@ public function test_null_value(): void public function test_string_already_starts_with_prefix(): void { - static::assertEquals('https://example.com', (new FunctionContext(flow_context()))->eval( + static::assertEquals('https://example.com', new FunctionContext(flow_context())->eval( ref('str')->ensureStart('https://'), ['str' => 'https://example.com'], schema(str_schema('str')), @@ -74,7 +74,7 @@ public function test_string_already_starts_with_prefix(): void public function test_string_doesnt_start_with_prefix(): void { - static::assertEquals('https://example.com', (new FunctionContext(flow_context()))->eval( + static::assertEquals('https://example.com', new FunctionContext(flow_context())->eval( ref('str')->ensureStart('https://'), ['str' => 'example.com'], schema(str_schema('str')), @@ -83,7 +83,7 @@ public function test_string_doesnt_start_with_prefix(): void public function test_string_with_empty_prefix(): void { - static::assertEquals('hello', (new FunctionContext(flow_context()))->eval( + static::assertEquals('hello', new FunctionContext(flow_context())->eval( ref('str')->ensureStart(''), ['str' => 'hello'], schema(str_schema('str')), @@ -92,7 +92,7 @@ public function test_string_with_empty_prefix(): void public function test_with_scalar_function_parameter(): void { - static::assertEquals('https://example.com', (new FunctionContext(flow_context()))->eval( + static::assertEquals('https://example.com', new FunctionContext(flow_context())->eval( ref('str')->ensureStart(ref('prefix')), ['str' => 'example.com', 'prefix' => 'https://'], schema(str_schema('str'), str_schema('prefix')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnumNameTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnumNameTest.php index 2fb6a43a9e..f05f75375a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnumNameTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnumNameTest.php @@ -26,7 +26,7 @@ final class EnumNameTest extends FlowTestCase { public function test_enum_name_accepts_literal_enum(): void { - static::assertSame('one', (new FunctionContext(flow_context()))->eval( + static::assertSame('one', new FunctionContext(flow_context())->eval( enum_name(BackedStringEnum::one), [], schema(), @@ -40,7 +40,7 @@ public function test_enum_name_carries_string_type(): void public function test_enum_name_from_scalar_function_chain(): void { - static::assertSame('one', (new FunctionContext(flow_context()))->eval( + static::assertSame('one', new FunctionContext(flow_context())->eval( ref('e')->enumName(), [ 'e' => BackedIntEnum::one, @@ -54,7 +54,7 @@ public function test_enum_name_from_scalar_function_chain(): void #[TestWith([BasicEnum::one])] public function test_enum_name_returns_case_name(UnitEnum $enum): void { - static::assertSame('one', (new FunctionContext(flow_context()))->eval( + static::assertSame('one', new FunctionContext(flow_context())->eval( enum_name(ref('e')), ['e' => $enum], schema(enum_schema('e', $enum::class)), @@ -69,6 +69,6 @@ public function test_enum_name_throws_in_strict_mode(mixed $input): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('EnumName function requires a UnitEnum value'); - (new FunctionContext(flow_context(config())))->eval(enum_name($input), [], schema()); + new FunctionContext(flow_context(config()))->eval(enum_name($input), [], schema()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnumValueTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnumValueTest.php index 61f3ca50e0..b92b18a609 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnumValueTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/EnumValueTest.php @@ -31,16 +31,12 @@ final class EnumValueTest extends FlowTestCase { public function test_enum_value_accepts_literal_enum(): void { - static::assertSame(1, (new FunctionContext(flow_context()))->eval( - enum_value(BackedIntEnum::one), - [], - schema(), - )); + static::assertSame(1, new FunctionContext(flow_context())->eval(enum_value(BackedIntEnum::one), [], schema())); } public function test_enum_value_from_scalar_function_chain(): void { - static::assertSame(1, (new FunctionContext(flow_context()))->eval( + static::assertSame(1, new FunctionContext(flow_context())->eval( ref('e')->enumValue(), [ 'e' => BackedIntEnum::one, @@ -53,7 +49,7 @@ public function test_enum_value_from_scalar_function_chain(): void #[TestWith([BackedIntEnum::one, 1])] public function test_enum_value_returns_backing_value(UnitEnum $enum, int|string $expected): void { - static::assertSame($expected, (new FunctionContext(flow_context()))->eval( + static::assertSame($expected, new FunctionContext(flow_context())->eval( enum_value(ref('e')), ['e' => $enum], schema(enum_schema('e', $enum::class)), @@ -69,13 +65,13 @@ public function test_enum_value_throws_in_strict_mode(mixed $input): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('EnumValue function requires a BackedEnum value'); - (new FunctionContext(flow_context(config())))->eval(enum_value($input), [], schema()); + new FunctionContext(flow_context(config()))->eval(enum_value($input), [], schema()); } public function test_a_non_enum_operand_is_refused_at_bind(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve(enum_value(ref('e')), schema(str_schema('e'))); + $resolved = new ReferenceResolver()->resolve(enum_value(ref('e')), schema(str_schema('e'))); $this->expectException(SchemaNotDerivableException::class); $this->expectExceptionMessage('which is not an enum'); @@ -86,7 +82,7 @@ public function test_a_non_enum_operand_is_refused_at_bind(): void public function test_enum_value_type_is_derived_from_int_backing_value(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( enum_value(ref('e')), schema(enum_schema('e', BackedIntEnum::class)), ); @@ -97,7 +93,7 @@ enum_value(ref('e')), public function test_enum_value_type_is_derived_from_string_backing_value(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( enum_value(ref('e')), schema(enum_schema('e', BackedStringEnum::class)), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Evaluation/ResultColumnTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Evaluation/ResultColumnTest.php index 2f24ebe7e5..d0c294feea 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Evaluation/ResultColumnTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Evaluation/ResultColumnTest.php @@ -45,7 +45,7 @@ final class ResultColumnTest extends TestCase { public function test_a_not_null_return_still_accepts_null(): void { - $column = (new ResultColumn(new PhpBackend()))->of(lit(5), [5, null]); + $column = new ResultColumn(new PhpBackend())->of(lit(5), [5, null]); static::assertSame([5, null], $column->values()); static::assertEquals(type_integer(), $column->type()); @@ -55,27 +55,27 @@ public function test_an_unresolved_tree_throws(): void { $this->expectException(InvalidLogicException::class); - (new ResultColumn(new PhpBackend()))->of(ref('a'), [1]); + new ResultColumn(new PhpBackend())->of(ref('a'), [1]); } public function test_casts_each_value_into_the_returned_type(): void { - static::assertSame([5, 6], (new ResultColumn(new PhpBackend()))->of(lit(1), ['5', 6])->values()); + static::assertSame([5, 6], new ResultColumn(new PhpBackend())->of(lit(1), ['5', 6])->values()); } public function test_builds_through_the_backend_it_was_given(): void { $backend = new SpyBackend(); - (new ResultColumn($backend))->of(lit(1), [1, 2]); - (new ResultColumn($backend))->of(lit(1), ['1', 2]); + new ResultColumn($backend)->of(lit(1), [1, 2]); + new ResultColumn($backend)->of(lit(1), ['1', 2]); static::assertSame(2, $backend->builders()); } public function test_null_type_builds_a_null_column(): void { - $column = (new ResultColumn(new PhpBackend()))->of(lit(null), [null, null]); + $column = new ResultColumn(new PhpBackend())->of(lit(null), [null, null]); static::assertEquals(type_null(), $column->type()); static::assertSame(2, $column->nullCount()); @@ -84,7 +84,7 @@ public function test_null_type_builds_a_null_column(): void public function test_refusal_names_the_row_of_the_value(): void { try { - (new ResultColumn(new PhpBackend()))->of(lit(1), [1, 2, 'x']); + new ResultColumn(new PhpBackend())->of(lit(1), [1, 2, 'x']); static::fail('expected a SchemaMismatchException'); } catch (SchemaMismatchException $e) { static::assertSame(2, $e->rowIndex); @@ -93,7 +93,7 @@ public function test_refusal_names_the_row_of_the_value(): void public function test_type_without_a_column_kind_is_an_untyped_column(): void { - $column = (new ResultColumn(new PhpBackend()))->of(call(lit('strval'), type_instance_of(ArrayObject::class)), [ + $column = new ResultColumn(new PhpBackend())->of(call(lit('strval'), type_instance_of(ArrayObject::class)), [ new ArrayObject(), null, ]); @@ -104,8 +104,8 @@ public function test_type_without_a_column_kind_is_an_untyped_column(): void public function test_underivable_return_is_an_untyped_column(): void { - $column = (new ResultColumn(new PhpBackend()))->of( - (new ReferenceResolver())->resolve(ref('j')->jsonDecode()->arrayGet('name'), schema(json_schema('j'))), + $column = new ResultColumn(new PhpBackend())->of( + new ReferenceResolver()->resolve(ref('j')->jsonDecode()->arrayGet('name'), schema(json_schema('j'))), ['a', ['b' => 1]], ); @@ -137,13 +137,13 @@ public function test_a_typed_column_holds_an_intermediate_only_when_it_keeps_the Type $type, bool $holds, ): void { - static::assertSame($holds, (new ResultColumn(new PhpBackend()))->holdsLosslessly($type)); + static::assertSame($holds, new ResultColumn(new PhpBackend())->holdsLosslessly($type)); } public function test_an_untyped_array_keeps_its_objects(): void { $object = new ArrayObject(); - $column = (new ResultColumn(new PhpBackend()))->typed(type_optional(type_array()), [[$object, 'count']]); + $column = new ResultColumn(new PhpBackend())->typed(type_optional(type_array()), [[$object, 'count']]); static::assertInstanceOf(ValueColumn::class, $column); static::assertSame([[$object, 'count']], $column->values()); @@ -151,7 +151,7 @@ public function test_an_untyped_array_keeps_its_objects(): void public function test_lists_of_an_expand_are_a_list_column(): void { - $column = (new ResultColumn(new PhpBackend()))->lists(lit(1), [[1, 2], []]); + $column = new ResultColumn(new PhpBackend())->lists(lit(1), [[1, 2], []]); static::assertEquals(type_list(type_integer()), $column->type()); static::assertSame([[1, 2], []], $column->values()); @@ -192,7 +192,7 @@ public static function valuesOfTheColumnTypePerBackend(): Generator #[DataProvider('valuesOfTheColumnTypePerBackend')] public function test_values_of_the_column_type_stay_unchanged(Backend $backend, Type $type, array $values): void { - $column = (new ResultColumn($backend))->typed(type_optional($type), $values); + $column = new ResultColumn($backend)->typed(type_optional($type), $values); static::assertSame($values, $column->physicals()); static::assertSame(1, $column->nullCount()); @@ -220,7 +220,7 @@ public function test_mixed_values_are_cast_into_the_column_type( ): void { static::assertSame( $expected, - (new ResultColumn($backend)) + new ResultColumn($backend) ->typed(type_optional($type), $values) ->physicals(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Evaluation/SelectionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Evaluation/SelectionTest.php index 73fd402c9b..cf84f61da1 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Evaluation/SelectionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Evaluation/SelectionTest.php @@ -43,8 +43,8 @@ public function test_all_rows_evaluate_the_batch_itself(): void static::assertSame( [1, 2], - (new Selection([0, 1])) - ->evaluate((new ReferenceResolver())->resolve($spy, $rows->schema()), $rows, flow_context()->backend()) + new Selection([0, 1]) + ->evaluate(new ReferenceResolver()->resolve($spy, $rows->schema()), $rows, flow_context()->backend()) ->values(), ); static::assertSame($rows, $spy->seen[0]); @@ -55,8 +55,8 @@ public function test_an_error_names_the_row_of_the_batch(): void $rows = array_to_rows([['v' => 1], ['v' => 2], ['v' => 3], ['v' => 4]], schema(int_schema('v'))); try { - (new Selection([1, 3]))->evaluate( - (new ReferenceResolver())->resolve(new FailingOnValuesFunction(ref('v'), [4]), $rows->schema()), + new Selection([1, 3])->evaluate( + new ReferenceResolver()->resolve(new FailingOnValuesFunction(ref('v'), [4]), $rows->schema()), $rows, flow_context()->backend(), ); @@ -77,8 +77,8 @@ public function test_a_subset_holds_only_the_selected_rows_of_the_referenced_col static::assertSame( [1, 3], - (new Selection([0, 2])) - ->evaluate((new ReferenceResolver())->resolve($spy, $rows->schema()), $rows, flow_context()->backend()) + new Selection([0, 2]) + ->evaluate(new ReferenceResolver()->resolve($spy, $rows->schema()), $rows, flow_context()->backend()) ->values(), ); static::assertSame(['v'], array_keys($spy->seen[0]->columns())); @@ -113,8 +113,8 @@ public function test_truths_are_the_php_truthiness_of_each_logical_value( 'v' => $value, ], $values), schema($definition)); - static::assertSame($truths, (new Selection(array_keys($values)))->truths( - (new ReferenceResolver())->resolve(ref('v'), $rows->schema()), + static::assertSame($truths, new Selection(array_keys($values))->truths( + new ReferenceResolver()->resolve(ref('v'), $rows->schema()), $rows, flow_context()->backend(), )); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Evaluation/TolerantEvaluationTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Evaluation/TolerantEvaluationTest.php index f87f9575b2..ec1f76579a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Evaluation/TolerantEvaluationTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Evaluation/TolerantEvaluationTest.php @@ -26,8 +26,8 @@ public function test_an_empty_batch_has_no_failures_and_no_values(): void static::assertSame( ['failed' => [], 'values' => []], - (new TolerantEvaluation())->evaluate( - (new ReferenceResolver())->resolve(new FailingOnValuesFunction(ref('id')), $rows->schema()), + new TolerantEvaluation()->evaluate( + new ReferenceResolver()->resolve(new FailingOnValuesFunction(ref('id')), $rows->schema()), $rows, flow_context()->backend(), ), @@ -41,8 +41,8 @@ public function test_every_row_evaluates_in_one_batch_when_none_fails(): void static::assertSame( ['failed' => [], 'values' => [0 => 1, 1 => 2, 2 => 3]], - (new TolerantEvaluation())->evaluate( - (new ReferenceResolver())->resolve($spy, $rows->schema()), + new TolerantEvaluation()->evaluate( + new ReferenceResolver()->resolve($spy, $rows->schema()), $rows, flow_context()->backend(), ), @@ -57,8 +57,8 @@ public function test_failing_rows_are_reported_and_left_out_of_the_values(): voi static::assertEquals( ['failed' => [1 => true, 3 => true], 'values' => [0 => 1, 2 => 3, 4 => 5]], - (new TolerantEvaluation())->evaluate( - (new ReferenceResolver())->resolve($spy, $rows->schema()), + new TolerantEvaluation()->evaluate( + new ReferenceResolver()->resolve($spy, $rows->schema()), $rows, flow_context()->backend(), ), @@ -71,8 +71,8 @@ public function test_rows_past_the_retry_limit_go_one_by_one(): void $spy = new FailingOnValuesFunction(ref('id'), range(1, 9)); $rows = IdRows::batches(range(1, 10))->current(); - $evaluated = (new TolerantEvaluation())->evaluate( - (new ReferenceResolver())->resolve($spy, $rows->schema()), + $evaluated = new TolerantEvaluation()->evaluate( + new ReferenceResolver()->resolve($spy, $rows->schema()), $rows, flow_context()->backend(), ); @@ -89,8 +89,8 @@ public function test_row_by_row_evaluates_each_given_row_alone(): void static::assertSame( ['failed' => [1 => true], 'values' => [0 => 1, 3 => 4]], - (new TolerantEvaluation())->rowByRow( - (new ReferenceResolver())->resolve($spy, $rows->schema()), + new TolerantEvaluation()->rowByRow( + new ReferenceResolver()->resolve($spy, $rows->schema()), $rows, [0, 1, 3], flow_context()->backend(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ExistsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ExistsTest.php index 67ae7dc102..4abb955117 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ExistsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ExistsTest.php @@ -27,7 +27,7 @@ final class ExistsTest extends FlowTestCase { public function test_a_throwing_operand_means_the_reference_does_not_exist(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( new Exists(ref('value')->upper()), [ 'value' => 1, @@ -38,7 +38,7 @@ public function test_a_throwing_operand_means_the_reference_does_not_exist(): vo public function test_if_reference_exists(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('value')->exists(), ['value' => 'test'], schema(str_schema('value')), @@ -47,12 +47,12 @@ public function test_if_reference_exists(): void public function test_that_lit_function_exists(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval(new Exists(lit('val')), [], schema())); + static::assertTrue(new FunctionContext(flow_context())->eval(new Exists(lit('val')), [], schema())); } public function test_that_null_reference_to_null_entry_exists(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('value')->exists(), ['value' => null], schema(str_schema('value', nullable: true)), @@ -61,7 +61,7 @@ public function test_that_null_reference_to_null_entry_exists(): void public function test_that_reference_does_not_exists(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval(ref('value')->exists(), [], schema())); + static::assertFalse(new FunctionContext(flow_context())->eval(ref('value')->exists(), [], schema())); } /** diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ExpandingFunctionsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ExpandingFunctionsTest.php index e64a8c6439..45108f3da5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ExpandingFunctionsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ExpandingFunctionsTest.php @@ -20,14 +20,14 @@ final class ExpandingFunctionsTest extends FlowTestCase { public function test_in_is_empty_without_an_expand(): void { - static::assertSame([], (new ExpandingFunctions())->in(concat(ref('id'), lit('x')))); + static::assertSame([], new ExpandingFunctions()->in(concat(ref('id'), lit('x')))); } public function test_in_includes_the_root(): void { $expand = ref('tags')->expand(); - static::assertSame([$expand], (new ExpandingFunctions())->in($expand)); + static::assertSame([$expand], new ExpandingFunctions()->in($expand)); } public function test_in_lists_expands_in_pre_order(): void @@ -37,7 +37,7 @@ public function test_in_lists_expands_in_pre_order(): void static::assertSame( [$tags, $nums], - (new ExpandingFunctions())->in(structure(['a' => $tags, 'b' => concat(lit('-'), $nums)])), + new ExpandingFunctions()->in(structure(['a' => $tags, 'b' => concat(lit('-'), $nums)])), ); } @@ -45,10 +45,7 @@ public function test_in_finds_an_expand_that_is_an_on_each_operand(): void { $expand = ref('lists')->expand(); - static::assertSame( - [$expand], - (new ExpandingFunctions())->in($expand->onEach(concat(ref('element'), lit('!')))), - ); + static::assertSame([$expand], new ExpandingFunctions()->in($expand->onEach(concat(ref('element'), lit('!'))))); } public function test_refuse_names_the_site(): void @@ -58,14 +55,14 @@ public function test_refuse_names_the_site(): void 'filter() cannot contain array_expand(), it turns one row into many rows. Expand with withColumn() first, then use the new column.', ); - (new ExpandingFunctions())->refuse(ref('tags')->expand()->equals(lit('x')), 'filter'); + new ExpandingFunctions()->refuse(ref('tags')->expand()->equals(lit('x')), 'filter'); } public function test_refuse_passes_a_tree_without_an_expand(): void { $this->expectNotToPerformAssertions(); - (new ExpandingFunctions())->refuse(ref('id')->equals(lit('x')), 'filter'); + new ExpandingFunctions()->refuse(ref('id')->equals(lit('x')), 'filter'); } #[DataProvider('expand_inside_expand_provider')] @@ -76,7 +73,7 @@ public function test_refuse_nested_refuses_an_expand_below_an_expand(ScalarFunct 'array_expand() cannot contain another array_expand(). Expand one level per withColumn().', ); - (new ExpandingFunctions())->refuseNested($tree); + new ExpandingFunctions()->refuseNested($tree); } /** @@ -93,7 +90,7 @@ public function test_refuse_nested_passes_sibling_expands(): void { $this->expectNotToPerformAssertions(); - (new ExpandingFunctions())->refuseNested(structure([ + new ExpandingFunctions()->refuseNested(structure([ 'n' => ref('nums')->expand(), 't' => ref('tags')->expand(), ])); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/FirstTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/FirstTest.php index 34fdfa0197..4612c7e556 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/FirstTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/FirstTest.php @@ -91,7 +91,7 @@ public function test_first_over_an_int_column_declares_optional_integer(): void { static::assertSame( '?integer', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(first(ref('v')), schema(int_schema('v'))) ->returns() ->toString(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/GreatestTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/GreatestTest.php index d33c9efd02..0c34fefa45 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/GreatestTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/GreatestTest.php @@ -26,13 +26,13 @@ final class GreatestTest extends FlowTestCase { public function test_children_of_keyed_values_are_a_list(): void { - static::assertTrue(array_is_list((new Greatest(['a' => lit(1), 'b' => lit(2)]))->children())); + static::assertTrue(array_is_list(new Greatest(['a' => lit(1), 'b' => lit(2)])->children())); } public function test_a_non_nullable_operand_makes_the_result_not_nullable(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( greatest(ref('int'), lit(10)), schema(int_schema('int', nullable: true)), ); @@ -42,7 +42,7 @@ public function test_a_non_nullable_operand_makes_the_result_not_nullable(): voi public function test_greatest_value(): void { - static::assertSame(55, (new FunctionContext(flow_context()))->eval( + static::assertSame(55, new FunctionContext(flow_context())->eval( greatest(10, 20, ref('int'), 40), ['int' => 55], schema(int_schema('int')), @@ -65,7 +65,7 @@ public function test_an_integer_and_a_string_column_have_no_common_type(): void public function test_nulls_are_skipped(): void { - static::assertSame(20, (new FunctionContext(flow_context()))->eval( + static::assertSame(20, new FunctionContext(flow_context())->eval( greatest(null, 20, ref('int')), [ 'int' => 4, @@ -76,7 +76,7 @@ public function test_nulls_are_skipped(): void public function test_null_only_when_every_argument_is_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( greatest(null, null), [ 'int' => 4, @@ -87,7 +87,7 @@ public function test_null_only_when_every_argument_is_null(): void public function test_greatest_with_null(): void { - static::assertSame(1257, (new FunctionContext(flow_context()))->eval( + static::assertSame(1257, new FunctionContext(flow_context())->eval( greatest(null, 20, ref('int'), 1257), [ 'int' => 55, @@ -98,7 +98,7 @@ public function test_greatest_with_null(): void public function test_greatest_orders_strings_by_bytes(): void { - static::assertSame('9', (new FunctionContext(flow_context()))->eval( + static::assertSame('9', new FunctionContext(flow_context())->eval( greatest(ref('a'), lit('10'), lit('9')), ['a' => null], schema(str_schema('a', nullable: true)), @@ -107,7 +107,7 @@ public function test_greatest_orders_strings_by_bytes(): void public function test_greatest_orders_a_numeric_string_column_numerically(): void { - static::assertSame('10', (new FunctionContext(flow_context()))->eval( + static::assertSame('10', new FunctionContext(flow_context())->eval( greatest(ref('a'), ref('b')), ['a' => '9', 'b' => '10'], schema(definition_from_type('a', type_numeric_string()), definition_from_type('b', type_numeric_string())), @@ -116,7 +116,7 @@ public function test_greatest_orders_a_numeric_string_column_numerically(): void public function test_greatest_keeps_the_first_of_equal_values(): void { - static::assertSame('10', (new FunctionContext(flow_context()))->eval( + static::assertSame('10', new FunctionContext(flow_context())->eval( greatest(ref('a'), ref('b')), ['a' => '10', 'b' => '10.0'], schema(definition_from_type('a', type_numeric_string()), definition_from_type('b', type_numeric_string())), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/HTMLQuerySelectorAllTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/HTMLQuerySelectorAllTest.php index a9896c51f3..6bdaf46f64 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/HTMLQuerySelectorAllTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/HTMLQuerySelectorAllTest.php @@ -7,13 +7,11 @@ use Dom\Element; use Dom\HTMLDocument; use Flow\ETL\Foundation\Exception\InvalidArgumentException; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Functions\HTMLQuerySelectorAll; use Flow\ETL\Tests\Context\DescribeRoundTrip; use Flow\ETL\Tests\Context\FunctionContext; use Flow\ETL\Tests\Context\ScalarFunctionFixtures; use Flow\ETL\Values\Column\PhpBackend; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\ETL\DSL\flow_context; @@ -25,26 +23,13 @@ final class HTMLQuerySelectorAllTest extends TestCase { - #[RequiresPhp('< 8.4.0')] - public function test_getting_element_for_older_versions(): void - { - $this->expectException(RequiredPHPVersionException::class); - (new FunctionContext(flow_context()))->eval( - ref('value')->htmlQuerySelectorAll('body div p'), - ['value' => ''], - schema(str_schema('value')), - ); - } - - #[RequiresPhp('>= 8.4.0')] public function test_getting_elements_for_given_path(): void { - // @mago-ignore analysis:unavailable-method $html = HTMLDocument::createFromString( '
foobar
', ); /** @var array $result */ - $result = (new FunctionContext(flow_context()))->eval( + $result = new FunctionContext(flow_context())->eval( ref('value')->htmlQuerySelectorAll('body div span'), ['value' => $html], schema(html_schema('value')), @@ -53,27 +38,24 @@ public function test_getting_elements_for_given_path(): void static::assertInstanceOf(Element::class, $result[0]); } - #[RequiresPhp('>= 8.4.0')] public function test_getting_null_when_nothing_found(): void { - // @mago-ignore analysis:unavailable-method $html = HTMLDocument::createFromString( '
foobar
', ); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('value')->htmlQuerySelectorAll('body div p'), ['value' => $html], schema(html_schema('value')), )); } - #[RequiresPhp('>= 8.4.0')] public function test_invalid_value(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected one of'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->htmlQuerySelectorAll('body div span'), ['value' => ''], schema(str_schema('value')), @@ -84,11 +66,7 @@ public function test_describe_round_trips(): void { $context = new FunctionContext(); - try { - $function = new HTMLQuerySelectorAll(ref('html'), lit('div')); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $function = new HTMLQuerySelectorAll(ref('html'), lit('div')); $rebuilt = DescribeRoundTrip::rebuilt($function); $rows = ScalarFunctionFixtures::rows(new PhpBackend()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/HTMLQuerySelectorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/HTMLQuerySelectorTest.php index cd911678f9..0621b2d11c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/HTMLQuerySelectorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/HTMLQuerySelectorTest.php @@ -7,13 +7,11 @@ use Dom\Element; use Dom\HTMLDocument; use Flow\ETL\Foundation\Exception\InvalidArgumentException; -use Flow\ETL\Foundation\Exception\RequiredPHPVersionException; use Flow\ETL\Functions\HTMLQuerySelector; use Flow\ETL\Tests\Context\DescribeRoundTrip; use Flow\ETL\Tests\Context\FunctionContext; use Flow\ETL\Tests\Context\ScalarFunctionFixtures; use Flow\ETL\Values\Column\PhpBackend; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\ETL\DSL\flow_context; @@ -25,52 +23,36 @@ final class HTMLQuerySelectorTest extends TestCase { - #[RequiresPhp('< 8.4.0')] - public function test_getting_element_for_older_versions(): void - { - $this->expectException(RequiredPHPVersionException::class); - (new FunctionContext(flow_context()))->eval( - ref('value')->htmlQuerySelector('body div p'), - ['value' => ''], - schema(str_schema('value')), - ); - } - - #[RequiresPhp('>= 8.4.0')] public function test_getting_elements_for_given_path(): void { - // @mago-ignore analysis:unavailable-method $html = HTMLDocument::createFromString( '
foobar
', ); - static::assertInstanceOf(Element::class, (new FunctionContext(flow_context()))->eval( + static::assertInstanceOf(Element::class, new FunctionContext(flow_context())->eval( ref('value')->htmlQuerySelector('body div span'), ['value' => $html], schema(html_schema('value')), )); } - #[RequiresPhp('>= 8.4.0')] public function test_getting_null_when_nothing_found(): void { - // @mago-ignore analysis:unavailable-method $html = HTMLDocument::createFromString( '
foobar
', ); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('value')->htmlQuerySelector('body div p'), ['value' => $html], schema(html_schema('value')), )); } - #[RequiresPhp('>= 8.4.0')] public function test_invalid_value(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected one of'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->htmlQuerySelector('body div span'), ['value' => ''], schema(str_schema('value')), @@ -81,11 +63,7 @@ public function test_describe_round_trips(): void { $context = new FunctionContext(); - try { - $function = new HTMLQuerySelector(ref('html'), lit('div')); - } catch (RequiredPHPVersionException $e) { - static::markTestSkipped($e->getMessage()); - } + $function = new HTMLQuerySelector(ref('html'), lit('div')); $rebuilt = DescribeRoundTrip::rebuilt($function); $rows = ScalarFunctionFixtures::rows(new PhpBackend()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/HashTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/HashTest.php index 8c6a44a7a7..fa109c86ee 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/HashTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/HashTest.php @@ -152,7 +152,7 @@ public function test_hash_output_is_pinned_per_value_kind_and_algorithm( HashAlgorithm $algorithm, ?string $expected, ): void { - static::assertSame($expected, (new FunctionContext(flow_context()))->eval( + static::assertSame($expected, new FunctionContext(flow_context())->eval( ref('value')->hash($algorithm), ['value' => $value], $schema, @@ -161,7 +161,7 @@ public function test_hash_output_is_pinned_per_value_kind_and_algorithm( public function test_hashing_concat(): void { - static::assertSame('5d22af35c78f30e5d85f3b65d988f8fb', (new FunctionContext(flow_context()))->eval( + static::assertSame('5d22af35c78f30e5d85f3b65d988f8fb', new FunctionContext(flow_context())->eval( hash(concat(ref('value'), lit('_'), ref('value')), HashAlgorithm::xxh128), [ 'value' => 'test', diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IndexOfLastTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IndexOfLastTest.php index d8084390e2..eb76d05fb0 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IndexOfLastTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IndexOfLastTest.php @@ -24,7 +24,7 @@ public function test_index_of_last_ignoring_case_over_two_rows(): void static::assertSame( [1, 0], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('str')->indexOfLast('A', ignoreCase: true), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -33,7 +33,7 @@ public function test_index_of_last_ignoring_case_over_two_rows(): void public function test_index_of_last_with_null_ignore_case_is_case_sensitive(): void { - static::assertSame(0, (new FunctionContext(flow_context()))->eval( + static::assertSame(0, new FunctionContext(flow_context())->eval( ref('str')->indexOfLast('A', ref('ignore_case')), ['str' => 'Aa', 'ignore_case' => null], schema(str_schema('str'), bool_schema('ignore_case', nullable: true)), @@ -42,7 +42,7 @@ public function test_index_of_last_with_null_ignore_case_is_case_sensitive(): vo public function test_index_of_last_basic(): void { - static::assertSame(9, (new FunctionContext(flow_context()))->eval( + static::assertSame(9, new FunctionContext(flow_context())->eval( ref('str')->indexOfLast('l'), ['str' => 'hello world'], schema(str_schema('str')), @@ -51,7 +51,7 @@ public function test_index_of_last_basic(): void public function test_index_of_last_is_case_sensitive_by_default(): void { - static::assertSame(0, (new FunctionContext(flow_context()))->eval( + static::assertSame(0, new FunctionContext(flow_context())->eval( ref('s')->indexOfLast('A'), ['s' => 'Aa'], schema(str_schema('s')), @@ -60,7 +60,7 @@ public function test_index_of_last_is_case_sensitive_by_default(): void public function test_index_of_last_searches_from_the_start_by_default(): void { - static::assertSame(0, (new FunctionContext(flow_context()))->eval( + static::assertSame(0, new FunctionContext(flow_context())->eval( ref('s')->indexOfLast('a'), ['s' => 'ab'], schema(str_schema('s')), @@ -69,7 +69,7 @@ public function test_index_of_last_searches_from_the_start_by_default(): void public function test_index_of_last_not_found(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->indexOfLast('x'), ['str' => 'hello world'], schema(str_schema('str')), @@ -81,7 +81,7 @@ public function test_index_of_last_throws_on_null_needle(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('IndexOfLast function requires non-null string and needle'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->indexOfLast(ref('needle')), ['str' => 'hello', 'needle' => null], schema(str_schema('str'), str_schema('needle', nullable: true)), @@ -93,7 +93,7 @@ public function test_index_of_last_throws_on_null_string(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('IndexOfLast function requires non-null string and needle'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->indexOfLast('l'), ['str' => null], schema(str_schema('str', nullable: true)), @@ -102,7 +102,7 @@ public function test_index_of_last_throws_on_null_string(): void public function test_index_of_last_with_scalar_function_parameters(): void { - static::assertSame(9, (new FunctionContext(flow_context()))->eval( + static::assertSame(9, new FunctionContext(flow_context())->eval( ref('str')->indexOfLast(ref('needle'), ref('ignore_case')), ['str' => 'hello world', 'needle' => 'L', 'ignore_case' => true], schema(str_schema('str'), str_schema('needle'), bool_schema('ignore_case')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IndexOfTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IndexOfTest.php index 56028bd589..d3a542d4ca 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IndexOfTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IndexOfTest.php @@ -24,7 +24,7 @@ public function test_index_of_ignoring_case_over_two_rows(): void static::assertSame( [0, 1], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('str')->indexOf('a', ignoreCase: true), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -33,25 +33,25 @@ public function test_index_of_ignoring_case_over_two_rows(): void public function test_index_of(): void { - static::assertSame(5, (new FunctionContext(flow_context()))->eval( + static::assertSame(5, new FunctionContext(flow_context())->eval( ref('str')->indexOf('x', offset: 5), ['str' => 'AbBAsxa'], schema(str_schema('str')), )); - static::assertSame(0, (new FunctionContext(flow_context()))->eval( + static::assertSame(0, new FunctionContext(flow_context())->eval( ref('str')->indexOf('A', ignoreCase: true), ['str' => 'abbbbb'], schema(str_schema('str')), )); - static::assertSame(5, (new FunctionContext(flow_context()))->eval( + static::assertSame(5, new FunctionContext(flow_context())->eval( ref('str')->indexOf('x', offset: 5), ['str' => 'AbBAsxa'], schema(str_schema('str')), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->indexOf('x', offset: 2), ['str' => 'Abba'], schema(str_schema('str')), @@ -60,7 +60,7 @@ public function test_index_of(): void public function test_index_of_with_null_ignore_case_is_case_sensitive(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->indexOf('a', ref('ignore_case')), ['str' => 'Abc', 'ignore_case' => null], schema(str_schema('str'), bool_schema('ignore_case', nullable: true)), @@ -69,7 +69,7 @@ public function test_index_of_with_null_ignore_case_is_case_sensitive(): void public function test_index_of_is_case_sensitive_by_default(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('s')->indexOf('a'), ['s' => 'Abc'], schema(str_schema('s')), @@ -81,7 +81,7 @@ public function test_index_of_throws_on_null_needle(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('IndexOf function requires non-null string and needle'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->indexOf(ref('needle')), ['str' => 'x', 'needle' => null], schema(str_schema('str'), str_schema('needle', nullable: true)), @@ -93,7 +93,7 @@ public function test_index_of_throws_on_null_string(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('IndexOf function requires non-null string and needle'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->indexOf('x'), ['str' => null], schema(str_schema('str', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsEmptyTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsEmptyTest.php index 568a91785a..31eee6e780 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsEmptyTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsEmptyTest.php @@ -22,7 +22,7 @@ public function test_a_null_row_does_not_stop_later_rows(): void static::assertSame( [null, true], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('str')->isEmpty(), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -31,7 +31,7 @@ public function test_a_null_row_does_not_stop_later_rows(): void public function test_is_empty_empty_string(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('str')->isEmpty(), ['str' => ''], schema(str_schema('str')), @@ -40,7 +40,7 @@ public function test_is_empty_empty_string(): void public function test_is_empty_non_empty_string(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( ref('str')->isEmpty(), ['str' => 'hello'], schema(str_schema('str')), @@ -49,7 +49,7 @@ public function test_is_empty_non_empty_string(): void public function test_is_empty_returns_null_for_null_input(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->isEmpty(), ['str' => null], schema(str_schema('str', nullable: true)), @@ -58,7 +58,7 @@ public function test_is_empty_returns_null_for_null_input(): void public function test_is_empty_single_character_string(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( ref('str')->isEmpty(), ['str' => 'a'], schema(str_schema('str')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsInTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsInTest.php index 19a7470e5a..95893bfc4e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsInTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsInTest.php @@ -57,13 +57,13 @@ public function test_a_heterogeneous_haystack_casts_every_candidate_to_the_needl "Column \"needle\" value 'a' cannot be cast to integer to compare: \"a\" is not a number (row 0)", ); - (new FunctionContext(flow_context()))->eval(lit('a')->isIn(lit([1, 'a'])), [], schema()); + new FunctionContext(flow_context())->eval(lit('a')->isIn(lit([1, 'a'])), [], schema()); } public function test_is_in_matches_two_equal_datetimes(): void { // in_array(strict: true) compared these by identity and answered false - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( lit(new DateTimeImmutable('2024-01-01 10:00:00')) ->isIn(lit([new DateTimeImmutable('2024-01-01 10:00:00')])), [], @@ -74,12 +74,12 @@ public function test_is_in_matches_two_equal_datetimes(): void public function test_is_in_matches_two_equal_date_intervals_by_value(): void { // a time list of the needle's type compares by the physical form, as equals() does - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( lit(new DateInterval('PT1H'))->equals(lit(new DateInterval('PT60M'))), [], schema(), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( lit(new DateInterval('PT1H'))->isIn(lit([new DateInterval('PT60M')])), [], schema(), @@ -89,17 +89,17 @@ public function test_is_in_matches_two_equal_date_intervals_by_value(): void public function test_is_in_over_an_empty_haystack(): void { static::assertSame('boolean', lit('a')->isIn(lit([]))->returns()->toString()); - static::assertFalse((new FunctionContext(flow_context()))->eval(lit('a')->isIn(lit([])), [], schema())); + static::assertFalse(new FunctionContext(flow_context())->eval(lit('a')->isIn(lit([])), [], schema())); } public function test_is_in_agrees_with_equals_on_numeric_operands(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('a')->equals(lit(1)), ['a' => '1'], schema(str_schema('a')), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('a')->isIn(lit([1])), ['a' => '1'], schema(str_schema('a')), @@ -108,7 +108,7 @@ public function test_is_in_agrees_with_equals_on_numeric_operands(): void public function test_a_string_candidate_casts_to_the_needle_type(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('n')->isIn(lit(['1'])), ['n' => 1], schema(int_schema('n')), @@ -117,7 +117,7 @@ public function test_a_string_candidate_casts_to_the_needle_type(): void public function test_a_number_candidate_widens_with_the_needle(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('n')->isIn(lit([1.0])), ['n' => 1], schema(int_schema('n')), @@ -134,11 +134,7 @@ public function test_a_candidate_that_does_not_cast_to_the_needle_type_throws(ar $this->expectException(EvaluationException::class); $this->expectExceptionMessage("value 'x' cannot be cast to integer to compare"); - (new FunctionContext(flow_context()))->eval( - ref('n')->isIn(lit($haystack)), - ['n' => 1], - schema(int_schema('n')), - ); + new FunctionContext(flow_context())->eval(ref('n')->isIn(lit($haystack)), ['n' => 1], schema(int_schema('n'))); } public function test_a_cast_error_names_the_needle_column_read_never_the_alias(): void @@ -146,7 +142,7 @@ public function test_a_cast_error_names_the_needle_column_read_never_the_alias() $this->expectException(EvaluationException::class); $this->expectExceptionMessage("Column \"n\" value 'x' cannot be cast to integer to compare"); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('n')->as('m')->isIn(lit([1])), ['n' => 'x'], schema(str_schema('n')), @@ -165,27 +161,27 @@ public function test_is_in_refuses_an_incomparable_element_type(): void public function test_a_match_beats_a_null_element(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval(lit(5)->isIn(lit([1, null, 5])), [], schema())); + static::assertTrue(new FunctionContext(flow_context())->eval(lit(5)->isIn(lit([1, null, 5])), [], schema())); } public function test_no_match_with_a_null_element_is_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval(lit(7)->isIn(lit([1, null, 5])), [], schema())); + static::assertNull(new FunctionContext(flow_context())->eval(lit(7)->isIn(lit([1, null, 5])), [], schema())); } public function test_no_match_without_a_null_element_is_false(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval(lit(7)->isIn(lit([1, 3, 5])), [], schema())); + static::assertFalse(new FunctionContext(flow_context())->eval(lit(7)->isIn(lit([1, 3, 5])), [], schema())); } public function test_a_null_needle_is_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval(lit(null)->isIn(lit([1, 3, 5])), [], schema())); + static::assertNull(new FunctionContext(flow_context())->eval(lit(null)->isIn(lit([1, 3, 5])), [], schema())); } public function test_a_null_haystack_is_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval(lit(5)->isIn(lit(null)), [], schema())); + static::assertNull(new FunctionContext(flow_context())->eval(lit(5)->isIn(lit(null)), [], schema())); } /** @@ -240,7 +236,7 @@ public function test_a_list_of_the_needle_type_matches_by_value( mixed $element, bool $in, ): void { - static::assertSame($in, (new FunctionContext(flow_context()))->eval( + static::assertSame($in, new FunctionContext(flow_context())->eval( ref('a')->isIn(ref('h')), ['a' => $needle, 'h' => [$element]], schema(definition_from_type('a', $type), definition_from_type('h', type_list($type))), @@ -257,7 +253,7 @@ public function test_a_map_of_the_needle_type_matches_by_value( mixed $element, bool $in, ): void { - static::assertSame($in, (new FunctionContext(flow_context()))->eval( + static::assertSame($in, new FunctionContext(flow_context())->eval( ref('a')->isIn(ref('h')), ['a' => $needle, 'h' => ['k' => $element]], schema(definition_from_type('a', $type), definition_from_type('h', type_map(type_string(), $type))), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNotNullTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNotNullTest.php index 1c06bcf862..76dc464d56 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNotNullTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNotNullTest.php @@ -23,7 +23,7 @@ final class IsNotNullTest extends TestCase #[DataProviderExternal(BackendsContext::class, 'backends')] public function test_answers_per_row(Backend $backend): void { - $column = (new FunctionContext(flow_context(config_builder()->backend($backend)->build())))->column( + $column = new FunctionContext(flow_context(config_builder()->backend($backend)->build()))->column( ref('a')->isNotNull(), [['a' => 1], ['a' => null], ['a' => 3]], schema(int_schema('a', nullable: true)), @@ -37,7 +37,7 @@ public function test_answers_per_row(Backend $backend): void #[DataProviderExternal(BackendsContext::class, 'backends')] public function test_a_column_without_nulls_answers(Backend $backend): void { - $column = (new FunctionContext(flow_context(config_builder()->backend($backend)->build())))->column( + $column = new FunctionContext(flow_context(config_builder()->backend($backend)->build()))->column( ref('a')->isNotNull(), [['a' => 1], ['a' => 2]], schema(int_schema('a', nullable: true)), @@ -51,7 +51,7 @@ public function test_no_rows_answer_with_an_empty_column(): void { static::assertSame( 0, - (new FunctionContext(flow_context(config_builder()->backend(new PhpBackend())->build()))) + new FunctionContext(flow_context(config_builder()->backend(new PhpBackend())->build())) ->column(ref('a')->isNotNull(), [], schema(int_schema('a', nullable: true))) ->count(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNotNumericTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNotNumericTest.php index c5434754c8..4f3d78dde7 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNotNumericTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNotNumericTest.php @@ -21,7 +21,7 @@ public function test_a_null_row_does_not_stop_later_rows(): void static::assertSame( [null, true], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('str')->isNotNumeric(), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNullTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNullTest.php index dbd3f79d0d..7719775b07 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNullTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNullTest.php @@ -23,7 +23,7 @@ final class IsNullTest extends TestCase #[DataProviderExternal(BackendsContext::class, 'backends')] public function test_answers_per_row(Backend $backend): void { - $column = (new FunctionContext(flow_context(config_builder()->backend($backend)->build())))->column( + $column = new FunctionContext(flow_context(config_builder()->backend($backend)->build()))->column( ref('a')->isNull(), [['a' => 1], ['a' => null], ['a' => 3]], schema(int_schema('a', nullable: true)), @@ -37,7 +37,7 @@ public function test_answers_per_row(Backend $backend): void #[DataProviderExternal(BackendsContext::class, 'backends')] public function test_a_column_without_nulls_answers(Backend $backend): void { - $column = (new FunctionContext(flow_context(config_builder()->backend($backend)->build())))->column( + $column = new FunctionContext(flow_context(config_builder()->backend($backend)->build()))->column( ref('a')->isNull(), [['a' => 1], ['a' => 2]], schema(int_schema('a', nullable: true)), @@ -51,7 +51,7 @@ public function test_no_rows_answer_with_an_empty_column(): void { static::assertSame( 0, - (new FunctionContext(flow_context(config_builder()->backend(new PhpBackend())->build()))) + new FunctionContext(flow_context(config_builder()->backend(new PhpBackend())->build())) ->column(ref('a')->isNull(), [], schema(int_schema('a', nullable: true))) ->count(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNumericTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNumericTest.php index ea13c9344b..1da1f5aa20 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNumericTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsNumericTest.php @@ -21,7 +21,7 @@ public function test_a_null_row_does_not_stop_later_rows(): void static::assertSame( [null, true], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('str')->isNumeric(), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsTypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsTypeTest.php index 4950924274..2ad73f96cb 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsTypeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsTypeTest.php @@ -34,7 +34,7 @@ public function test_a_null_row_does_not_stop_later_rows(): void { static::assertSame( [null, true, true], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('value')->isType(type_integer(), type_integer()), [['value' => null], ['value' => 1], ['value' => 2]], diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsUtf8Test.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsUtf8Test.php index 866a38a131..4075612e3a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsUtf8Test.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/IsUtf8Test.php @@ -22,7 +22,7 @@ public function test_a_null_row_does_not_stop_later_rows(): void static::assertSame( [null, true], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('str')->isUtf8(), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -31,7 +31,7 @@ public function test_a_null_row_does_not_stop_later_rows(): void public function test_is_utf8_returns_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->isUtf8(), ['str' => null], schema(str_schema('str', nullable: true)), @@ -40,13 +40,13 @@ public function test_is_utf8_returns_null(): void public function test_is_utf_8(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('str')->isUtf8(), ['str' => 'Lorem Ipsum'], schema(str_schema('str')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( ref('str')->isUtf8(), ['str' => "\xc3\x28"], schema(str_schema('str')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/AllTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/AllTest.php index afaef0e500..c76545ddcc 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/AllTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/AllTest.php @@ -32,7 +32,7 @@ public function test_from_description_without_comparisons_is_refused(): void public function test_from_description_takes_string_keyed_comparisons(): void { - $described = (new Equal('a', 'b'))->describe(); + $described = new Equal('a', 'b')->describe(); static::assertNotNull($described); static::assertEquals( @@ -43,7 +43,7 @@ public function test_from_description_takes_string_keyed_comparisons(): void public function test_describe_lists_comparisons_given_by_name(): void { - $described = (new All(new Equal('a', 'b'), x: new Equal('c', 'd')))->describe(); + $described = new All(new Equal('a', 'b'), x: new Equal('c', 'd'))->describe(); static::assertNotNull($described); static::assertTrue(array_is_list(type_array()->assert( @@ -53,12 +53,12 @@ public function test_describe_lists_comparisons_given_by_name(): void public function test_left_lists_a_shared_column_once(): void { - static::assertEquals([ref('a')], (new All(new Equal('a', 'b'), new Equal('a', 'c')))->left()); + static::assertEquals([ref('a')], new All(new Equal('a', 'b'), new Equal('a', 'c'))->left()); } public function test_right_lists_a_shared_column_once(): void { - static::assertEquals([ref('b')], (new All(new Equal('a', 'b'), new Equal('c', 'b')))->right()); + static::assertEquals([ref('b')], new All(new Equal('a', 'b'), new Equal('c', 'b'))->right()); } public function test_describe_round_trips(): void @@ -83,7 +83,7 @@ public function test_failure(): void { static::assertSame( [false], - (new All(new ConstantComparison(true), new ConstantComparison(false)))->compare( + new All(new ConstantComparison(true), new ConstantComparison(false))->compare( array_to_rows([['id' => 1]], schema(int_schema('id'))), array_to_rows([['id' => 2]], schema(int_schema('id'))), ), @@ -94,7 +94,7 @@ public function test_success(): void { static::assertSame( [true], - (new All(new ConstantComparison(true), new ConstantComparison(true)))->compare( + new All(new ConstantComparison(true), new ConstantComparison(true))->compare( array_to_rows([['id' => 1]], schema(int_schema('id'))), array_to_rows([['id' => 2]], schema(int_schema('id'))), ), @@ -105,7 +105,7 @@ public function test_combines_children_element_wise(): void { static::assertSame( [true, false, false], - (new All(new Equal('a', 'a'), new Equal('b', 'b')))->compare( + new All(new Equal('a', 'a'), new Equal('b', 'b'))->compare( array_to_rows( [['a' => 1, 'b' => 1], ['a' => 1, 'b' => 2], ['a' => 3, 'b' => 3]], schema(int_schema('a'), int_schema('b')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/AnyTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/AnyTest.php index b5d36da7e0..a68628002f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/AnyTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/AnyTest.php @@ -32,7 +32,7 @@ public function test_from_description_without_comparisons_is_refused(): void public function test_from_description_takes_string_keyed_comparisons(): void { - $described = (new Equal('a', 'b'))->describe(); + $described = new Equal('a', 'b')->describe(); static::assertNotNull($described); static::assertEquals( @@ -43,7 +43,7 @@ public function test_from_description_takes_string_keyed_comparisons(): void public function test_describe_lists_comparisons_given_by_name(): void { - $described = (new Any(new Equal('a', 'b'), x: new Equal('c', 'd')))->describe(); + $described = new Any(new Equal('a', 'b'), x: new Equal('c', 'd'))->describe(); static::assertNotNull($described); static::assertTrue(array_is_list(type_array()->assert( @@ -53,12 +53,12 @@ public function test_describe_lists_comparisons_given_by_name(): void public function test_left_lists_a_shared_column_once(): void { - static::assertEquals([ref('a')], (new Any(new Equal('a', 'b'), new Equal('a', 'c')))->left()); + static::assertEquals([ref('a')], new Any(new Equal('a', 'b'), new Equal('a', 'c'))->left()); } public function test_right_lists_a_shared_column_once(): void { - static::assertEquals([ref('b')], (new Any(new Equal('a', 'b'), new Equal('c', 'b')))->right()); + static::assertEquals([ref('b')], new Any(new Equal('a', 'b'), new Equal('c', 'b'))->right()); } public function test_describe_round_trips(): void @@ -83,7 +83,7 @@ public function test_failure(): void { static::assertSame( [false], - (new Any(new ConstantComparison(false), new ConstantComparison(false)))->compare( + new Any(new ConstantComparison(false), new ConstantComparison(false))->compare( array_to_rows([['id' => 1]], schema(int_schema('id'))), array_to_rows([['id' => 2]], schema(int_schema('id'))), ), @@ -94,7 +94,7 @@ public function test_success(): void { static::assertSame( [true], - (new Any(new ConstantComparison(true), new ConstantComparison(false)))->compare( + new Any(new ConstantComparison(true), new ConstantComparison(false))->compare( array_to_rows([['id' => 1]], schema(int_schema('id'))), array_to_rows([['id' => 2]], schema(int_schema('id'))), ), @@ -105,7 +105,7 @@ public function test_combines_children_element_wise(): void { static::assertSame( [true, true, false], - (new Any(new Equal('a', 'a'), new Equal('b', 'b')))->compare( + new Any(new Equal('a', 'a'), new Equal('b', 'b'))->compare( array_to_rows( [['a' => 1, 'b' => 1], ['a' => 1, 'b' => 2], ['a' => 3, 'b' => 3]], schema(int_schema('a'), int_schema('b')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/EqualTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/EqualTest.php index 39fd8bb1f5..915abdc1ba 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/EqualTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/EqualTest.php @@ -42,7 +42,7 @@ public function test_failure(): void { static::assertSame( [false], - (new Equal('datetime', 'datetime'))->compare( + new Equal('datetime', 'datetime')->compare( array_to_rows([[ 'datetime' => new DateTimeImmutable('2022-10-01 00:00:00'), ]], schema(datetime_schema('datetime'))), @@ -57,7 +57,7 @@ public function test_null_is_not_equal_to_null(): void { static::assertSame( [false], - (new Equal('id', 'id'))->compare( + new Equal('id', 'id')->compare( array_to_rows([['id' => null]], schema(str_schema('id', nullable: true))), array_to_rows([['id' => null]], schema(str_schema('id', nullable: true))), ), @@ -68,14 +68,14 @@ public function test_null_is_not_equal_to_value(): void { static::assertSame( [false], - (new Equal('id', 'id'))->compare( + new Equal('id', 'id')->compare( array_to_rows([['id' => null]], schema(int_schema('id', nullable: true))), array_to_rows([['id' => 1]], schema(int_schema('id'))), ), ); static::assertSame( [false], - (new Equal('id', 'id'))->compare( + new Equal('id', 'id')->compare( array_to_rows([['id' => 1]], schema(int_schema('id'))), array_to_rows([['id' => null]], schema(int_schema('id', nullable: true))), ), @@ -89,7 +89,7 @@ public function test_a_string_that_does_not_cast_to_the_other_side_throws(): voi 'Column "id" value \'f47ac10b-58cc-4372-a567-0e02b2c3d479\' cannot be cast to integer', ); - (new Equal('id', 'id'))->compare( + new Equal('id', 'id')->compare( array_to_rows([['id' => 'f47ac10b-58cc-4372-a567-0e02b2c3d479']], schema(str_schema('id'))), array_to_rows([['id' => 1]], schema(int_schema('id'))), ); @@ -99,7 +99,7 @@ public function test_an_integral_string_past_two_to_the_53_casts_exactly(): void { static::assertSame( [true, false], - (new Equal('id', 'id'))->compare( + new Equal('id', 'id')->compare( array_to_rows([['id' => '9007199254740993'], ['id' => '9007199254740993']], schema(str_schema('id'))), array_to_rows([ ['id' => 9_007_199_254_740_993], @@ -113,7 +113,7 @@ public function test_a_numeric_string_casts_to_the_other_side(): void { static::assertSame( [true, false], - (new Equal('id', 'id'))->compare( + new Equal('id', 'id')->compare( array_to_rows([['id' => '1'], ['id' => '1.5']], schema(str_schema('id'))), array_to_rows([['id' => 1], ['id' => 1]], schema(int_schema('id'))), ), @@ -124,7 +124,7 @@ public function test_uuid_objects_with_different_values_are_not_equal(): void { static::assertSame( [false], - (new Equal('id', 'id'))->compare( + new Equal('id', 'id')->compare( array_to_rows([['id' => 'f47ac10b-58cc-4372-a567-0e02b2c3d479']], schema(str_schema('id'))), array_to_rows([['id' => '00000000-0000-4000-8000-000000000000']], schema(str_schema('id'))), ), @@ -135,7 +135,7 @@ public function test_uuid_objects_with_same_value_are_equal(): void { static::assertSame( [true], - (new Equal('id', 'id'))->compare( + new Equal('id', 'id')->compare( array_to_rows([['id' => 'f47ac10b-58cc-4372-a567-0e02b2c3d479']], schema(str_schema('id'))), array_to_rows([['id' => 'f47ac10b-58cc-4372-a567-0e02b2c3d479']], schema(str_schema('id'))), ), @@ -146,7 +146,7 @@ public function test_success(): void { static::assertSame( [true], - (new Equal('datetime', 'datetime'))->compare( + new Equal('datetime', 'datetime')->compare( array_to_rows([[ 'datetime' => $datetime = new DateTimeImmutable('2022-10-01 00:00:00'), ]], schema(datetime_schema('datetime'))), @@ -159,7 +159,7 @@ public function test_compares_pair_aligned_batches(): void { static::assertSame( [true, false, false, true], - (new Equal('a', 'b'))->compare( + new Equal('a', 'b')->compare( array_to_rows([ ['a' => 1], ['a' => 2], @@ -175,7 +175,7 @@ public function test_numeric_strings_are_equal_only_when_identical_as_under_equa { static::assertSame( [false, true], - (new Equal('k', 'k'))->compare( + new Equal('k', 'k')->compare( array_to_rows([['k' => '1'], ['k' => '1']], schema(str_schema('k'))), array_to_rows([['k' => '1.0'], ['k' => '1']], schema(str_schema('k'))), ), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/IdenticalTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/IdenticalTest.php index 55419fe86e..61416af3dc 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/IdenticalTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Join/Condition/IdenticalTest.php @@ -41,7 +41,7 @@ public function test_failure(): void { static::assertSame( [false], - (new Identical('id', 'id'))->compare( + new Identical('id', 'id')->compare( array_to_rows([['id' => 1]], schema(int_schema('id'))), array_to_rows([['id' => 2]], schema(int_schema('id'))), ), @@ -52,7 +52,7 @@ public function test_null_is_not_identical_to_null(): void { static::assertSame( [false], - (new Identical('id', 'id'))->compare( + new Identical('id', 'id')->compare( array_to_rows([['id' => null]], schema(str_schema('id', nullable: true))), array_to_rows([['id' => null]], schema(str_schema('id', nullable: true))), ), @@ -63,14 +63,14 @@ public function test_null_is_not_identical_to_value(): void { static::assertSame( [false], - (new Identical('id', 'id'))->compare( + new Identical('id', 'id')->compare( array_to_rows([['id' => null]], schema(int_schema('id', nullable: true))), array_to_rows([['id' => 1]], schema(int_schema('id'))), ), ); static::assertSame( [false], - (new Identical('id', 'id'))->compare( + new Identical('id', 'id')->compare( array_to_rows([['id' => 1]], schema(int_schema('id'))), array_to_rows([['id' => null]], schema(int_schema('id', nullable: true))), ), @@ -81,7 +81,7 @@ public function test_success(): void { static::assertSame( [true], - (new Identical('id', 'id'))->compare( + new Identical('id', 'id')->compare( array_to_rows([['id' => 1]], schema(int_schema('id'))), array_to_rows([['id' => 1]], schema(int_schema('id'))), ), @@ -92,7 +92,7 @@ public function test_compares_pair_aligned_batches(): void { static::assertSame( [true, false, false], - (new Identical('id', 'id'))->compare( + new Identical('id', 'id')->compare( array_to_rows([['id' => 1], ['id' => 2], ['id' => null]], schema(int_schema('id', nullable: true))), array_to_rows([['id' => 1], ['id' => 3], ['id' => null]], schema(int_schema('id', nullable: true))), ), @@ -103,7 +103,7 @@ public function test_equal_datetimes_are_identical(): void { static::assertSame( [true], - (new Identical('at', 'at'))->compare( + new Identical('at', 'at')->compare( array_to_rows([['at' => new DateTimeImmutable('2024-01-01 00:00:00')]], schema(datetime_schema('at'))), array_to_rows([['at' => new DateTimeImmutable('2024-01-01 00:00:00')]], schema(datetime_schema('at'))), ), @@ -114,7 +114,7 @@ public function test_equal_uuids_are_identical(): void { static::assertSame( [true, false], - (new Identical('id', 'id'))->compare( + new Identical('id', 'id')->compare( array_to_rows([ ['id' => '00000000-0000-4000-8000-000000000001'], ['id' => '00000000-0000-4000-8000-000000000001'], @@ -131,7 +131,7 @@ public function test_values_of_different_types_are_not_identical(): void { static::assertSame( [false], - (new Identical('id', 'id'))->compare( + new Identical('id', 'id')->compare( array_to_rows([['id' => 1]], schema(int_schema('id'))), array_to_rows([['id' => '1']], schema(str_schema('id'))), ), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/JsonDecodeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/JsonDecodeTest.php index f007078664..c469a14969 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/JsonDecodeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/JsonDecodeTest.php @@ -25,7 +25,7 @@ public function test_json_decode_expression(): void { static::assertSame( ['value' => 1], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->jsonDecode(), ['value' => '{"value": 1}'], schema(str_schema('value')), @@ -37,7 +37,7 @@ public function test_null_flags_decode_without_flags(): void { static::assertSame( ['value' => 1], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->jsonDecode(ref('flags')), ['value' => '{"value": 1}', 'flags' => null], schema(str_schema('value'), int_schema('flags', nullable: true)), @@ -49,7 +49,7 @@ public function test_every_json_row_is_decoded(): void { static::assertSame( [['a' => 1], ['b' => 2]], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('value')->jsonDecode(), [['value' => new Json('{"a": 1}')], ['value' => new Json('{"b": 2}')]], @@ -61,7 +61,7 @@ public function test_every_json_row_is_decoded(): void public function test_json_with_511_nested_containers_is_decoded(): void { - static::assertIsArray((new FunctionContext(flow_context()))->eval( + static::assertIsArray(new FunctionContext(flow_context())->eval( ref('value')->jsonDecode(), ['value' => str_repeat('[', 511) . str_repeat(']', 511)], schema(str_schema('value')), @@ -73,7 +73,7 @@ public function test_json_with_512_nested_containers_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('JsonDecode error: Maximum stack depth exceeded'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->jsonDecode(), ['value' => str_repeat('[', 512) . str_repeat(']', 512)], schema(str_schema('value')), @@ -85,7 +85,7 @@ public function test_json_decode_expression_with_invalid_json(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('JsonDecode error: Syntax error'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->jsonDecode(), ['value' => '{"value": 1'], schema(str_schema('value')), @@ -95,7 +95,7 @@ public function test_json_decode_expression_with_invalid_json(): void public function test_invalid_json_keeps_the_decoder_error_as_the_cause(): void { try { - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->jsonDecode(), ['value' => '{"value": 1'], schema(str_schema('value')), @@ -111,7 +111,7 @@ public function test_json_decode_on_non_json_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('JsonDecode function requires string, array, or Json value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->jsonDecode(), ['value' => 125], schema(int_schema('value')), @@ -125,7 +125,7 @@ public function test_json_decode_on_scalar_json_throws(): void 'JsonDecode function requires JSON that decodes to an array, cast scalar JSON instead', ); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->jsonDecode(), ['value' => '5'], schema(str_schema('value')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/JsonEncodeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/JsonEncodeTest.php index ef6a1b478e..341c7c6d55 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/JsonEncodeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/JsonEncodeTest.php @@ -32,9 +32,9 @@ final class JsonEncodeTest extends FlowTestCase public function test_json_encode_on_datetime(): void { // json_encode() of a non-container operand declares string, so the encoded object is a string - static::assertSame('{"date":"2021-01-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"}', (new FunctionContext( + static::assertSame('{"date":"2021-01-01 00:00:00.000000","timezone_type":3,"timezone":"UTC"}', new FunctionContext( flow_context(), - ))->eval( + )->eval( ref('value')->jsonEncode(), [ 'value' => new DateTimeImmutable('2021-01-01'), @@ -45,7 +45,7 @@ public function test_json_encode_on_datetime(): void public function test_null_flags_encode_without_flags(): void { - static::assertSame('1', (new FunctionContext(flow_context()))->eval( + static::assertSame('1', new FunctionContext(flow_context())->eval( ref('value')->jsonEncode(ref('flags')), ['value' => 1, 'flags' => null], schema(int_schema('value'), int_schema('flags', nullable: true)), @@ -54,7 +54,7 @@ public function test_null_flags_encode_without_flags(): void public function test_json_encode_on_integer(): void { - static::assertSame('125', (new FunctionContext(flow_context()))->eval( + static::assertSame('125', new FunctionContext(flow_context())->eval( ref('value')->jsonEncode(), ['value' => 125], schema(int_schema('value')), @@ -63,7 +63,7 @@ public function test_json_encode_on_integer(): void public function test_json_encode_on_string(): void { - static::assertSame('"test"', (new FunctionContext(flow_context()))->eval( + static::assertSame('"test"', new FunctionContext(flow_context())->eval( ref('value')->jsonEncode(), ['value' => 'test'], schema(str_schema('value')), @@ -74,7 +74,7 @@ public function test_a_structure_declares_optional_json(): void { static::assertEquals( type_optional(type_json()), - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('value')->jsonEncode(), schema(structure_schema('value', type_structure(['a' => type_integer()]))), @@ -87,7 +87,7 @@ public function test_every_row_after_a_null_is_encoded_to_json(): void { static::assertEquals( [null, new Json('[1]'), new Json('[2]')], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('value')->jsonEncode(), [['value' => null], ['value' => [1]], ['value' => [2]]], @@ -100,7 +100,7 @@ public function test_every_row_after_a_null_is_encoded_to_json(): void public function test_json_encode_on_valid_associative_array(): void { // @mago-ignore analysis:mixed-assignment - $result = (new FunctionContext(flow_context()))->eval( + $result = new FunctionContext(flow_context())->eval( ref('value')->jsonEncode(), ['value' => [ 'value' => 1, diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LastBatchColumnTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LastBatchColumnTest.php index 3d9315daf1..4cc5798f38 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LastBatchColumnTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LastBatchColumnTest.php @@ -33,7 +33,7 @@ public function test_another_batch_resolves_its_own_column(): void public function test_a_batch_without_the_column_has_none(): void { - static::assertNull((new LastBatchColumn('missing'))->of(array_to_rows([[ + static::assertNull(new LastBatchColumn('missing')->of(array_to_rows([[ 'id' => 1, ]], schema(int_schema('id'))))); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LastTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LastTest.php index 93c9d4aa07..63d60c14db 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LastTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LastTest.php @@ -91,7 +91,7 @@ public function test_last_over_an_int_column_declares_optional_integer(): void { static::assertSame( '?integer', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(last(ref('v')), schema(int_schema('v'))) ->returns() ->toString(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LeastTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LeastTest.php index 3adc13cdec..b6f9dde60d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LeastTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LeastTest.php @@ -26,13 +26,13 @@ final class LeastTest extends FlowTestCase { public function test_children_of_keyed_values_are_a_list(): void { - static::assertTrue(array_is_list((new Least(['a' => lit(1), 'b' => lit(2)]))->children())); + static::assertTrue(array_is_list(new Least(['a' => lit(1), 'b' => lit(2)])->children())); } public function test_a_non_nullable_operand_makes_the_result_not_nullable(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( least(ref('int'), lit(10)), schema(int_schema('int', nullable: true)), ); @@ -56,7 +56,7 @@ public function test_an_integer_and_a_string_column_have_no_common_type(): void public function test_null_only_when_every_argument_is_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( least(null, null), [ 'int' => 4, @@ -67,7 +67,7 @@ public function test_null_only_when_every_argument_is_null(): void public function test_least_value(): void { - static::assertSame(10, (new FunctionContext(flow_context()))->eval( + static::assertSame(10, new FunctionContext(flow_context())->eval( least(10, 20, ref('int'), 40), ['int' => 55], schema(int_schema('int')), @@ -76,7 +76,7 @@ public function test_least_value(): void public function test_least_with_null(): void { - static::assertSame(4, (new FunctionContext(flow_context()))->eval( + static::assertSame(4, new FunctionContext(flow_context())->eval( least(null, 20, ref('int'), 1257), [ 'int' => 4, @@ -87,7 +87,7 @@ public function test_least_with_null(): void public function test_least_orders_strings_by_bytes(): void { - static::assertSame('10', (new FunctionContext(flow_context()))->eval( + static::assertSame('10', new FunctionContext(flow_context())->eval( least(ref('a'), lit('10'), lit('9')), ['a' => null], schema(str_schema('a', nullable: true)), @@ -96,7 +96,7 @@ public function test_least_orders_strings_by_bytes(): void public function test_least_orders_a_numeric_string_column_numerically(): void { - static::assertSame('9', (new FunctionContext(flow_context()))->eval( + static::assertSame('9', new FunctionContext(flow_context())->eval( least(ref('a'), ref('b')), ['a' => '9', 'b' => '10'], schema(definition_from_type('a', type_numeric_string()), definition_from_type('b', type_numeric_string())), @@ -105,7 +105,7 @@ public function test_least_orders_a_numeric_string_column_numerically(): void public function test_least_keeps_the_first_of_equal_values(): void { - static::assertSame('10', (new FunctionContext(flow_context()))->eval( + static::assertSame('10', new FunctionContext(flow_context())->eval( least(ref('a'), ref('b')), ['a' => '10', 'b' => '10.0'], schema(definition_from_type('a', type_numeric_string()), definition_from_type('b', type_numeric_string())), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ListSelectTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ListSelectTest.php index 78cfece86d..5d58a382b1 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ListSelectTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ListSelectTest.php @@ -29,7 +29,7 @@ final class ListSelectTest extends FlowTestCase public function test_selecting_from_a_list_of_maps_declares_optional_map_value_types(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( new ListSelect(ref('list'), 'field'), schema(list_schema('list', type_list(type_map(type_string(), type_integer())))), ); @@ -40,7 +40,7 @@ public function test_selecting_from_a_list_of_maps_declares_optional_map_value_t public function test_selecting_from_a_list_of_maps_of_mixed_keeps_the_value_mixed(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( new ListSelect(ref('list'), 'field'), schema(list_schema('list', type_list(type_map(type_string(), type_mixed())))), ); @@ -51,7 +51,7 @@ public function test_selecting_from_a_list_of_maps_of_mixed_keeps_the_value_mixe public function test_selecting_from_a_list_of_scalars_declares_null_element_types(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( new ListSelect(ref('list'), 'field'), schema(list_schema('list', type_list(type_string()))), ); @@ -67,7 +67,7 @@ public function test_selecting_non_existing_value_from_list_using_alias(): void ['id' => 2, 'mail' => null], ['id' => 3, 'mail' => null], ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new ListSelect(ref('list'), ref('id'), ref('mail')), [ 'list' => [ @@ -92,7 +92,7 @@ public function test_selecting_value_from_list(): void ['id' => 2], ['id' => 3], ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new ListSelect(ref('list'), 'id'), [ 'list' => [ @@ -113,7 +113,7 @@ public function test_a_null_list_does_not_stop_the_next_row(): void { static::assertEquals( [null, [['id' => 1]]], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( new ListSelect(ref('list'), 'id'), [['list' => null], ['list' => [['id' => 1, 'name' => 'test']]]], @@ -135,7 +135,7 @@ public function test_selecting_value_from_list_using_alias(): void ['new_id' => 2], ['new_id' => 3], ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new ListSelect(ref('list'), ref('id')->as('new_id')), [ 'list' => [ @@ -161,7 +161,7 @@ public function test_selecting_value_from_simple_list(): void ['id' => null], ['id' => null], ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new ListSelect(ref('list'), ref('id')), ['list' => [ 'a', diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LiteralValueTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LiteralValueTest.php index 52c9ae7147..5e7344f019 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LiteralValueTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LiteralValueTest.php @@ -97,7 +97,7 @@ public function test_a_dom_node_does_not_encode(): void $document = new DOMDocument(); $document->loadXML('
1'); - static::assertNull((new LiteralValue())->encode($document->documentElement)); + static::assertNull(new LiteralValue()->encode($document->documentElement)); } public function test_an_array_with_a_dom_node_does_not_encode(): void @@ -105,14 +105,14 @@ public function test_an_array_with_a_dom_node_does_not_encode(): void $document = new DOMDocument(); $document->loadXML('1'); - static::assertNull((new LiteralValue())->encode(['node' => $document->documentElement])); + static::assertNull(new LiteralValue()->encode(['node' => $document->documentElement])); } public function test_decode_refuses_an_unknown_shape(): void { $this->expectException(InvalidArgumentException::class); - (new LiteralValue())->decode(['type' => ['type' => 'float'], 'value' => 'not a float']); + new LiteralValue()->decode(['type' => ['type' => 'float'], 'value' => 'not a float']); } public function test_decode_refuses_a_missing_key(): void @@ -120,13 +120,13 @@ public function test_decode_refuses_a_missing_key(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('A literal value is encoded as {type, value}'); - (new LiteralValue())->decode(['type' => ['type' => 'integer']]); + new LiteralValue()->decode(['type' => ['type' => 'integer']]); } public function test_decode_refuses_an_unknown_enum_case(): void { $this->expectException(InvalidArgumentException::class); - (new LiteralValue())->decode(['type' => ['type' => 'enum', 'class' => Boundary::class], 'value' => 'NOPE']); + new LiteralValue()->decode(['type' => ['type' => 'enum', 'class' => Boundary::class], 'value' => 'NOPE']); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LogicalFunctionsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LogicalFunctionsTest.php index 716a26b5ec..1466fbf3ea 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LogicalFunctionsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/LogicalFunctionsTest.php @@ -17,22 +17,22 @@ final class LogicalFunctionsTest extends FlowTestCase { public function test_logical_operations(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( ref('id')->isEven()->andNot(ref('id')->equals(lit(1))), ['id' => 1], schema(int_schema('id')), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('id')->isOdd()->and(ref('id')->equals(lit(1))), ['id' => 1], schema(int_schema('id')), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('id')->isEven()->or(ref('id')->equals(lit(1))), ['id' => 1], schema(int_schema('id')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( ref('id')->isOdd()->andNot(ref('id')->equals(lit(1))), ['id' => 1], schema(int_schema('id')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MatchCasesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MatchCasesTest.php index 5c4045b3bd..7c88c01308 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MatchCasesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MatchCasesTest.php @@ -40,10 +40,10 @@ public function test_children_of_keyed_cases_are_a_list(): void { static::assertTrue( array_is_list( - (new MatchCases([ + new MatchCases([ 'a' => match_condition(lit(true), lit(1)), 'b' => match_condition(lit(false), lit(2)), - ]))->children(), + ])->children(), ), ); } @@ -53,7 +53,7 @@ public function test_no_matching_case_without_a_default_still_throws(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Not a single case matches row, consider using default parameter'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( match_cases([ match_condition(ref('string')->contains('_'), ref('string')->strReplace('_', ' ')), ]), @@ -69,14 +69,14 @@ public function test_case_match(): void match_condition(ref('string')->contains('-'), ref('string')->strReplace('-', ' ')), ]); - static::assertSame('this is slug', (new FunctionContext(flow_context()))->eval( + static::assertSame('this is slug', new FunctionContext(flow_context())->eval( $match, [ 'string' => 'this-is-slug', ], schema(str_schema('string')), )); - static::assertSame('this is slug', (new FunctionContext(flow_context()))->eval( + static::assertSame('this is slug', new FunctionContext(flow_context())->eval( $match, [ 'string' => 'this_is_slug', @@ -92,7 +92,7 @@ public function test_not_matching_anything_in_strict_mode(): void 'Not a single case matches row, consider using default parameter, row: {"string":"weirdstring"}', ); - (new FunctionContext(flow_context(config())))->eval( + new FunctionContext(flow_context(config()))->eval( match_cases([ match_condition(ref('string')->contains('_'), ref('string')->strReplace('_', ' ')), match_condition(ref('string')->contains('-'), ref('string')->strReplace('-', ' ')), @@ -104,7 +104,7 @@ public function test_not_matching_anything_in_strict_mode(): void public function test_not_matching_anything_with_default(): void { - static::assertEquals('normal string', (new FunctionContext(flow_context()))->eval( + static::assertEquals('normal string', new FunctionContext(flow_context())->eval( match_cases([ match_condition(ref('string')->contains('_'), ref('string')->strReplace('_', ' ')), match_condition(ref('string')->contains('-'), ref('string')->strReplace('-', ' ')), @@ -134,7 +134,7 @@ public function test_a_condition_that_gives_an_array_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "boolean", got "array".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( match_cases([match_condition(ref('list'), lit(1))], default: lit(0)), ['list' => [1]], schema(list_schema('list', type_list(type_integer()))), @@ -150,10 +150,10 @@ public function test_a_later_case_runs_only_on_the_rows_no_earlier_case_took(): static::assertSame( [0, 2], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(match_cases([ match_condition(ref('c'), lit(0)), - match_condition((new FailingOnValuesFunction(ref('v'), [99]))->isNotNull(), ref('v')), + match_condition(new FailingOnValuesFunction(ref('v'), [99])->isNotNull(), ref('v')), ]), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MathTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MathTest.php index 84540f8a38..2658f8856f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MathTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MathTest.php @@ -26,7 +26,7 @@ final class MathTest extends FlowTestCase { public function test_divide(): void { - static::assertSame(10.0, (new FunctionContext(flow_context()))->eval( + static::assertSame(10.0, new FunctionContext(flow_context())->eval( new Divide(ref('a'), ref('b')), ['a' => 100, 'b' => 10], schema(int_schema('a'), int_schema('b')), @@ -38,7 +38,7 @@ public function test_divide_with_null_right_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Divide function requires non-null values'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->divide(ref('b')), ['a' => 100, 'b' => null], schema(int_schema('a'), int_schema('b', nullable: true)), @@ -50,7 +50,7 @@ public function test_divide_by_zero(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Divide function cannot divide by zero'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->divide(ref('b')), ['a' => 100, 'b' => 0], schema(int_schema('a'), int_schema('b')), @@ -59,7 +59,7 @@ public function test_divide_by_zero(): void public function test_minus(): void { - static::assertSame(0, (new FunctionContext(flow_context()))->eval( + static::assertSame(0, new FunctionContext(flow_context())->eval( new Minus(ref('a'), ref('b'), false), ['a' => 100, 'b' => 100], schema(int_schema('a'), int_schema('b')), @@ -68,7 +68,7 @@ public function test_minus(): void public function test_modulo(): void { - static::assertSame(10, (new FunctionContext(flow_context()))->eval( + static::assertSame(10, new FunctionContext(flow_context())->eval( new Mod(ref('a'), ref('b')), ['a' => 110, 'b' => 100], schema(int_schema('a'), int_schema('b')), @@ -77,7 +77,7 @@ public function test_modulo(): void public function test_multiple_operations(): void { - static::assertSame(200, (new FunctionContext(flow_context()))->eval( + static::assertSame(200, new FunctionContext(flow_context())->eval( ref('a')->plus(lit(100))->plus(lit(100))->minus(ref('b')), ['a' => 100, 'b' => 100], schema(int_schema('a'), int_schema('b')), @@ -86,7 +86,7 @@ public function test_multiple_operations(): void public function test_multiply(): void { - static::assertSame(10_000, (new FunctionContext(flow_context()))->eval( + static::assertSame(10_000, new FunctionContext(flow_context())->eval( new Multiply(ref('a'), ref('b'), false), ['a' => 100, 'b' => 100], schema(int_schema('a'), int_schema('b')), @@ -95,7 +95,7 @@ public function test_multiply(): void public function test_plus(): void { - static::assertSame(200, (new FunctionContext(flow_context()))->eval( + static::assertSame(200, new FunctionContext(flow_context())->eval( new Plus(ref('a'), ref('b'), false), ['a' => 100, 'b' => 100], schema(int_schema('a'), int_schema('b')), @@ -104,7 +104,7 @@ public function test_plus(): void public function test_power(): void { - static::assertSame(1, (new FunctionContext(flow_context()))->eval( + static::assertSame(1, new FunctionContext(flow_context())->eval( new Power(ref('a'), ref('b')), ['a' => 1, 'b' => 2], schema(int_schema('a'), int_schema('b')), @@ -113,7 +113,7 @@ public function test_power(): void public function test_round(): void { - static::assertSame(1.01, (new FunctionContext(flow_context()))->eval( + static::assertSame(1.01, new FunctionContext(flow_context())->eval( new Round(ref('a'), ref('b')), ['a' => 1.009, 'b' => 2], schema(float_schema('a'), int_schema('b')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MaxTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MaxTest.php index 2703493e65..fe388d6de1 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MaxTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MaxTest.php @@ -220,7 +220,7 @@ public function test_max_over_an_int_column_declares_optional_integer(): void { static::assertSame( '?integer', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(max(ref('int')), schema(int_schema('int'))) ->returns() ->toString(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MinTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MinTest.php index d1934bba29..a1668894ac 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MinTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MinTest.php @@ -227,7 +227,7 @@ public function test_min_over_an_int_column_declares_optional_integer(): void { static::assertSame( '?integer', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(min(ref('int')), schema(int_schema('int'))) ->returns() ->toString(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MinusTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MinusTest.php index 7e528e438b..f82bb883b9 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MinusTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MinusTest.php @@ -26,7 +26,7 @@ final class MinusTest extends FlowTestCase { public function test_exact_keeps_decimal_arithmetic(): void { - static::assertSame(0.2, (new FunctionContext(flow_context()))->eval( + static::assertSame(0.2, new FunctionContext(flow_context())->eval( ref('a')->minus(ref('b'), exact: true), ['a' => 0.3, 'b' => 0.1], schema(float_schema('a'), float_schema('b')), @@ -35,7 +35,7 @@ public function test_exact_keeps_decimal_arithmetic(): void public function test_floats_use_ieee_arithmetic(): void { - static::assertSame(0.19999999999999998, (new FunctionContext(flow_context()))->eval( + static::assertSame(0.19999999999999998, new FunctionContext(flow_context())->eval( ref('a')->minus(ref('b')), ['a' => 0.3, 'b' => 0.1], schema(float_schema('a'), float_schema('b')), @@ -44,7 +44,7 @@ public function test_floats_use_ieee_arithmetic(): void public function test_integers_stay_integers(): void { - static::assertSame(2, (new FunctionContext(flow_context()))->eval( + static::assertSame(2, new FunctionContext(flow_context())->eval( ref('a')->minus(ref('b')), ['a' => 5, 'b' => 3], schema(int_schema('a'), int_schema('b')), @@ -56,7 +56,7 @@ public function test_integer_overflow_names_its_row(): void $this->expectException(EvaluationException::class); $this->expectExceptionMessage('Minus function integer overflow (row 0)'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->minus(ref('b')), ['a' => PHP_INT_MIN, 'b' => 1], schema(int_schema('a'), int_schema('b')), @@ -87,7 +87,7 @@ public static function refusalsPerBackend(): Generator public function test_a_refusal_message(Backend $backend, array $row, string $message): void { try { - (new FunctionContext(flow_context(config_builder()->backend($backend)->build())))->eval( + new FunctionContext(flow_context(config_builder()->backend($backend)->build()))->eval( ref('a')->minus(ref('b')), $row, schema(int_schema('a', nullable: true), int_schema('b', nullable: true)), @@ -103,7 +103,7 @@ public function test_exact_refuses_a_null_right_operand(): void $this->expectException(EvaluationException::class); $this->expectExceptionMessage('Minus function requires non-null values (row 0)'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->minus(ref('b'), exact: true), ['a' => 5, 'b' => null], schema(int_schema('a'), int_schema('b', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ModTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ModTest.php index 67d3aff329..5b0c569e64 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ModTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ModTest.php @@ -45,7 +45,7 @@ public static function refusalsPerBackend(): Generator public function test_a_refusal_message(Backend $backend, array $row, string $message): void { try { - (new FunctionContext(flow_context(config_builder()->backend($backend)->build())))->eval( + new FunctionContext(flow_context(config_builder()->backend($backend)->build()))->eval( ref('a')->mod(ref('b')), $row, schema(int_schema('a', nullable: true), int_schema('b', nullable: true)), @@ -60,7 +60,7 @@ public function test_a_negative_remainder_folds_back_under_a_positive_modulus(): { static::assertSame( [2, 1, 0], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('a')->mod(ref('b')), [['a' => -7, 'b' => 3], ['a' => 7, 'b' => 3], ['a' => PHP_INT_MIN, 'b' => 2]], diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ModifyDateTimeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ModifyDateTimeTest.php index 47ea7091a0..1b0fc41b63 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ModifyDateTimeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ModifyDateTimeTest.php @@ -26,7 +26,7 @@ public function test_modify_date(): void { static::assertEquals( new DateTimeImmutable('2025-01-01 12:00:00 +00:00'), - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('datetime')->modifyDateTime('noon'), [ 'datetime' => type_date()->cast('2025-01-01'), @@ -40,7 +40,7 @@ public function test_modify_datetime(): void { static::assertEquals( new DateTimeImmutable('2025-01-01 00:00:00 +00:00'), - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('datetime')->modifyDateTime('midnight'), [ 'datetime' => type_datetime()->cast('2025-01-01 10:00:23 +00:00'), @@ -55,7 +55,7 @@ public function test_modify_using_invalid_modifier(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('datetime')->modifyDateTime(lit(1)), [ 'datetime' => type_datetime()->cast('2025-01-01 10:00:23 +00:00'), @@ -69,7 +69,7 @@ public function test_a_null_modifier_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ModifyDateTime function requires non-null values'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('datetime')->modifyDateTime(ref('modifier')), [ 'datetime' => type_datetime()->cast('2025-01-01 10:00:23 +00:00'), @@ -83,7 +83,7 @@ public function test_zone_of_the_reference_is_kept(): void { static::assertSame( 'datetime', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('at')->modifyDateTime('+1 day'), schema(datetime_schema('at', zone: 'Europe/Warsaw'))) ->returns() ->toString(), @@ -94,7 +94,7 @@ public function test_zone_of_a_nullable_reference_is_kept(): void { static::assertSame( 'datetime', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('at')->modifyDateTime('+1 day'), schema(datetime_schema('at', nullable: true, zone: 'Europe/Warsaw')), @@ -108,7 +108,7 @@ public function test_non_datetime_reference_returns_utc_datetime(): void { static::assertSame( 'datetime', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('at')->modifyDateTime('+1 day'), schema(str_schema('at'))) ->returns() ->toString(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MultiplyTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MultiplyTest.php index 09e9c53dd7..e5b8c23c14 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MultiplyTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MultiplyTest.php @@ -25,7 +25,7 @@ final class MultiplyTest extends FlowTestCase { public function test_exact_keeps_decimal_arithmetic(): void { - static::assertSame(0.3, (new FunctionContext(flow_context()))->eval( + static::assertSame(0.3, new FunctionContext(flow_context())->eval( ref('a')->multiply(ref('b'), exact: true), ['a' => 0.1, 'b' => 3], schema(float_schema('a'), int_schema('b')), @@ -34,7 +34,7 @@ public function test_exact_keeps_decimal_arithmetic(): void public function test_floats_use_ieee_arithmetic(): void { - static::assertSame(0.30000000000000004, (new FunctionContext(flow_context()))->eval( + static::assertSame(0.30000000000000004, new FunctionContext(flow_context())->eval( ref('a')->multiply(ref('b')), ['a' => 0.1, 'b' => 3], schema(float_schema('a'), int_schema('b')), @@ -43,7 +43,7 @@ public function test_floats_use_ieee_arithmetic(): void public function test_integers_stay_integers(): void { - static::assertSame(15, (new FunctionContext(flow_context()))->eval( + static::assertSame(15, new FunctionContext(flow_context())->eval( ref('a')->multiply(ref('b')), ['a' => 5, 'b' => 3], schema(int_schema('a'), int_schema('b')), @@ -55,7 +55,7 @@ public function test_integer_overflow_names_its_row(): void $this->expectException(EvaluationException::class); $this->expectExceptionMessage('Multiply function integer overflow (row 0)'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->multiply(ref('b')), ['a' => PHP_INT_MAX, 'b' => 2], schema(int_schema('a'), int_schema('b')), @@ -86,7 +86,7 @@ public static function refusalsPerBackend(): Generator public function test_a_refusal_message(Backend $backend, array $row, string $message): void { try { - (new FunctionContext(flow_context(config_builder()->backend($backend)->build())))->eval( + new FunctionContext(flow_context(config_builder()->backend($backend)->build()))->eval( ref('a')->multiply(ref('b')), $row, schema(int_schema('a', nullable: true), int_schema('b', nullable: true)), @@ -102,7 +102,7 @@ public function test_exact_refuses_a_null_right_operand(): void $this->expectException(EvaluationException::class); $this->expectExceptionMessage('Multiply function requires non-null values (row 0)'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->multiply(ref('b'), exact: true), ['a' => 5, 'b' => null], schema(int_schema('a'), int_schema('b', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MultisetHashesByGroupTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MultisetHashesByGroupTest.php index 1af1f4b00a..f9c09bb62d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MultisetHashesByGroupTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/MultisetHashesByGroupTest.php @@ -88,7 +88,7 @@ public function test_it_absorbs_only_grouped_multiset_hashes(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Grouped multiset hashes absorb only other grouped multiset hashes'); - (new MultisetHashesByGroup([], $backend->groupedMultisetHashes(HashAlgorithm::xxh128)))->absorbEarlier( + new MultisetHashesByGroup([], $backend->groupedMultisetHashes(HashAlgorithm::xxh128))->absorbEarlier( new CountsByGroup(null, $backend->groupedCounts()), [0 => 0], $backend, diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NotTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NotTest.php index 841b791bca..a4cfe7c2cc 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NotTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NotTest.php @@ -54,17 +54,17 @@ public function test_not_over_a_null_predicate_drops_the_row(): void public function test_not_expression_on_array_true_value(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval(not(lit([1, 2, 3])), [], schema())); + static::assertFalse(new FunctionContext(flow_context())->eval(not(lit([1, 2, 3])), [], schema())); } public function test_not_expression_on_boolean_true_value(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval(not(lit(true)), [], schema())); + static::assertFalse(new FunctionContext(flow_context())->eval(not(lit(true)), [], schema())); } public function test_not_expression_on_is_in_expression(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( not(ref('value')->isIn(ref('array'))), ['array' => [1, 2, 3], 'value' => 10], schema(list_schema('array', type_list(type_integer())), int_schema('value')), @@ -73,22 +73,22 @@ public function test_not_expression_on_is_in_expression(): void public function test_not_expression_with_and_operator(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( not(ref('value')->isNull()->or(ref('value')->isType(type_integer()))), ['value' => '10'], schema(str_schema('value')), )); - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( not(ref('value')->isNull()->or(ref('value')->isType(type_integer()))), ['value' => null], schema(str_schema('value', nullable: true)), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( not(ref('value')->isNull()->and(ref('value')->size()->between(1, 10))), ['value' => 'abcd'], schema(str_schema('value')), )); - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( not(ref('value')->isNull()->or(ref('value')->size()->equals(1))), ['value' => 'abcd'], schema(str_schema('value')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NowTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NowTest.php index 1181800110..2d72160ff0 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NowTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NowTest.php @@ -38,7 +38,7 @@ public function test_value_is_in_the_zone(): void static::assertSame( 'Europe/Warsaw', type_datetime() - ->assert((new FunctionContext(flow_context()))->eval( + ->assert(new FunctionContext(flow_context())->eval( now(new DateTimeZone('Europe/Warsaw')), [], schema(), @@ -53,7 +53,7 @@ public function test_function_zone_value_is_in_the_declared_zone(): void static::assertSame( 'UTC', type_datetime() - ->assert((new FunctionContext(flow_context()))->eval( + ->assert(new FunctionContext(flow_context())->eval( now(ref('tz')), [ 'tz' => new DateTimeZone('Europe/Warsaw'), @@ -70,7 +70,7 @@ public function test_function_zone_null_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Now function requires valid DateTimeZone'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( now(ref('tz')), ['tz' => null], schema(str_schema('tz', nullable: true)), @@ -82,7 +82,7 @@ public function test_utc_alias_zone_lands_in_utc(): void static::assertSame( 'UTC', type_datetime() - ->assert((new FunctionContext(flow_context()))->eval(now(new DateTimeZone('GMT')), [], schema())) + ->assert(new FunctionContext(flow_context())->eval(now(new DateTimeZone('GMT')), [], schema())) ->getTimezone() ->getName(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NumberFormatTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NumberFormatTest.php index 30981ea4fc..292a8a7e31 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NumberFormatTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NumberFormatTest.php @@ -23,7 +23,7 @@ final class NumberFormatTest extends FlowTestCase { public function test_number_format(): void { - static::assertSame('1,234.57', (new FunctionContext(flow_context()))->eval( + static::assertSame('1,234.57', new FunctionContext(flow_context())->eval( new NumberFormat(ref('value'), ref('decimals'), ref('decimal_separator'), ref('thousands_separator')), [ 'value' => 1234.5678, @@ -42,7 +42,7 @@ public function test_number_format(): void public function test_number_format_dsl(): void { - static::assertSame('1,234.57', (new FunctionContext(flow_context()))->eval( + static::assertSame('1,234.57', new FunctionContext(flow_context())->eval( number_format(ref('value'), lit(2), lit('.'), lit(',')), [ 'value' => 1234.5678, @@ -56,7 +56,7 @@ public function test_number_format_on_decimals_that_are_not_integer(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "integer", got "float".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new NumberFormat(ref('value'), ref('decimals'), ref('decimal_separator'), ref('thousands_separator')), [ 'value' => 1234.5678, @@ -86,7 +86,7 @@ public function test_number_format_on_null_parameter( $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('NumberFormat function requires non-null values'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new NumberFormat(ref('value'), ref('decimals'), ref('decimal_separator'), ref('thousands_separator')), [ 'value' => $value, @@ -108,7 +108,7 @@ public function test_number_format_on_non_int_entry(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "numeric", got "string".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new NumberFormat(ref('value'), ref('decimals'), ref('decimal_separator'), ref('thousands_separator')), [ 'value' => 'test', diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NumericTotalTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NumericTotalTest.php index 44e19ed75b..c52aac168d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NumericTotalTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/NumericTotalTest.php @@ -80,7 +80,7 @@ public function test_a_single_row_is_added_without_taking_the_column(): void public function test_nothing_added_has_no_sum(): void { - static::assertNull((new NumericTotal())->sum()); + static::assertNull(new NumericTotal()->sum()); } public function test_a_partial_merged_into_a_fresh_total_restores_it(): void @@ -89,7 +89,7 @@ public function test_a_partial_merged_into_a_fresh_total_restores_it(): void $total->aggregate(array_to_rows([['v' => 4], ['v' => 5]], schema(int_schema('v')))->column('v'), [0, 1]); $restored = new NumericTotal(); $restored->merge($total->partial()); - $restored->merge((new NumericTotal())->partial()); + $restored->merge(new NumericTotal()->partial()); static::assertSame(9, $restored->sum()); static::assertSame(2, $restored->count()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/OnEachElementSchemaTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/OnEachElementSchemaTest.php index d5576b1f1e..2085d1a8bd 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/OnEachElementSchemaTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/OnEachElementSchemaTest.php @@ -26,7 +26,7 @@ public function test_a_list_declares_its_element_type(): void { static::assertEquals( schema(definition_from_type('element', type_integer())), - (new OnEachElementSchema())->of(type_list(type_integer())), + new OnEachElementSchema()->of(type_list(type_integer())), ); } @@ -34,7 +34,7 @@ public function test_a_map_declares_its_value_type(): void { static::assertEquals( schema(definition_from_type('element', type_integer())), - (new OnEachElementSchema())->of(type_map(type_string(), type_integer())), + new OnEachElementSchema()->of(type_map(type_string(), type_integer())), ); } @@ -42,7 +42,7 @@ public function test_a_structure_declares_the_type_its_fields_unify_to(): void { static::assertSame( 'integer', - (new OnEachElementSchema()) + new OnEachElementSchema() ->of(type_structure(['a' => type_integer(), 'b' => type_integer()])) ->get('element') ->type() @@ -54,7 +54,7 @@ public function test_an_optional_structure_field_still_unifies(): void { static::assertSame( 'string', - (new OnEachElementSchema()) + new OnEachElementSchema() ->of(type_structure([ 'a' => type_string(), 'b' => structure_element('b', type_string(), optional: true), @@ -69,7 +69,7 @@ public function test_a_structure_whose_fields_do_not_unify_is_refused(): void { $this->expectException(SchemaNotDerivableException::class); - (new OnEachElementSchema())->of(type_structure([ + new OnEachElementSchema()->of(type_structure([ 'a' => type_boolean(), 'b' => type_list(type_integer()), ])); @@ -80,7 +80,7 @@ public function test_an_operand_with_no_element_type_is_refused(): void $this->expectException(SchemaNotDerivableException::class); $this->expectExceptionMessage('the array operand declares "array", which has no element type'); - (new OnEachElementSchema())->of(type_array()); + new OnEachElementSchema()->of(type_array()); } public function test_a_scalar_operand_is_refused(): void @@ -88,6 +88,6 @@ public function test_a_scalar_operand_is_refused(): void $this->expectException(SchemaNotDerivableException::class); $this->expectExceptionMessage('the array operand declares "float", which has no element type'); - (new OnEachElementSchema())->of(type_float()); + new OnEachElementSchema()->of(type_float()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/OnEachTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/OnEachTest.php index aa59159a8b..f3f41618e4 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/OnEachTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/OnEachTest.php @@ -53,8 +53,8 @@ public function test_a_throwing_body_is_not_swallowed(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer"'); - (new FunctionContext(flow_context()))->eval( - (new ReferenceResolver())->resolve( + new FunctionContext(flow_context())->eval( + new ReferenceResolver()->resolve( ref('array')->onEach(ref('element')->upper()), schema(list_schema('array', type_list(type_integer()))), ), @@ -71,8 +71,8 @@ public function test_an_element_the_declared_type_refuses_is_not_swallowed(): vo { $this->expectException(SchemaMismatchException::class); - (new FunctionContext(flow_context()))->eval( - (new ReferenceResolver())->resolve( + new FunctionContext(flow_context())->eval( + new ReferenceResolver()->resolve( ref('array')->onEach(ref('element')->upper()), schema(list_schema('array', type_list(type_string()))), ), @@ -88,8 +88,8 @@ public function test_executing_function_on_each_value_from_array(): void { static::assertSame( ['1', '2', '3', '4', '5'], - (new FunctionContext(flow_context()))->eval( - (new ReferenceResolver())->resolve( + new FunctionContext(flow_context())->eval( + new ReferenceResolver()->resolve( ref('array')->onEach(ref('element')->cast(type_string())), schema(list_schema('array', type_list(type_integer()))), ), @@ -109,8 +109,8 @@ public function test_executing_function_on_each_value_from_empty_array(): void { static::assertSame( [], - (new FunctionContext(flow_context()))->eval( - (new ReferenceResolver())->resolve( + new FunctionContext(flow_context())->eval( + new ReferenceResolver()->resolve( ref('array')->onEach(ref('element')->cast(type_string())), schema(list_schema('array', type_list(type_integer()))), ), @@ -124,8 +124,8 @@ public function test_executing_function_on_each_value_with_preserving_keys(): vo { static::assertSame( ['a' => '1', 'b' => '2', 'c' => '3', 'd' => '4', 'e' => '5'], - (new FunctionContext(flow_context()))->eval( - (new ReferenceResolver())->resolve( + new FunctionContext(flow_context())->eval( + new ReferenceResolver()->resolve( ref('array')->onEach(ref('element')->cast(type_string()), true), schema(map_schema('array', type_map(type_string(), type_integer()))), ), @@ -145,8 +145,8 @@ public function test_on_each_preserves_keys_by_default(): void { static::assertSame( ['a' => '1', 'b' => '2'], - (new FunctionContext(flow_context()))->eval( - (new ReferenceResolver())->resolve( + new FunctionContext(flow_context())->eval( + new ReferenceResolver()->resolve( new OnEach(ref('array'), ref('element')->cast(type_string())), schema(map_schema('array', type_map(type_string(), type_integer()))), ), @@ -160,8 +160,8 @@ public function test_executing_function_on_each_value_without_preserving_keys(): { static::assertSame( ['1', '2', '3', '4', '5'], - (new FunctionContext(flow_context()))->eval( - (new ReferenceResolver())->resolve( + new FunctionContext(flow_context())->eval( + new ReferenceResolver()->resolve( ref('array')->onEach(ref('element')->cast(type_string()), false), schema(map_schema('array', type_map(type_string(), type_integer()))), ), @@ -184,8 +184,8 @@ public function test_on_each_over_an_untyped_array_operand_is_refused(): void $this->expectException(SchemaNotDerivableException::class); $this->expectExceptionMessage('the array operand declares "json", which has no element type'); - (new FunctionContext(flow_context()))->eval( - (new ReferenceResolver())->resolve( + new FunctionContext(flow_context())->eval( + new ReferenceResolver()->resolve( ref('array')->onEach(ref('element')->cast(type_string())), schema(definition_from_type('array', type_array())), ), @@ -201,7 +201,7 @@ public function test_the_element_schema_is_built_once_per_eval_not_once_per_elem { $operand = new CountingReturnsFunction(lit([1, 2, 3, 4, 5]), type_list(type_integer())); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new OnEach($operand, ref('element')->cast(type_string())), [], schema(), @@ -214,7 +214,7 @@ public function test_a_structure_operand_keeps_its_fields_typed_by_the_body(): v { static::assertSame( 'structure{a: string, b: string}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->onEach(ref('element')->cast(type_string())), schema(structure_schema('structure', type_structure(['a' => type_integer(), 'b' => type_float()]))), @@ -228,7 +228,7 @@ public function test_an_interleaved_structure_operand_keeps_every_position_and_f { static::assertSame( 'structure{z: string, a?: string, b: string}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->onEach(ref('element')->cast(type_string())), schema(structure_schema('structure', type_structure([ @@ -246,7 +246,7 @@ public function test_a_structure_operand_without_keys_declares_a_list_of_the_bod { static::assertSame( 'list', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->onEach(ref('element')->cast(type_string()), preserveKeys: false), schema(structure_schema('structure', type_structure(['a' => type_integer()]))), @@ -260,7 +260,7 @@ public function test_a_map_operand_with_preserved_keys_declares_a_map_of_the_bod { static::assertSame( 'map', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('map')->onEach(ref('element')->cast(type_string())), schema(map_schema('map', type_map(type_string(), type_integer()))), @@ -274,7 +274,7 @@ public function test_a_structure_with_non_unifying_fields_refuses_to_declare(): { $this->expectException(SchemaNotDerivableException::class); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( ref('structure')->onEach(ref('element')->cast(type_string())), schema(structure_schema('structure', type_structure([ @@ -310,7 +310,7 @@ public function test_a_null_array_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('OnEach requires non-null array'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('tags')->onEach(ref('element')), ['tags' => null], schema(str_schema('tags', nullable: true)), @@ -323,7 +323,7 @@ public function test_with_children_keeps_the_element_schema(): void // two stateless instances are equal, but serialize() names an instance it already wrote only by back-reference static::assertSame(1, substr_count(serialize([ $elementSchema, - (new OnEach(ref('a'), ref('element'), true, $elementSchema))->withChildren([ref('b')]), + new OnEach(ref('a'), ref('element'), true, $elementSchema)->withChildren([ref('b')]), ]), 'OnEachElementSchema')); } @@ -345,7 +345,7 @@ public function test_the_element_batch_is_built_by_the_configured_backend(): voi static::assertSame( [['1', '2']], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(new OnEach(ref('l'), ref('element')->cast(type_string())), $rows->schema()) ->eval($rows, $backend) ->values(), @@ -364,7 +364,7 @@ public function test_the_function_evaluates_once_per_batch(): void static::assertSame( [[1, 2], [3], []], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(new OnEach(ref('l'), $spy), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/OptionalTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/OptionalTest.php index 59d313a227..e030d2ce17 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/OptionalTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/OptionalTest.php @@ -32,7 +32,7 @@ public function test_optional_declares_the_inner_type_widened_to_optional(): voi public function test_optional_returns_null_when_the_inner_function_throws(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( optional(ref('name')->upper()), ['other' => 'flow'], schema(str_schema('other')), @@ -66,7 +66,7 @@ public function test_only_the_failing_rows_are_null(array $failing, string $fail schema(int_schema('v')), ); - $values = (new ReferenceResolver()) + $values = new ReferenceResolver() ->resolve(optional($spy), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(); @@ -84,7 +84,7 @@ public function test_an_error_propagates(): void $this->expectException(Error::class); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( optional(new FailingOnValuesFunction(ref('v'), [1], FailingOnValuesFunction::ERROR)), $rows->schema(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ParameterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ParameterTest.php index 21cc00e42c..aff7894757 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ParameterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ParameterTest.php @@ -94,7 +94,7 @@ public function test_as_array_with_empty_array(): void { static::assertSame( [[]], - (new Parameter(lit([])))->asArrays(RowsMother::sequentialIds(1), flow_context()->backend()), + new Parameter(lit([]))->asArrays(RowsMother::sequentialIds(1), flow_context()->backend()), ); } @@ -102,7 +102,7 @@ public function test_as_array_with_valid_array(): void { static::assertSame( [['key' => 'value', 'number' => 42]], - (new Parameter(lit(['key' => 'value', 'number' => 42])))->asArrays( + new Parameter(lit(['key' => 'value', 'number' => 42]))->asArrays( RowsMother::sequentialIds(1), flow_context()->backend(), ), @@ -113,13 +113,13 @@ public function test_as_arrays_reads_a_json_column_as_arrays(): void { static::assertSame( [['a' => 1], null], - (new Parameter((new ReferenceResolver())->resolve( + new Parameter(new ReferenceResolver()->resolve( ref('j'), array_to_rows([ ['j' => '{"a":1}'], ['j' => null], ], schema(json_schema('j', nullable: true)))->schema(), - )))->asArrays(array_to_rows([ + ))->asArrays(array_to_rows([ ['j' => '{"a":1}'], ['j' => null], ], schema(json_schema('j', nullable: true))), flow_context()->backend()), @@ -129,11 +129,11 @@ public function test_as_arrays_reads_a_json_column_as_arrays(): void public function test_as_integer_column_reads_an_integer_column_as_is_and_nulls_as_integer_nulls(): void { $rows = array_to_rows([['i' => 1], ['i' => 2]], schema(int_schema('i'))); - $integers = (new Parameter((new ReferenceResolver())->resolve(ref('i'), $rows->schema())))->asIntegerColumn( + $integers = new Parameter(new ReferenceResolver()->resolve(ref('i'), $rows->schema()))->asIntegerColumn( $rows, flow_context()->backend(), ); - $nulls = (new Parameter(lit(null)))->asIntegerColumn(RowsMother::sequentialIds(2), flow_context()->backend()); + $nulls = new Parameter(lit(null))->asIntegerColumn(RowsMother::sequentialIds(2), flow_context()->backend()); static::assertSame([[1, 2], 'integer'], [$integers->values(), $integers->type()->toString()]); static::assertSame([[null, null], 'integer'], [$nulls->values(), $nulls->type()->toString()]); @@ -145,7 +145,7 @@ public function test_as_integer_column_throws_on_a_non_integer_value(): void $this->expectException(EvaluationException::class); - (new Parameter((new ReferenceResolver())->resolve(ref('s'), $rows->schema())))->asIntegerColumn( + new Parameter(new ReferenceResolver()->resolve(ref('s'), $rows->schema()))->asIntegerColumn( $rows, flow_context()->backend(), ); @@ -157,7 +157,7 @@ public function test_as_string_column_returns_a_string_column_as_it_is(): void static::assertSame( $rows->column('s'), - (new Parameter((new ReferenceResolver())->resolve(ref('s'), $rows->schema())))->asStringColumn( + new Parameter(new ReferenceResolver()->resolve(ref('s'), $rows->schema()))->asStringColumn( $rows, flow_context()->backend(), ), @@ -170,10 +170,10 @@ public function test_as_string_column_builds_a_string_column_from_untyped_string ['m' => ['k' => 'a']], ['m' => ['k' => 'b']], ], schema(map_schema('m', type_map(type_string(), type_string())))); - $strings = (new Parameter((new ReferenceResolver())->resolve( + $strings = new Parameter(new ReferenceResolver()->resolve( ref('m')->arrayGet('k'), $rows->schema(), - )))->asStringColumn($rows, flow_context()->backend()); + ))->asStringColumn($rows, flow_context()->backend()); static::assertSame([['a', 'b'], 'string'], [$strings->values(), $strings->type()->toString()]); } @@ -183,7 +183,7 @@ public function test_as_string_column_refuses_an_integer_with_its_row(): void $rows = array_to_rows([['i' => null], ['i' => 12]], schema(int_schema('i', nullable: true))); try { - (new Parameter((new ReferenceResolver())->resolve(ref('i'), $rows->schema())))->asStringColumn( + new Parameter(new ReferenceResolver()->resolve(ref('i'), $rows->schema()))->asStringColumn( $rows, flow_context()->backend(), ); @@ -200,10 +200,10 @@ public function test_as_number_column_takes_an_integer_or_a_float_column(): void $resolver = new ReferenceResolver(); static::assertSame([[1], [1.5]], [ - (new Parameter($resolver->resolve(ref('i'), $rows->schema()))) + new Parameter($resolver->resolve(ref('i'), $rows->schema())) ->asNumberColumn($rows, flow_context()->backend()) ->values(), - (new Parameter($resolver->resolve(ref('f'), $rows->schema()))) + new Parameter($resolver->resolve(ref('f'), $rows->schema())) ->asNumberColumn($rows, flow_context()->backend()) ->values(), ]); @@ -215,7 +215,7 @@ public function test_as_number_column_refuses_another_column_type(): void $this->expectExceptionObject(new InvalidArgumentException('Expected an integer or float column, got "string"')); - (new Parameter((new ReferenceResolver())->resolve(ref('s'), $rows->schema())))->asNumberColumn( + new Parameter(new ReferenceResolver()->resolve(ref('s'), $rows->schema()))->asNumberColumn( $rows, flow_context()->backend(), ); @@ -225,14 +225,14 @@ public function test_as_array_throws_on_a_malformed_value(): void { $this->expectException(InvalidArgumentException::class); - (new Parameter(lit('not an array')))->asArrays(RowsMother::sequentialIds(1), flow_context()->backend()); + new Parameter(lit('not an array'))->asArrays(RowsMother::sequentialIds(1), flow_context()->backend()); } public function test_as_array_propagates_null(): void { static::assertSame( [null], - (new Parameter(lit(null)))->asArrays(RowsMother::sequentialIds(1), flow_context()->backend()), + new Parameter(lit(null))->asArrays(RowsMother::sequentialIds(1), flow_context()->backend()), ); } @@ -244,7 +244,7 @@ public function test_as_boolean(mixed $input, ?bool $expected): void { static::assertSame( [$expected], - (new Parameter(lit($input)))->asBooleans(RowsMother::sequentialIds(1), flow_context()->backend()), + new Parameter(lit($input))->asBooleans(RowsMother::sequentialIds(1), flow_context()->backend()), ); } @@ -252,14 +252,14 @@ public function test_as_booleans_reads_a_boolean_column_as_is(): void { static::assertSame( [true, null, false], - (new Parameter((new ReferenceResolver())->resolve( + new Parameter(new ReferenceResolver()->resolve( ref('b'), array_to_rows([ ['b' => true], ['b' => null], ['b' => false], ], schema(bool_schema('b', nullable: true)))->schema(), - )))->asBooleans(array_to_rows([ + ))->asBooleans(array_to_rows([ ['b' => true], ['b' => null], ['b' => false], @@ -273,7 +273,7 @@ public function test_as_booleans_reads_every_row_of_an_integer_column(): void static::assertSame( [null, true, false], - (new Parameter((new ReferenceResolver())->resolve(ref('i'), $rows->schema())))->asBooleans( + new Parameter(new ReferenceResolver()->resolve(ref('i'), $rows->schema()))->asBooleans( $rows, flow_context()->backend(), ), @@ -289,7 +289,7 @@ public function test_as_arrays_reads_every_row_after_a_null(): void static::assertSame( [null, ['k' => 'a']], - (new Parameter((new ReferenceResolver())->resolve(ref('m'), $rows->schema())))->asArrays( + new Parameter(new ReferenceResolver()->resolve(ref('m'), $rows->schema()))->asArrays( $rows, flow_context()->backend(), ), @@ -302,7 +302,7 @@ public function test_as_numbers_reads_every_row_of_a_string_column(): void static::assertSame( [7, 2, 3], - (new Parameter((new ReferenceResolver())->resolve(ref('s'), $rows->schema())))->asNumbers( + new Parameter(new ReferenceResolver()->resolve(ref('s'), $rows->schema()))->asNumbers( $rows, flow_context()->backend(), 7, @@ -314,14 +314,14 @@ public function test_as_boolean_throws_on_a_malformed_value(): void { $this->expectException(InvalidArgumentException::class); - (new Parameter(lit(['value'])))->asBooleans(RowsMother::sequentialIds(1), flow_context()->backend()); + new Parameter(lit(['value']))->asBooleans(RowsMother::sequentialIds(1), flow_context()->backend()); } public function test_as_enum_propagates_null(): void { static::assertSame( [null], - (new Parameter(lit(null)))->asEnums( + new Parameter(lit(null))->asEnums( RowsMother::sequentialIds(1), flow_context()->backend(), SQLParametersStyle::class, @@ -333,7 +333,7 @@ public function test_as_enum_throws_on_a_malformed_value(): void { $this->expectException(InvalidArgumentException::class); - (new Parameter(lit('not an enum')))->asEnums( + new Parameter(lit('not an enum'))->asEnums( RowsMother::sequentialIds(1), flow_context()->backend(), SQLParametersStyle::class, @@ -344,7 +344,7 @@ public function test_as_enum_with_valid_enum(): void { static::assertSame( [SQLParametersStyle::NAMED], - (new Parameter(lit(SQLParametersStyle::NAMED)))->asEnums( + new Parameter(lit(SQLParametersStyle::NAMED))->asEnums( RowsMother::sequentialIds(1), flow_context()->backend(), SQLParametersStyle::class, @@ -356,7 +356,7 @@ public function test_as_enum_with_wrong_enum_class(): void { $this->expectException(InvalidArgumentException::class); - (new Parameter(lit(SQLParametersStyle::NAMED)))->asEnums( + new Parameter(lit(SQLParametersStyle::NAMED))->asEnums( RowsMother::sequentialIds(1), flow_context()->backend(), StringStyles::class, @@ -367,7 +367,7 @@ public function test_as_instance_of_propagates_null(): void { static::assertSame( [null], - (new Parameter(lit(null)))->asInstancesOf( + new Parameter(lit(null))->asInstancesOf( RowsMother::sequentialIds(1), flow_context()->backend(), DateTimeImmutable::class, @@ -379,7 +379,7 @@ public function test_as_instance_of_throws_on_a_malformed_value(): void { $this->expectException(InvalidArgumentException::class); - (new Parameter(lit('not an object')))->asInstancesOf( + new Parameter(lit('not an object'))->asInstancesOf( RowsMother::sequentialIds(1), flow_context()->backend(), DateTimeImmutable::class, @@ -393,7 +393,7 @@ public function test_as_instance_of_with_valid_object(): void static::assertEquals( [$dateTime], - (new Parameter((new ReferenceResolver())->resolve(ref('at'), $rows->schema())))->asInstancesOf( + new Parameter(new ReferenceResolver()->resolve(ref('at'), $rows->schema()))->asInstancesOf( $rows, flow_context()->backend(), DateTimeImmutable::class, @@ -401,7 +401,7 @@ public function test_as_instance_of_with_valid_object(): void ); static::assertEquals( [$dateTime], - (new Parameter((new ReferenceResolver())->resolve(ref('at'), $rows->schema())))->asInstancesOf( + new Parameter(new ReferenceResolver()->resolve(ref('at'), $rows->schema()))->asInstancesOf( $rows, flow_context()->backend(), DateTimeInterface::class, @@ -414,7 +414,7 @@ public function test_as_int(mixed $input, ?int $default, ?int $expected): void { static::assertSame( [$expected], - (new Parameter(lit($input)))->asInts(RowsMother::sequentialIds(1), flow_context()->backend(), $default), + new Parameter(lit($input))->asInts(RowsMother::sequentialIds(1), flow_context()->backend(), $default), ); } @@ -424,14 +424,14 @@ public function test_as_ints_reads_an_integer_column_as_is_and_defaults_its_null static::assertSame( [1, null], - (new Parameter((new ReferenceResolver())->resolve(ref('n'), $rows->schema())))->asInts( + new Parameter(new ReferenceResolver()->resolve(ref('n'), $rows->schema()))->asInts( $rows, flow_context()->backend(), ), ); static::assertSame( [1, 7], - (new Parameter((new ReferenceResolver())->resolve(ref('n'), $rows->schema())))->asInts( + new Parameter(new ReferenceResolver()->resolve(ref('n'), $rows->schema()))->asInts( $rows, flow_context()->backend(), 7, @@ -444,14 +444,14 @@ public function test_as_int_throws_on_a_malformed_value(): void // A default never applies to a malformed value - only to a NULL input. $this->expectException(InvalidArgumentException::class); - (new Parameter(lit(3.14)))->asInts(RowsMother::sequentialIds(1), flow_context()->backend(), 99); + new Parameter(lit(3.14))->asInts(RowsMother::sequentialIds(1), flow_context()->backend(), 99); } public function test_as_list_of_objects_propagates_null(): void { static::assertSame( [null], - (new Parameter(lit(null)))->asListsOfObjects( + new Parameter(lit(null))->asListsOfObjects( RowsMother::sequentialIds(1), flow_context()->backend(), DateTimeImmutable::class, @@ -469,7 +469,7 @@ public function test_as_list_of_objects_reads_every_row_after_a_null(): void static::assertEquals( [null, [new DateTimeImmutable('2023-01-01')], [new DateTimeImmutable('2023-01-02')]], - (new Parameter((new ReferenceResolver())->resolve(ref('l'), $rows->schema())))->asListsOfObjects( + new Parameter(new ReferenceResolver()->resolve(ref('l'), $rows->schema()))->asListsOfObjects( $rows, flow_context()->backend(), DateTimeImmutable::class, @@ -481,7 +481,7 @@ public function test_as_list_of_objects_throws_on_a_malformed_element(): void { $this->expectException(InvalidArgumentException::class); - (new Parameter(lit([new DateTimeImmutable('2023-01-01'), 'not an object'])))->asListsOfObjects( + new Parameter(lit([new DateTimeImmutable('2023-01-01'), 'not an object']))->asListsOfObjects( RowsMother::sequentialIds(1), flow_context()->backend(), DateTimeImmutable::class, @@ -492,7 +492,7 @@ public function test_as_list_of_objects_throws_on_a_non_array(): void { $this->expectException(InvalidArgumentException::class); - (new Parameter(lit('not an array')))->asListsOfObjects( + new Parameter(lit('not an array'))->asListsOfObjects( RowsMother::sequentialIds(1), flow_context()->backend(), DateTimeImmutable::class, @@ -503,7 +503,7 @@ public function test_as_list_of_objects_with_empty_array(): void { static::assertSame( [[]], - (new Parameter(lit([])))->asListsOfObjects( + new Parameter(lit([]))->asListsOfObjects( RowsMother::sequentialIds(1), flow_context()->backend(), DateTimeImmutable::class, @@ -518,7 +518,7 @@ public function test_as_list_of_objects_with_valid_array(): void static::assertEquals( [[$date1, $date2]], - (new Parameter(lit([$date1, $date2])))->asListsOfObjects( + new Parameter(lit([$date1, $date2]))->asListsOfObjects( RowsMother::sequentialIds(1), flow_context()->backend(), DateTimeImmutable::class, @@ -530,7 +530,7 @@ public function test_as_list_of_objects_with_wrong_object_type(): void { $this->expectException(InvalidArgumentException::class); - (new Parameter(lit([new DateTimeImmutable('2023-01-01'), new stdClass()])))->asListsOfObjects( + new Parameter(lit([new DateTimeImmutable('2023-01-01'), new stdClass()]))->asListsOfObjects( RowsMother::sequentialIds(1), flow_context()->backend(), DateTimeImmutable::class, @@ -542,7 +542,7 @@ public function test_as_number(mixed $input, int|float|null $default, int|float| { static::assertSame( [$expected], - (new Parameter(lit($input)))->asNumbers(RowsMother::sequentialIds(1), flow_context()->backend(), $default), + new Parameter(lit($input))->asNumbers(RowsMother::sequentialIds(1), flow_context()->backend(), $default), ); } @@ -552,14 +552,14 @@ public function test_as_numbers_reads_numeric_columns_as_is_and_defaults_their_n static::assertSame( [1.5, null], - (new Parameter((new ReferenceResolver())->resolve(ref('f'), $rows->schema())))->asNumbers( + new Parameter(new ReferenceResolver()->resolve(ref('f'), $rows->schema()))->asNumbers( $rows, flow_context()->backend(), ), ); static::assertSame( [1.5, 0], - (new Parameter((new ReferenceResolver())->resolve(ref('f'), $rows->schema())))->asNumbers( + new Parameter(new ReferenceResolver()->resolve(ref('f'), $rows->schema()))->asNumbers( $rows, flow_context()->backend(), 0, @@ -571,7 +571,7 @@ public function test_as_number_throws_on_a_malformed_value(): void { $this->expectException(InvalidArgumentException::class); - (new Parameter(lit('not numeric')))->asNumbers(RowsMother::sequentialIds(1), flow_context()->backend(), 99); + new Parameter(lit('not numeric'))->asNumbers(RowsMother::sequentialIds(1), flow_context()->backend(), 99); } #[DataProvider('string_data_provider')] @@ -579,7 +579,7 @@ public function test_as_string(mixed $input, ?string $default, ?string $expected { static::assertSame( [$expected], - (new Parameter(lit($input)))->asStrings(RowsMother::sequentialIds(1), flow_context()->backend(), $default), + new Parameter(lit($input))->asStrings(RowsMother::sequentialIds(1), flow_context()->backend(), $default), ); } @@ -589,14 +589,14 @@ public function test_as_strings_reads_a_string_column_as_is_and_defaults_its_nul static::assertSame( ['a', null], - (new Parameter((new ReferenceResolver())->resolve(ref('s'), $rows->schema())))->asStrings( + new Parameter(new ReferenceResolver()->resolve(ref('s'), $rows->schema()))->asStrings( $rows, flow_context()->backend(), ), ); static::assertSame( ['a', 'x'], - (new Parameter((new ReferenceResolver())->resolve(ref('s'), $rows->schema())))->asStrings( + new Parameter(new ReferenceResolver()->resolve(ref('s'), $rows->schema()))->asStrings( $rows, flow_context()->backend(), 'x', @@ -608,17 +608,17 @@ public function test_as_string_throws_on_a_malformed_value(): void { $this->expectException(InvalidArgumentException::class); - (new Parameter(lit(42)))->asStrings(RowsMother::sequentialIds(1), flow_context()->backend(), 'default'); + new Parameter(lit(42))->asStrings(RowsMother::sequentialIds(1), flow_context()->backend(), 'default'); } public function test_as_types_accepts_the_first_type_that_matches(): void { static::assertSame( ['42'], - (new Parameter((new ReferenceResolver())->resolve( + new Parameter(new ReferenceResolver()->resolve( ref('value'), array_to_rows([['value' => '42']], schema(str_schema('value')))->schema(), - )))->asTypes( + ))->asTypes( array_to_rows([['value' => '42']], schema(str_schema('value'))), flow_context()->backend(), type_string(), @@ -631,11 +631,7 @@ public function test_as_types_propagates_null(): void { static::assertSame( [null], - (new Parameter(lit(null)))->asTypes( - RowsMother::sequentialIds(1), - flow_context()->backend(), - type_integer(), - ), + new Parameter(lit(null))->asTypes(RowsMother::sequentialIds(1), flow_context()->backend(), type_integer()), ); } @@ -644,10 +640,10 @@ public function test_as_types_throws_when_no_type_matches(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected one of "integer", "boolean", got "string". (row 0)'); - (new Parameter((new ReferenceResolver())->resolve( + new Parameter(new ReferenceResolver()->resolve( ref('value'), array_to_rows([['value' => '42']], schema(str_schema('value')))->schema(), - )))->asTypes( + ))->asTypes( array_to_rows([['value' => '42']], schema(str_schema('value'))), flow_context()->backend(), type_integer(), @@ -658,14 +654,14 @@ public function test_as_types_throws_when_no_type_matches(): void public function test_a_refused_value_names_its_row(): void { try { - (new Parameter((new ReferenceResolver())->resolve( + new Parameter(new ReferenceResolver()->resolve( ref('value'), array_to_rows([ ['value' => '1'], ['value' => '2'], ['value' => 'x'], ], schema(str_schema('value')))->schema(), - )))->asInts(array_to_rows([ + ))->asInts(array_to_rows([ ['value' => '1'], ['value' => '2'], ['value' => 'x'], @@ -681,15 +677,12 @@ public function test_constructor_with_mixed_value(): void { static::assertSame( ['direct_string'], - (new Parameter('direct_string'))->values(RowsMother::sequentialIds(1), flow_context()->backend()), - ); - static::assertSame( - [123], - (new Parameter(123))->values(RowsMother::sequentialIds(1), flow_context()->backend()), + new Parameter('direct_string')->values(RowsMother::sequentialIds(1), flow_context()->backend()), ); + static::assertSame([123], new Parameter(123)->values(RowsMother::sequentialIds(1), flow_context()->backend())); static::assertSame( [true], - (new Parameter(true))->values(RowsMother::sequentialIds(1), flow_context()->backend()), + new Parameter(true)->values(RowsMother::sequentialIds(1), flow_context()->backend()), ); } @@ -697,12 +690,12 @@ public function test_values_read_an_array_result_back_as_arrays(): void { static::assertSame( [['name' => 'a']], - (new Parameter((new ReferenceResolver())->resolve( + new Parameter(new ReferenceResolver()->resolve( ref('j')->jsonDecode(), array_to_rows([[ 'j' => '{"name":"a"}', ]], schema(json_schema('j')))->schema(), - )))->values(array_to_rows([[ + ))->values(array_to_rows([[ 'j' => '{"name":"a"}', ]], schema(json_schema('j'))), flow_context()->backend()), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PerGroupAggregationTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PerGroupAggregationTest.php index bd5588f4fa..827d803ee1 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PerGroupAggregationTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PerGroupAggregationTest.php @@ -82,8 +82,8 @@ public function test_it_absorbs_only_another_per_group_aggregation(): void { $this->expectException(InvalidArgumentException::class); - (new PerGroupAggregation(string_agg(ref('note')), Definitions::of('n', type_string(), true)))->absorbEarlier( - new CountsByGroup(null, (new PhpBackend())->groupedCounts()), + new PerGroupAggregation(string_agg(ref('note')), Definitions::of('n', type_string(), true))->absorbEarlier( + new CountsByGroup(null, new PhpBackend()->groupedCounts()), [], new PhpBackend(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PlusTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PlusTest.php index ab6978f18b..df09a2e95e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PlusTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PlusTest.php @@ -26,7 +26,7 @@ final class PlusTest extends FlowTestCase { public function test_exact_keeps_decimal_arithmetic(): void { - static::assertSame(0.3, (new FunctionContext(flow_context()))->eval( + static::assertSame(0.3, new FunctionContext(flow_context())->eval( ref('a')->plus(ref('b'), exact: true), ['a' => 0.1, 'b' => 0.2], schema(float_schema('a'), float_schema('b')), @@ -35,7 +35,7 @@ public function test_exact_keeps_decimal_arithmetic(): void public function test_floats_use_ieee_arithmetic(): void { - static::assertSame(0.30000000000000004, (new FunctionContext(flow_context()))->eval( + static::assertSame(0.30000000000000004, new FunctionContext(flow_context())->eval( ref('a')->plus(ref('b')), ['a' => 0.1, 'b' => 0.2], schema(float_schema('a'), float_schema('b')), @@ -44,7 +44,7 @@ public function test_floats_use_ieee_arithmetic(): void public function test_integers_stay_integers(): void { - static::assertSame(8, (new FunctionContext(flow_context()))->eval( + static::assertSame(8, new FunctionContext(flow_context())->eval( ref('a')->plus(ref('b')), ['a' => 5, 'b' => 3], schema(int_schema('a'), int_schema('b')), @@ -56,7 +56,7 @@ public function test_integer_overflow_names_its_row(): void $this->expectException(EvaluationException::class); $this->expectExceptionMessage('Plus function integer overflow (row 0)'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->plus(ref('b')), ['a' => PHP_INT_MAX, 'b' => 1], schema(int_schema('a'), int_schema('b')), @@ -88,7 +88,7 @@ public static function refusalsPerBackend(): Generator public function test_a_refusal_message(Backend $backend, array $row, string $message): void { try { - (new FunctionContext(flow_context(config_builder()->backend($backend)->build())))->eval( + new FunctionContext(flow_context(config_builder()->backend($backend)->build()))->eval( ref('a')->plus(ref('b')), $row, schema(int_schema('a', nullable: true), int_schema('b', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PowerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PowerTest.php index c36c05c51f..079010e971 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PowerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PowerTest.php @@ -26,12 +26,12 @@ public function test_power_non_numeric_values(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "integer", got "string".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('int')->power(lit('non numeric')), ['int' => 10], schema(int_schema('int')), ); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->power(lit(2)), ['str' => 'abc'], schema(str_schema('str')), @@ -40,7 +40,7 @@ public function test_power_non_numeric_values(): void public function test_power_two_numeric_values(): void { - static::assertSame(100, (new FunctionContext(flow_context()))->eval( + static::assertSame(100, new FunctionContext(flow_context())->eval( ref('int')->power(lit(2)), ['int' => 10], schema(int_schema('int')), @@ -49,7 +49,7 @@ public function test_power_two_numeric_values(): void public function test_exact_keeps_decimal_arithmetic(): void { - static::assertSame(1.21, (new FunctionContext(flow_context()))->eval( + static::assertSame(1.21, new FunctionContext(flow_context())->eval( ref('a')->power(ref('b'), exact: true), ['a' => 1.1, 'b' => 2], schema(float_schema('a'), int_schema('b')), @@ -58,7 +58,7 @@ public function test_exact_keeps_decimal_arithmetic(): void public function test_floats_use_ieee_arithmetic(): void { - static::assertSame(1.2100000000000002, (new FunctionContext(flow_context()))->eval( + static::assertSame(1.2100000000000002, new FunctionContext(flow_context())->eval( ref('a')->power(ref('b')), ['a' => 1.1, 'b' => 2], schema(float_schema('a'), int_schema('b')), @@ -70,7 +70,7 @@ public function test_a_negative_exponent_of_an_integer_is_refused(): void $this->expectException(EvaluationException::class); $this->expectExceptionMessage('Power function of an integer requires a non-negative exponent (row 0)'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->power(ref('b')), ['a' => 2, 'b' => -1], schema(int_schema('a'), int_schema('b')), @@ -79,7 +79,7 @@ public function test_a_negative_exponent_of_an_integer_is_refused(): void public function test_a_zero_exponent_of_an_integer_is_one(): void { - static::assertSame(1, (new FunctionContext(flow_context()))->eval( + static::assertSame(1, new FunctionContext(flow_context())->eval( ref('a')->power(ref('b')), ['a' => 2, 'b' => 0], schema(int_schema('a'), int_schema('b')), @@ -91,7 +91,7 @@ public function test_a_null_exponent_is_refused(): void $this->expectException(EvaluationException::class); $this->expectExceptionMessage('Power function requires non-null values (row 0)'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->power(ref('b')), ['a' => 2, 'b' => null], schema(int_schema('a'), int_schema('b', nullable: true)), @@ -102,7 +102,7 @@ public function test_exact_evaluates_every_row(): void { static::assertSame( [1.21, 1.44], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('a')->power(ref('b'), exact: true), [['a' => 1.1, 'b' => 2], ['a' => 1.2, 'b' => 2]], @@ -130,7 +130,7 @@ public function test_integer_overflow_names_its_row(): void $this->expectException(EvaluationException::class); $this->expectExceptionMessage('Power function integer overflow (row 0)'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('a')->power(ref('b')), ['a' => 10, 'b' => 30], schema(int_schema('a'), int_schema('b')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PrependTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PrependTest.php index ad6bfc60a8..92f3a66c0f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PrependTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/PrependTest.php @@ -17,7 +17,7 @@ final class PrependTest extends FlowTestCase { public function test_prepend_empty_string_to_content(): void { - static::assertEquals('hello', (new FunctionContext(flow_context()))->eval( + static::assertEquals('hello', new FunctionContext(flow_context())->eval( ref('str')->prepend(''), ['str' => 'hello'], schema(str_schema('str')), @@ -26,7 +26,7 @@ public function test_prepend_empty_string_to_content(): void public function test_prepend_to_empty_string(): void { - static::assertEquals('hello', (new FunctionContext(flow_context()))->eval( + static::assertEquals('hello', new FunctionContext(flow_context())->eval( ref('str')->prepend('hello'), ['str' => ''], schema(str_schema('str')), @@ -35,7 +35,7 @@ public function test_prepend_to_empty_string(): void public function test_prepend_to_non_empty_string(): void { - static::assertEquals('Hello world', (new FunctionContext(flow_context()))->eval( + static::assertEquals('Hello world', new FunctionContext(flow_context())->eval( ref('str')->prepend('Hello '), ['str' => 'world'], schema(str_schema('str')), @@ -44,7 +44,7 @@ public function test_prepend_to_non_empty_string(): void public function test_prepend_with_null_prefix(): void { - static::assertEquals('world', (new FunctionContext(flow_context()))->eval( + static::assertEquals('world', new FunctionContext(flow_context())->eval( ref('str')->prepend(ref('prefix')), ['str' => 'world', 'prefix' => null], schema(str_schema('str'), str_schema('prefix', nullable: true)), @@ -55,7 +55,7 @@ public function test_prepend_with_null_prefix_keeps_the_next_rows(): void { static::assertSame( ['world', 'hello world'], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('str')->prepend(ref('prefix')), [['str' => 'world', 'prefix' => null], ['str' => 'world', 'prefix' => 'hello ']], @@ -70,7 +70,7 @@ public function test_prepend_with_null_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Prepend function requires non-null value'); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->prepend('Hello '), ['str' => null], schema(str_schema('str', nullable: true)), @@ -79,7 +79,7 @@ public function test_prepend_with_null_value(): void public function test_prepend_with_scalar_function_parameter(): void { - static::assertEquals('Hello world', (new FunctionContext(flow_context()))->eval( + static::assertEquals('Hello world', new FunctionContext(flow_context())->eval( ref('str')->prepend(ref('prefix')), ['str' => 'world', 'prefix' => 'Hello '], schema(str_schema('str'), str_schema('prefix')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RandomStringTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RandomStringTest.php index 8380671ccb..534aed85bd 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RandomStringTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RandomStringTest.php @@ -32,11 +32,11 @@ public function test_describe_round_trips(): void public function test_a_literal_length_is_resolved(): void { - static::assertTrue((new RandomString(lit(5)))->resolved()); + static::assertTrue(new RandomString(lit(5))->resolved()); } public function test_a_reference_length_is_not_resolved(): void { - static::assertFalse((new RandomString(ref('length')))->resolved()); + static::assertFalse(new RandomString(ref('length'))->resolved()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Reference/UnresolvedReferenceTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Reference/UnresolvedReferenceTest.php index 0607afea0b..baac2a80f2 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Reference/UnresolvedReferenceTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Reference/UnresolvedReferenceTest.php @@ -38,7 +38,7 @@ public function test_asc_and_desc_sort_the_column_read_never_the_alias(): void public function test_executing_equals_expression(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('a')->equals(ref('b')), ['a' => 1, 'b' => 1], schema(int_schema('a'), int_schema('b')), @@ -47,7 +47,7 @@ public function test_executing_equals_expression(): void public function test_executing_expression(): void { - static::assertSame(100, (new FunctionContext(flow_context()))->eval( + static::assertSame(100, new FunctionContext(flow_context())->eval( ref('b')->literal(100), ['a' => 1], schema(int_schema('a')), @@ -58,18 +58,18 @@ public function test_is_even(): void { $ref = ref('a')->isEven(); - static::assertFalse((new FunctionContext(flow_context()))->eval($ref, ['a' => 1], schema(int_schema('a')))); + static::assertFalse(new FunctionContext(flow_context())->eval($ref, ['a' => 1], schema(int_schema('a')))); - static::assertTrue((new FunctionContext(flow_context()))->eval($ref, ['a' => 2], schema(int_schema('a')))); + static::assertTrue(new FunctionContext(flow_context())->eval($ref, ['a' => 2], schema(int_schema('a')))); } public function test_is_odd(): void { $ref = ref('a')->isOdd(); - static::assertTrue((new FunctionContext(flow_context()))->eval($ref, ['a' => 1], schema(int_schema('a')))); + static::assertTrue(new FunctionContext(flow_context())->eval($ref, ['a' => 1], schema(int_schema('a')))); - static::assertFalse((new FunctionContext(flow_context()))->eval($ref, ['a' => 2], schema(int_schema('a')))); + static::assertFalse(new FunctionContext(flow_context())->eval($ref, ['a' => 2], schema(int_schema('a')))); } public function test_nulls_default_to_the_smallest_value_and_can_be_moved(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReferenceRenameTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReferenceRenameTest.php index 1354b4e58b..58935000f2 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReferenceRenameTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReferenceRenameTest.php @@ -15,14 +15,14 @@ final class ReferenceRenameTest extends FlowTestCase { public function test_a_reference_to_the_renamed_column_points_at_the_new_one(): void { - static::assertEquals(ref('year'), (new ReferenceRename('y', 'year'))->in(ref('y'))); + static::assertEquals(ref('year'), new ReferenceRename('y', 'year')->in(ref('y'))); } public function test_every_reference_inside_the_tree_is_renamed_and_the_rest_kept(): void { static::assertEquals( ref('year')->equals(lit(2023))->and(ref('month')->equals(lit('07'))), - (new ReferenceRename('y', 'year'))->in(ref('y')->equals(lit(2023))->and(ref('month')->equals(lit('07')))), + new ReferenceRename('y', 'year')->in(ref('y')->equals(lit(2023))->and(ref('month')->equals(lit('07')))), ); } @@ -30,16 +30,16 @@ public function test_a_tree_without_the_column_is_returned_as_is(): void { $tree = ref('month')->equals(lit('07')); - static::assertSame($tree, (new ReferenceRename('y', 'year'))->in($tree)); + static::assertSame($tree, new ReferenceRename('y', 'year')->in($tree)); } public function test_an_alias_on_the_reference_is_kept(): void { - static::assertEquals(ref('year')->as('label'), (new ReferenceRename('y', 'year'))->in(ref('y')->as('label'))); + static::assertEquals(ref('year')->as('label'), new ReferenceRename('y', 'year')->in(ref('y')->as('label'))); } public function test_a_resolved_reference_to_the_column_cannot_be_renamed(): void { - static::assertNull((new ReferenceRename('y', 'year'))->in(ref('y')->resolve(int_schema('y')))); + static::assertNull(new ReferenceRename('y', 'year')->in(ref('y')->resolve(int_schema('y')))); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReferenceResolverTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReferenceResolverTest.php index 146dda360a..564ea3fd54 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReferenceResolverTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReferenceResolverTest.php @@ -55,7 +55,7 @@ public function test_a_string_compared_with_a_temporal_operand_is_cast_to_it( ): void { static::assertSame( $expected, - (new ReferenceResolver()) + new ReferenceResolver() ->resolve($predicate, schema( datetime_schema('ts'), date_schema('d'), @@ -70,10 +70,7 @@ public function test_a_string_compared_with_a_temporal_operand_is_cast_to_it( public function test_same_keeps_a_string_and_a_datetime_strict(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( - ref('ts')->same(lit('2026-10-02')), - schema(datetime_schema('ts')), - ); + $resolved = new ReferenceResolver()->resolve(ref('ts')->same(lit('2026-10-02')), schema(datetime_schema('ts'))); static::assertInstanceOf(Literal::class, $resolved->children()[1]); } @@ -81,22 +78,22 @@ public function test_same_keeps_a_string_and_a_datetime_strict(): void public function test_a_coerced_comparison_resolves_to_itself(): void { $schema = schema(datetime_schema('ts'), str_schema('s')); - $resolved = (new ReferenceResolver())->resolve(ref('ts')->equals(ref('s')), $schema); + $resolved = new ReferenceResolver()->resolve(ref('ts')->equals(ref('s')), $schema); - static::assertSame($resolved, (new ReferenceResolver())->resolve($resolved, $schema)); + static::assertSame($resolved, new ReferenceResolver()->resolve($resolved, $schema)); } public function test_a_comparison_over_an_unknown_column_is_left_as_it_is(): void { $predicate = ref('missing')->equals(lit('2026-10-02')); - static::assertSame($predicate, (new ReferenceResolver())->resolve($predicate, schema(datetime_schema('ts')))); + static::assertSame($predicate, new ReferenceResolver()->resolve($predicate, schema(datetime_schema('ts')))); } public function test_resolves_a_leaf_from_a_hand_built_schema(): void { /** @var ResolvedReference $resolved */ - $resolved = (new ReferenceResolver())->resolve(ref('a'), schema(int_schema('a'))); + $resolved = new ReferenceResolver()->resolve(ref('a'), schema(int_schema('a'))); static::assertInstanceOf(ResolvedReference::class, $resolved); static::assertSame('integer', $resolved->returns()->toString()); @@ -106,7 +103,7 @@ public function test_resolves_a_leaf_from_a_hand_built_schema(): void public function test_resolves_a_leaf_inside_a_nested_tree(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve(ref('a')->upper()->equals(lit('X')), schema(str_schema('a'))); + $resolved = new ReferenceResolver()->resolve(ref('a')->upper()->equals(lit('X')), schema(str_schema('a'))); static::assertTrue($resolved->resolved()); static::assertSame('boolean', $resolved->returns()->toString()); @@ -115,14 +112,14 @@ public function test_resolves_a_leaf_inside_a_nested_tree(): void public function test_returns_the_same_object_when_nothing_moved(): void { $schema = schema(str_schema('a')); - $resolved = (new ReferenceResolver())->resolve(ref('a')->upper(), $schema); + $resolved = new ReferenceResolver()->resolve(ref('a')->upper(), $schema); - static::assertSame($resolved, (new ReferenceResolver())->resolve($resolved, $schema)); + static::assertSame($resolved, new ReferenceResolver()->resolve($resolved, $schema)); } public function test_an_unknown_column_is_left_unresolved(): void { - $resolved = (new ReferenceResolver())->resolve(ref('missing'), schema(str_schema('a'))); + $resolved = new ReferenceResolver()->resolve(ref('missing'), schema(str_schema('a'))); static::assertInstanceOf(UnresolvedReference::class, $resolved); static::assertFalse($resolved->resolved()); @@ -132,7 +129,7 @@ public function test_the_original_tree_is_not_mutated(): void { $tree = ref('a')->upper(); - (new ReferenceResolver())->resolve($tree, schema(str_schema('a'))); + new ReferenceResolver()->resolve($tree, schema(str_schema('a'))); static::assertFalse($tree->resolved()); static::assertInstanceOf(UnresolvedReference::class, $tree->children()[0]); @@ -141,7 +138,7 @@ public function test_the_original_tree_is_not_mutated(): void public function test_a_lambda_body_is_not_walked(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( ref('list')->onEach(ref('element')->upper()), schema(list_schema('list', type_list(type_string())), str_schema('element')), ); @@ -154,7 +151,7 @@ public function test_an_exists_operand_is_not_walked(): void $tree = ref('missing')->exists(); /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve($tree, schema(str_schema('a'))); + $resolved = new ReferenceResolver()->resolve($tree, schema(str_schema('a'))); static::assertSame($tree, $resolved); static::assertTrue($resolved->resolved()); @@ -167,7 +164,7 @@ public function test_an_impossible_comparison_fails_at_bind(): void $this->expectExceptionMessage("Can't compare"); /** @var ScalarFunction $predicate */ - $predicate = (new ReferenceResolver())->resolve( + $predicate = new ReferenceResolver()->resolve( ref('id')->greaterThan(ref('created_at')), schema(int_schema('id'), datetime_schema('created_at')), ); @@ -181,8 +178,8 @@ public function test_assert_resolved_names_the_column_and_the_available_ones(): $schema = schema(int_schema('id'), int_schema('score')); - (new ReferenceResolver())->assertResolved( - (new ReferenceResolver())->resolve(ref('scoree')->greaterThan(lit(10)), $schema), + new ReferenceResolver()->assertResolved( + new ReferenceResolver()->resolve(ref('scoree')->greaterThan(lit(10)), $schema), $schema, ); } @@ -191,8 +188,8 @@ public function test_assert_resolved_passes_for_a_fully_resolved_tree(): void { $schema = schema(int_schema('score')); - (new ReferenceResolver())->assertResolved( - (new ReferenceResolver())->resolve(ref('score')->greaterThan(lit(10)), $schema), + new ReferenceResolver()->assertResolved( + new ReferenceResolver()->resolve(ref('score')->greaterThan(lit(10)), $schema), $schema, ); @@ -201,7 +198,7 @@ public function test_assert_resolved_passes_for_a_fully_resolved_tree(): void public function test_an_aliased_reference_resolves_by_its_source_column(): void { - $resolved = (new ReferenceResolver())->resolve(ref('age')->as('total_age'), schema(int_schema('age'))); + $resolved = new ReferenceResolver()->resolve(ref('age')->as('total_age'), schema(int_schema('age'))); static::assertInstanceOf(ResolvedReference::class, $resolved); static::assertSame('total_age', $resolved->name()); @@ -211,7 +208,7 @@ public function test_an_aliased_reference_resolves_by_its_source_column(): void public function test_bind_returns_the_resolved_tree(): void { - static::assertInstanceOf(ResolvedReference::class, (new ReferenceResolver())->bind( + static::assertInstanceOf(ResolvedReference::class, new ReferenceResolver()->bind( ref('id'), schema(int_schema('id')), 'transform', @@ -222,7 +219,7 @@ public function test_bind_refuses_an_unknown_column(): void { $this->expectException(SchemaDefinitionNotFoundException::class); - (new ReferenceResolver())->bind(ref('missing'), schema(int_schema('id')), 'transform'); + new ReferenceResolver()->bind(ref('missing'), schema(int_schema('id')), 'transform'); } public function test_bind_refuses_an_expansion_naming_the_method(): void @@ -230,7 +227,7 @@ public function test_bind_refuses_an_expansion_naming_the_method(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('over() cannot contain array_expand()'); - (new ReferenceResolver())->bind( + new ReferenceResolver()->bind( array_expand(ref('list')), schema(list_schema('list', type_list(type_string()))), 'over', @@ -242,14 +239,14 @@ public function test_bind_refuses_a_result_of_another_type_than_required(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('until() requires a predicate returning boolean'); - (new ReferenceResolver())->bind(ref('id'), schema(int_schema('id')), 'until', type_boolean()); + new ReferenceResolver()->bind(ref('id'), schema(int_schema('id')), 'until', type_boolean()); } public function test_bind_accepts_a_nullable_result_of_the_required_type(): void { static::assertSame( '?boolean', - (new ReferenceResolver()) + new ReferenceResolver() ->bind(ref('id')->equals(lit(1)), schema(int_schema('id', nullable: true)), 'filter', type_boolean()) ->returns() ->toString(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReferencedColumnsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReferencedColumnsTest.php index 8d86f7612b..154dc315ff 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReferencedColumnsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReferencedColumnsTest.php @@ -14,24 +14,24 @@ final class ReferencedColumnsTest extends FlowTestCase { public function test_a_bare_reference_is_its_own_source_column(): void { - static::assertSame(['a'], (new ReferencedColumns())->in(ref('a'))->names()); + static::assertSame(['a'], new ReferencedColumns()->in(ref('a'))->names()); } public function test_an_alias_reports_the_source_column(): void { - static::assertSame(['year'], (new ReferencedColumns())->in(ref('year')->as('y'))->names()); + static::assertSame(['year'], new ReferencedColumns()->in(ref('year')->as('y'))->names()); } public function test_a_nested_tree_reports_every_column_once(): void { static::assertSame( ['a', 'b'], - (new ReferencedColumns())->in(ref('a')->equals(ref('b'))->and(ref('a')->isNotNull()))->names(), + new ReferencedColumns()->in(ref('a')->equals(ref('b'))->and(ref('a')->isNotNull()))->names(), ); } public function test_a_literal_only_predicate_references_nothing(): void { - static::assertSame([], (new ReferencedColumns())->in(lit(true))->names()); + static::assertSame([], new ReferencedColumns()->in(lit(true))->names()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexAllTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexAllTest.php index f0231c37a2..0f213c474d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexAllTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexAllTest.php @@ -27,12 +27,12 @@ public function test_regex_all_expression_on_invalid_subject(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval(regex_all(lit('/\d+/'), lit(2)), [], schema()); + new FunctionContext(flow_context())->eval(regex_all(lit('/\d+/'), lit(2)), [], schema()); } public function test_regex_all_expression_on_no_match(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( regex_all(lit('/\d+/'), lit('apples and oranges')), [], schema(), @@ -47,7 +47,7 @@ public function test_regex_all_expression_on_valid_strings(): void ['124.23', '12', '45'], ['EUR', 'USD', 'PLN'], ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( regex_all(lit('/(\d+(?:\.\d+)?)\s+([A-Z]{3})/'), lit('124.23 EUR 12 USD 45 PLN')), [], schema(), @@ -72,7 +72,7 @@ public function test_the_default_offset_starts_at_the_beginning(): void { static::assertSame( [['a']], - (new FunctionContext(flow_context()))->eval(regex_all(lit('/a/'), lit('ab')), [], schema()), + new FunctionContext(flow_context())->eval(regex_all(lit('/a/'), lit('ab')), [], schema()), ); } @@ -81,7 +81,7 @@ public function test_a_null_subject_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('RegexAll requires non-null subject'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( regex_all(lit('/a/'), ref('subject')), ['subject' => null], schema(str_schema('subject', nullable: true)), @@ -92,7 +92,7 @@ public function test_every_matching_row_gives_its_matches(): void { static::assertSame( [[['a']], [['a', 'a']]], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( regex_all(lit('/a/'), ref('subject')), [['subject' => 'a'], ['subject' => 'aa']], @@ -107,7 +107,7 @@ public function test_regex_expression_on_invalid_pattern(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval(regex_all(lit(1), lit('12 apples and 45 oranges')), [], schema()); + new FunctionContext(flow_context())->eval(regex_all(lit(1), lit('12 apples and 45 oranges')), [], schema()); } public function test_describe_round_trips(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexMatchAllTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexMatchAllTest.php index f0d3eba11f..4ebeb2e69f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexMatchAllTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexMatchAllTest.php @@ -23,7 +23,7 @@ public function test_regex_match_all_expression_on_invalid_flags(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "integer", got "string".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( regex_match_all(lit('/\d+/'), lit('12 apples and 45 oranges'), lit('invalid')), [], schema(), @@ -35,7 +35,7 @@ public function test_regex_match_all_expression_on_invalid_pattern(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( regex_match_all(lit(1), lit('12 apples and 45 oranges')), [], schema(), @@ -47,14 +47,14 @@ public function test_regex_match_all_expression_on_invalid_subject(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval(regex_match_all(lit('/\d+/'), lit(2)), [], schema()); + new FunctionContext(flow_context())->eval(regex_match_all(lit('/\d+/'), lit(2)), [], schema()); } public function test_any_null_argument_gives_null_and_the_next_row_still_matches(): void { static::assertSame( [null, null, null, null, true], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( regex_match_all(ref('pattern'), ref('subject'), ref('flags'), ref('offset')), [ @@ -77,7 +77,7 @@ public function test_any_null_argument_gives_null_and_the_next_row_still_matches public function test_regex_match_all_expression_on_valid_strings(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( regex_match_all(lit('/\d+/'), lit('12 apples and 45 oranges')), [], schema(), @@ -86,7 +86,7 @@ public function test_regex_match_all_expression_on_valid_strings(): void public function test_regex_match_all_expression_without_a_match_is_false(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( regex_match_all(lit('/\d+/'), lit('apples')), [], schema(), @@ -95,7 +95,7 @@ public function test_regex_match_all_expression_without_a_match_is_false(): void public function test_regex_match_all_expression_on_valid_strings_with_flags(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( regex_match_all( lit('/(\d+(?:\.\d+)?)\s+([A-Z]{3})/'), lit('124.23 EUR 12 USD 45 PLN'), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexMatchTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexMatchTest.php index 76c28b5baf..7e803afedc 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexMatchTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexMatchTest.php @@ -23,7 +23,7 @@ public function test_regex_match_expression_on_invalid_pattern(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval(regex_match(lit(1), lit('12 apples and 45 oranges')), [], schema()); + new FunctionContext(flow_context())->eval(regex_match(lit(1), lit('12 apples and 45 oranges')), [], schema()); } public function test_regex_match_expression_on_invalid_subject(): void @@ -31,12 +31,12 @@ public function test_regex_match_expression_on_invalid_subject(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval(regex_match(lit('/\d+/'), lit(2)), [], schema()); + new FunctionContext(flow_context())->eval(regex_match(lit('/\d+/'), lit(2)), [], schema()); } public function test_regex_match_expression_on_no_match(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( regex_match(lit('/\d+/'), lit('apples and oranges')), [], schema(), @@ -45,7 +45,7 @@ public function test_regex_match_expression_on_no_match(): void public function test_the_default_offset_starts_at_the_beginning(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( regex_match(lit('/^a/'), lit('ab')), [], schema(), @@ -56,7 +56,7 @@ public function test_any_null_argument_gives_null_and_the_next_row_still_matches { static::assertSame( [null, null, null, null, true], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( regex_match(ref('pattern'), ref('subject'), ref('flags'), ref('offset')), [ @@ -79,7 +79,7 @@ public function test_any_null_argument_gives_null_and_the_next_row_still_matches public function test_regex_match_expression_on_valid_strings(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( regex_match(lit('/\d+/'), lit('12 apples and 45 oranges')), [], schema(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexReplaceTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexReplaceTest.php index 33a802b8d1..9d7d0b56e8 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexReplaceTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexReplaceTest.php @@ -20,7 +20,7 @@ final class RegexReplaceTest extends FlowTestCase { public function test_a_null_limit_still_means_unlimited(): void { - static::assertSame('x x x', (new FunctionContext(flow_context()))->eval( + static::assertSame('x x x', new FunctionContext(flow_context())->eval( regex_replace(lit('/a/'), lit('x'), ref('text')), [ 'text' => 'a a a', @@ -31,7 +31,7 @@ public function test_a_null_limit_still_means_unlimited(): void public function test_a_limit_caps_the_replacements(): void { - static::assertSame('x a a', (new FunctionContext(flow_context()))->eval( + static::assertSame('x a a', new FunctionContext(flow_context())->eval( regex_replace(lit('/a/'), lit('x'), ref('text'), lit(1)), [ 'text' => 'a a a', @@ -45,7 +45,7 @@ public function test_regex_replace_on_invalid_pattern(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( regex_replace(lit(1), lit('bar'), lit('foo is awesome')), [], schema(), @@ -57,7 +57,7 @@ public function test_regex_replace_on_invalid_replacement(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( regex_replace(lit('/(foo)/'), lit(2), lit('foo is awesome')), [], schema(), @@ -69,12 +69,12 @@ public function test_regex_replace_on_invalid_subject(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval(regex_replace(lit('/(foo)/'), lit('bar'), lit(3)), [], schema()); + new FunctionContext(flow_context())->eval(regex_replace(lit('/(foo)/'), lit('bar'), lit(3)), [], schema()); } public function test_the_limit_survives_a_describe_round_trip(): void { - static::assertSame('baa', (new FunctionContext(flow_context()))->eval( + static::assertSame('baa', new FunctionContext(flow_context())->eval( DescribeRoundTrip::rebuilt(regex_replace(lit('/a/'), lit('b'), lit('aaa'), 1)), [], schema(), @@ -86,7 +86,7 @@ public function test_a_null_subject_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('RegexReplace requires non-null subject'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( regex_replace(lit('/a/'), lit('b'), ref('subject')), ['subject' => null], schema(str_schema('subject', nullable: true)), @@ -95,7 +95,7 @@ public function test_a_null_subject_is_refused(): void public function test_regex_replace_on_valid_strings(): void { - static::assertSame('bar is awesome', (new FunctionContext(flow_context()))->eval( + static::assertSame('bar is awesome', new FunctionContext(flow_context())->eval( regex_replace(lit('/(foo)/'), lit('bar'), lit('foo is awesome')), [], schema(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexTest.php index 10a581194c..b8362edb3f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RegexTest.php @@ -32,7 +32,7 @@ public function test_regex_expression_on_invalid_pattern(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval(regex(lit(1), lit('12 apples and 45 oranges')), [], schema()); + new FunctionContext(flow_context())->eval(regex(lit(1), lit('12 apples and 45 oranges')), [], schema()); } public function test_regex_expression_on_invalid_subject(): void @@ -40,12 +40,12 @@ public function test_regex_expression_on_invalid_subject(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval(regex(lit('/\d+/'), lit(2)), [], schema()); + new FunctionContext(flow_context())->eval(regex(lit('/\d+/'), lit(2)), [], schema()); } public function test_regex_expression_on_no_match(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( regex(lit('/\d+/'), lit('apples and oranges')), [], schema(), @@ -56,7 +56,7 @@ public function test_regex_expression_on_a_match_at_the_start(): void { static::assertSame( ['a'], - (new FunctionContext(flow_context()))->eval(regex(lit('/^a/'), lit('ab')), [], schema()), + new FunctionContext(flow_context())->eval(regex(lit('/^a/'), lit('ab')), [], schema()), ); } @@ -65,7 +65,7 @@ public function test_regex_expression_on_null_subject(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Regex requires non-null subject'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( regex(lit('/a/'), ref('subject')), ['subject' => null], schema(str_schema('subject', nullable: true)), @@ -82,7 +82,7 @@ public function test_regex_refuses_unmatched_as_null_flag(): void public function test_regex_expression_on_valid_strings(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( regex_match_all(lit('/\d+/'), lit('12 apples and 45 oranges')), [], schema(), @@ -116,14 +116,14 @@ public function test_a_description_rebuilds_through_the_constructor_checks(): vo $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Regex does not support PREG_OFFSET_CAPTURE'); - (new Rebuild())->of($data, ScalarFunction::class); + new Rebuild()->of($data, ScalarFunction::class); } public function test_a_match_keeps_the_rows_after_it(): void { static::assertSame( [['a'], ['a']], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('subject')->regex('/a/'), [['subject' => 'ab'], ['subject' => 'ba']], diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RepeatTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RepeatTest.php index c3819a6db6..39527f32c2 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RepeatTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RepeatTest.php @@ -18,7 +18,7 @@ final class RepeatTest extends FlowTestCase { public function test_repeat_empty_string(): void { - static::assertSame('', (new FunctionContext(flow_context()))->eval( + static::assertSame('', new FunctionContext(flow_context())->eval( ref('str')->repeat(3), ['str' => ''], schema(str_schema('str')), @@ -30,7 +30,7 @@ public function test_repeat_negative_times(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Repeat function requires non-null, positive times'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->repeat(-1), ['str' => 'hello'], schema(str_schema('str')), @@ -42,7 +42,7 @@ public function test_repeat_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Repeat function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->repeat(3), ['str' => null], schema(str_schema('str', nullable: true)), @@ -51,7 +51,7 @@ public function test_repeat_null_input(): void public function test_repeat_string_multiple_times(): void { - static::assertSame('hellohellohello', (new FunctionContext(flow_context()))->eval( + static::assertSame('hellohellohello', new FunctionContext(flow_context())->eval( ref('str')->repeat(3), ['str' => 'hello'], schema(str_schema('str')), @@ -63,7 +63,7 @@ public function test_repeat_with_null_times(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Repeat function requires non-null, positive times'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->repeat(ref('times')), ['str' => 'hello', 'times' => null], schema(str_schema('str'), str_schema('times', nullable: true)), @@ -72,7 +72,7 @@ public function test_repeat_with_null_times(): void public function test_repeat_with_scalar_function_times(): void { - static::assertSame('hellohello', (new FunctionContext(flow_context()))->eval( + static::assertSame('hellohello', new FunctionContext(flow_context())->eval( ref('str')->repeat(ref('times')), ['str' => 'hello', 'times' => 2], schema(str_schema('str'), int_schema('times')), @@ -84,10 +84,6 @@ public function test_repeat_zero_times(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Repeat function requires non-null, positive times'); - (new FunctionContext(flow_context()))->eval( - ref('str')->repeat(0), - ['str' => 'hello'], - schema(str_schema('str')), - ); + new FunctionContext(flow_context())->eval(ref('str')->repeat(0), ['str' => 'hello'], schema(str_schema('str'))); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReverseTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReverseTest.php index 08cbbd1481..fe316f1bab 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReverseTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ReverseTest.php @@ -17,7 +17,7 @@ final class ReverseTest extends FlowTestCase { public function test_reverse_ascii_string(): void { - static::assertSame('olleh', (new FunctionContext(flow_context()))->eval( + static::assertSame('olleh', new FunctionContext(flow_context())->eval( ref('str')->reverse(), ['str' => 'hello'], schema(str_schema('str')), @@ -26,7 +26,7 @@ public function test_reverse_ascii_string(): void public function test_reverse_empty_string(): void { - static::assertSame('', (new FunctionContext(flow_context()))->eval( + static::assertSame('', new FunctionContext(flow_context())->eval( ref('str')->reverse(), ['str' => ''], schema(str_schema('str')), @@ -38,7 +38,7 @@ public function test_reverse_throws_on_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Reverse function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->reverse(), ['str' => null], schema(str_schema('str', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RoundTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RoundTest.php index cf095658b8..684413e78b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RoundTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RoundTest.php @@ -21,13 +21,13 @@ final class RoundTest extends FlowTestCase { public function test_round_float(): void { - static::assertEquals(10.12, (new FunctionContext(flow_context()))->eval( + static::assertEquals(10.12, new FunctionContext(flow_context())->eval( ref('float')->round(lit(2)), ['float' => 10.123], schema(float_schema('float')), )); - static::assertIsFloat((new FunctionContext(flow_context()))->eval( + static::assertIsFloat(new FunctionContext(flow_context())->eval( ref('float')->round(lit(2)), ['float' => 10.123], schema(float_schema('float')), @@ -36,7 +36,7 @@ public function test_round_float(): void public function test_round_with_precision_0(): void { - static::assertSame(10.0, (new FunctionContext(flow_context()))->eval( + static::assertSame(10.0, new FunctionContext(flow_context())->eval( ref('float')->round(lit(0)), ['float' => 10.123], schema(float_schema('float')), @@ -47,7 +47,7 @@ public function test_constructor_default_matches_the_dsl_default(): void { static::assertSame( round(10.12345, 2), - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new Round(ref('float')), ['float' => 10.12345], schema(float_schema('float')), @@ -55,7 +55,7 @@ public function test_constructor_default_matches_the_dsl_default(): void ); static::assertSame( round(10.12345, 2), - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('float')->round(), ['float' => 10.12345], schema(float_schema('float')), @@ -65,7 +65,7 @@ public function test_constructor_default_matches_the_dsl_default(): void public function test_half_odd_is_the_last_known_mode(): void { - static::assertSame(3.0, (new FunctionContext(flow_context()))->eval( + static::assertSame(3.0, new FunctionContext(flow_context())->eval( lit(2.5)->round(lit(0), lit(PHP_ROUND_HALF_ODD)), [], schema(), @@ -79,7 +79,7 @@ public function test_an_unknown_mode_is_refused(): void 'Round mode 9 is unknown, use PHP_ROUND_HALF_UP (1), PHP_ROUND_HALF_DOWN (2), PHP_ROUND_HALF_EVEN (3) or PHP_ROUND_HALF_ODD (4)', ); - (new FunctionContext(flow_context()))->eval(lit(2.5)->round(lit(0), lit(9)), [], schema()); + new FunctionContext(flow_context())->eval(lit(2.5)->round(lit(0), lit(9)), [], schema()); } public function test_round_on_null(): void @@ -87,7 +87,7 @@ public function test_round_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Round function requires non-null values'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('float')->round(lit(2)), ['float' => null], schema(float_schema('float', nullable: true)), @@ -99,7 +99,7 @@ public function test_a_null_precision_is_refused(): void $this->expectException(EvaluationException::class); $this->expectExceptionMessage('Round function requires non-null values (row 0)'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->round(ref('precision')), ['value' => 1.25, 'precision' => null], schema(float_schema('value'), int_schema('precision', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RowHashTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RowHashTest.php index bc21cd24dd..ed3f0165a7 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RowHashTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/RowHashTest.php @@ -27,7 +27,7 @@ public function test_it_hashes_the_named_pairs_of_each_row(): void { static::assertSame( ['bdea5ee4847f3df6cb724988fb66ecd4', 'ba7c3390ce5fcedfea5c7d697dbe1ac9'], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( row_hash(ref('a'), ref('b')), [['a' => 1, 'b' => 'x'], ['a' => 2, 'b' => 'y']], @@ -45,7 +45,7 @@ public function test_it_equals_the_row_hashes_of_the_backend(): void ); static::assertSame( - (new PhpBackend()) + new PhpBackend() ->rowHashes($rows->columns(), 2) ->values(), row_hash(ref('a'), ref('b'))->eval($rows, new PhpBackend())->values(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SanitizeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SanitizeTest.php index bab03e8f41..4eddfec2b5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SanitizeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SanitizeTest.php @@ -23,7 +23,7 @@ public function test_sanitize_on_non_string_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->sanitize(), ['value' => 1000], schema(int_schema('value')), @@ -32,7 +32,7 @@ public function test_sanitize_on_non_string_value(): void public function test_sanitize_on_valid_string(): void { - static::assertSame('****', (new FunctionContext(flow_context()))->eval( + static::assertSame('****', new FunctionContext(flow_context())->eval( ref('value')->sanitize(), ['value' => 'test'], schema(str_schema('value')), @@ -41,7 +41,7 @@ public function test_sanitize_on_valid_string(): void public function test_sanitize_on_valid_string_with_left_characters(): void { - static::assertSame('te**', (new FunctionContext(flow_context()))->eval( + static::assertSame('te**', new FunctionContext(flow_context())->eval( ref('value')->sanitize(skipCharacters: lit(2)), ['value' => 'test'], schema(str_schema('value')), @@ -50,7 +50,7 @@ public function test_sanitize_on_valid_string_with_left_characters(): void public function test_sanitize_on_valid_string_with_left_characters_longer_than_string(): void { - static::assertSame('****', (new FunctionContext(flow_context()))->eval( + static::assertSame('****', new FunctionContext(flow_context())->eval( ref('value')->sanitize(skipCharacters: lit(5)), ['value' => 'test'], schema(str_schema('value')), @@ -59,7 +59,7 @@ public function test_sanitize_on_valid_string_with_left_characters_longer_than_s public function test_sanitize_on_valid_string_with_placeholder(): void { - static::assertSame('----', (new FunctionContext(flow_context()))->eval( + static::assertSame('----', new FunctionContext(flow_context())->eval( ref('value')->sanitize(lit('-')), ['value' => 'test'], schema(str_schema('value')), @@ -71,7 +71,7 @@ public function test_sanitize_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Sanitize function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->sanitize(), ['value' => null], schema(str_schema('value', nullable: true)), @@ -82,7 +82,7 @@ public function test_skipped_characters_count_multibyte_characters_and_each_row_ { static::assertSame( ['ż***', 'a*', '*'], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( sanitize(ref('value'), lit('*'), lit(1)), [['value' => 'żółw'], ['value' => 'ab'], ['value' => 'b']], @@ -94,7 +94,7 @@ public function test_skipped_characters_count_multibyte_characters_and_each_row_ public function test_a_value_as_long_as_the_skipped_characters_is_fully_masked(): void { - static::assertSame('**', (new FunctionContext(flow_context()))->eval( + static::assertSame('**', new FunctionContext(flow_context())->eval( sanitize(lit('ab'), lit('*'), lit(2)), [], schema(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SizeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SizeTest.php index 02c113a603..813cb544fb 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SizeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SizeTest.php @@ -21,7 +21,7 @@ final class SizeTest extends FlowTestCase { public function test_size_expression_on_array_value(): void { - static::assertSame(3, (new FunctionContext(flow_context()))->eval( + static::assertSame(3, new FunctionContext(flow_context())->eval( size(lit(['foo', 'bar', 'baz'])), [], schema(), @@ -32,7 +32,7 @@ public function test_every_string_row_gives_its_length(): void { static::assertSame( [1, 2], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column(size(ref('v')), [['v' => 'a'], ['v' => 'ab']], schema(str_schema('v'))) ->values(), ); @@ -42,7 +42,7 @@ public function test_every_array_row_gives_its_count(): void { static::assertSame( [1, 2], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( size(ref('v')), [['v' => [1]], ['v' => [1, 2]]], @@ -54,11 +54,11 @@ public function test_every_array_row_gives_its_count(): void public function test_size_expression_on_integer_value(): void { - static::assertNull((new FunctionContext(flow_context()))->eval(size(lit(1)), [], schema())); + static::assertNull(new FunctionContext(flow_context())->eval(size(lit(1)), [], schema())); } public function test_size_expression_on_string_value(): void { - static::assertSame(3, (new FunctionContext(flow_context()))->eval(size(lit('foo')), [], schema())); + static::assertSame(3, new FunctionContext(flow_context())->eval(size(lit('foo')), [], schema())); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SlugTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SlugTest.php index 4ce68bdb05..b3aa647bb2 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SlugTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SlugTest.php @@ -20,7 +20,7 @@ public function test_a_malformed_separator_operand_throws(): void { $this->expectException(InvalidArgumentException::class); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->slug(lit(123)), ['value' => 'hello world'], schema(str_schema('value')), @@ -32,7 +32,7 @@ public function test_ascii_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Slug function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->slug(), ['str' => null], schema(str_schema('str', nullable: true)), @@ -41,7 +41,7 @@ public function test_ascii_on_null(): void public function test_slug(): void { - static::assertSame('azcz', (new FunctionContext(flow_context()))->eval( + static::assertSame('azcz', new FunctionContext(flow_context())->eval( ref('str')->slug(), ['str' => 'ąźćż'], schema(str_schema('str')), @@ -50,7 +50,7 @@ public function test_slug(): void public function test_slug_separator(): void { - static::assertSame('Some_Text', (new FunctionContext(flow_context()))->eval( + static::assertSame('Some_Text', new FunctionContext(flow_context())->eval( ref('str')->slug('_'), ['str' => 'Some Text'], schema(str_schema('str')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SplitTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SplitTest.php index f499fd5006..ae9452dce5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SplitTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SplitTest.php @@ -24,14 +24,14 @@ public function test_split_not_string(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval(split(lit(123), ','), [], schema()); + new FunctionContext(flow_context())->eval(split(lit(123), ','), [], schema()); } public function test_split_string(): void { static::assertSame( ['foo', 'bar', 'baz'], - (new FunctionContext(flow_context()))->eval(split(lit('foo,bar,baz'), ','), [], schema()), + new FunctionContext(flow_context())->eval(split(lit('foo,bar,baz'), ','), [], schema()), ); } @@ -39,7 +39,7 @@ public function test_split_string_with_limit(): void { static::assertSame( ['foo', 'bar,baz'], - (new FunctionContext(flow_context()))->eval(split(lit('foo,bar,baz'), ',', 2), [], schema()), + new FunctionContext(flow_context())->eval(split(lit('foo,bar,baz'), ',', 2), [], schema()), ); } @@ -48,7 +48,7 @@ public function test_split_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Split function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( split(ref('value'), ','), ['value' => null], schema(str_schema('value', nullable: true)), @@ -62,7 +62,7 @@ public function test_a_null_separator_is_refused(): void 'Split function requires non-null separator and limit, separator cannot be empty (row 0)', ); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->split(ref('separator')), ['value' => 'a,b', 'separator' => null], schema(str_schema('value'), str_schema('separator', nullable: true)), @@ -76,7 +76,7 @@ public function test_a_null_limit_is_refused(): void 'Split function requires non-null separator and limit, separator cannot be empty (row 0)', ); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->split(',', ref('limit')), ['value' => 'a,b', 'limit' => null], schema(str_schema('value'), int_schema('limit', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SprintfTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SprintfTest.php index 35f70eec10..6de0a9d76b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SprintfTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/SprintfTest.php @@ -27,12 +27,12 @@ public function test_sprintf_expression_on_invalid_format(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected type "string", got "integer".'); - (new FunctionContext(flow_context()))->eval(sprintf(lit(1), lit('John'), lit(25)), [], schema()); + new FunctionContext(flow_context())->eval(sprintf(lit(1), lit('John'), lit(25)), [], schema()); } public function test_sprintf_expression_on_valid_format_and_args(): void { - static::assertSame('Hello, John! Your age is 25.', (new FunctionContext(flow_context()))->eval( + static::assertSame('Hello, John! Your age is 25.', new FunctionContext(flow_context())->eval( sprintf(lit('Hello, %s! Your age is %d.'), lit('John'), lit(25)), [], schema(), @@ -41,13 +41,13 @@ public function test_sprintf_expression_on_valid_format_and_args(): void public function test_a_plain_string_value_is_formatted(): void { - static::assertSame('x', (new FunctionContext(flow_context()))->eval(sprintf('%s', 'x'), [], schema())); + static::assertSame('x', new FunctionContext(flow_context())->eval(sprintf('%s', 'x'), [], schema())); } public function test_children_are_the_format_and_every_value_as_a_list(): void { static::assertSame([0, 1, 2], array_keys(sprintf('%s%s', 'a', 'b')->children())); - static::assertSame([0, 1], array_keys((new Sprintf('%s', ...['a' => 'x']))->children())); + static::assertSame([0, 1], array_keys(new Sprintf('%s', ...['a' => 'x'])->children())); } public function test_a_null_value_is_refused(): void @@ -55,7 +55,7 @@ public function test_a_null_value_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Sprintf requires non-null format and values'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( sprintf(lit('%s'), ref('value')), ['value' => null], schema(str_schema('value', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StartsWithTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StartsWithTest.php index 3523e0aa72..31d224954c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StartsWithTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StartsWithTest.php @@ -26,7 +26,7 @@ public function test_a_column_needle(): void { static::assertSame( [false, null, null, true, true, false, false], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('h')->startsWith(ref('n')), [ @@ -48,7 +48,7 @@ public function test_a_literal_needle(): void { static::assertSame( [false, null, false, false, false, false, true], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('h')->startsWith(lit('x')), [ @@ -68,7 +68,7 @@ public function test_a_literal_needle(): void public function test_the_result_is_a_boolean_column(): void { - $column = (new FunctionContext(flow_context()))->column( + $column = new FunctionContext(flow_context())->column( ref('h')->startsWith(ref('n')), [ ['h' => 'abcx', 'n' => 'x'], @@ -87,7 +87,7 @@ public function test_an_empty_batch_gives_an_empty_column(): void { static::assertSame( [], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column(ref('h')->startsWith(lit('x')), [], schema(str_schema('h', nullable: true))) ->values(), ); @@ -96,7 +96,7 @@ public function test_an_empty_batch_gives_an_empty_column(): void public function test_a_haystack_that_is_not_a_string_is_refused_with_its_row(): void { try { - (new FunctionContext(flow_context()))->column( + new FunctionContext(flow_context())->column( ref('i')->startsWith(lit('1')), [['i' => null], ['i' => 12]], schema(int_schema('i', nullable: true)), @@ -112,7 +112,7 @@ public function test_a_haystack_that_is_not_a_string_is_refused_with_its_row(): public function test_a_needle_that_is_not_a_string_is_refused_with_its_row(): void { try { - (new FunctionContext(flow_context()))->column( + new FunctionContext(flow_context())->column( ref('h')->startsWith(ref('i')), [['h' => 'a1', 'i' => 1]], schema(str_schema('h'), int_schema('i')), @@ -129,7 +129,7 @@ public function test_string_columns_are_matched_by_the_backend_without_a_builder { $schema = schema(str_schema('h'), str_schema('n')); $backend = new SpyBackend(); - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('h')->startsWith(ref('n')), $schema) ->eval(array_to_rows([['h' => 'ax', 'n' => 'x']], $schema, new PhpBackend()), $backend); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StrPadTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StrPadTest.php index c11a113aa0..b04281d2d0 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StrPadTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StrPadTest.php @@ -19,7 +19,7 @@ final class StrPadTest extends FlowTestCase { public function test_str_pad_on_valid_string(): void { - static::assertSame('----N', (new FunctionContext(flow_context()))->eval( + static::assertSame('----N', new FunctionContext(flow_context())->eval( ref('value')->strPad(5, '-', STR_PAD_LEFT), ['value' => 'N'], schema(str_schema('value')), @@ -31,7 +31,7 @@ public function test_str_pad_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StrPad function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->strPad(5, '-', STR_PAD_LEFT), ['value' => null], schema(str_schema('value', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StrReplaceTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StrReplaceTest.php index 5f71f39e1a..66219a7518 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StrReplaceTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StrReplaceTest.php @@ -18,7 +18,7 @@ final class StrReplaceTest extends FlowTestCase { public function test_str_replace_on_valid_string(): void { - static::assertSame('1', (new FunctionContext(flow_context()))->eval( + static::assertSame('1', new FunctionContext(flow_context())->eval( ref('value')->strReplace('test', '1'), ['value' => 'test'], schema(str_schema('value')), @@ -27,7 +27,7 @@ public function test_str_replace_on_valid_string(): void public function test_str_replace_on_valid_string_with_array_of_replacements(): void { - static::assertSame('test was successful', (new FunctionContext(flow_context()))->eval( + static::assertSame('test was successful', new FunctionContext(flow_context())->eval( ref('value')->strReplace(['is', 'broken'], ['was', 'successful']), ['value' => 'test is broken'], schema(str_schema('value')), @@ -39,7 +39,7 @@ public function test_str_replace_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StrReplace function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->strReplace('test', '1'), ['value' => null], schema(str_schema('value', nullable: true)), @@ -51,7 +51,7 @@ public function test_a_null_search_is_refused(): void $this->expectException(EvaluationException::class); $this->expectExceptionMessage('StrReplace function requires non-null search and replace (row 0)'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->strReplace(ref('search'), 'x'), ['value' => 'abc', 'search' => null], schema(str_schema('value'), str_schema('search', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringAfterLastTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringAfterLastTest.php index 0c36dc6d88..4055480e2d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringAfterLastTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringAfterLastTest.php @@ -18,7 +18,7 @@ final class StringAfterLastTest extends FlowTestCase { public function test_string_after_last(): void { - static::assertSame('rld', (new FunctionContext(flow_context()))->eval( + static::assertSame('rld', new FunctionContext(flow_context())->eval( ref('str')->stringAfterLast(ref('needle')), ['str' => 'hello world', 'needle' => 'o'], schema(str_schema('str'), str_schema('needle')), @@ -27,7 +27,7 @@ public function test_string_after_last(): void public function test_the_needle_is_excluded_by_default(): void { - static::assertSame('c', (new FunctionContext(flow_context()))->eval( + static::assertSame('c', new FunctionContext(flow_context())->eval( ref('str')->stringAfterLast('.'), ['str' => 'a.b.c'], schema(str_schema('str')), @@ -36,7 +36,7 @@ public function test_the_needle_is_excluded_by_default(): void public function test_a_null_include_needle_excludes_the_needle(): void { - static::assertSame('c', (new FunctionContext(flow_context()))->eval( + static::assertSame('c', new FunctionContext(flow_context())->eval( ref('str')->stringAfterLast('.', ref('include')), ['str' => 'a.b.c', 'include' => null], schema(str_schema('str'), bool_schema('include', nullable: true)), @@ -45,7 +45,7 @@ public function test_a_null_include_needle_excludes_the_needle(): void public function test_string_after_last_including_needle(): void { - static::assertSame('orld', (new FunctionContext(flow_context()))->eval( + static::assertSame('orld', new FunctionContext(flow_context())->eval( ref('str')->stringAfterLast(ref('needle'), includeNeedle: true), ['str' => 'hello world', 'needle' => 'o'], schema(str_schema('str'), str_schema('needle')), @@ -57,7 +57,7 @@ public function test_string_after_last_throws_on_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringAfterLast function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringAfterLast('x'), ['str' => null], schema(str_schema('str', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringAfterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringAfterTest.php index 6ab1e00693..99d4d2f9dd 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringAfterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringAfterTest.php @@ -18,13 +18,13 @@ final class StringAfterTest extends FlowTestCase { public function test_string_after(): void { - static::assertSame(' world', (new FunctionContext(flow_context()))->eval( + static::assertSame(' world', new FunctionContext(flow_context())->eval( ref('str')->stringAfter(ref('needle')), ['str' => 'hello world', 'needle' => 'hello'], schema(str_schema('str'), str_schema('needle')), )); - static::assertSame(' world', (new FunctionContext(flow_context()))->eval( + static::assertSame(' world', new FunctionContext(flow_context())->eval( ref('str')->stringAfter(ref('needle')), ['str' => 'hello world', 'needle' => 'o'], schema(str_schema('str'), str_schema('needle')), @@ -33,7 +33,7 @@ public function test_string_after(): void public function test_the_needle_is_excluded_by_default(): void { - static::assertSame('b', (new FunctionContext(flow_context()))->eval( + static::assertSame('b', new FunctionContext(flow_context())->eval( ref('str')->stringAfter('.'), ['str' => 'a.b'], schema(str_schema('str')), @@ -42,7 +42,7 @@ public function test_the_needle_is_excluded_by_default(): void public function test_a_null_include_needle_excludes_the_needle(): void { - static::assertSame('b', (new FunctionContext(flow_context()))->eval( + static::assertSame('b', new FunctionContext(flow_context())->eval( ref('str')->stringAfter('.', ref('include')), ['str' => 'a.b', 'include' => null], schema(str_schema('str'), bool_schema('include', nullable: true)), @@ -51,7 +51,7 @@ public function test_a_null_include_needle_excludes_the_needle(): void public function test_string_after_including_needle(): void { - static::assertSame('o world', (new FunctionContext(flow_context()))->eval( + static::assertSame('o world', new FunctionContext(flow_context())->eval( ref('str')->stringAfter(ref('needle'), includeNeedle: true), ['str' => 'hello world', 'needle' => 'o'], schema(str_schema('str'), str_schema('needle')), @@ -63,7 +63,7 @@ public function test_string_after_throws_on_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringAfter function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringAfter('x'), ['str' => null], schema(str_schema('str', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringBeforeLastTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringBeforeLastTest.php index abbe163396..e818eff821 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringBeforeLastTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringBeforeLastTest.php @@ -18,7 +18,7 @@ final class StringBeforeLastTest extends FlowTestCase { public function test_string_before_last_with_null_include_needle_excludes_the_needle(): void { - static::assertSame('a.b', (new FunctionContext(flow_context()))->eval( + static::assertSame('a.b', new FunctionContext(flow_context())->eval( ref('str')->stringBeforeLast('.', ref('include_needle')), ['str' => 'a.b.c', 'include_needle' => null], schema(str_schema('str'), bool_schema('include_needle', nullable: true)), @@ -27,7 +27,7 @@ public function test_string_before_last_with_null_include_needle_excludes_the_ne public function test_string_before_last(): void { - static::assertSame('hello w', (new FunctionContext(flow_context()))->eval( + static::assertSame('hello w', new FunctionContext(flow_context())->eval( ref('str')->stringBeforeLast(ref('needle')), ['str' => 'hello world', 'needle' => 'o'], schema(str_schema('str'), str_schema('needle')), @@ -36,7 +36,7 @@ public function test_string_before_last(): void public function test_string_before_last_including_needle(): void { - static::assertSame('hello wo', (new FunctionContext(flow_context()))->eval( + static::assertSame('hello wo', new FunctionContext(flow_context())->eval( ref('str')->stringBeforeLast(ref('needle'), includeNeedle: true), ['str' => 'hello world', 'needle' => 'o'], schema(str_schema('str'), str_schema('needle')), @@ -45,7 +45,7 @@ public function test_string_before_last_including_needle(): void public function test_string_before_last_returns_empty_string(): void { - static::assertSame('', (new FunctionContext(flow_context()))->eval( + static::assertSame('', new FunctionContext(flow_context())->eval( ref('str')->stringBeforeLast(ref('needle')), ['str' => '', 'needle' => 'o'], schema(str_schema('str'), str_schema('needle')), @@ -57,7 +57,7 @@ public function test_string_before_last_throws_on_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringBeforeLast function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringBeforeLast(ref('needle')), ['str' => null, 'needle' => 'o'], schema(str_schema('str', nullable: true), str_schema('needle')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringBeforeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringBeforeTest.php index 656deac1d8..e455af044c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringBeforeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringBeforeTest.php @@ -18,7 +18,7 @@ final class StringBeforeTest extends FlowTestCase { public function test_string_before_with_null_include_needle_excludes_the_needle(): void { - static::assertSame('a', (new FunctionContext(flow_context()))->eval( + static::assertSame('a', new FunctionContext(flow_context())->eval( ref('str')->stringBefore('.', ref('include_needle')), ['str' => 'a.b', 'include_needle' => null], schema(str_schema('str'), bool_schema('include_needle', nullable: true)), @@ -27,13 +27,13 @@ public function test_string_before_with_null_include_needle_excludes_the_needle( public function test_string_before(): void { - static::assertSame('hello ', (new FunctionContext(flow_context()))->eval( + static::assertSame('hello ', new FunctionContext(flow_context())->eval( ref('str')->stringBefore(ref('needle')), ['str' => 'hello world', 'needle' => 'world'], schema(str_schema('str'), str_schema('needle')), )); - static::assertSame('hell', (new FunctionContext(flow_context()))->eval( + static::assertSame('hell', new FunctionContext(flow_context())->eval( ref('str')->stringBefore(ref('needle')), ['str' => 'hello world', 'needle' => 'o'], schema(str_schema('str'), str_schema('needle')), @@ -42,7 +42,7 @@ public function test_string_before(): void public function test_string_before_including_needle(): void { - static::assertSame('hello', (new FunctionContext(flow_context()))->eval( + static::assertSame('hello', new FunctionContext(flow_context())->eval( ref('str')->stringBefore(ref('needle'), includeNeedle: true), ['str' => 'hello world', 'needle' => 'o'], schema(str_schema('str'), str_schema('needle')), @@ -51,7 +51,7 @@ public function test_string_before_including_needle(): void public function test_string_before_returns_empty_string(): void { - static::assertSame('', (new FunctionContext(flow_context()))->eval( + static::assertSame('', new FunctionContext(flow_context())->eval( ref('str')->stringBefore(ref('needle')), ['str' => '', 'needle' => 'o'], schema(str_schema('str'), str_schema('needle')), @@ -63,7 +63,7 @@ public function test_string_before_throws_on_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringBefore function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringBefore(ref('needle')), ['str' => null, 'needle' => 'o'], schema(str_schema('str', nullable: true), str_schema('needle')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringContainsAnyTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringContainsAnyTest.php index 84eac506b5..79dc91acf8 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringContainsAnyTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringContainsAnyTest.php @@ -27,7 +27,7 @@ public function test_a_null_row_does_not_stop_later_rows(): void static::assertSame( [null, true], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('str')->stringContainsAny(['b']), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -39,7 +39,7 @@ public function test_contains_any_empty_needles_array(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringContainsAny function requires a non-empty needles array'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringContainsAny([]), ['str' => 'hello world'], schema(str_schema('str')), @@ -48,7 +48,7 @@ public function test_contains_any_empty_needles_array(): void public function test_contains_any_multiple_needles_one_found(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('str')->stringContainsAny(['foo', 'world', 'bar']), ['str' => 'hello world'], schema(str_schema('str')), @@ -57,7 +57,7 @@ public function test_contains_any_multiple_needles_one_found(): void public function test_contains_any_no_needles_found(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( ref('str')->stringContainsAny(['foo', 'bar', 'baz']), ['str' => 'hello world'], schema(str_schema('str')), @@ -66,7 +66,7 @@ public function test_contains_any_no_needles_found(): void public function test_contains_any_null_needles(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->stringContainsAny(ref('needles')), ['str' => 'hello world', 'needles' => null], schema(str_schema('str'), str_schema('needles', nullable: true)), @@ -75,7 +75,7 @@ public function test_contains_any_null_needles(): void public function test_contains_any_null_string(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->stringContainsAny(['hello', 'world']), ['str' => null], schema(str_schema('str', nullable: true)), @@ -84,7 +84,7 @@ public function test_contains_any_null_string(): void public function test_contains_any_null_string_in_strict_mode(): void { - static::assertNull((new FunctionContext(flow_context(config())))->eval( + static::assertNull(new FunctionContext(flow_context(config()))->eval( ref('str')->stringContainsAny(['hello', 'world']), ['str' => null], schema(str_schema('str', nullable: true)), @@ -93,7 +93,7 @@ public function test_contains_any_null_string_in_strict_mode(): void public function test_contains_any_with_scalar_function_parameter(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('str')->stringContainsAny(ref('needles')), ['str' => 'hello world', 'needles' => ['world', 'foo']], schema(str_schema('str'), list_schema('needles', type_list(type_string()))), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringEqualsToTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringEqualsToTest.php index a296428614..3b12cd9f2c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringEqualsToTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringEqualsToTest.php @@ -22,7 +22,7 @@ public function test_a_null_row_does_not_stop_later_rows(): void static::assertSame( [null, true], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ref('str')->stringEqualsTo('abc'), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -31,7 +31,7 @@ public function test_a_null_row_does_not_stop_later_rows(): void public function test_equals_to_empty_strings(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('str')->stringEqualsTo(''), ['str' => ''], schema(str_schema('str')), @@ -40,7 +40,7 @@ public function test_equals_to_empty_strings(): void public function test_equals_to_exact_match(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('str')->stringEqualsTo('hello'), ['str' => 'hello'], schema(str_schema('str')), @@ -49,7 +49,7 @@ public function test_equals_to_exact_match(): void public function test_equals_to_no_match(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( ref('str')->stringEqualsTo('world'), ['str' => 'hello'], schema(str_schema('str')), @@ -58,7 +58,7 @@ public function test_equals_to_no_match(): void public function test_equals_to_null_comparison_string_returns_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->stringEqualsTo(ref('compare')), ['str' => 'hello', 'compare' => null], schema(str_schema('str'), str_schema('compare', nullable: true)), @@ -67,7 +67,7 @@ public function test_equals_to_null_comparison_string_returns_null(): void public function test_equals_to_null_string_returns_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->stringEqualsTo('hello'), ['str' => null], schema(str_schema('str', nullable: true)), @@ -76,7 +76,7 @@ public function test_equals_to_null_string_returns_null(): void public function test_equals_to_with_scalar_function_parameter(): void { - static::assertTrue((new FunctionContext(flow_context()))->eval( + static::assertTrue(new FunctionContext(flow_context())->eval( ref('str')->stringEqualsTo(ref('compare')), ['str' => 'hello', 'compare' => 'hello'], schema(str_schema('str'), str_schema('compare')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringFoldTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringFoldTest.php index 45dbb6858d..18438c9be6 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringFoldTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringFoldTest.php @@ -17,7 +17,7 @@ final class StringFoldTest extends FlowTestCase { public function test_string_folded(): void { - static::assertSame("die o'brian strasse", (new FunctionContext(flow_context()))->eval( + static::assertSame("die o'brian strasse", new FunctionContext(flow_context())->eval( ref('str')->stringFold(), ['str' => "Die O'Brian Straße"], schema(str_schema('str')), @@ -29,7 +29,7 @@ public function test_string_fold_throws_on_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringFold function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringFold(), ['str' => null], schema(str_schema('str', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringMatchAllTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringMatchAllTest.php index 2d0f81764e..a791325c36 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringMatchAllTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringMatchAllTest.php @@ -19,7 +19,7 @@ public function test_empty_haystack_string(): void { static::assertEquals( [], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringMatchAll('/hello/'), ['str' => ''], schema(str_schema('str')), @@ -31,7 +31,7 @@ public function test_multiple_successful_pattern_matches(): void { static::assertEquals( [['123'], ['456'], ['789']], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringMatchAll('/\d+/'), ['str' => 'test 123 and 456 and 789'], schema(str_schema('str')), @@ -43,7 +43,7 @@ public function test_no_matches_found(): void { static::assertEquals( [], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringMatchAll('/foo/'), ['str' => 'hello world'], schema(str_schema('str')), @@ -56,7 +56,7 @@ public function test_null_haystack(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringMatchAll function requires non-null haystack'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringMatchAll('/hello/'), ['str' => null], schema(str_schema('str', nullable: true)), @@ -68,7 +68,7 @@ public function test_null_pattern(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringMatchAll function requires non-null pattern'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringMatchAll(ref('pattern')), ['str' => 'hello world', 'pattern' => null], schema(str_schema('str'), str_schema('pattern', nullable: true)), @@ -79,7 +79,7 @@ public function test_with_scalar_function_parameter(): void { static::assertEquals( [['123'], ['456']], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringMatchAll(ref('pattern')), ['str' => 'test 123 and 456', 'pattern' => '/\d+/'], schema(str_schema('str'), str_schema('pattern')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringMatchTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringMatchTest.php index 286fb58e90..e17ffa9f2f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringMatchTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringMatchTest.php @@ -19,7 +19,7 @@ final class StringMatchTest extends FlowTestCase { public function test_no_matches_found(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->stringMatch('/foo/'), ['str' => 'hello world'], schema(str_schema('str')), @@ -31,7 +31,7 @@ public function test_null_haystack(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringMatch function requires non-null haystack'); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->stringMatch('/hello/'), ['str' => null], schema(str_schema('str', nullable: true)), @@ -43,7 +43,7 @@ public function test_null_pattern(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringMatch function requires non-null pattern'); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->stringMatch(ref('pattern')), ['str' => 'hello world', 'pattern' => null], schema(str_schema('str'), str_schema('pattern', nullable: true)), @@ -53,7 +53,7 @@ public function test_null_pattern(): void public function test_an_invalid_pattern_keeps_the_regex_error_as_the_cause(): void { try { - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->stringMatch(lit('/(/')), ['value' => 'abc'], schema(str_schema('value')), @@ -69,7 +69,7 @@ public function test_successful_pattern_match(): void { static::assertEquals( ['hello'], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringMatch('/hello/'), ['str' => 'hello world'], schema(str_schema('str')), @@ -81,7 +81,7 @@ public function test_with_scalar_function_parameter(): void { static::assertEquals( ['world'], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringMatch(ref('pattern')), ['str' => 'hello world', 'pattern' => '/world/'], schema(str_schema('str'), str_schema('pattern')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringNormalizeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringNormalizeTest.php index bd2d8ce5f6..71957a6a6c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringNormalizeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringNormalizeTest.php @@ -22,7 +22,7 @@ public function test_a_malformed_form_operand_throws(): void { $this->expectException(InvalidArgumentException::class); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->stringNormalize(lit('not-a-form')), ['value' => 'abc'], schema(str_schema('value')), @@ -31,7 +31,7 @@ public function test_a_malformed_form_operand_throws(): void public function test_normalize_already_normalized(): void { - static::assertSame('hello', (new FunctionContext(flow_context()))->eval( + static::assertSame('hello', new FunctionContext(flow_context())->eval( ref('str')->stringNormalize(Normalizer::NFC), ['str' => 'hello'], schema(str_schema('str')), @@ -40,7 +40,7 @@ public function test_normalize_already_normalized(): void public function test_normalize_empty_string(): void { - static::assertSame('', (new FunctionContext(flow_context()))->eval( + static::assertSame('', new FunctionContext(flow_context())->eval( ref('str')->stringNormalize(), ['str' => ''], schema(str_schema('str')), @@ -49,7 +49,7 @@ public function test_normalize_empty_string(): void public function test_normalize_nfc_default(): void { - static::assertSame('é', (new FunctionContext(flow_context()))->eval( + static::assertSame('é', new FunctionContext(flow_context())->eval( ref('str')->stringNormalize(), ['str' => "e\u{0301}"], schema(str_schema('str')), @@ -58,7 +58,7 @@ public function test_normalize_nfc_default(): void public function test_normalize_nfc_explicit(): void { - static::assertSame('é', (new FunctionContext(flow_context()))->eval( + static::assertSame('é', new FunctionContext(flow_context())->eval( ref('str')->stringNormalize(Normalizer::NFC), ['str' => "e\u{0301}"], schema(str_schema('str')), @@ -67,7 +67,7 @@ public function test_normalize_nfc_explicit(): void public function test_normalize_nfd(): void { - static::assertSame("e\u{0301}", (new FunctionContext(flow_context()))->eval( + static::assertSame("e\u{0301}", new FunctionContext(flow_context())->eval( ref('str')->stringNormalize(Normalizer::NFD), ['str' => 'é'], schema(str_schema('str')), @@ -79,7 +79,7 @@ public function test_normalize_throws_on_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringNormalize function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringNormalize(), ['str' => null], schema(str_schema('str', nullable: true)), @@ -88,7 +88,7 @@ public function test_normalize_throws_on_null_input(): void public function test_normalize_with_scalar_function_form(): void { - static::assertSame('é', (new FunctionContext(flow_context()))->eval( + static::assertSame('é', new FunctionContext(flow_context())->eval( ref('str')->stringNormalize(ref('form')), ['str' => "e\u{0301}", 'form' => Normalizer::NFC], schema(str_schema('str'), int_schema('form')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringStyleTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringStyleTest.php index 38e45ade7a..7cec290092 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringStyleTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringStyleTest.php @@ -23,7 +23,7 @@ public function test_a_null_value_throws(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringStyle function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->stringStyle(StringStyles::LOWER), ['value' => null], schema(str_schema('value', nullable: true)), @@ -100,7 +100,7 @@ public function test_all_lists_every_style_value(): void public function test_string_style_camel(): void { - static::assertSame('fooBarBaz', (new FunctionContext(flow_context()))->eval( + static::assertSame('fooBarBaz', new FunctionContext(flow_context())->eval( ref('str')->stringStyle(ref('style')), ['str' => 'Foo: Bar-baz.', 'style' => 'camel'], schema(str_schema('str'), str_schema('style')), @@ -109,7 +109,7 @@ public function test_string_style_camel(): void public function test_string_style_kebab(): void { - static::assertSame('foo-bar-baz', (new FunctionContext(flow_context()))->eval( + static::assertSame('foo-bar-baz', new FunctionContext(flow_context())->eval( ref('str')->stringStyle('kebab'), ['str' => 'Foo: Bar-baz.'], schema(str_schema('str')), @@ -118,7 +118,7 @@ public function test_string_style_kebab(): void public function test_string_style_lower(): void { - static::assertSame('foo bar bri̇an', (new FunctionContext(flow_context()))->eval( + static::assertSame('foo bar bri̇an', new FunctionContext(flow_context())->eval( ref('str')->stringStyle('lower'), ['str' => 'FOO Bar Brİan'], schema(str_schema('str')), @@ -128,7 +128,7 @@ public function test_string_style_lower(): void #[DataProvider('provideStringStyles')] public function test_string_styles(StringStyles $style, ?string $value, ?string $expected): void { - static::assertSame($expected, (new FunctionContext(flow_context()))->eval( + static::assertSame($expected, new FunctionContext(flow_context())->eval( ref('str')->stringStyle($style), ['str' => $value], schema(str_schema('str', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringTitleTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringTitleTest.php index e9bba320b3..dd57918fc0 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringTitleTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringTitleTest.php @@ -18,7 +18,7 @@ final class StringTitleTest extends FlowTestCase { public function test_string_title_with_null_all_words_changes_only_the_first_word(): void { - static::assertSame('Hello world', (new FunctionContext(flow_context()))->eval( + static::assertSame('Hello world', new FunctionContext(flow_context())->eval( ref('str')->stringTitle(ref('all_words')), ['str' => 'hello world', 'all_words' => null], schema(str_schema('str'), bool_schema('all_words', nullable: true)), @@ -27,7 +27,7 @@ public function test_string_title_with_null_all_words_changes_only_the_first_wor public function test_string_title(): void { - static::assertSame('Foo ijssel', (new FunctionContext(flow_context()))->eval( + static::assertSame('Foo ijssel', new FunctionContext(flow_context())->eval( ref('str')->stringTitle(), ['str' => 'foo ijssel'], schema(str_schema('str')), @@ -36,7 +36,7 @@ public function test_string_title(): void public function test_string_title_allwords(): void { - static::assertSame('Foo Ijssel', (new FunctionContext(flow_context()))->eval( + static::assertSame('Foo Ijssel', new FunctionContext(flow_context())->eval( ref('str')->stringTitle(allWords: true), ['str' => 'foo ijssel'], schema(str_schema('str')), @@ -48,7 +48,7 @@ public function test_string_title_throws_on_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringTitle function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringTitle(), ['str' => null], schema(str_schema('str', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringWidthTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringWidthTest.php index df6ae561f2..309da28778 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringWidthTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StringWidthTest.php @@ -17,7 +17,7 @@ final class StringWidthTest extends FlowTestCase { public function test_width_ascii_string(): void { - static::assertSame(5, (new FunctionContext(flow_context()))->eval( + static::assertSame(5, new FunctionContext(flow_context())->eval( ref('str')->stringWidth(), ['str' => 'hello'], schema(str_schema('str')), @@ -26,7 +26,7 @@ public function test_width_ascii_string(): void public function test_width_empty_string(): void { - static::assertSame(0, (new FunctionContext(flow_context()))->eval( + static::assertSame(0, new FunctionContext(flow_context())->eval( ref('str')->stringWidth(), ['str' => ''], schema(str_schema('str')), @@ -38,7 +38,7 @@ public function test_width_throws_on_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('StringWidth function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->stringWidth(), ['str' => null], schema(str_schema('str', nullable: true)), @@ -47,7 +47,7 @@ public function test_width_throws_on_null_input(): void public function test_width_single_character(): void { - static::assertSame(1, (new FunctionContext(flow_context()))->eval( + static::assertSame(1, new FunctionContext(flow_context())->eval( ref('str')->stringWidth(), ['str' => 'a'], schema(str_schema('str')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StructureSelectTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StructureSelectTest.php index 1ca9a90aa8..7a78e0302e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StructureSelectTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StructureSelectTest.php @@ -31,7 +31,7 @@ public function test_selecting_multiple_values_from_structure(): void { static::assertEquals( ['id' => 1, 'name' => 'test'], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new StructureSelect(ref('struct'), ref('id'), ref('name')), ['struct' => [ 'id' => 1, @@ -46,7 +46,7 @@ public function test_selecting_single_value_from_structure(): void { static::assertEquals( ['id' => 1], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new StructureSelect(ref('struct'), 'id'), ['struct' => [ 'id' => 1, @@ -61,7 +61,7 @@ public function test_selecting_single_value_from_structure_with_alias(): void { static::assertEquals( ['new_id' => 1], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new StructureSelect(ref('struct'), ref('id')->as('new_id')), ['struct' => [ 'id' => 1, @@ -76,7 +76,7 @@ public function test_selecting_values_from_empty_structure(): void { static::assertEquals( ['new_id' => null], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( new StructureSelect(ref('struct'), ref('id')->as('new_id')), ['struct' => [ 'id' => null, @@ -95,7 +95,7 @@ public function test_selecting_values_from_empty_structure(): void public function test_a_non_structure_operand_is_refused_at_bind(): void { /** @var ScalarFunction $resolved */ - $resolved = (new ReferenceResolver())->resolve( + $resolved = new ReferenceResolver()->resolve( new StructureSelect(ref('list'), ref('id')), schema(list_schema( 'list', diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StructureTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StructureTest.php index d2af8469c2..ba945bd022 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StructureTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/StructureTest.php @@ -31,7 +31,7 @@ public function test_eval_preserves_key_order(): void { static::assertSame( ['second' => 'x', 'first' => 1], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( structure(['second' => ref('b'), 'first' => ref('a')]), [ 'a' => 1, @@ -47,7 +47,7 @@ public function test_eval_keeps_null_under_its_key(): void { static::assertSame( ['id' => 'x', 'quantity' => null], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( structure(['id' => ref('b'), 'quantity' => ref('q')]), [ 'a' => 1, @@ -63,7 +63,7 @@ public function test_eval_with_numeric_keys(): void { static::assertSame( [5 => 1, 7 => 'x'], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( structure([5 => ref('a'), 7 => ref('b')]), ['a' => 1, 'b' => 'x', 'q' => null], schema(int_schema('a'), str_schema('b'), str_schema('q', nullable: true)), @@ -85,7 +85,7 @@ public function test_eval_nested_structure(): void { static::assertSame( ['user' => ['id' => 1]], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( structure(['user' => structure(['id' => ref('a')])]), [ 'a' => 1, @@ -101,7 +101,7 @@ public function test_returns_carries_element_types_and_nullability(): void { static::assertSame( 'structure{id: string, quantity: ?integer}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve( structure(['id' => ref('line_id'), 'quantity' => ref('quantity')]), schema(str_schema('line_id'), int_schema('quantity', nullable: true)), @@ -113,7 +113,7 @@ public function test_returns_carries_element_types_and_nullability(): void public function test_returns_is_never_nullable(): void { - $returns = (new ReferenceResolver()) + $returns = new ReferenceResolver() ->resolve( structure(['id' => ref('line_id'), 'quantity' => ref('quantity')]), schema(str_schema('line_id', true), int_schema('quantity', true)), @@ -128,7 +128,7 @@ public function test_returns_with_numeric_keys(): void { static::assertSame( 'structure{5: integer, 7: string}', - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(structure([5 => ref('a'), 7 => ref('b')]), schema(int_schema('a'), str_schema('b'))) ->returns() ->toString(), @@ -147,7 +147,7 @@ public function test_with_children_keeps_keys(): void { static::assertSame( ['id' => 1, 'name' => 'x'], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( structure(['id' => ref('a'), 'name' => ref('b')])->withChildren([lit(1), lit('x')]), ['a' => 1, 'b' => 'x', 'q' => null], schema(int_schema('a'), str_schema('b'), str_schema('q', nullable: true)), @@ -177,7 +177,7 @@ public function test_resolved_only_after_every_element_resolves(): void static::assertFalse($function->resolved()); static::assertTrue( - (new ReferenceResolver()) + new ReferenceResolver() ->resolve($function, schema(str_schema('line_id'), int_schema('quantity', nullable: true))) ->resolved(), ); @@ -205,6 +205,6 @@ public function test_a_description_rebuilds_through_the_constructor_checks(): vo $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Structure keys cannot be a list'); - (new Rebuild())->of($data, ScalarFunction::class); + new Rebuild()->of($data, ScalarFunction::class); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TemporalStringCoercionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TemporalStringCoercionTest.php index 346205d12e..bc943fe6ec 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TemporalStringCoercionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TemporalStringCoercionTest.php @@ -80,12 +80,12 @@ public function test_a_string_operand_is_cast_to_the_temporal_operand( ): void { static::assertSame($expected, array_map(static fn(ScalarFunction $operand): string => $operand ->returns() - ->toString(), type_instance_of(ComparisonFunction::class)->assert((new TemporalStringCoercion())->coerce($predicate))->operands())); + ->toString(), type_instance_of(ComparisonFunction::class)->assert(new TemporalStringCoercion()->coerce($predicate))->operands())); } #[DataProvider('untouched')] public function test_the_function_is_returned_as_it_is(ScalarFunction $predicate): void { - static::assertSame($predicate, (new TemporalStringCoercion())->coerce($predicate)); + static::assertSame($predicate, new TemporalStringCoercion()->coerce($predicate)); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToDateTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToDateTest.php index 2730447faf..afd7bde24e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToDateTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToDateTest.php @@ -27,7 +27,7 @@ public function test_null_value_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ToDate function requires non-null values'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( to_date(ref('value')), ['value' => null], schema(str_schema('value', nullable: true)), @@ -39,7 +39,7 @@ public function test_null_format_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ToDate function requires non-null values'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( to_date(ref('value'), ref('format')), ['value' => '2024-01-01', 'format' => null], schema(str_schema('value'), str_schema('format', nullable: true)), @@ -55,7 +55,7 @@ public function test_string_rows_are_all_converted(): void new DateTimeImmutable('2024-01-01 00:00:00', new DateTimeZone('UTC')), new DateTimeImmutable('2024-01-02 00:00:00', new DateTimeZone('UTC')), ], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(to_date(ref('value')), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -71,7 +71,7 @@ public function test_int_rows_are_all_converted(): void new DateTimeImmutable('2024-01-01 00:00:00', new DateTimeZone('UTC')), new DateTimeImmutable('2024-01-02 00:00:00', new DateTimeZone('UTC')), ], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(to_date(ref('value')), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -90,7 +90,7 @@ public function test_date_time_rows_are_all_converted(): void new DateTimeImmutable('2024-01-01 00:00:00', new DateTimeZone('UTC')), new DateTimeImmutable('2024-01-02 00:00:00', new DateTimeZone('UTC')), ], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(to_date(ref('value')), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -101,7 +101,7 @@ public function test_date_time_to_date(): void { static::assertEquals( new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('UTC')), - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( to_date(ref('date_time')), ['date_time' => new DateTimeImmutable('2020-01-01 12:43:23', new DateTimeZone('UTC'))], schema(datetime_schema('date_time')), @@ -113,10 +113,10 @@ public function test_int_to_date_time(): void { static::assertEquals( new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('UTC')), - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( to_date(ref('int')), [ - 'int' => (int) (new DateTimeImmutable('2020-01-01 10:11:11', new DateTimeZone('UTC')))->format('U'), + 'int' => (int) new DateTimeImmutable('2020-01-01 10:11:11', new DateTimeZone('UTC'))->format('U'), ], schema(int_schema('int')), ), @@ -127,7 +127,7 @@ public function test_string_to_date_time(): void { static::assertEquals( new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('UTC')), - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( to_date(ref('string'), 'Y-m-d H:i:s'), [ 'string' => '2020-01-01 10:08:00', diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToDateTime/PatternCoverageTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToDateTime/PatternCoverageTest.php index 1599371802..10fcd2e2f3 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToDateTime/PatternCoverageTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToDateTime/PatternCoverageTest.php @@ -20,7 +20,7 @@ final class PatternCoverageTest extends FlowTestCase #[TestWith(['U'])] public function test_a_pattern_parsing_every_field_or_resetting_them_does_not_read_the_clock(string $pattern): void { - static::assertFalse((new PatternCoverage($pattern))->fillsFromClock()); + static::assertFalse(new PatternCoverage($pattern)->fillsFromClock()); } #[TestWith(['Y-m-d'])] @@ -31,7 +31,7 @@ public function test_a_pattern_parsing_every_field_or_resetting_them_does_not_re #[TestWith(['\U Y-m-d'])] public function test_a_pattern_leaving_a_field_out_reads_the_clock(string $pattern): void { - static::assertTrue((new PatternCoverage($pattern))->fillsFromClock()); + static::assertTrue(new PatternCoverage($pattern)->fillsFromClock()); } public function test_any_finds_one_of_the_characters(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToDateTimeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToDateTimeTest.php index 0d3e4810e1..6fb9faf1ad 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToDateTimeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToDateTimeTest.php @@ -42,7 +42,7 @@ public function test_a_null_row_does_not_stop_later_rows(): void static::assertEquals( [null, new DateTimeImmutable('2024-01-01 10:20:30', new DateTimeZone('UTC'))], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(to_date_time(ref('value')), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -61,7 +61,7 @@ public function test_date_time_rows_are_all_converted(): void new DateTimeImmutable('2024-01-01 10:20:30', new DateTimeZone('UTC')), new DateTimeImmutable('2024-01-02 10:20:30', new DateTimeZone('UTC')), ], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(to_date_time(ref('value')), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -77,7 +77,7 @@ public function test_int_rows_are_all_converted(): void new DateTimeImmutable('2024-01-01 00:00:00', new DateTimeZone('UTC')), new DateTimeImmutable('2024-01-02 00:00:00', new DateTimeZone('UTC')), ], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(to_date_time(ref('value')), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -96,7 +96,7 @@ public function test_string_rows_are_all_converted(): void new DateTimeImmutable('2024-01-01 10:20:30', new DateTimeZone('UTC')), new DateTimeImmutable('2024-01-02 10:20:30', new DateTimeZone('UTC')), ], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(to_date_time(ref('value')), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -149,7 +149,7 @@ public function test_date_time_to_date_time(): void { static::assertEquals( new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('UTC')), - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( to_date_time(ref('date_time')), ['date_time' => new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('UTC'))], schema(datetime_schema('date_time')), @@ -161,10 +161,10 @@ public function test_int_to_date_time(): void { static::assertEquals( new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('UTC')), - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( to_date_time(ref('int')), [ - 'int' => (int) (new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('UTC')))->format('U'), + 'int' => (int) new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('UTC'))->format('U'), ], schema(int_schema('int')), ), @@ -175,7 +175,7 @@ public function test_string_to_date_time(): void { static::assertEquals( new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('UTC')), - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( to_date_time(ref('string'), 'Y-m-d H:i:s'), [ 'string' => '2020-01-01 00:00:00', @@ -187,7 +187,7 @@ public function test_string_to_date_time(): void public function test_a_null_value_is_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( to_date_time(ref('string'), 'Y-m-d H:i:s'), [ 'string' => null, @@ -199,7 +199,7 @@ public function test_a_null_value_is_null(): void public function test_a_null_format_is_refused(): void { try { - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( to_date_time(ref('string'), ref('format')), [ 'string' => '2020-01-01', @@ -218,7 +218,7 @@ public function test_a_null_format_is_refused(): void public function test_unparseable_string_to_date_time_is_null(): void { - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( to_date_time(ref('string'), 'Y-m-d H:i:s'), [ 'string' => 'not a datetime', @@ -240,7 +240,7 @@ public function test_object_keeps_its_time(): void static::assertSame( '10:30:00', type_datetime() - ->assert((new FunctionContext(flow_context()))->eval( + ->assert(new FunctionContext(flow_context())->eval( to_date_time(ref('at')), ['at' => new DateTimeImmutable('2020-01-01 10:30:00', new DateTimeZone('UTC'))], schema(datetime_schema('at')), @@ -254,7 +254,7 @@ public function test_int_lands_in_the_constant_zone(): void static::assertSame( '2020-01-01 11:30:00 Europe/Warsaw', type_datetime() - ->assert((new FunctionContext(flow_context()))->eval( + ->assert(new FunctionContext(flow_context())->eval( to_date_time(ref('at'), 'Y-m-d H:i:s', new DateTimeZone('Europe/Warsaw')), [ 'at' => 1577874600, @@ -271,7 +271,7 @@ public function test_mutable_datetime_is_converted_without_mutation(): void static::assertEquals( new DateTimeImmutable('2020-01-01 11:30:00', new DateTimeZone('Europe/Warsaw')), - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( to_date_time(ref('at'), 'Y-m-d H:i:s', new DateTimeZone('Europe/Warsaw')), [ 'at' => $value, @@ -287,7 +287,7 @@ public function test_non_datetime_object_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ToDateTime function requires DateTimeInterface object'); - (new FunctionContext(flow_context()))->eval(to_date_time(lit(new stdClass())), [], schema()); + new FunctionContext(flow_context())->eval(to_date_time(lit(new stdClass())), [], schema()); } public function test_string_in_a_utc_alias_zone_lands_in_utc(): void @@ -295,7 +295,7 @@ public function test_string_in_a_utc_alias_zone_lands_in_utc(): void static::assertSame( '2020-01-01 10:30:00 UTC', type_datetime() - ->assert((new FunctionContext(flow_context()))->eval( + ->assert(new FunctionContext(flow_context())->eval( to_date_time(ref('at'), 'Y-m-d H:i:s', new DateTimeZone('GMT')), [ 'at' => '2020-01-01 10:30:00', diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToLowerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToLowerTest.php index 97c24aaf7a..8572472ab0 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToLowerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToLowerTest.php @@ -19,7 +19,7 @@ final class ToLowerTest extends FlowTestCase { public function test_string_to_lower(): void { - static::assertSame('lower', (new FunctionContext(flow_context()))->eval(lower(lit('LOWER')), [], schema())); + static::assertSame('lower', new FunctionContext(flow_context())->eval(lower(lit('LOWER')), [], schema())); } public function test_lower_on_null(): void @@ -27,7 +27,7 @@ public function test_lower_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ToLower function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( lower(ref('string')), ['string' => null], schema(str_schema('string', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToTimeZoneTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToTimeZoneTest.php index 19b1c03b78..0c648469b5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToTimeZoneTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToTimeZoneTest.php @@ -41,7 +41,7 @@ public function test_abbreviation_zone_is_refused(): void public function test_casting_date_time_pst_to_utc_time_zone(): void { // @mago-ignore analysis:mixed-assignment - $result = (new FunctionContext(flow_context()))->eval( + $result = new FunctionContext(flow_context())->eval( to_timezone( lit(new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('PST'))), new DateTimeZone('UTC'), @@ -56,7 +56,7 @@ public function test_casting_date_time_pst_to_utc_time_zone(): void public function test_casting_date_time_pst_to_utc_time_zone_from_string_tz(): void { // @mago-ignore analysis:mixed-assignment - $result = (new FunctionContext(flow_context()))->eval( + $result = new FunctionContext(flow_context())->eval( to_timezone(lit(new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('PST'))), 'UTC'), [], schema(), @@ -69,7 +69,7 @@ public function test_does_not_mutate_a_datetime(): void { $value = new DateTime('2020-01-01 00:00:00 UTC'); - (new FunctionContext(flow_context()))->eval(to_timezone(lit($value), 'Europe/Warsaw'), [], schema()); + new FunctionContext(flow_context())->eval(to_timezone(lit($value), 'Europe/Warsaw'), [], schema()); static::assertSame('UTC', $value->getTimezone()->getName()); } @@ -89,7 +89,7 @@ public function test_null_value_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ToTimeZone function requires non-null values'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( to_timezone(ref('at'), 'UTC'), [ 'at' => null, @@ -114,7 +114,7 @@ public function test_a_null_in_a_datetime_column_is_refused_at_its_row(): void $this->expectException(EvaluationException::class); $this->expectExceptionMessage('ToTimeZone function requires non-null values (row 1)'); - (new FunctionContext(flow_context()))->column( + new FunctionContext(flow_context())->column( to_timezone(ref('at'), 'UTC'), [['at' => new DateTimeImmutable('2026-01-01 00:00:00')], ['at' => null]], schema(datetime_schema('at', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToUpperTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToUpperTest.php index e2ef43e760..8a6c980628 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToUpperTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/ToUpperTest.php @@ -19,7 +19,7 @@ final class ToUpperTest extends FlowTestCase { public function test_string_to_upper(): void { - static::assertSame('UPPER', (new FunctionContext(flow_context()))->eval(upper(lit('upper')), [], schema())); + static::assertSame('UPPER', new FunctionContext(flow_context())->eval(upper(lit('upper')), [], schema())); } public function test_upper_on_null(): void @@ -27,7 +27,7 @@ public function test_upper_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ToUpper function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( upper(ref('string')), ['string' => null], schema(str_schema('string', nullable: true)), @@ -36,6 +36,6 @@ public function test_upper_on_null(): void public function test_multibyte_letters_are_upper_cased(): void { - static::assertSame('ŻÓŁW', (new FunctionContext(flow_context()))->eval(upper(lit('żółw')), [], schema())); + static::assertSame('ŻÓŁW', new FunctionContext(flow_context())->eval(upper(lit('żółw')), [], schema())); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TotalsByGroupTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TotalsByGroupTest.php index dcba239c4d..d98f47ebc0 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TotalsByGroupTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TotalsByGroupTest.php @@ -33,7 +33,7 @@ public function test_a_sum_and_an_average_over_one_shared_total_read_their_own_v static::assertSame([3.0, 4.0], $sums->groupValues(2, $backend)->values()); static::assertSame( [1.5, 4.0], - (new TotalsByGroup(average(ref('v')), $totals)) + new TotalsByGroup(average(ref('v')), $totals) ->groupValues(2, $backend) ->values(), ); @@ -91,8 +91,8 @@ public function test_it_absorbs_only_other_grouped_totals(): void { $this->expectException(InvalidArgumentException::class); - (new TotalsByGroup(sum(ref('v')), (new PhpBackend())->groupedTotals()))->absorbEarlier( - new CountsByGroup(null, (new PhpBackend())->groupedCounts()), + new TotalsByGroup(sum(ref('v')), new PhpBackend()->groupedTotals())->absorbEarlier( + new CountsByGroup(null, new PhpBackend()->groupedCounts()), [], new PhpBackend(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TrimTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TrimTest.php index fcb734ff50..b43b83755a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TrimTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TrimTest.php @@ -18,7 +18,7 @@ final class TrimTest extends FlowTestCase { public function test_trim_both_valid_string(): void { - static::assertSame('value', (new FunctionContext(flow_context()))->eval( + static::assertSame('value', new FunctionContext(flow_context())->eval( ref('string')->trim(), ['string' => ' value'], schema(str_schema('string')), @@ -27,7 +27,7 @@ public function test_trim_both_valid_string(): void public function test_trim_left_valid_string(): void { - static::assertSame('value ', (new FunctionContext(flow_context()))->eval( + static::assertSame('value ', new FunctionContext(flow_context())->eval( ref('string')->trim(Type::LEFT), ['string' => ' value '], schema(str_schema('string')), @@ -36,7 +36,7 @@ public function test_trim_left_valid_string(): void public function test_trim_right_valid_string(): void { - static::assertSame(' value', (new FunctionContext(flow_context()))->eval( + static::assertSame(' value', new FunctionContext(flow_context())->eval( ref('string')->trim(Type::RIGHT), ['string' => ' value '], schema(str_schema('string')), @@ -48,7 +48,7 @@ public function test_trim_on_null(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Trim function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('string')->trim(), ['string' => null], schema(str_schema('string', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TruncateTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TruncateTest.php index d7770a62cf..8f260e2ae4 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TruncateTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/TruncateTest.php @@ -18,7 +18,7 @@ final class TruncateTest extends FlowTestCase { public function test_truncate_ellipsis_longer_than_limit(): void { - static::assertSame('hello', (new FunctionContext(flow_context()))->eval( + static::assertSame('hello', new FunctionContext(flow_context())->eval( ref('str')->truncate(5, 'verylongellipsis'), ['str' => 'hello world'], schema(str_schema('str')), @@ -27,7 +27,7 @@ public function test_truncate_ellipsis_longer_than_limit(): void public function test_truncate_empty_string(): void { - static::assertSame('', (new FunctionContext(flow_context()))->eval( + static::assertSame('', new FunctionContext(flow_context())->eval( ref('str')->truncate(10), ['str' => ''], schema(str_schema('str')), @@ -36,7 +36,7 @@ public function test_truncate_empty_string(): void public function test_truncate_exact_length(): void { - static::assertSame('hello', (new FunctionContext(flow_context()))->eval( + static::assertSame('hello', new FunctionContext(flow_context())->eval( ref('str')->truncate(5), ['str' => 'hello'], schema(str_schema('str')), @@ -48,7 +48,7 @@ public function test_truncate_throws_on_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Truncate function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->truncate(10), ['str' => null], schema(str_schema('str', nullable: true)), @@ -57,7 +57,7 @@ public function test_truncate_throws_on_null_input(): void public function test_truncate_string_longer_than_limit(): void { - static::assertSame('he...', (new FunctionContext(flow_context()))->eval( + static::assertSame('he...', new FunctionContext(flow_context())->eval( ref('str')->truncate(5), ['str' => 'hello world'], schema(str_schema('str')), @@ -66,7 +66,7 @@ public function test_truncate_string_longer_than_limit(): void public function test_truncate_string_shorter_than_limit(): void { - static::assertSame('hello', (new FunctionContext(flow_context()))->eval( + static::assertSame('hello', new FunctionContext(flow_context())->eval( ref('str')->truncate(10), ['str' => 'hello'], schema(str_schema('str')), @@ -75,7 +75,7 @@ public function test_truncate_string_shorter_than_limit(): void public function test_truncate_with_custom_ellipsis(): void { - static::assertSame('he***', (new FunctionContext(flow_context()))->eval( + static::assertSame('he***', new FunctionContext(flow_context())->eval( ref('str')->truncate(5, '***'), ['str' => 'hello world'], schema(str_schema('str')), @@ -84,7 +84,7 @@ public function test_truncate_with_custom_ellipsis(): void public function test_truncate_with_length_one(): void { - static::assertSame('h', (new FunctionContext(flow_context()))->eval( + static::assertSame('h', new FunctionContext(flow_context())->eval( ref('str')->truncate(1), ['str' => 'hello'], schema(str_schema('str')), @@ -93,7 +93,7 @@ public function test_truncate_with_length_one(): void public function test_truncate_with_length_zero(): void { - static::assertSame('', (new FunctionContext(flow_context()))->eval( + static::assertSame('', new FunctionContext(flow_context())->eval( ref('str')->truncate(0), ['str' => 'hello'], schema(str_schema('str')), @@ -102,7 +102,7 @@ public function test_truncate_with_length_zero(): void public function test_truncate_with_negative_length(): void { - static::assertSame('hell', (new FunctionContext(flow_context()))->eval( + static::assertSame('hell', new FunctionContext(flow_context())->eval( ref('str')->truncate(-1), ['str' => 'hello'], schema(str_schema('str')), @@ -111,7 +111,7 @@ public function test_truncate_with_negative_length(): void public function test_truncate_with_null_length(): void { - static::assertSame('hello world', (new FunctionContext(flow_context()))->eval( + static::assertSame('hello world', new FunctionContext(flow_context())->eval( ref('str')->truncate(ref('length')), ['str' => 'hello world', 'length' => null], schema(str_schema('str'), str_schema('length', nullable: true)), @@ -120,7 +120,7 @@ public function test_truncate_with_null_length(): void public function test_truncate_with_scalar_function_ellipsis(): void { - static::assertSame('hel>>', (new FunctionContext(flow_context()))->eval( + static::assertSame('hel>>', new FunctionContext(flow_context())->eval( ref('str')->truncate(5, ref('ellipsis')), ['str' => 'hello world', 'ellipsis' => '>>'], schema(str_schema('str'), str_schema('ellipsis')), @@ -129,7 +129,7 @@ public function test_truncate_with_scalar_function_ellipsis(): void public function test_truncate_with_scalar_function_length(): void { - static::assertSame('he...', (new FunctionContext(flow_context()))->eval( + static::assertSame('he...', new FunctionContext(flow_context())->eval( ref('str')->truncate(ref('length')), ['str' => 'hello world', 'length' => 5], schema(str_schema('str'), int_schema('length')), @@ -140,7 +140,7 @@ public function test_a_row_without_a_length_keeps_its_value_and_the_next_row_is_ { static::assertSame( ['hello world', 'he...'], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('str')->truncate(ref('length')), [['str' => 'hello world', 'length' => null], ['str' => 'hello world', 'length' => 5]], diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/UlidTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/UlidTest.php index 0498a55d0c..6c66a0a13b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/UlidTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/UlidTest.php @@ -34,7 +34,7 @@ public function test_ulid_rows_are_all_converted(): void static::assertSame( ['01ARZ3NDEKTSV4RRFFQ69G5FAV', '01BX5ZZKBKACTAV9WEVGEMMVRZ'], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(ulid(ref('value')), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), @@ -45,13 +45,13 @@ public function test_ulid_produces_a_string_column(): void { $expression = ulid(); // @mago-ignore analysis:mixed-assignment - $result = (new FunctionContext(flow_context()))->eval($expression, [], schema()); + $result = new FunctionContext(flow_context())->eval($expression, [], schema()); static::assertIsString($result); static::assertTrue(Ulid::isValid($result)); static::assertNotSame( - (new FunctionContext(flow_context()))->eval($expression, [], schema()), - (new FunctionContext(flow_context()))->eval($expression, [], schema()), + new FunctionContext(flow_context())->eval($expression, [], schema()), + new FunctionContext(flow_context())->eval($expression, [], schema()), ); } @@ -60,8 +60,8 @@ public function test_ulid_is_unique(): void $expression = ulid(); static::assertNotEquals( - (new FunctionContext(flow_context()))->eval($expression, [], schema()), - (new FunctionContext(flow_context()))->eval($expression, [], schema()), + new FunctionContext(flow_context())->eval($expression, [], schema()), + new FunctionContext(flow_context())->eval($expression, [], schema()), ); } @@ -70,6 +70,6 @@ public function test_ulid_with_invalid_value_throws(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Ulid requires valid ULID string: Invalid ULID'); - (new FunctionContext(flow_context()))->eval(ulid(lit('')), [], schema()); + new FunctionContext(flow_context())->eval(ulid(lit('')), [], schema()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/UnicodeLengthTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/UnicodeLengthTest.php index f728f6d15f..e4c8253187 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/UnicodeLengthTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/UnicodeLengthTest.php @@ -17,7 +17,7 @@ final class UnicodeLengthTest extends FlowTestCase { public function test_unicode_length_ascii_string(): void { - static::assertSame(5, (new FunctionContext(flow_context()))->eval( + static::assertSame(5, new FunctionContext(flow_context())->eval( ref('str')->unicodeLength(), ['str' => 'hello'], schema(str_schema('str')), @@ -26,7 +26,7 @@ public function test_unicode_length_ascii_string(): void public function test_unicode_length_empty_string(): void { - static::assertSame(0, (new FunctionContext(flow_context()))->eval( + static::assertSame(0, new FunctionContext(flow_context())->eval( ref('str')->unicodeLength(), ['str' => ''], schema(str_schema('str')), @@ -38,7 +38,7 @@ public function test_unicode_length_throws_on_null_input(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('UnicodeLength function requires non-null value'); - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('str')->unicodeLength(), ['str' => null], schema(str_schema('str', nullable: true)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/UuidTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/UuidTest.php index a34fb89ccd..fc070273c2 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/UuidTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/UuidTest.php @@ -45,12 +45,12 @@ public function test_uuid4(): void $expression = uuid_v4(); // @mago-ignore analysis:mixed-assignment - $result = (new FunctionContext(flow_context()))->eval($expression, [], schema()); + $result = new FunctionContext(flow_context())->eval($expression, [], schema()); static::assertInstanceOf(FlowUuid::class, $result); static::assertTrue(Uuid::isValid($result->toString())); static::assertNotSame( - (new FunctionContext(flow_context()))->eval($expression, [], schema()), - (new FunctionContext(flow_context()))->eval($expression, [], schema()), + new FunctionContext(flow_context())->eval($expression, [], schema()), + new FunctionContext(flow_context())->eval($expression, [], schema()), ); } @@ -59,8 +59,8 @@ public function test_uuid4_is_unique(): void $expression = uuid_v4(); static::assertNotEquals( - (new FunctionContext(flow_context()))->eval($expression, [], schema()), - (new FunctionContext(flow_context()))->eval($expression, [], schema()), + new FunctionContext(flow_context())->eval($expression, [], schema()), + new FunctionContext(flow_context())->eval($expression, [], schema()), ); } @@ -71,7 +71,7 @@ public function test_uuid7(): void } // @mago-ignore analysis:mixed-assignment - $result = (new FunctionContext(flow_context()))->eval( + $result = new FunctionContext(flow_context())->eval( uuid_v7(lit(new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('UTC')))), [], schema(), @@ -84,8 +84,8 @@ public function test_uuid7_is_unique(): void { $dateTime = lit(new DateTimeImmutable('2020-01-01 00:00:00', new DateTimeZone('UTC'))); static::assertNotEquals( - (new FunctionContext(flow_context()))->eval(uuid_v7($dateTime), [], schema()), - (new FunctionContext(flow_context()))->eval(uuid_v7($dateTime), [], schema()), + new FunctionContext(flow_context())->eval(uuid_v7($dateTime), [], schema()), + new FunctionContext(flow_context())->eval(uuid_v7($dateTime), [], schema()), ); } @@ -95,7 +95,7 @@ public function test_uuid4_gives_one_value_per_row(): void static fn(FlowUuid $uuid): string => $uuid->toString(), type_list(type_instance_of(FlowUuid::class)) ->assert( - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column(uuid_v4(), [['id' => 1], ['id' => 2]], schema(int_schema('id'))) ->values(), ), @@ -125,7 +125,7 @@ public function test_uuid_v7_requires_a_date_time(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Uuid uuid7 function requires a DateTimeInterface value'); - (new FunctionContext(flow_context()))->eval(uuid_v7(lit('')), [], schema()); + new FunctionContext(flow_context())->eval(uuid_v7(lit('')), [], schema()); } public function test_describe_round_trips(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/WhenTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/WhenTest.php index 979a43ffa4..c47d1a5e72 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/WhenTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/WhenTest.php @@ -27,21 +27,21 @@ final class WhenTest extends FlowTestCase { public function test_a_falsy_else_branch_is_returned(): void { - static::assertFalse((new FunctionContext(flow_context()))->eval( + static::assertFalse(new FunctionContext(flow_context())->eval( when(ref('active'), lit(true), false), [ 'active' => false, ], schema(bool_schema('active')), )); - static::assertSame(0, (new FunctionContext(flow_context()))->eval( + static::assertSame(0, new FunctionContext(flow_context())->eval( when(ref('active'), lit(1), 0), [ 'active' => false, ], schema(bool_schema('active')), )); - static::assertSame('', (new FunctionContext(flow_context()))->eval( + static::assertSame('', new FunctionContext(flow_context())->eval( when(ref('active'), lit('yes'), ''), [ 'active' => false, @@ -50,7 +50,7 @@ public function test_a_falsy_else_branch_is_returned(): void )); static::assertSame( [], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( when(ref('active'), lit(['yes']), []), [ 'active' => false, @@ -58,7 +58,7 @@ public function test_a_falsy_else_branch_is_returned(): void schema(bool_schema('active')), ), ); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( when(ref('active'), lit('yes')), [ 'active' => false, @@ -70,7 +70,7 @@ public function test_a_falsy_else_branch_is_returned(): void public function test_condition_not_satisfied_without_else(): void { // when() of string and integer branches declares string: the value is cast to it - static::assertSame('1', (new FunctionContext(flow_context()))->eval( + static::assertSame('1', new FunctionContext(flow_context())->eval( new When(ref('id')->equals(lit(2)), new Literal('then'), ref('id')), [ 'id' => 1, @@ -81,7 +81,7 @@ public function test_condition_not_satisfied_without_else(): void public function test_else(): void { - static::assertSame('else', (new FunctionContext(flow_context()))->eval( + static::assertSame('else', new FunctionContext(flow_context())->eval( new When(new Literal(false), new Literal('then'), new Literal('else')), [ 'id' => 1, @@ -92,8 +92,8 @@ public function test_else(): void public function test_with_children_keeps_the_then_branch(): void { - static::assertSame('y', (new FunctionContext(flow_context()))->eval( - (new When(lit(true), lit('x')))->withChildren([lit(true), lit('y')]), + static::assertSame('y', new FunctionContext(flow_context())->eval( + new When(lit(true), lit('x'))->withChildren([lit(true), lit('y')]), [], schema(), )); @@ -104,12 +104,12 @@ public function test_branches_without_a_common_type_refuse_to_declare(): void $this->expectException(InvalidTypeException::class); $this->expectExceptionMessage('Cannot combine types'); - (new When(lit(true), lit(true), lit(new DateTimeImmutable())))->returns(); + new When(lit(true), lit(true), lit(new DateTimeImmutable()))->returns(); } public function test_when(): void { - static::assertSame('then', (new FunctionContext(flow_context()))->eval( + static::assertSame('then', new FunctionContext(flow_context())->eval( new When(new Literal(true), new Literal('then')), [ 'id' => 1, @@ -133,7 +133,7 @@ public function test_then_branch_error_names_the_batch_row(): void ); try { - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(when(ref('c'), new FailingOnValuesFunction(ref('v'), [50]), lit(0)), $rows->schema()) ->eval($rows, flow_context()->backend()); static::fail('expected an EvaluationException'); @@ -156,7 +156,7 @@ public function test_else_branch_error_names_the_batch_row(): void ); try { - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(when(ref('c'), lit(0), new FailingOnValuesFunction(ref('v'), [50])), $rows->schema()) ->eval($rows, flow_context()->backend()); static::fail('expected an EvaluationException'); @@ -181,7 +181,7 @@ public function test_a_branch_runs_only_on_the_rows_that_reach_it(): void static::assertSame( [1, 0, 3, 0, 0, 50], - (new ReferenceResolver()) + new ReferenceResolver() ->resolve(when(ref('c'), new FailingOnValuesFunction(ref('v'), [99]), lit(0)), $rows->schema()) ->eval($rows, flow_context()->backend()) ->values(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/FrameAccumulationTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/FrameAccumulationTest.php index 15f2f38fca..a7232e7e0d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/FrameAccumulationTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/FrameAccumulationTest.php @@ -211,7 +211,7 @@ public function test_a_frame_aggregate_over_floats_with_nulls_and_ties( WindowFrame $frame, array $expected, ): void { - static::assertSame($expected, (new FrameAccumulation($frame))->values( + static::assertSame($expected, new FrameAccumulation($frame)->values( $function, array_to_rows( [ @@ -239,7 +239,7 @@ public function test_a_frame_aggregate_over_integers_past_the_int_range( WindowFrame $frame, array $expected, ): void { - static::assertSame($expected, (new FrameAccumulation($frame))->values( + static::assertSame($expected, new FrameAccumulation($frame)->values( $function, array_to_rows([ ['v' => PHP_INT_MAX], @@ -257,7 +257,7 @@ public function test_an_empty_partition_has_no_values(): void { static::assertSame( [], - (new FrameAccumulation(new RowsFrame(preceding(1), following(1))))->values( + new FrameAccumulation(new RowsFrame(preceding(1), following(1)))->values( sum(ref('id')), RowsMother::empty(), flow_context()->backend(), @@ -272,7 +272,7 @@ public function test_a_one_row_partition_frames_only_that_row(): void static::assertSame( [1.0], - (new FrameAccumulation(new RowsFrame(preceding(1), following(1))))->values( + new FrameAccumulation(new RowsFrame(preceding(1), following(1)))->values( sum(ref('id')), $one, flow_context()->backend(), @@ -281,7 +281,7 @@ public function test_a_one_row_partition_frames_only_that_row(): void ); static::assertSame( [0], - (new FrameAccumulation(new RowsFrame(preceding(1), preceding(1))))->values( + new FrameAccumulation(new RowsFrame(preceding(1), preceding(1)))->values( count(), $one, flow_context()->backend(), @@ -296,7 +296,7 @@ public function test_a_whole_partition_frame_hands_every_row_the_same_bounds_in_ static::assertSame( [15.0, 15.0, 15.0, 15.0, 15.0], - (new FrameAccumulation(new WholePartitionFrame()))->values( + new FrameAccumulation(new WholePartitionFrame())->values( $function, RowsMother::sequentialIds(5), flow_context()->backend(), @@ -312,7 +312,7 @@ public function test_a_rows_frame_hands_every_row_its_own_bounds_in_one_call(): static::assertSame( [1.0, 3.0, 5.0, 7.0, 9.0], - (new FrameAccumulation(new RowsFrame(preceding(1), current_row())))->values( + new FrameAccumulation(new RowsFrame(preceding(1), current_row()))->values( $function, RowsMother::sequentialIds(5), flow_context()->backend(), @@ -326,7 +326,7 @@ public function test_a_rows_frame_reads_only_the_rows_between_its_bounds(): void { static::assertSame( [1.0, 3.0, 6.0, 9.0, 12.0], - (new FrameAccumulation(new RowsFrame(preceding(2), current_row())))->values( + new FrameAccumulation(new RowsFrame(preceding(2), current_row()))->values( new CountingFrameAccumulating(ref('id')), RowsMother::sequentialIds(5), flow_context()->backend(), @@ -341,7 +341,7 @@ public function test_a_peer_frame_grows_through_ties(): void static::assertSame( [3.0, 3.0, 10.0, 10.0, 15.0], - (new FrameAccumulation(new PeerFrame([ref('d')->asc()])))->values( + new FrameAccumulation(new PeerFrame([ref('d')->asc()]))->values( $function, array_to_rows( [ @@ -364,7 +364,7 @@ public function test_an_empty_frame_gives_the_value_of_nothing_accumulated(): vo { static::assertSame( [null, null, null], - (new FrameAccumulation(new RowsFrame(preceding(10), preceding(5))))->values( + new FrameAccumulation(new RowsFrame(preceding(10), preceding(5)))->values( sum(ref('id'))->over(window()), RowsMother::sequentialIds(3), flow_context()->backend(), @@ -391,7 +391,7 @@ public function test_a_frame_aggregate_reads_its_column_once_per_partition( $calls = new ArrayObject(); $schema = schema(int_schema('v')); - static::assertSame($expected, (new FrameAccumulation(new RowsFrame(preceding(2), current_row())))->values( + static::assertSame($expected, new FrameAccumulation(new RowsFrame(preceding(2), current_row()))->values( $function, Rows::fromColumns( $schema, @@ -415,7 +415,7 @@ public function test_bounds_are_resolved_once_per_row(): void static::assertSame( [6.0, 6.0, 6.0, 6.0, 6.0], - (new FrameAccumulation($frame))->values( + new FrameAccumulation($frame)->values( new CountingFrameAccumulating(ref('id')), RowsMother::sequentialIds(5), flow_context()->backend(), @@ -430,7 +430,7 @@ public function test_reports_the_bounds_of_a_long_partition_in_chunks(): void $progress = new ProgressSpy(); $function = new CountingFrameAccumulating(ref('id')); - (new FrameAccumulation(new RowsFrame(preceding(1), current_row())))->values( + new FrameAccumulation(new RowsFrame(preceding(1), current_row()))->values( $function, RowsMother::sequentialIds(2500), flow_context()->backend(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/PeerFrameTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/PeerFrameTest.php index 21baca791a..db418a48bd 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/PeerFrameTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/PeerFrameTest.php @@ -86,7 +86,7 @@ public function test_datetime_peers_are_matched_by_value_not_identity(): void public function test_index_past_the_partition_end_is_empty(): void { - static::assertSame([1, 0], (new PeerFrame([ref('d')->asc()]))->bounds(0, rows(schema()))); + static::assertSame([1, 0], new PeerFrame([ref('d')->asc()])->bounds(0, rows(schema()))); } public function test_multiple_order_by_references_must_all_match(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/RowsFrameTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/RowsFrameTest.php index ef8ae79fb5..524da6060c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/RowsFrameTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/RowsFrameTest.php @@ -28,81 +28,57 @@ public function test_describe_round_trips(): void public function test_centred_frame_clamps_at_the_first_index(): void { - static::assertSame( - [0, 1], - (new RowsFrame(preceding(1), following(1)))->bounds(0, RowsMother::sequentialIds(5)), - ); + static::assertSame([0, 1], new RowsFrame(preceding(1), following(1))->bounds(0, RowsMother::sequentialIds(5))); } public function test_centred_frame_clamps_at_the_last_index(): void { - static::assertSame( - [3, 4], - (new RowsFrame(preceding(1), following(1)))->bounds(4, RowsMother::sequentialIds(5)), - ); + static::assertSame([3, 4], new RowsFrame(preceding(1), following(1))->bounds(4, RowsMother::sequentialIds(5))); } public function test_empty_partition_yields_an_empty_frame(): void { static::assertSame( [1, 0], - (new RowsFrame(unbounded_preceding(), unbounded_following()))->bounds(0, rows(schema())), + new RowsFrame(unbounded_preceding(), unbounded_following())->bounds(0, rows(schema())), ); } public function test_frame_entirely_after_the_partition_end_is_empty(): void { - static::assertSame( - [1, 0], - (new RowsFrame(following(5), following(10)))->bounds(4, RowsMother::sequentialIds(5)), - ); + static::assertSame([1, 0], new RowsFrame(following(5), following(10))->bounds(4, RowsMother::sequentialIds(5))); } public function test_frame_entirely_before_the_partition_start_is_empty(): void { - static::assertSame( - [1, 0], - (new RowsFrame(preceding(10), preceding(5)))->bounds(0, RowsMother::sequentialIds(5)), - ); + static::assertSame([1, 0], new RowsFrame(preceding(10), preceding(5))->bounds(0, RowsMother::sequentialIds(5))); } public function test_preceding_to_current_row_clamps_at_the_first_index(): void { - static::assertSame( - [0, 0], - (new RowsFrame(preceding(2), current_row()))->bounds(0, RowsMother::sequentialIds(5)), - ); + static::assertSame([0, 0], new RowsFrame(preceding(2), current_row())->bounds(0, RowsMother::sequentialIds(5))); } public function test_preceding_to_current_row_in_the_middle_of_the_partition(): void { - static::assertSame( - [1, 3], - (new RowsFrame(preceding(2), current_row()))->bounds(3, RowsMother::sequentialIds(5)), - ); + static::assertSame([1, 3], new RowsFrame(preceding(2), current_row())->bounds(3, RowsMother::sequentialIds(5))); } public function test_single_row_partition(): void { - static::assertSame( - [0, 0], - (new RowsFrame(preceding(2), following(2)))->bounds(0, RowsMother::sequentialIds(1)), - ); + static::assertSame([0, 0], new RowsFrame(preceding(2), following(2))->bounds(0, RowsMother::sequentialIds(1))); } public function test_start_after_end_is_empty(): void { - static::assertSame( - [1, 0], - (new RowsFrame(following(1), preceding(1)))->bounds(2, RowsMother::sequentialIds(5)), - ); + static::assertSame([1, 0], new RowsFrame(following(1), preceding(1))->bounds(2, RowsMother::sequentialIds(5))); } public function test_unbounded_to_unbounded_covers_the_whole_partition(): void { static::assertSame( [0, 4], - (new RowsFrame(unbounded_preceding(), unbounded_following()))->bounds(2, RowsMother::sequentialIds(5)), + new RowsFrame(unbounded_preceding(), unbounded_following())->bounds(2, RowsMother::sequentialIds(5)), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/WholePartitionFrameTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/WholePartitionFrameTest.php index 43f10e3dd0..fbda51cd6e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/WholePartitionFrameTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/Window/WholePartitionFrameTest.php @@ -32,11 +32,11 @@ public function test_covers_the_whole_partition_regardless_of_the_index(): void public function test_empty_partition_yields_an_empty_frame(): void { - static::assertSame([0, -1], (new WholePartitionFrame())->bounds(0, rows(schema()))); + static::assertSame([0, -1], new WholePartitionFrame()->bounds(0, rows(schema()))); } public function test_single_row_partition(): void { - static::assertSame([0, 0], (new WholePartitionFrame())->bounds(0, RowsMother::sequentialIds(1))); + static::assertSame([0, 0], new WholePartitionFrame()->bounds(0, RowsMother::sequentialIds(1))); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/WordwrapTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/WordwrapTest.php index 7730cd13ac..e3b5fab571 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/WordwrapTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/WordwrapTest.php @@ -20,7 +20,7 @@ final class WordwrapTest extends FlowTestCase { public function test_empty_string(): void { - static::assertEquals('', (new FunctionContext(flow_context()))->eval( + static::assertEquals('', new FunctionContext(flow_context())->eval( ref('str')->wordwrap(10), ['str' => ''], schema(str_schema('str')), @@ -29,7 +29,7 @@ public function test_empty_string(): void public function test_normal_word_wrapping(): void { - static::assertEquals("The quick\nbrown fox\njumps", (new FunctionContext(flow_context()))->eval( + static::assertEquals("The quick\nbrown fox\njumps", new FunctionContext(flow_context())->eval( ref('str')->wordwrap(10), ['str' => 'The quick brown fox jumps'], schema(str_schema('str')), @@ -38,7 +38,7 @@ public function test_normal_word_wrapping(): void public function test_null_break_character(): void { - static::assertEquals("Hello\nWorld Test", (new FunctionContext(flow_context()))->eval( + static::assertEquals("Hello\nWorld Test", new FunctionContext(flow_context())->eval( ref('str')->wordwrap(10, ref('break')), ['str' => 'Hello World Test', 'break' => null], schema(str_schema('str'), str_schema('break', nullable: true)), @@ -50,7 +50,7 @@ public function test_null_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Wordwrap function requires non-null value'); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('str')->wordwrap(10), ['str' => null], schema(str_schema('str', nullable: true)), @@ -59,7 +59,7 @@ public function test_null_value(): void public function test_a_long_word_is_not_cut_by_default(): void { - static::assertSame('abcdef', (new FunctionContext(flow_context()))->eval( + static::assertSame('abcdef', new FunctionContext(flow_context())->eval( ref('s')->wordwrap(3), ['s' => 'abcdef'], schema(str_schema('s')), @@ -68,7 +68,7 @@ public function test_a_long_word_is_not_cut_by_default(): void public function test_text_shorter_than_width(): void { - static::assertEquals('Hello', (new FunctionContext(flow_context()))->eval( + static::assertEquals('Hello', new FunctionContext(flow_context())->eval( ref('str')->wordwrap(20), ['str' => 'Hello'], schema(str_schema('str')), @@ -77,7 +77,7 @@ public function test_text_shorter_than_width(): void public function test_width_zero(): void { - static::assertEquals('Hello World', (new FunctionContext(flow_context()))->eval( + static::assertEquals('Hello World', new FunctionContext(flow_context())->eval( ref('str')->wordwrap(0), ['str' => 'Hello World'], schema(str_schema('str')), @@ -88,7 +88,7 @@ public function test_width_zero_keeps_every_row(): void { static::assertSame( ['Hello World', 'Bye World'], - (new FunctionContext(flow_context())) + new FunctionContext(flow_context()) ->column( ref('str')->wordwrap(0), [['str' => 'Hello World'], ['str' => 'Bye World']], @@ -100,7 +100,7 @@ public function test_width_zero_keeps_every_row(): void public function test_does_not_cut_words_by_default(): void { - static::assertSame('Hello', (new FunctionContext(flow_context()))->eval( + static::assertSame('Hello', new FunctionContext(flow_context())->eval( new Wordwrap(ref('str'), 3), ['str' => 'Hello'], schema(str_schema('str')), @@ -109,7 +109,7 @@ public function test_does_not_cut_words_by_default(): void public function test_null_cut_does_not_cut_words(): void { - static::assertSame('Hello', (new FunctionContext(flow_context()))->eval( + static::assertSame('Hello', new FunctionContext(flow_context())->eval( ref('str')->wordwrap(3, "\n", ref('cut')), ['str' => 'Hello', 'cut' => null], schema(str_schema('str'), bool_schema('cut', nullable: true)), @@ -118,7 +118,7 @@ public function test_null_cut_does_not_cut_words(): void public function test_with_scalar_function_break(): void { - static::assertEquals('Hello | World Test', (new FunctionContext(flow_context()))->eval( + static::assertEquals('Hello | World Test', new FunctionContext(flow_context())->eval( ref('str')->wordwrap(10, ref('break')), ['str' => 'Hello World Test', 'break' => ' | '], schema(str_schema('str'), str_schema('break')), @@ -127,7 +127,7 @@ public function test_with_scalar_function_break(): void public function test_with_scalar_function_cut(): void { - static::assertEquals("Hel\nlo", (new FunctionContext(flow_context()))->eval( + static::assertEquals("Hel\nlo", new FunctionContext(flow_context())->eval( ref('str')->wordwrap(3, "\n", ref('cut')), ['str' => 'Hello', 'cut' => true], schema(str_schema('str'), bool_schema('cut')), @@ -136,7 +136,7 @@ public function test_with_scalar_function_cut(): void public function test_with_scalar_function_width(): void { - static::assertEquals("Hello\nWorld\nTest", (new FunctionContext(flow_context()))->eval( + static::assertEquals("Hello\nWorld\nTest", new FunctionContext(flow_context())->eval( ref('str')->wordwrap(ref('width')), ['str' => 'Hello World Test', 'width' => 8], schema(str_schema('str'), int_schema('width')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/XPathTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/XPathTest.php index ff520fe75d..b07035cb35 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/XPathTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Functions/XPathTest.php @@ -24,7 +24,7 @@ public function test_xpath_on_simple_xml_with_only_one_node_returned(): void static::assertInstanceOf(DOMElement::class, $xml->documentElement); static::assertEquals( [$xml->documentElement->firstChild], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->xpath('/root/foo'), ['value' => $xml], schema(xml_schema('value')), @@ -43,7 +43,7 @@ public function test_xpath_when_there_are_more_than_one_elements_under_given_pat $xml->documentElement->firstChild, $xml->documentElement->lastChild, ], - (new FunctionContext(flow_context()))->eval( + new FunctionContext(flow_context())->eval( ref('value')->xpath('/root/foo'), ['value' => $xml], schema(xml_schema('value')), @@ -56,7 +56,7 @@ public function test_xpath_with_invalid_path_syntax(): void $xml = new DOMDocument(); $xml->loadXML('bar'); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('value')->xpath('/root/foo/asa'), ['value' => $xml], schema(xml_schema('value')), @@ -68,7 +68,7 @@ public function test_xpath_with_non_existing_path(): void $xml = new DOMDocument(); $xml->loadXML('bar'); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('value')->xpath('/root/bar'), ['value' => $xml], schema(xml_schema('value')), @@ -80,12 +80,12 @@ public function test_xpath_selecting_non_element_nodes_returns_null(): void $xml = new DOMDocument(); $xml->loadXML('bar'); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('value')->xpath('/root/foo/text()'), ['value' => $xml], schema(xml_schema('value')), )); - static::assertNull((new FunctionContext(flow_context()))->eval( + static::assertNull(new FunctionContext(flow_context())->eval( ref('value')->xpath('/root/foo/@baz'), ['value' => $xml], schema(xml_schema('value')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/CriteriaTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/CriteriaTest.php index 1fcda407cb..d7dcb3eeba 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/CriteriaTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/CriteriaTest.php @@ -43,7 +43,7 @@ public function test_a_limit_below_one_is_refused(int $limit): void public function test_a_zero_offset_is_accepted_and_keeps_the_offset(): void { - static::assertSame(2, (new Criteria())->withOffset(2)->withOffset(0)->offset); + static::assertSame(2, new Criteria()->withOffset(2)->withOffset(0)->offset); } public function test_a_filter_appends_its_conjuncts_in_push_order(): void @@ -52,7 +52,7 @@ public function test_a_filter_appends_its_conjuncts_in_push_order(): void $second = ref('id')->lessThan(lit(10)); $third = ref('id')->notEquals(lit(5)); - $criteria = (new Criteria(5)) + $criteria = new Criteria(5) ->withFilter($first) ->withFilter($second->and($third)); @@ -64,7 +64,7 @@ public function test_a_filter_appends_its_conjuncts_in_push_order(): void public function test_a_second_limit_only_lowers_the_first_and_keeps_the_conjuncts(): void { $filter = ref('id')->greaterThan(lit(1)); - $criteria = (new Criteria()) + $criteria = new Criteria() ->withFilter($filter) ->withLimit(5); @@ -72,7 +72,7 @@ public function test_a_second_limit_only_lowers_the_first_and_keeps_the_conjunct static::assertSame(5, $criteria->withLimit(8)->limit); static::assertSame([$filter], $criteria->withLimit(8)->conjuncts); static::assertTrue( - (new Criteria()) + new Criteria() ->withLimit(1) ->narrows(), ); @@ -84,7 +84,7 @@ public function test_path_filters_compose_and_keep_the_conjuncts(): void $first = new RejectingFilter(); $second = new RejectingFilter(); - $criteria = (new Criteria()) + $criteria = new Criteria() ->withFilter($filter) ->withPathFilter($first) ->withPathFilter($second); @@ -92,7 +92,7 @@ public function test_path_filters_compose_and_keep_the_conjuncts(): void static::assertEquals(new Filters(new OnlyFiles(), $first, $second), $criteria->pathFilter); static::assertSame([$filter], $criteria->conjuncts); static::assertTrue( - (new Criteria()) + new Criteria() ->withPathFilter($first) ->narrows(), ); @@ -100,7 +100,7 @@ public function test_path_filters_compose_and_keep_the_conjuncts(): void public function test_a_split_narrows(): void { - $criteria = (new Criteria())->withSplit(new FileSplit(path('memory://orders.csv'), 0, 1_024)); + $criteria = new Criteria()->withSplit(new FileSplit(path('memory://orders.csv'), 0, 1_024)); static::assertTrue($criteria->narrows()); static::assertSame(0, $criteria->split?->start); @@ -112,7 +112,7 @@ public function test_with_split_keeps_limit_path_filter_and_conjuncts_and_every_ $pathFilter = new RejectingFilter(); $split = new FileSplit(path('memory://orders.csv'), 1_024, 1_024); - $criteria = (new Criteria(5)) + $criteria = new Criteria(5) ->withFilter($filter) ->withPathFilter($pathFilter) ->withSplit($split); @@ -128,17 +128,17 @@ public function test_with_split_keeps_limit_path_filter_and_conjuncts_and_every_ public function test_pushed_columns_keep_each_name_once(): void { - static::assertSame(['a', 'b'], (new Criteria())->withColumns('a', 'b', 'a')->columns); + static::assertSame(['a', 'b'], new Criteria()->withColumns('a', 'b', 'a')->columns); } public function test_a_second_push_of_columns_keeps_only_the_columns_both_name_in_the_first_order(): void { - static::assertSame(['a', 'c'], (new Criteria())->withColumns('a', 'b', 'c')->withColumns('c', 'a')->columns); + static::assertSame(['a', 'c'], new Criteria()->withColumns('a', 'b', 'c')->withColumns('c', 'a')->columns); } public function test_pushed_columns_survive_every_other_push(): void { - $criteria = (new Criteria())->withColumns('a', 'b'); + $criteria = new Criteria()->withColumns('a', 'b'); static::assertSame(['a', 'b'], $criteria->withFilter(ref('a')->greaterThan(lit(1)))->columns); static::assertSame(['a', 'b'], $criteria->withLimit(3)->columns); @@ -157,7 +157,7 @@ public function test_an_offset_below_zero_is_refused(): void public function test_an_offset_narrows(): void { - static::assertTrue((new Criteria(offset: 1))->narrows()); + static::assertTrue(new Criteria(offset: 1)->narrows()); } public function test_offsets_add_up_and_keep_limit_path_filter_and_conjuncts(): void @@ -165,7 +165,7 @@ public function test_offsets_add_up_and_keep_limit_path_filter_and_conjuncts(): $filter = ref('id')->greaterThan(lit(1)); $pathFilter = new RejectingFilter(); - $criteria = (new Criteria(5)) + $criteria = new Criteria(5) ->withFilter($filter) ->withPathFilter($pathFilter) ->withOffset(3) @@ -185,7 +185,7 @@ public function test_a_negative_offset_push_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Offset must be greater than or equal to 0, given: -1'); - (new Criteria(offset: 5))->withOffset(-1); + new Criteria(offset: 5)->withOffset(-1); } public function test_a_read_with_an_offset_cannot_be_split(): void @@ -193,7 +193,7 @@ public function test_a_read_with_an_offset_cannot_be_split(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('A read with an offset cannot be split, given offset: 3'); - (new Criteria(offset: 3))->withSplit(new FileSplit(path('memory://orders.csv'), 0, 1_024)); + new Criteria(offset: 3)->withSplit(new FileSplit(path('memory://orders.csv'), 0, 1_024)); } public function test_a_split_read_refuses_an_offset(): void @@ -201,7 +201,7 @@ public function test_a_split_read_refuses_an_offset(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('A read with an offset cannot be split, given offset: 3'); - (new Criteria()) + new Criteria() ->withSplit(new FileSplit(path('memory://orders.csv'), 0, 1_024)) ->withOffset(3); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/FeedExtractorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/FeedExtractorTest.php index 8667da30c0..e74c4c259f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/FeedExtractorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/FeedExtractorTest.php @@ -24,7 +24,7 @@ final class FeedExtractorTest extends FlowTestCase { public function test_extract_outside_a_fiber_fails(): void { - $generator = (new FeedExtractor(schema(int_schema('id'))))->extract( + $generator = new FeedExtractor(schema(int_schema('id')))->extract( flow_context(config())->backend(), new Criteria(), ); @@ -64,7 +64,7 @@ public function test_it_describes_the_shape_it_was_seeded_with(): void { static::assertEquals( schema(int_schema('id'), str_schema('name')), - (new FeedExtractor(schema(int_schema('id'), str_schema('name'))))->schema(), + new FeedExtractor(schema(int_schema('id'), str_schema('name')))->schema(), ); } @@ -144,7 +144,7 @@ public function test_with_schema_replaces_the_seeded_shape(): void { static::assertEquals( schema(str_schema('name')), - (new FeedExtractor(schema(int_schema('id')))) + new FeedExtractor(schema(int_schema('id'))) ->withSchema(schema(str_schema('name'))) ->schema(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/ByteUnitTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/ByteUnitTest.php index b503a14d8f..f9a6f4e7ca 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/ByteUnitTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/ByteUnitTest.php @@ -27,7 +27,7 @@ public function test_a_negative_value_is_rejected(int $start, int $bytes, int $r #[TestWith([100, 0, 100])] public function test_the_midpoint_is_the_start_plus_half_the_bytes(int $start, int $bytes, int $midpoint): void { - static::assertSame($midpoint, (new ByteUnit($start, $bytes, 1))->midpoint()); + static::assertSame($midpoint, new ByteUnit($start, $bytes, 1)->midpoint()); } public function test_zero_is_accepted_everywhere(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/DerivedFromFilesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/DerivedFromFilesTest.php index cd5f253e69..746e9351b9 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/DerivedFromFilesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/DerivedFromFilesTest.php @@ -23,7 +23,7 @@ final class DerivedFromFilesTest extends FlowTestCase { public function test_an_empty_listing_derives_an_empty_schema(): void { - static::assertEquals(schema(), (new DerivedFromFiles())->fold( + static::assertEquals(schema(), new DerivedFromFiles()->fold( SelfDescribingFilesContext::describing()->generator(), false, )); @@ -33,7 +33,7 @@ public function test_an_empty_listing_folds_zero_rows_and_zero_bytes(): void { static::assertEquals( new Statistics(rows: Cardinality::exact(0), size: Cardinality::exact(0)), - (new DerivedFromFiles())->footers(SelfDescribingFilesContext::describing()->generator(), false)->of(0), + new DerivedFromFiles()->footers(SelfDescribingFilesContext::describing()->generator(), false)->of(0), ); } @@ -41,7 +41,7 @@ public function test_every_file_but_the_first_is_closed_the_first_stays_with_its { $files = SelfDescribingFilesContext::describing(schema(int_schema('id')), schema(str_schema('name'))); - (new DerivedFromFiles())->fold($files->generator(), true); + new DerivedFromFiles()->fold($files->generator(), true); static::assertSame(array_slice($files->files, 1), $files->closed()); } @@ -51,7 +51,7 @@ public function test_a_first_file_that_cannot_describe_itself_stays_with_its_own $files = SelfDescribingFilesContext::failing(); try { - (new DerivedFromFiles())->fold($files->generator(), false); + new DerivedFromFiles()->fold($files->generator(), false); } catch (RuntimeException) { static::assertSame([], $files->closed()); @@ -65,7 +65,7 @@ public function test_the_fold_stops_at_the_first_file(): void { $files = SelfDescribingFilesContext::describing(schema(int_schema('id')), schema(str_schema('name'))); - static::assertEquals(schema(int_schema('id')), (new DerivedFromFiles())->fold($files->generator(), false)); + static::assertEquals(schema(int_schema('id')), new DerivedFromFiles()->fold($files->generator(), false)); static::assertSame(1, $files->advanced); } @@ -86,7 +86,7 @@ public function test_union_by_name_folds_every_file(): void static::assertEquals( schema(int_schema('id', nullable: true), str_schema('name', nullable: true)), - (new DerivedFromFiles())->fold($files->generator(), true), + new DerivedFromFiles()->fold($files->generator(), true), ); static::assertSame(2, $files->advanced); } @@ -104,14 +104,14 @@ public function test_the_fold_remembers_the_file_it_read_first(): void public function test_nothing_folded_was_read_from_no_file(): void { - static::assertSame('', (new DerivedFromFiles())->from()); + static::assertSame('', new DerivedFromFiles()->from()); } public function test_footers_count_the_files_the_fold_read(): void { static::assertSame( 2, - (new DerivedFromFiles())->footers( + new DerivedFromFiles()->footers( SelfDescribingFilesContext::describing(schema(int_schema('id')), schema(int_schema('id')))->generator(), true, )->files, @@ -185,7 +185,7 @@ public function test_a_later_file_that_cannot_describe_itself_is_closed(): void ); try { - (new DerivedFromFiles())->fold($files->generator(), true); + new DerivedFromFiles()->fold($files->generator(), true); } catch (RuntimeException) { static::assertSame([$files->files[1]], $files->closed()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/DerivedSchemaTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/DerivedSchemaTest.php index f01c736149..855ae7e9c7 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/DerivedSchemaTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/DerivedSchemaTest.php @@ -18,7 +18,7 @@ public function test_a_file_of_the_derived_schema_passes(): void { $this->expectNotToPerformAssertions(); - (new DerivedSchema(schema(int_schema('id')), 'memory://a.floe'))->refuseDivergence( + new DerivedSchema(schema(int_schema('id')), 'memory://a.floe')->refuseDivergence( 'memory://b.floe', schema(int_schema('id')), ); @@ -29,7 +29,7 @@ public function test_a_file_of_another_schema_is_refused_naming_both_files(): vo $this->expectException(InferredSchemaException::class); $this->expectExceptionMessage('memory://b.floe'); - (new DerivedSchema(schema(int_schema('id')), 'memory://a.floe'))->refuseDivergence( + new DerivedSchema(schema(int_schema('id')), 'memory://a.floe')->refuseDivergence( 'memory://b.floe', schema(str_schema('name')), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileColumnsSourceTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileColumnsSourceTest.php index 066d93a0fa..87c01e93e3 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileColumnsSourceTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileColumnsSourceTest.php @@ -45,11 +45,11 @@ public function test_the_withers_share_the_listing(): void public function test_the_columns_carry_the_declared_partition_types_and_the_metadata_flag(): void { - $source = (new FileColumnsSource( + $source = new FileColumnsSource( new SourceFiles(MemoryFiles::with([ 'memory://orders/year=2024/a.csv' => 'id', ]), path('memory://orders/*/*.csv')), - )) + ) ->withPartitionTypes(partition_types(year: type_integer())) ->withMetadataColumns(true); @@ -66,8 +66,8 @@ public function test_the_columns_carry_the_declared_partition_types_and_the_meta public function test_no_partition_type_is_declared_by_default(): void { static::assertEquals( - (new PartitionTypes())->normalize(), - (new FileColumnsSource(new SourceFiles(MemoryFiles::with([]), path('memory://orders/*.csv')))) + new PartitionTypes()->normalize(), + new FileColumnsSource(new SourceFiles(MemoryFiles::with([]), path('memory://orders/*.csv'))) ->columns() ->normalize()['partition_types'], ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileConstantsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileConstantsTest.php index 52d05432ce..5413d15f7e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileConstantsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileConstantsTest.php @@ -17,14 +17,14 @@ final class FileConstantsTest extends FlowTestCase { public function test_values_are_empty_without_metadata_columns_and_partitions(): void { - static::assertSame([], (new FileConstants(null, [], []))->values()); + static::assertSame([], new FileConstants(null, [], [])->values()); } public function test_values_carry_the_uri_when_metadata_columns_are_on(): void { static::assertSame( ['_input_file_uri' => 'memory://orders/data.csv'], - (new FileConstants('memory://orders/data.csv', [], []))->values(), + new FileConstants('memory://orders/data.csv', [], [])->values(), ); } @@ -32,11 +32,11 @@ public function test_values_carry_every_partition_and_null_for_one_the_path_lack { static::assertSame( ['_input_file_uri' => 'memory://orders/year=2024/data.csv', 'year' => 2024, 'month' => null], - (new FileConstants( + new FileConstants( 'memory://orders/year=2024/data.csv', ['year' => false, 'month' => true], ['year' => 2024], - ))->values(), + )->values(), ); } @@ -44,11 +44,7 @@ public function test_fill_rows_returns_a_batch_with_nothing_to_add_as_it_is(): v { $rows = array_to_rows([['name' => 'Norbert']], schema(str_schema('name'))); - static::assertSame($rows, (new FileConstants(null, [], []))->fillRows( - $rows, - $rows->schema(), - new PhpBackend(), - )); + static::assertSame($rows, new FileConstants(null, [], [])->fillRows($rows, $rows->schema(), new PhpBackend())); } public function test_fill_rows_adds_the_constants_to_every_row_under_the_declared_schema(): void @@ -60,7 +56,7 @@ public function test_fill_rows_adds_the_constants_to_every_row_under_the_declare ['name' => 'Norbert', '_input_file_uri' => 'memory://orders/data.csv', 'year' => 2024], ['name' => 'Flow', '_input_file_uri' => 'memory://orders/data.csv', 'year' => 2024], ], $declared), - (new FileConstants('memory://orders/data.csv', ['year' => false], ['year' => 2024]))->fillRows( + new FileConstants('memory://orders/data.csv', ['year' => false], ['year' => 2024])->fillRows( array_to_rows([ ['name' => 'Norbert'], ['name' => 'Flow'], diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileMetadataRowTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileMetadataRowTest.php index f91ec7fc35..54b6311911 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileMetadataRowTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileMetadataRowTest.php @@ -16,8 +16,8 @@ final class FileMetadataRowTest extends FlowTestCase public function test_the_schema_names_every_column_of_the_row_and_no_partition_column(): void { static::assertSame( - array_keys((new FileMetadataRow())->row(new FileStatus(path('memory://dir/year=2024/a.csv'), true))), - (new FileMetadataRow())->schema()->names(), + array_keys(new FileMetadataRow()->row(new FileStatus(path('memory://dir/year=2024/a.csv'), true))), + new FileMetadataRow()->schema()->names(), ); } @@ -33,14 +33,14 @@ public function test_a_file_is_described_by_its_path_names_kind_and_extension(): 'is_dir' => false, 'extension' => 'csv', ], - (new FileMetadataRow())->row(new FileStatus(path('memory://dir/a.csv'), true)), + new FileMetadataRow()->row(new FileStatus(path('memory://dir/a.csv'), true)), ); } public function test_the_extension_column_is_nullable(): void { static::assertTrue( - (new FileMetadataRow()) + new FileMetadataRow() ->schema() ->get('extension') ->isNullable(), @@ -49,6 +49,6 @@ public function test_the_extension_column_is_nullable(): void public function test_a_file_without_an_extension_has_a_null_extension(): void { - static::assertNull((new FileMetadataRow())->row(new FileStatus(path('memory://dir/a'), true))['extension']); + static::assertNull(new FileMetadataRow()->row(new FileStatus(path('memory://dir/a'), true))['extension']); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileReadLoopTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileReadLoopTest.php index d80967adfd..2af4864e4d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileReadLoopTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileReadLoopTest.php @@ -37,7 +37,7 @@ public function test_every_batch_carries_its_files_constants(): void [[['id' => 1, 'year' => '2023'], ['id' => 2, 'year' => '2023']], [['id' => 3, 'year' => '2024']]], array_map(static fn(CorruptedRecordException|Rows $batch): array => ( $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] - ), iterator_to_array((new FileReadLoop(FileReadMother::of(schema(int_schema('id'), str_schema('year')), FileColumnsContext::discovering(), 10)))->read([ + ), iterator_to_array(new FileReadLoop(FileReadMother::of(schema(int_schema('id'), str_schema('year')), FileColumnsContext::discovering(), 10))->read([ new SourceFile(path('memory://orders/year=2023/a.csv')), new SourceFile(path('memory://orders/year=2024/b.csv')), ], new InMemoryFileBatches([ @@ -61,10 +61,10 @@ public function test_a_corrupted_record_passes_through_outside_the_filter_and_th $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] ), iterator_to_array( - (new FileReadLoop( + new FileReadLoop( FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10), new Criteria(conjuncts: [ref('id')->greaterThan(lit(1))]), - ))->read( + )->read( [new SourceFile(path('memory://a.csv'))], new InMemoryFileBatches(['memory://a.csv' => [1, 2, 3]], corrupted: [ 'memory://a.csv' => new CorruptedRecordException('memory://a.csv', 4, 2, 'reason', 'x'), @@ -89,10 +89,10 @@ public function test_a_filter_a_file_yields_applies_to_that_file_only(): void $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] ), iterator_to_array( - (new FileReadLoop( + new FileReadLoop( FileReadMother::of($schema, FileColumnsContext::discovering(names: []), 10), new Criteria(conjuncts: [ref('id')->greaterThan(lit(1))]), - ))->read( + )->read( [new SourceFile(path('memory://a.parquet')), new SourceFile(path('memory://b.parquet'))], new InMemoryFileBatches(['memory://a.parquet' => [1, 2, 3], 'memory://b.parquet' => [1, 5]], [ 'memory://a.parquet' => Filter::bind($schema), @@ -108,11 +108,11 @@ public function test_a_filter_a_file_yields_applies_to_that_file_only(): void public function test_stop_after_the_first_batch_ends_the_read(): void { - $read = (new FileReadLoop(FileReadMother::of( + $read = new FileReadLoop(FileReadMother::of( schema(int_schema('id')), FileColumnsContext::discovering(names: []), 1, - )))->read( + ))->read( [new SourceFile(path('memory://a.csv')), new SourceFile(path('memory://b.csv'))], new InMemoryFileBatches(['memory://a.csv' => [1, 2, 3], 'memory://b.csv' => [4]]), flow_context()->backend(), @@ -137,7 +137,7 @@ public function test_a_limit_inside_a_file_ends_the_read_and_is_pushed_down(): v [[['id' => 1], ['id' => 2]]], array_map(static fn(CorruptedRecordException|Rows $batch): array => ( $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] - ), iterator_to_array((new FileReadLoop(FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10)))->read([new SourceFile(path('memory://a.csv')), new SourceFile(path('memory://b.csv'))], $batches, flow_context()->backend(), new ReadWindow(limit: 2)))), + ), iterator_to_array(new FileReadLoop(FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10))->read([new SourceFile(path('memory://a.csv')), new SourceFile(path('memory://b.csv'))], $batches, flow_context()->backend(), new ReadWindow(limit: 2)))), ); static::assertEquals(['memory://a.csv' => [new ReadWindow(0, 2)]], $batches->windows); } @@ -148,11 +148,11 @@ public function test_a_limit_at_a_file_boundary_opens_no_further_file(): void static::assertCount( 2, - iterator_to_array((new FileReadLoop(FileReadMother::of( + iterator_to_array(new FileReadLoop(FileReadMother::of( schema(int_schema('id')), FileColumnsContext::discovering(names: []), 1, - )))->read( + ))->read( [new SourceFile(path('memory://a.csv')), new SourceFile(path('memory://b.csv'))], $batches, flow_context()->backend(), @@ -174,7 +174,7 @@ public function test_the_offset_a_file_leaves_and_the_rows_still_wanted_reach_th [[['id' => 4]], [['id' => 5]]], array_map(static fn(CorruptedRecordException|Rows $batch): array => ( $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] - ), iterator_to_array((new FileReadLoop(FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10)))->read([ + ), iterator_to_array(new FileReadLoop(FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10))->read([ new SourceFile(path('memory://a.csv')), new SourceFile(path('memory://b.csv')), new SourceFile(path('memory://c.csv')), @@ -194,11 +194,11 @@ public function test_no_sources_read_nothing(): void { static::assertSame( [], - iterator_to_array((new FileReadLoop(FileReadMother::of( + iterator_to_array(new FileReadLoop(FileReadMother::of( schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10, - )))->read([], new InMemoryFileBatches([]), flow_context()->backend(), new ReadWindow())), + ))->read([], new InMemoryFileBatches([]), flow_context()->backend(), new ReadWindow())), ); } @@ -217,11 +217,11 @@ public function test_the_loop_slices_the_offset_a_format_cannot_skip_across_file $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] ), iterator_to_array( - (new FileReadLoop(FileReadMother::of( + new FileReadLoop(FileReadMother::of( schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10, - )))->read( + ))->read( [ new SourceFile(path('memory://a.csv')), new SourceFile(path('memory://b.csv')), @@ -256,11 +256,11 @@ public function test_the_loop_skips_the_offset_and_trims_to_the_limit_for_a_form $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] ), iterator_to_array( - (new FileReadLoop(FileReadMother::of( + new FileReadLoop(FileReadMother::of( schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10, - )))->read( + ))->read( [new SourceFile(path('memory://a.csv'))], $batches, flow_context()->backend(), @@ -282,10 +282,10 @@ public function test_a_filter_drops_the_rows_it_does_not_match_and_skips_a_batch $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] ), iterator_to_array( - (new FileReadLoop( + new FileReadLoop( FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 2), new Criteria(conjuncts: [ref('id')->greaterThan(lit(2))]), - ))->read( + )->read( [new SourceFile(path('memory://a.csv'))], new InMemoryFileBatches(['memory://a.csv' => [1, 2, 3, 4, 5]]), flow_context()->backend(), @@ -311,12 +311,12 @@ public function test_an_offset_counts_the_rows_the_filter_keeps_even_for_a_forma $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] ), iterator_to_array( - (new FileReadLoop( + new FileReadLoop( FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10), new Criteria(conjuncts: [ ref('id')->greaterThan(lit(2)), ]), - ))->read( + )->read( [new SourceFile(path('memory://a.csv')), new SourceFile(path('memory://b.csv'))], $batches, flow_context()->backend(), @@ -341,7 +341,7 @@ public function test_a_filter_mixing_a_body_and_a_partition_column_sees_the_part $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] ), iterator_to_array( - (new FileReadLoop( + new FileReadLoop( FileReadMother::of( schema(int_schema('id'), str_schema('year')), FileColumnsContext::discovering(), @@ -351,7 +351,7 @@ public function test_a_filter_mixing_a_body_and_a_partition_column_sees_the_part ref('year')->equals(lit('2024')), ref('id')->greaterThan(lit(3)), ]), - ))->read( + )->read( [ new SourceFile(path('memory://orders/year=2023/a.csv')), new SourceFile(path('memory://orders/year=2024/b.csv')), @@ -380,10 +380,10 @@ public function test_the_offset_and_the_limit_count_filtered_rows(): void $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] ), iterator_to_array( - (new FileReadLoop( + new FileReadLoop( FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10), new Criteria(conjuncts: [ref('id')->greaterThan(lit(5))]), - ))->read( + )->read( [new SourceFile(path('memory://a.csv'))], $batches, flow_context()->backend(), @@ -407,10 +407,10 @@ public function test_the_loop_skips_the_offset_after_the_filter_for_a_format_tha $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] ), iterator_to_array( - (new FileReadLoop( + new FileReadLoop( FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10), new Criteria(conjuncts: [ref('id')->greaterThan(lit(5))]), - ))->read( + )->read( [new SourceFile(path('memory://a.csv'))], $batches, flow_context()->backend(), @@ -438,10 +438,10 @@ public function test_a_limit_beside_a_filter_counts_matching_rows_across_files_a $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] ), iterator_to_array( - (new FileReadLoop( + new FileReadLoop( FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10), new Criteria(conjuncts: [ref('id')->greaterThan(lit(1))]), - ))->read( + )->read( [ new SourceFile(path('memory://a.csv')), new SourceFile(path('memory://b.csv')), @@ -472,10 +472,10 @@ public function test_the_rows_a_format_yields_after_its_skipped_rows_are_not_sli $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] ), iterator_to_array( - (new FileReadLoop( + new FileReadLoop( FileReadMother::of($schema, FileColumnsContext::discovering(names: []), 10), new Criteria(conjuncts: [ref('id')->greaterThan(lit(9))]), - ))->read( + )->read( [new SourceFile(path('memory://a.parquet'))], new InMemoryFileBatches( ['memory://a.parquet' => [10, 11, 12]], @@ -507,10 +507,10 @@ public function test_a_file_with_a_residual_between_exact_files_is_sliced_by_the $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] ), iterator_to_array( - (new FileReadLoop( + new FileReadLoop( FileReadMother::of($schema, FileColumnsContext::discovering(names: []), 10), new Criteria(conjuncts: [ref('id')->greaterThan(lit(2))]), - ))->read( + )->read( [ new SourceFile(path('memory://a.parquet')), new SourceFile(path('memory://b.parquet')), @@ -543,13 +543,13 @@ public function test_each_conjunct_of_the_filter_sees_only_the_rows_the_ones_bef $batch instanceof Rows ? $batch->toArray() : [$batch->getMessage()] ), iterator_to_array( - (new FileReadLoop( + new FileReadLoop( FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10), new Criteria(conjuncts: [ ref('id')->notEquals(lit(0)), lit(10)->divide(ref('id'))->greaterThan(lit(1)), ]), - ))->read( + )->read( [new SourceFile(path('memory://a.csv'))], new InMemoryFileBatches(['memory://a.csv' => [0, 2, 10]]), flow_context()->backend(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileReadTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileReadTest.php index 616ed8819b..c22436844c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileReadTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileReadTest.php @@ -61,12 +61,12 @@ public function test_a_rebuilt_batch_size_is_at_least_one_and_keeps_one(): void public function test_a_read_skips_the_offset_of_its_criteria(): void { - $rows = (new FileRead( + $rows = new FileRead( new SourceFiles(MemoryFiles::with(['memory://a.csv' => 'abcd']), path('memory://a.csv')), FileColumnsContext::discovering([]), schema(int_schema('id')), 10, - )) + ) ->scan( flow_context()->backend(), new Criteria(offset: 2), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileSplitReaderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileSplitReaderTest.php index 77f654edcb..1c875680d0 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileSplitReaderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileSplitReaderTest.php @@ -76,7 +76,7 @@ public function test_a_read_stopped_early_still_closes_the_batches(): void public function test_a_read_abandoned_midway_still_closes_the_batches(): void { $batches = new InMemoryFileBatches(['memory://a.csv' => [1, 2, 3]]); - $read = (new FileSplitReader( + $read = new FileSplitReader( FileReadMother::of( schema(int_schema('id')), batchSize: 2, @@ -84,7 +84,7 @@ public function test_a_read_abandoned_midway_still_closes_the_batches(): void path: path('memory://a.csv'), ), $batches, - ))->extract(flow_context()->backend(), new Criteria()); + )->extract(flow_context()->backend(), new Criteria()); $read->current(); unset($read); @@ -95,7 +95,7 @@ public function test_a_read_abandoned_midway_still_closes_the_batches(): void public function test_batches_that_do_not_describe_leave_the_reader_undescribed(): void { static::assertNull( - (new FileSplitReader( + new FileSplitReader( FileReadMother::of( schema(int_schema('id')), batchSize: 2, @@ -103,7 +103,7 @@ public function test_batches_that_do_not_describe_leave_the_reader_undescribed() path: path('memory://a.csv'), ), new InMemoryFileBatches([]), - ))->describe(), + )->describe(), ); } @@ -116,9 +116,9 @@ public function test_a_reject_loader_that_does_not_describe_leaves_the_reader_un ); $batches = new FloeFileBatches(new NoopCodec(), 65_536, null); - static::assertNotNull((new FileSplitReader($read, $batches))->describe()); + static::assertNotNull(new FileSplitReader($read, $batches)->describe()); static::assertNull( - (new FileSplitReader($read, $batches, new InlineLoader(static function (): void {})))->describe(), + new FileSplitReader($read, $batches, new InlineLoader(static function (): void {}))->describe(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileSplitTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileSplitTest.php index c32b9f88e7..a426145ba5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileSplitTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FileSplitTest.php @@ -33,7 +33,7 @@ public function test_a_negative_start_is_rejected(): void public function test_a_null_length_means_to_the_end_of_the_file(): void { - static::assertNull((new FileSplit(path('memory://orders.csv'), 0, null))->length); + static::assertNull(new FileSplit(path('memory://orders.csv'), 0, null)->length); } public function test_a_zero_length_is_rejected(): void @@ -55,23 +55,23 @@ public function test_it_accepts_the_smallest_valid_values(): void public function test_only_the_window_at_the_start_of_the_file_is_first(): void { - static::assertTrue((new FileSplit(path('memory://orders.csv'), 0, null))->isFirst()); - static::assertFalse((new FileSplit(path('memory://orders.csv'), 1, null))->isFirst()); + static::assertTrue(new FileSplit(path('memory://orders.csv'), 0, null)->isFirst()); + static::assertFalse(new FileSplit(path('memory://orders.csv'), 1, null)->isFirst()); } public function test_the_bytes_a_launcher_sizes_by_are_the_window_length(): void { - static::assertSame(8_388_608, (new FileSplit(path('memory://orders.csv'), 0, 8_388_608, 20_000_000))->bytes()); + static::assertSame(8_388_608, new FileSplit(path('memory://orders.csv'), 0, 8_388_608, 20_000_000)->bytes()); } public function test_the_bytes_of_a_whole_file_split_are_the_listed_file_size(): void { - static::assertSame(20_000_000, (new FileSplit(path('memory://orders.csv'), 0, null, 20_000_000))->bytes()); + static::assertSame(20_000_000, new FileSplit(path('memory://orders.csv'), 0, null, 20_000_000)->bytes()); } public function test_the_bytes_of_an_unlisted_whole_file_split_are_unknown(): void { - static::assertSame(0, (new FileSplit(path('memory://orders.csv'), 0, null))->bytes()); + static::assertSame(0, new FileSplit(path('memory://orders.csv'), 0, null)->bytes()); } public function test_it_is_a_window_of_one_file(): void @@ -107,7 +107,7 @@ public function test_a_split_describes_itself_and_is_rebuilt_equal(): void $split->describe()->data, ); static::assertFalse($split->describe()->sensitive()); - static::assertEquals($split, (new Rebuild())->object( + static::assertEquals($split, new Rebuild()->object( Description::fromArray($split->describe()->normalize()), Split::class, )); @@ -117,7 +117,7 @@ public function test_an_unsized_window_to_the_end_rebuilds_with_nulls(): void { $split = new FileSplit(path('memory://orders.csv'), 0, null); - static::assertEquals($split, (new Rebuild())->object($split->describe(), FileSplit::class)); + static::assertEquals($split, new Rebuild()->object($split->describe(), FileSplit::class)); } public function test_a_file_smaller_than_the_target_is_one_window(): void @@ -165,7 +165,7 @@ public function test_a_split_without_a_length_owns_every_unit(): void { static::assertEquals( new RowRange(0, 30), - (new FileSplit(path('memory://a.parquet'), 0, null))->owns([ + new FileSplit(path('memory://a.parquet'), 0, null)->owns([ new ByteUnit(4, 100, 10), new ByteUnit(104, 100, 20), ]), @@ -189,7 +189,7 @@ public function test_a_window_holding_no_midpoint_owns_nothing(): void { static::assertEquals( new RowRange(10, 0), - (new FileSplit(path('memory://a.parquet'), 100, 10))->owns([ + new FileSplit(path('memory://a.parquet'), 100, 10)->owns([ new ByteUnit(4, 100, 10), new ByteUnit(104, 100, 20), ]), @@ -236,7 +236,7 @@ public function test_the_first_window_starts_at_zero_and_ends_at_the_end_boundar static::assertSame( '01234', - (new FileSplit(path('memory://f.txt'), 0, 4)) + new FileSplit(path('memory://f.txt'), 0, 4) ->window($stream, 2, 5) ->content(), ); @@ -246,7 +246,7 @@ public function test_a_later_window_starts_at_its_start_boundary(): void { static::assertSame( '23456789', - (new FileSplit(path('memory://f.txt'), 1, null)) + new FileSplit(path('memory://f.txt'), 1, null) ->window(self::content('0123456789'), 2, null) ->content(), ); @@ -256,7 +256,7 @@ public function test_a_window_without_a_start_boundary_is_empty(): void { static::assertSame( '', - (new FileSplit(path('memory://f.txt'), 3, 2)) + new FileSplit(path('memory://f.txt'), 3, 2) ->window(self::content('0123456789'), null, 7) ->content(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FooterStatisticsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FooterStatisticsTest.php index 07a33ac133..bd123dc2ea 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FooterStatisticsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/FooterStatisticsTest.php @@ -16,7 +16,7 @@ public function test_every_listed_footer_read_is_exact(): void { static::assertEquals( new Statistics(rows: Cardinality::exact(30), size: Cardinality::exact(300)), - (new FooterStatistics(new Statistics(Cardinality::exact(30), Cardinality::exact(300)), 3))->of(3), + new FooterStatistics(new Statistics(Cardinality::exact(30), Cardinality::exact(300)), 3)->of(3), ); } @@ -24,7 +24,7 @@ public function test_the_first_footer_is_scaled_to_the_listing(): void { static::assertEquals( new Statistics(rows: Cardinality::approximately(40), size: Cardinality::approximately(400)), - (new FooterStatistics(new Statistics(Cardinality::exact(10), Cardinality::exact(100)), 1))->of(4), + new FooterStatistics(new Statistics(Cardinality::exact(10), Cardinality::exact(100)), 1)->of(4), ); } @@ -32,7 +32,7 @@ public function test_no_footer_read_is_zero_exactly(): void { static::assertEquals( new Statistics(rows: Cardinality::exact(0), size: Cardinality::exact(0)), - (new FooterStatistics(new Statistics(Cardinality::exact(0), Cardinality::exact(0)), 0))->of(0), + new FooterStatistics(new Statistics(Cardinality::exact(0), Cardinality::exact(0)), 0)->of(0), ); } @@ -40,7 +40,7 @@ public function test_unknown_footer_statistics_count_as_zero(): void { static::assertEquals( new Statistics(rows: Cardinality::exact(0), size: Cardinality::exact(0)), - (new FooterStatistics(new Statistics(Cardinality::unknown(), Cardinality::unknown()), 3))->of(3), + new FooterStatistics(new Statistics(Cardinality::unknown(), Cardinality::unknown()), 3)->of(3), ); } @@ -48,7 +48,7 @@ public function test_no_footer_read_keeps_the_statistics_exact_for_any_listing() { static::assertEquals( new Statistics(rows: Cardinality::exact(10), size: Cardinality::exact(100)), - (new FooterStatistics(new Statistics(Cardinality::exact(10), Cardinality::exact(100)), 0))->of(4), + new FooterStatistics(new Statistics(Cardinality::exact(10), Cardinality::exact(100)), 0)->of(4), ); } @@ -56,11 +56,11 @@ public function test_a_scaled_estimate_rounds_to_the_nearest_integer(): void { static::assertEquals( new Statistics(rows: Cardinality::approximately(13), size: Cardinality::approximately(133)), - (new FooterStatistics(new Statistics(Cardinality::exact(10), Cardinality::exact(100)), 3))->of(4), + new FooterStatistics(new Statistics(Cardinality::exact(10), Cardinality::exact(100)), 3)->of(4), ); static::assertEquals( new Statistics(rows: Cardinality::approximately(7), size: Cardinality::approximately(67)), - (new FooterStatistics(new Statistics(Cardinality::exact(5), Cardinality::exact(50)), 3))->of(4), + new FooterStatistics(new Statistics(Cardinality::exact(5), Cardinality::exact(50)), 3)->of(4), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/InferredColumnsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/InferredColumnsTest.php index 1ffe8b8032..5e8c9b4d26 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/InferredColumnsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/InferredColumnsTest.php @@ -19,24 +19,24 @@ public function test_a_file_with_the_inferred_columns_in_any_order_passes(): voi { $this->expectNotToPerformAssertions(); - (new InferredColumns( + new InferredColumns( schema(int_schema('id'), str_schema('name')), ['_input_file_uri'], new SchemaInference(), 'memory://a.csv', - ))->refuseDivergence('memory://b.csv', ['name', 'id', 'id', '_input_file_uri']); + )->refuseDivergence('memory://b.csv', ['name', 'id', 'id', '_input_file_uri']); } public function test_a_file_without_columns_passes(): void { $this->expectNotToPerformAssertions(); - (new InferredColumns( + new InferredColumns( schema(int_schema('id'), str_schema('name')), ['_input_file_uri'], new SchemaInference(), 'memory://a.csv', - ))->refuseDivergence('memory://empty.csv', []); + )->refuseDivergence('memory://empty.csv', []); } public function test_a_file_whose_columns_diverge_is_refused_naming_both_sources(): void @@ -46,12 +46,12 @@ public function test_a_file_whose_columns_diverge_is_refused_naming_both_sources 'Columns of memory://b.csv do not match the schema inferred from memory://a.csv: unexpected [age], missing [name]', ); - (new InferredColumns( + new InferredColumns( schema(int_schema('id'), str_schema('name')), ['_input_file_uri'], new SchemaInference(), 'memory://a.csv', - ))->refuseDivergence('memory://b.csv', ['id', 'age']); + )->refuseDivergence('memory://b.csv', ['id', 'age']); } public function test_normalize_round_trips_and_the_rebuilt_check_refuses_the_same_divergence(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/ListingScanTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/ListingScanTest.php index 7622970447..26633852d5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/ListingScanTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/ListingScanTest.php @@ -36,7 +36,7 @@ public function test_each_listed_file_is_one_row_in_batches_of_the_batch_size(): array_map( static fn(Rows $rows): array => $rows->reduceToArray('path'), iterator_to_array( - (new ListingScan( + new ListingScan( new SourceFiles(MemoryFiles::with([ 'memory://dir/a' => 'a', 'memory://dir/b' => 'b', @@ -44,7 +44,7 @@ public function test_each_listed_file_is_one_row_in_batches_of_the_batch_size(): ]), path('memory://dir/*')), new FileColumns([], new PartitionTypes(), false), new PathPartitionsRow(), - ))->scan( + )->scan( flow_context()->backend(), new Criteria(), schema(str_schema('path'), map_schema('partitions', type_map(type_string(), type_string()))), @@ -63,7 +63,7 @@ public function test_a_batch_holds_only_the_files_every_conjunct_keeps_and_an_em array_map( static fn(Rows $rows): array => $rows->reduceToArray('path'), iterator_to_array( - (new ListingScan( + new ListingScan( new SourceFiles(MemoryFiles::with([ 'memory://dir/a' => 'a', 'memory://dir/b' => 'b', @@ -71,7 +71,7 @@ public function test_a_batch_holds_only_the_files_every_conjunct_keeps_and_an_em ]), path('memory://dir/*')), new FileColumns([], new PartitionTypes(), false), new PathPartitionsRow(), - ))->scan( + )->scan( flow_context()->backend(), new Criteria(conjuncts: [ ref('path')->notEquals(lit('memory://dir/a')), @@ -89,7 +89,7 @@ public function test_a_batch_holds_only_the_files_every_conjunct_keeps_and_an_em public function test_the_scan_stops_once_the_limit_of_rows_is_handed_out(): void { static::assertCount(1, iterator_to_array( - (new ListingScan( + new ListingScan( new SourceFiles(MemoryFiles::with([ 'memory://dir/a' => 'a', 'memory://dir/b' => 'b', @@ -97,7 +97,7 @@ public function test_the_scan_stops_once_the_limit_of_rows_is_handed_out(): void ]), path('memory://dir/*')), new FileColumns([], new PartitionTypes(), false), new PathPartitionsRow(), - ))->scan( + )->scan( flow_context()->backend(), new Criteria(limit: 1), schema(str_schema('path'), map_schema('partitions', type_map(type_string(), type_string()))), @@ -114,7 +114,7 @@ public function test_an_offset_skips_the_listed_files_the_filter_keeps(): void array_map( static fn(Rows $rows): array => $rows->reduceToArray('path'), iterator_to_array( - (new ListingScan( + new ListingScan( new SourceFiles(MemoryFiles::with([ 'memory://dir/a' => 'a', 'memory://dir/b' => 'b', @@ -123,7 +123,7 @@ public function test_an_offset_skips_the_listed_files_the_filter_keeps(): void ]), path('memory://dir/*')), new FileColumns([], new PartitionTypes(), false), new PathPartitionsRow(), - ))->scan( + )->scan( flow_context()->backend(), new Criteria(offset: 1, conjuncts: [ref('path')->notEquals(lit('memory://dir/a'))]), schema(str_schema('path'), map_schema('partitions', type_map(type_string(), type_string()))), @@ -142,7 +142,7 @@ public function test_a_batch_past_the_limit_is_trimmed_to_it(): void array_map( static fn(Rows $rows): array => $rows->reduceToArray('path'), iterator_to_array( - (new ListingScan( + new ListingScan( new SourceFiles(MemoryFiles::with([ 'memory://dir/a' => 'a', 'memory://dir/b' => 'b', @@ -150,7 +150,7 @@ public function test_a_batch_past_the_limit_is_trimmed_to_it(): void ]), path('memory://dir/*')), new FileColumns([], new PartitionTypes(), false), new PathPartitionsRow(), - ))->scan( + )->scan( flow_context()->backend(), new Criteria(limit: 2), schema(str_schema('path'), map_schema('partitions', type_map(type_string(), type_string()))), @@ -164,14 +164,14 @@ public function test_a_batch_past_the_limit_is_trimmed_to_it(): void public function test_a_stop_signal_ends_the_scan(): void { - $criteria = (new ListingScan( + $criteria = new ListingScan( new SourceFiles(MemoryFiles::with([ 'memory://dir/a' => 'a', 'memory://dir/b' => 'b', ]), path('memory://dir/*')), new FileColumns([], new PartitionTypes(), false), new PathPartitionsRow(), - ))->scan( + )->scan( flow_context()->backend(), new Criteria(), schema(str_schema('path'), map_schema('partitions', type_map(type_string(), type_string()))), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/MetadataColumnsExtractorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/MetadataColumnsExtractorTest.php index e0a27c4edc..bff65cd93d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/MetadataColumnsExtractorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/MetadataColumnsExtractorTest.php @@ -27,7 +27,7 @@ public static function classesDeclaringMetadataColumns(): array $declaring = []; foreach (ExtractorClasses::all(ExtractorClasses::root('core/etl')) as $class) { - if ((new ReflectionClass($class))->implementsInterface(MetadataColumnsExtractor::class)) { + if (new ReflectionClass($class)->implementsInterface(MetadataColumnsExtractor::class)) { $declaring[] = $class; } } @@ -41,7 +41,7 @@ public static function classesDeclaringMetadataColumns(): array public static function provide_extractor_classes_without_metadata(): Generator { foreach (ExtractorClasses::all(ExtractorClasses::root('core/etl')) as $class) { - if (!(new ReflectionClass($class))->implementsInterface(MetadataColumnsExtractor::class)) { + if (!new ReflectionClass($class)->implementsInterface(MetadataColumnsExtractor::class)) { yield $class => [$class]; } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/PartitionTypesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/PartitionTypesTest.php index 9d107515b1..6db0655cd5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/PartitionTypesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/PartitionTypesTest.php @@ -63,7 +63,7 @@ public function test_an_undeclared_name_is_refused_by_get(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('No partition type declared for "month"'); - (new PartitionTypes())->get('month'); + new PartitionTypes()->get('month'); } public function test_the_dsl_delegates_without_normalising(): void @@ -80,6 +80,6 @@ public function test_normalize_round_trips_every_type(): void $types->normalize(), ); static::assertEquals($types, PartitionTypes::fromArray($types->normalize())); - static::assertSame([], (new PartitionTypes())->normalize()); + static::assertSame([], new PartitionTypes()->normalize()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/PathPartitionsRowTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/PathPartitionsRowTest.php index 8f34764aaf..1916b6e8c8 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/PathPartitionsRowTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/PathPartitionsRowTest.php @@ -16,8 +16,8 @@ final class PathPartitionsRowTest extends FlowTestCase public function test_the_schema_names_every_column_of_the_row_and_no_partition_column(): void { static::assertSame( - array_keys((new PathPartitionsRow())->row(new FileStatus(path('memory://dir/year=2024/a.csv'), true))), - (new PathPartitionsRow())->schema()->names(), + array_keys(new PathPartitionsRow()->row(new FileStatus(path('memory://dir/year=2024/a.csv'), true))), + new PathPartitionsRow()->schema()->names(), ); } @@ -25,7 +25,7 @@ public function test_a_file_is_described_by_its_uri_and_its_partitions(): void { static::assertSame( ['path' => 'memory://dir/year=2024/month=01/a.csv', 'partitions' => ['year' => '2024', 'month' => '01']], - (new PathPartitionsRow())->row(new FileStatus(path('memory://dir/year=2024/month=01/a.csv'), true)), + new PathPartitionsRow()->row(new FileStatus(path('memory://dir/year=2024/month=01/a.csv'), true)), ); } @@ -33,7 +33,7 @@ public function test_a_file_outside_partitions_has_none(): void { static::assertSame( [], - (new PathPartitionsRow())->row(new FileStatus(path('memory://dir/a.csv'), true))['partitions'], + new PathPartitionsRow()->row(new FileStatus(path('memory://dir/a.csv'), true))['partitions'], ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/ReadWindowTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/ReadWindowTest.php index f9c25a50a9..e5885a98a9 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/ReadWindowTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/ReadWindowTest.php @@ -32,7 +32,7 @@ public function test_a_negative_limit_is_refused(): void public function test_a_zero_limit_is_accepted(): void { - static::assertSame(0, (new ReadWindow(limit: 0))->limit); + static::assertSame(0, new ReadWindow(limit: 0)->limit); } public function test_the_default_window_skips_nothing_and_wants_everything(): void @@ -49,12 +49,12 @@ public function test_trim_cuts_rows_to_what_the_limit_still_wants(): void static::assertSame( [['id' => 1]], - (new ReadWindow(limit: 3)) + new ReadWindow(limit: 3) ->trim($rows, 2) ->toArray(), ); - static::assertSame($rows, (new ReadWindow(limit: 5))->trim($rows, 2)); - static::assertSame($rows, (new ReadWindow())->trim($rows, 100)); + static::assertSame($rows, new ReadWindow(limit: 5)->trim($rows, 2)); + static::assertSame($rows, new ReadWindow()->trim($rows, 100)); } public function test_skip_drops_what_the_offset_still_skips(): void @@ -63,30 +63,30 @@ public function test_skip_drops_what_the_offset_still_skips(): void static::assertSame( [['id' => 3]], - (new ReadWindow(offset: 4)) + new ReadWindow(offset: 4) ->skip($rows, 2) ->toArray(), ); static::assertSame( [], - (new ReadWindow(offset: 4)) + new ReadWindow(offset: 4) ->skip($rows, 0) ->toArray(), ); static::assertSame( [], - (new ReadWindow(offset: 3)) + new ReadWindow(offset: 3) ->skip($rows, 0) ->toArray(), ); - static::assertSame($rows, (new ReadWindow(offset: 2))->skip($rows, 2)); - static::assertSame($rows, (new ReadWindow())->skip($rows, 0)); + static::assertSame($rows, new ReadWindow(offset: 2)->skip($rows, 2)); + static::assertSame($rows, new ReadWindow()->skip($rows, 0)); } public function test_reached_only_once_the_limit_was_yielded(): void { - static::assertFalse((new ReadWindow(limit: 3))->reached(2)); - static::assertTrue((new ReadWindow(limit: 3))->reached(3)); - static::assertFalse((new ReadWindow())->reached(1_000)); + static::assertFalse(new ReadWindow(limit: 3)->reached(2)); + static::assertTrue(new ReadWindow(limit: 3)->reached(3)); + static::assertFalse(new ReadWindow()->reached(1_000)); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/SkippedRowsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/SkippedRowsTest.php index 0ac71f1f5d..58307c5cb9 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/SkippedRowsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/SkippedRowsTest.php @@ -12,12 +12,12 @@ final class SkippedRowsTest extends FlowTestCase { public function test_it_carries_the_rows_skipped(): void { - static::assertSame(3, (new SkippedRows(3))->count); + static::assertSame(3, new SkippedRows(3)->count); } public function test_zero_skipped_rows_are_accepted(): void { - static::assertSame(0, (new SkippedRows(0))->count); + static::assertSame(0, new SkippedRows(0)->count); } public function test_a_negative_count_is_refused(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/SourceFileTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/SourceFileTest.php index b4266957f5..6aeff207a5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/SourceFileTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/SourceFileTest.php @@ -13,14 +13,14 @@ final class SourceFileTest extends FlowTestCase { public function test_a_path_without_partitions_carries_no_values(): void { - static::assertSame([], (new SourceFile(path('memory://orders/data.csv')))->partitionValues); + static::assertSame([], new SourceFile(path('memory://orders/data.csv'))->partitionValues); } public function test_partition_values_come_from_the_path(): void { static::assertSame( ['country' => 'PL', 'year' => '2024'], - (new SourceFile(path('memory://orders/country=PL/year=2024/data.csv')))->partitionValues, + new SourceFile(path('memory://orders/country=PL/year=2024/data.csv'))->partitionValues, ); } @@ -28,18 +28,18 @@ public function test_uri_is_the_paths_uri(): void { static::assertSame( 'memory://orders/year=2024/data.csv', - (new SourceFile(path('memory://orders/year=2024/data.csv')))->uri(), + new SourceFile(path('memory://orders/year=2024/data.csv'))->uri(), ); } public function test_it_carries_the_listed_size(): void { - static::assertSame(1024, (new SourceFile(path('memory://orders/data.csv'), 1024))->size); + static::assertSame(1024, new SourceFile(path('memory://orders/data.csv'), 1024)->size); } public function test_a_size_may_be_absent(): void { - static::assertNull((new SourceFile(path('memory://orders/data.csv')))->size); + static::assertNull(new SourceFile(path('memory://orders/data.csv'))->size); } public function test_it_normalizes_and_rebuilds_equal(): void @@ -50,7 +50,7 @@ public function test_it_normalizes_and_rebuilds_equal(): void static::assertEquals($source, SourceFile::fromArray($source->normalize())); static::assertEquals( new SourceFile(path('memory://a.csv')), - SourceFile::fromArray((new SourceFile(path('memory://a.csv')))->normalize()), + SourceFile::fromArray(new SourceFile(path('memory://a.csv'))->normalize()), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/SourceFilesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/SourceFilesTest.php index 6bcc91f03f..e3567fe988 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/SourceFilesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/File/SourceFilesTest.php @@ -28,7 +28,7 @@ public function test_a_sized_split_names_its_file_without_listing(): void static::assertEquals( [new SourceFile(path('memory://dir/a.csv'), 7)], - (new SourceFiles($counting, path('memory://dir/*.csv')))->of((new Criteria())->withSplit( + new SourceFiles($counting, path('memory://dir/*.csv'))->of(new Criteria()->withSplit( new FileSplit(path('memory://dir/a.csv'), 0, null, 7), )), ); @@ -44,7 +44,7 @@ public function test_an_unsized_split_lists_its_path(): void static::assertEquals( [new SourceFile(path('memory://dir/b.csv'), 2)], - (new SourceFiles($counting, path('memory://dir/*.csv')))->of((new Criteria())->withSplit( + new SourceFiles($counting, path('memory://dir/*.csv'))->of(new Criteria()->withSplit( new FileSplit(path('memory://dir/b.csv'), 0, null), )), ); @@ -126,10 +126,10 @@ public function test_windows_of_consecutive_files_follow_the_listing_order(): vo new FileSplit(path('memory://orders/a.csv'), 1, 1, 2), new FileSplit(path('memory://orders/c.csv'), 0, 1, 1), ], - (new SourceFiles(MemoryFiles::with([ + new SourceFiles(MemoryFiles::with([ 'memory://orders/a.csv' => 'ab', 'memory://orders/c.csv' => 'c', - ]), path('memory://orders/*.csv')))->byteWindows(1), + ]), path('memory://orders/*.csv'))->byteWindows(1), ); } @@ -192,9 +192,9 @@ public function test_a_listing_without_partitions_names_none(): void { static::assertSame( [], - (new SourceFiles(MemoryFiles::with([ + new SourceFiles(MemoryFiles::with([ 'memory://plain/data.csv' => 'id', - ]), path('memory://plain/*.csv')))->partitionNames(), + ]), path('memory://plain/*.csv'))->partitionNames(), ); } @@ -202,9 +202,9 @@ public function test_partition_names_are_sorted_by_name_not_by_path_order(): voi { static::assertSame( ['month' => false, 'region' => false, 'year' => false], - (new SourceFiles(MemoryFiles::with([ + new SourceFiles(MemoryFiles::with([ 'memory://sorted/year=2026/month=01/region=eu/data.csv' => 'id', - ]), path('memory://sorted/*/*/*/*.csv')))->partitionNames(), + ]), path('memory://sorted/*/*/*/*.csv'))->partitionNames(), ); } @@ -212,10 +212,10 @@ public function test_a_partition_only_some_paths_carry_is_nullable(): void { static::assertSame( ['date' => true], - (new SourceFiles(MemoryFiles::with([ + new SourceFiles(MemoryFiles::with([ 'memory://mixed/date=2026-01-01/data.csv' => 'id', 'memory://mixed/plain/data.csv' => 'id', - ]), path('memory://mixed/*/*.csv')))->partitionNames(), + ]), path('memory://mixed/*/*.csv'))->partitionNames(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/FileListingExtractorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/FileListingExtractorTest.php index ca2fbe32eb..07ec169f4e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/FileListingExtractorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/FileListingExtractorTest.php @@ -260,7 +260,7 @@ public function test_extract_split_stops_on_the_stop_signal(): void ->withBatchSize(1) ->extract( flow_context()->backend(), - (new Criteria())->withSplit( + new Criteria()->withSplit( new FileSplit(path(__DIR__ . '/../../../Fixtures/FileListExtractor/*'), 0, null), ), ); @@ -282,7 +282,7 @@ public function test_a_split_reads_one_listed_file(): void 'memory://dir/b.txt' => 'bb', ]))->extract( flow_context()->backend(), - (new Criteria())->withSplit(new FileSplit(path('memory://dir/b.txt'), 0, null)), + new Criteria()->withSplit(new FileSplit(path('memory://dir/b.txt'), 0, null)), ), false, ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Grid/GridHeaderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Grid/GridHeaderTest.php index 80f7d4dda2..421c09e695 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Grid/GridHeaderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Grid/GridHeaderTest.php @@ -21,12 +21,12 @@ public function test_it_normalizes_and_rebuilds_equal(): void { static::assertSame( ['names' => ['id'], 'source' => 'file:///a.csv'], - (new GridHeader(['id'], 'file:///a.csv'))->normalize(), + new GridHeader(['id'], 'file:///a.csv')->normalize(), ); static::assertEquals( new GridHeader(['id'], 'file:///a.csv'), - GridHeader::fromArray((new GridHeader(['id'], 'file:///a.csv'))->normalize()), + GridHeader::fromArray(new GridHeader(['id'], 'file:///a.csv')->normalize()), ); - static::assertEquals(new GridHeader([], null), GridHeader::fromArray((new GridHeader([], null))->normalize())); + static::assertEquals(new GridHeader([], null), GridHeader::fromArray(new GridHeader([], null)->normalize())); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Grid/HeaderNamesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Grid/HeaderNamesTest.php index db4e7d4904..deaa9e0c07 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Grid/HeaderNamesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Grid/HeaderNamesTest.php @@ -12,19 +12,19 @@ final class HeaderNamesTest extends FlowTestCase { public function test_scalar_cells_are_trimmed_text(): void { - static::assertSame(['id', '1', '2.5', '1'], (new HeaderNames())->of([' id ', 1, 2.5, true])); + static::assertSame(['id', '1', '2.5', '1'], new HeaderNames()->of([' id ', 1, 2.5, true])); } public function test_form_feed_padded_header_is_trimmed(): void { - static::assertSame(['id', 'name'], (new HeaderNames())->of(["\fid", "name\f"])); + static::assertSame(['id', 'name'], new HeaderNames()->of(["\fid", "name\f"])); } public function test_a_blank_or_non_scalar_cell_is_named_by_its_position(): void { static::assertSame( ['e00', 'e01', 'e02', 'name', 'e04'], - (new HeaderNames())->of(['', null, ' ', 'name', new DateTimeImmutable('2026-01-01')]), + new HeaderNames()->of(['', null, ' ', 'name', new DateTimeImmutable('2026-01-01')]), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Grid/RecordDecoderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Grid/RecordDecoderTest.php index b06349441c..2359745db3 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Grid/RecordDecoderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Grid/RecordDecoderTest.php @@ -137,7 +137,7 @@ public function test_an_empty_record_is_no_row_before_and_after_the_header(array public function test_headers_are_null_before_the_first_decode(): void { - static::assertNull((new RecordDecoder(withHeader: true, emptyToNull: true))->headers()); + static::assertNull(new RecordDecoder(withHeader: true, emptyToNull: true)->headers()); } /** diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Memory/InMemoryRowsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Memory/InMemoryRowsTest.php index 3f29710a37..8e53ea9ffc 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Memory/InMemoryRowsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/Memory/InMemoryRowsTest.php @@ -25,14 +25,14 @@ public function test_positional_keys_are_named_like_the_hydrator_names_them(): v { static::assertSame( ['e00', 'e01'], - array_keys(iterator_to_array((new InMemoryRows([[1, 2]]))->values(), false)[0]), + array_keys(iterator_to_array(new InMemoryRows([[1, 2]])->values(), false)[0]), ); } public function test_the_dataset_is_one_unit_without_a_header(): void { - static::assertSame(1, (new InMemoryRows([['id' => 1]]))->units()); - static::assertSame([], (new InMemoryRows([['id' => 1]]))->names()); + static::assertSame(1, new InMemoryRows([['id' => 1]])->units()); + static::assertSame([], new InMemoryRows([['id' => 1]])->names()); } public function test_a_sample_is_complete_only_below_its_budget_and_has_no_bytes(): void @@ -50,11 +50,11 @@ public function test_sniff_folds_at_most_its_budget(): void { static::assertSame( 1, - (new InMemoryRows([['id' => 1], ['id' => 2], ['id' => 3]]))->sniff(0, 1, new VoidProgress())->columns->rows, + new InMemoryRows([['id' => 1], ['id' => 2], ['id' => 3]])->sniff(0, 1, new VoidProgress())->columns->rows, ); static::assertSame( 3, - (new InMemoryRows([['id' => 1], ['id' => 2], ['id' => 3]])) + new InMemoryRows([['id' => 1], ['id' => 2], ['id' => 3]]) ->sniff(0, null, new VoidProgress()) ->columns ->rows, diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/SequenceExtractorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/SequenceExtractorTest.php index f28f001003..f3c56615a2 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/SequenceExtractorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/SequenceExtractorTest.php @@ -167,15 +167,15 @@ public function test_extracting_from_numbers_range(): void public function test_a_bounded_sample_types_only_its_prefix(): void { - $extractor = (new SequenceExtractor( + $extractor = new SequenceExtractor( new MixedSequenceGenerator(), 'code', - ))->inferSchema(infer_schema()->sampleSize(1)); + )->inferSchema(infer_schema()->sampleSize(1)); static::assertSame('integer', $extractor->schema()->get('code')->type()->toString()); static::assertSame( 'string', - (new SequenceExtractor(new MixedSequenceGenerator(), 'code')) + new SequenceExtractor(new MixedSequenceGenerator(), 'code') ->schema() ->get('code') ->type() diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/SequenceGenerator/DatePeriodSequenceGeneratorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/SequenceGenerator/DatePeriodSequenceGeneratorTest.php index e53b4346fc..0312e4b9c2 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/SequenceGenerator/DatePeriodSequenceGeneratorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/SequenceGenerator/DatePeriodSequenceGeneratorTest.php @@ -19,13 +19,13 @@ public function test_an_empty_period_declares_zero_rows(): void { static::assertEquals( Cardinality::exact(0), - (new DatePeriodSequenceGenerator( + new DatePeriodSequenceGenerator( new DatePeriod( new DateTimeImmutable('2023-01-10'), new DateInterval('P1D'), new DateTimeImmutable('2023-01-01'), ), - ))->rows(), + )->rows(), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/SequenceGenerator/NumberSequenceGeneratorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/SequenceGenerator/NumberSequenceGeneratorTest.php index 79f967498a..456c3306e5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/SequenceGenerator/NumberSequenceGeneratorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/SequenceGenerator/NumberSequenceGeneratorTest.php @@ -60,7 +60,7 @@ public function test_generate_yields_the_values_range_yields( array $expected, ): void { static::assertSame($expected, iterator_to_array( - (new NumberSequenceGenerator($start, $end, $step))->generate(), + new NumberSequenceGenerator($start, $end, $step)->generate(), false, )); static::assertSame(range($start, $end, $step), $expected); @@ -68,7 +68,7 @@ public function test_generate_yields_the_values_range_yields( public function test_an_integer_sequence_is_generated_without_building_it_first(): void { - $generator = (new NumberSequenceGenerator(0, PHP_INT_MAX))->generate(); + $generator = new NumberSequenceGenerator(0, PHP_INT_MAX)->generate(); static::assertSame(0, $generator->current()); $generator->next(); @@ -83,7 +83,7 @@ public function test_a_step_the_range_rejects_is_rejected_the_same_way(int $star { $this->expectException(ValueError::class); - (new NumberSequenceGenerator($start, $end, $step))->rows(); + new NumberSequenceGenerator($start, $end, $step)->rows(); } public function test_generate_rejects_a_step_wider_than_the_span(): void @@ -93,7 +93,7 @@ public function test_generate_rejects_a_step_wider_than_the_span(): void 'range(): Argument #3 ($step) must be less than the range spanned by argument #1 ($start) and argument #2 ($end)', ); - iterator_to_array((new NumberSequenceGenerator(2, 3, 4))->generate()); + iterator_to_array(new NumberSequenceGenerator(2, 3, 4)->generate()); } public function test_generate_rejects_a_zero_step_the_way_range_does(): void @@ -101,6 +101,6 @@ public function test_generate_rejects_a_zero_step_the_way_range_does(): void $this->expectException(ValueError::class); $this->expectExceptionMessage('range(): Argument #3 ($step) cannot be 0'); - iterator_to_array((new NumberSequenceGenerator(1, 10, 0))->generate()); + iterator_to_array(new NumberSequenceGenerator(1, 10, 0)->generate()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/StatisticsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/StatisticsTest.php index 38558009d7..e343f44d35 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/StatisticsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Extractor/StatisticsTest.php @@ -22,7 +22,7 @@ public function test_merge_adds_rows_and_size_independently(): void { static::assertEquals( new Statistics(Cardinality::exact(30), Cardinality::approximately(300)), - (new Statistics(Cardinality::exact(10), Cardinality::approximately(100)))->merge( + new Statistics(Cardinality::exact(10), Cardinality::approximately(100))->merge( new Statistics(Cardinality::exact(20), Cardinality::exact(200)), ), ); @@ -32,7 +32,7 @@ public function test_merging_with_an_unknown_partial_yields_unknown(): void { static::assertEquals( new Statistics(), - (new Statistics(Cardinality::exact(10), Cardinality::exact(100)))->merge(new Statistics()), + new Statistics(Cardinality::exact(10), Cardinality::exact(100))->merge(new Statistics()), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Filesystem/ScalarFunctionFilterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Filesystem/ScalarFunctionFilterTest.php index 776a9b7151..83310aeef5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Filesystem/ScalarFunctionFilterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Filesystem/ScalarFunctionFilterTest.php @@ -32,16 +32,16 @@ public function test_a_declared_partition_the_path_lacks_is_evaluated_as_null_as $partitions = schema(str_schema('year', nullable: true)); $file = new FileStatus(path('memory://part/a.parquet'), true); - static::assertTrue((new ScalarFunctionFilter( + static::assertTrue(new ScalarFunctionFilter( ref('year')->isNull(), $partitions, flow_context()->backend(), - ))->accept($file)); - static::assertFalse((new ScalarFunctionFilter( + )->accept($file)); + static::assertFalse(new ScalarFunctionFilter( ref('year')->equals(lit('2023')), $partitions, flow_context()->backend(), - ))->accept($file)); + )->accept($file)); } public function test_a_listing_keeps_the_files_of_every_partition_the_function_accepts(): void @@ -111,21 +111,21 @@ public function test_function_is_the_one_given_not_its_resolved_copy(): void static::assertSame( $function, - (new ScalarFunctionFilter( + new ScalarFunctionFilter( $function, schema(int_schema('year')), flow_context(config())->backend(), - ))->function(), + )->function(), ); } public function test_accept_evaluates_the_resolved_function(): void { - static::assertTrue((new ScalarFunctionFilter( + static::assertTrue(new ScalarFunctionFilter( new ReportsResolvedOperand(ref('year')), schema(int_schema('year')), flow_context(config())->backend(), - ))->accept(new FileStatus(path('flow-file://data/year=2024/file.csv'), true))); + )->accept(new FileStatus(path('flow-file://data/year=2024/file.csv'), true))); } public function test_a_hive_null_partition_value_against_a_declared_nullable_type(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Filesystem/VisibleFilesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Filesystem/VisibleFilesTest.php index f3a40455a3..37a458c04c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Filesystem/VisibleFilesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Filesystem/VisibleFilesTest.php @@ -20,7 +20,7 @@ final class VisibleFilesTest extends FlowTestCase #[TestWith(['file:///out/year=2024/.hidden/part.csv'])] public function test_a_hidden_segment_below_the_root_hides_the_file(string $file): void { - static::assertFalse((new VisibleFiles(path('file:///out')))->accept(new FileStatus(path($file), true))); + static::assertFalse(new VisibleFiles(path('file:///out'))->accept(new FileStatus(path($file), true))); } #[TestWith(['file:///out/part.csv'])] @@ -31,47 +31,47 @@ public function test_a_hidden_segment_below_the_root_hides_the_file(string $file #[TestWith(['file:///out/a.b/part.csv'])] public function test_a_visible_file_below_the_root_is_kept(string $file): void { - static::assertTrue((new VisibleFiles(path('file:///out')))->accept(new FileStatus(path($file), true))); + static::assertTrue(new VisibleFiles(path('file:///out'))->accept(new FileStatus(path($file), true))); } public function test_a_root_with_a_trailing_slash_still_hides_a_hidden_segment(): void { - static::assertFalse((new VisibleFiles(path('file:///out/')))->accept( + static::assertFalse(new VisibleFiles(path('file:///out/'))->accept( new FileStatus(path('file:///out/.hidden/part.csv'), true), )); } public function test_a_file_outside_the_root_is_kept_whatever_its_segments(): void { - static::assertTrue((new VisibleFiles(path('file:///a')))->accept( + static::assertTrue(new VisibleFiles(path('file:///a'))->accept( new FileStatus(path('file:///b/_x/part.csv'), true), )); } public function test_a_hidden_segment_of_the_root_itself_is_read(): void { - static::assertTrue((new VisibleFiles(path('file:///home/u/.local/_exports')))->accept( + static::assertTrue(new VisibleFiles(path('file:///home/u/.local/_exports'))->accept( new FileStatus(path('file:///home/u/.local/_exports/part.csv'), true), )); } public function test_an_explicit_hidden_file_is_read(): void { - static::assertTrue((new VisibleFiles(path('file:///out/.hidden.csv')))->accept( + static::assertTrue(new VisibleFiles(path('file:///out/.hidden.csv'))->accept( new FileStatus(path('file:///out/.hidden.csv'), true), )); } public function test_a_root_prefix_is_not_a_parent(): void { - static::assertTrue((new VisibleFiles(path('file:///out')))->accept( + static::assertTrue(new VisibleFiles(path('file:///out'))->accept( new FileStatus(path('file:///out.csv'), true), )); } public function test_a_directory_is_not_a_file(): void { - static::assertFalse((new VisibleFiles(path('file:///out')))->accept( + static::assertFalse(new VisibleFiles(path('file:///out'))->accept( new FileStatus(path('file:///out/a'), false), )); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeExtractorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeExtractorTest.php index 694cd452ff..8d95d7e62a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeExtractorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeExtractorTest.php @@ -649,7 +649,7 @@ public function test_extract_split_reads_no_more_than_the_limit(): void foreach (FlowTestCase::extracted( $extractor, flow_context()->backend(), - (new Criteria(25))->withSplit($extractor->splits(new Criteria(), 100_000)[0]), + new Criteria(25)->withSplit($extractor->splits(new Criteria(), 100_000)[0]), ) as $rows) { $total += $rows->count(); } @@ -666,7 +666,7 @@ public function test_extract_split_stops_on_the_stop_signal(): void $generator = FlowTestCase::extracted( $extractor, flow_context()->backend(), - (new Criteria())->withSplit($extractor->splits(new Criteria(), 100_000)[0]), + new Criteria()->withSplit($extractor->splits(new Criteria(), 100_000)[0]), ); $totalRows = 0; @@ -685,7 +685,7 @@ public function test_extract_split_stops_on_the_stop_signal_of_a_whole_source_sp $generator = FlowTestCase::extracted( from_floe(path('memory://split/a.floe'), filesystem: $memory)->withBatchSize(1), flow_context()->backend(), - (new Criteria())->withSplit(new FileSplit(path('memory://split/a.floe'), 0, null)), + new Criteria()->withSplit(new FileSplit(path('memory://split/a.floe'), 0, null)), ); $totalRows = 0; @@ -741,7 +741,7 @@ public function test_a_pushed_path_filter_prunes_the_files_splits_are_cut_from() static::assertEquals( [new FileSplit($extractor->source(), 0, null)], - $extractor->splits((new Criteria())->withPathFilter(new RejectingFilter()), 1), + $extractor->splits(new Criteria()->withPathFilter(new RejectingFilter()), 1), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeFileBatchesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeFileBatchesTest.php index 16219dfaec..5ab32ea4d6 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeFileBatchesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeFileBatchesTest.php @@ -41,7 +41,7 @@ public function test_an_offset_that_covers_the_file_skips_it_and_yields_its_row_ ['id' => 2], ['id' => 3], ], schema(int_schema('id')))]); - $file = (new FloeFileBatches(new NoopCodec(), 65536, null))->batches( + $file = new FloeFileBatches(new NoopCodec(), 65536, null)->batches( FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10, $filesystem), new Criteria(), new SourceFile(path('memory://a.floe')), @@ -61,7 +61,7 @@ public function test_an_offset_past_the_file_skips_only_its_row_count(): void ['id' => 2], ['id' => 3], ], schema(int_schema('id')))]); - $file = (new FloeFileBatches(new NoopCodec(), 65536, null))->batches( + $file = new FloeFileBatches(new NoopCodec(), 65536, null)->batches( FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10, $filesystem), new Criteria(), new SourceFile(path('memory://a.floe')), @@ -80,7 +80,7 @@ public function test_no_offset_skips_nothing(): void ['id' => 1], ['id' => 2], ], schema(int_schema('id')))]); - $file = (new FloeFileBatches(new NoopCodec(), 65536, null))->batches( + $file = new FloeFileBatches(new NoopCodec(), 65536, null)->batches( FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10, $filesystem), new Criteria(), new SourceFile(path('memory://a.floe')), @@ -108,7 +108,7 @@ public function test_an_offset_inside_the_file_starts_the_read_there_and_is_cons ['id' => 2], ['id' => 3], ], schema(int_schema('id')))]); - $file = (new FloeFileBatches(new NoopCodec(), 65536, null))->batches( + $file = new FloeFileBatches(new NoopCodec(), 65536, null)->batches( FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10, $filesystem), new Criteria(), new SourceFile(path('memory://a.floe')), @@ -136,7 +136,7 @@ public function test_beside_a_conjunct_it_answers_no_row_so_it_leaves_the_offset ['id' => 2], ['id' => 3], ], schema(int_schema('id')))]); - $file = (new FloeFileBatches(new NoopCodec(), 65536, null))->batches( + $file = new FloeFileBatches(new NoopCodec(), 65536, null)->batches( FileReadMother::of(schema(int_schema('id')), FileColumnsContext::discovering(names: []), 10, $filesystem), new Criteria(conjuncts: [ref('id')->greaterThan(lit(1))]), new SourceFile(path('memory://a.floe')), @@ -162,7 +162,7 @@ public function test_a_file_narrower_than_the_body_is_padded_with_nulls(): void [[['id' => 1, 'name' => null]]], array_map( static fn(Rows $rows): array => $rows->toArray(), - FloeFilesContext::rows((new FloeFileBatches(new NoopCodec(), 65536, null))->batches( + FloeFilesContext::rows(new FloeFileBatches(new NoopCodec(), 65536, null)->batches( FileReadMother::of( schema(int_schema('id'), str_schema('name', nullable: true)), FileColumnsContext::discovering(names: []), @@ -187,11 +187,11 @@ public function test_a_file_that_diverges_from_the_derived_schema_is_refused_and ]], schema(str_schema('name')))]); try { - iterator_to_array((new FloeFileBatches( + iterator_to_array(new FloeFileBatches( new NoopCodec(), 65536, new DerivedSchema(schema(int_schema('id')), 'memory://a.floe'), - ))->batches( + )->batches( FileReadMother::of( schema(int_schema('id')), FileColumnsContext::discovering(names: []), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeFileWriterFactoryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeFileWriterFactoryTest.php index 590a82ef96..ee3af01211 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeFileWriterFactoryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeFileWriterFactoryTest.php @@ -43,7 +43,7 @@ public function test_a_declared_schema_is_the_written_one(): void { $filesystem = memory_filesystem(); $declared = schema(int_schema('id', nullable: true)); - $writer = (new FloeFileWriterFactory($declared, null, new Options()))->writer( + $writer = new FloeFileWriterFactory($declared, null, new Options())->writer( $filesystem->writeTo(path('memory://a.floe')), schema(int_schema('id')), new PhpBackend(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeFileWriterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeFileWriterTest.php index 033aa9744f..6011508841 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeFileWriterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeFileWriterTest.php @@ -23,7 +23,7 @@ public function test_a_writer_closed_before_any_write_leaves_a_file_without_rows $filesystem = memory_filesystem(); $stream = $filesystem->writeTo(path('memory://a.floe')); - (new FloeFileWriterFactory(null, null, new Options())) + new FloeFileWriterFactory(null, null, new Options()) ->writer($stream, schema(int_schema('id')), new PhpBackend()) ->close(); $stream->close(); @@ -38,7 +38,7 @@ public function test_every_write_lands_in_the_file(): void { $filesystem = memory_filesystem(); $stream = $filesystem->writeTo(path('memory://a.floe')); - $writer = (new FloeFileWriterFactory(null, null, new Options()))->writer( + $writer = new FloeFileWriterFactory(null, null, new Options())->writer( $stream, schema(int_schema('id')), new PhpBackend(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeLoaderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeLoaderTest.php index 5e1b8b588a..6e428f6ca3 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeLoaderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeLoaderTest.php @@ -55,7 +55,7 @@ public function test_discarding_a_loader_that_never_loaded_is_a_no_op(): void { $filesystem = new RecordingFilesystem(memory_filesystem()); - (new FloeLoader(path('memory://never-written.floe'), filesystem: $filesystem))->discard(); + new FloeLoader(path('memory://never-written.floe'), filesystem: $filesystem)->discard(); static::assertSame([], $filesystem->calls); } @@ -240,7 +240,7 @@ public function test_describe_round_trips(): void { $scratch = ReaderRoundTrip::scratch('floe-describe'); $file = $scratch->suffix('/rows.floe'); - $loader = (new FloeLoader($file, Metadata::fromArray(['owner' => 'tests']), new Options(1024))) + $loader = new FloeLoader($file, Metadata::fromArray(['owner' => 'tests']), new Options(1024)) ->saveMode(SaveMode::Overwrite) ->withSchema(schema(int_schema('id'), str_schema('name'))); $rebuilt = DescribeRoundTrip::rebuilt($loader); @@ -263,11 +263,11 @@ public function test_a_partitioned_loader_describes_its_partitioning(): void static::assertSame( ['by' => ['name'], 'write_columns' => true], DescribeRoundTrip::rebuilt( - (new FloeLoader( + new FloeLoader( $scratch->suffix('/{name}/rows.floe'), Metadata::fromArray(['owner' => 'tests']), new Options(1024), - )) + ) ->saveMode(SaveMode::Overwrite) ->withSchema(schema(int_schema('id'), str_schema('name'))) ->partitionBy('name', writeColumns: true), @@ -285,7 +285,7 @@ public function test_a_live_filesystem_does_not_describe(): void public function test_a_loader_with_another_codec_does_not_describe(): void { static::assertNull( - (new FloeLoader( + new FloeLoader( ($scratch = ReaderRoundTrip::scratch('floe-codec'))->suffix('/rows.floe'), options: new Options(1024, new class implements Codec { public function encode(string $data): string @@ -303,7 +303,7 @@ public function id(): int return 7; } }), - ))->describe(), + )->describe(), ); native_local_filesystem()->rm($scratch); @@ -312,11 +312,11 @@ public function id(): int public function test_in_task_copies_every_setting_and_leaves_the_original(): void { $scratch = ReaderRoundTrip::scratch('in-task'); - $loader = (new FloeLoader( + $loader = new FloeLoader( $scratch->suffix('/rows.out'), Metadata::fromArray(['owner' => 'tests']), new Options(1024), - )) + ) ->saveMode(SaveMode::Overwrite) ->partitionBy('name') ->withSchema(schema(int_schema('id'))); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeSourceFileTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeSourceFileTest.php index c5bf95a973..bf5f46b316 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeSourceFileTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Floe/FloeSourceFileTest.php @@ -39,10 +39,10 @@ public function test_schema_comes_from_the_footer(): void static::assertEquals( schema(int_schema('id')), - (new FloeSourceFile( + new FloeSourceFile( FloeFilesContext::files($memory)->read(path('memory://parts/country=PL/data.floe'))->footer(), new SourceFile(path('memory://parts/country=PL/data.floe')), - ))->schema(), + )->schema(), ); } @@ -53,10 +53,10 @@ public function test_source_returns_the_listed_file(): void static::assertEquals( new SourceFile(path('memory://parts/country=PL/data.floe')), - (new FloeSourceFile( + new FloeSourceFile( FloeFilesContext::files($memory)->read(path('memory://parts/country=PL/data.floe'))->footer(), new SourceFile(path('memory://parts/country=PL/data.floe')), - ))->source(), + )->source(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/ASCII/ASCIIValueTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/ASCII/ASCIIValueTest.php index 737c7ec368..f0f1034c03 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/ASCII/ASCIIValueTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/ASCII/ASCIIValueTest.php @@ -44,7 +44,7 @@ public static function values_without_truncating(): Generator #[DataProvider('values_without_truncating')] public function test_converting_value_to_ascii_value(Type $type, mixed $value, string $asciiValue): void { - static::assertSame($asciiValue, (new ASCIIValue($type, $value))->print(false)); + static::assertSame($asciiValue, new ASCIIValue($type, $value)->print(false)); } /** @@ -56,24 +56,24 @@ public function test_converting_value_to_ascii_value_with_truncating( mixed $value, string $asciiValue, ): void { - static::assertSame($asciiValue, (new ASCIIValue($type, $value))->print(3)); + static::assertSame($asciiValue, new ASCIIValue($type, $value)->print(3)); } public function test_the_default_truncation_keeps_twenty_characters(): void { - static::assertSame('abcdefghijklmnopqrst', (new ASCIIValue(type_string(), 'abcdefghijklmnopqrstu'))->print()); - static::assertSame(20, (new ASCIIValue(type_string(), 'abcdefghijklmnopqrstu'))->length()); - static::assertSame('abcdefghijklmnopqrst', (new ASCIIValue(type_string(), 'abcdefghijklmnopqrst'))->print()); + static::assertSame('abcdefghijklmnopqrst', new ASCIIValue(type_string(), 'abcdefghijklmnopqrstu')->print()); + static::assertSame(20, new ASCIIValue(type_string(), 'abcdefghijklmnopqrstu')->length()); + static::assertSame('abcdefghijklmnopqrst', new ASCIIValue(type_string(), 'abcdefghijklmnopqrst')->print()); } public function test_a_zero_truncation_prints_the_whole_value(): void { - static::assertSame('abcdefghijklmnopqrstu', (new ASCIIValue(type_string(), 'abcdefghijklmnopqrstu'))->print(0)); + static::assertSame('abcdefghijklmnopqrstu', new ASCIIValue(type_string(), 'abcdefghijklmnopqrstu')->print(0)); } public function test_truncation_counts_characters_not_bytes(): void { - static::assertSame('ąćę', (new ASCIIValue(type_string(), 'ąćęź'))->print(3)); + static::assertSame('ąćę', new ASCIIValue(type_string(), 'ąćęź')->print(3)); } public function test_mb_str_pad_with_a_multibyte_padding(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/AsciiTableFormatterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/AsciiTableFormatterTest.php index 009815cf7e..b911de1c80 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/AsciiTableFormatterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/AsciiTableFormatterTest.php @@ -22,7 +22,7 @@ final class AsciiTableFormatterTest extends FlowTestCase { public function test_values_are_truncated_to_twenty_characters_by_default(): void { - $table = (new AsciiTableFormatter())->format(array_to_rows([[ + $table = new AsciiTableFormatter()->format(array_to_rows([[ 'row' => 'abcdefghijklmnopqrstu', ]], schema(str_schema('row')))); @@ -54,7 +54,7 @@ public function test_a_table_with_mb_strings(): void | [763][805]/nieśmiertelnym, najmędrszym|/i najbliższym magii spośród wszystkich ras. | | [816][853]/Siedem - władcom krasnoludów,|/wspaniałym górnikom | +-------------------------------------------------------------------------------------+ - TABLE, (new AsciiTableFormatter())->format($rows, false)); + TABLE, new AsciiTableFormatter()->format($rows, false)); } public function test_a_table_with_mb_strings_truncate(): void @@ -81,7 +81,7 @@ public function test_a_table_with_mb_strings_truncate(): void | [763][805]/nieśmiert | | [816][853]/Siedem - | +----------------------+ - TABLE, (new AsciiTableFormatter())->format($rows, true)); + TABLE, new AsciiTableFormatter()->format($rows, true)); } public function test_a_table_with_non_symmetric_entries(): void @@ -111,7 +111,7 @@ public function test_a_table_with_non_symmetric_entries(): void | [763][805]/nieśmiertelnym, najmędrszym|/i najbliższym magii spośród wszystkich ras. | | | | [816][853]/Siedem - władcom krasnoludów,|/wspaniałym górnikom | +-------------------------------------------------------------------------------------+---------------------------------------------------------------+ - TABLE, (new AsciiTableFormatter())->format($rows, false)); + TABLE, new AsciiTableFormatter()->format($rows, false)); } public function test_a_table_with_single_row(): void @@ -123,7 +123,7 @@ public function test_a_table_with_single_row(): void | 1 | EN | | 2 | PL | +----+------+ - TABLE, (new AsciiTableFormatter())->format( + TABLE, new AsciiTableFormatter()->format( array_to_rows( [['id' => 1, 'name' => 'EN'], ['id' => 2, 'name' => 'PL']], schema(int_schema('id'), str_schema('name')), @@ -134,7 +134,7 @@ public function test_a_table_with_single_row(): void public function test_a_batch_of_2000_rows_prints_every_row_at_one_width_per_column(): void { - $output = (new AsciiTableFormatter())->format(array_to_rows( + $output = new AsciiTableFormatter()->format(array_to_rows( array_map(static fn(int $id): array => ['id' => $id, 'name' => 'name-' . $id], range(1, 2000)), schema(int_schema('id'), str_schema('name')), )); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Row/ASCIISchemaFormatterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Row/ASCIISchemaFormatterTest.php index c488bac756..6f435c8ece 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Row/ASCIISchemaFormatterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Row/ASCIISchemaFormatterTest.php @@ -74,7 +74,7 @@ public function test_format_nested_schema(): void |-- uuid: uuid |-- datetime: datetime - SCHEMA, (new ASCIISchemaFormatter())->format($schema)); + SCHEMA, new ASCIISchemaFormatter()->format($schema)); } public function test_format_schema_with_optional_structure_elements(): void @@ -97,7 +97,7 @@ public function test_format_schema_with_optional_structure_elements(): void | |-- zip?: string | |-- nickname?: string - SCHEMA, (new ASCIISchemaFormatter())->format($schema)); + SCHEMA, new ASCIISchemaFormatter()->format($schema)); } public function test_format_nested_schema_as_table(): void @@ -142,7 +142,22 @@ public function test_format_nested_schema_as_table(): void +-------------+--------------+----------+----------+ 11 rows - SCHEMA, (new ASCIISchemaFormatter(true, true))->format($schema)); + SCHEMA, new ASCIISchemaFormatter(true, true)->format($schema)); + } + + public function test_format_as_table_keeps_names_longer_than_twenty_characters(): void + { + CommandOutputNormalizer::assertCommandOutputIdentical(<<<'SCHEMA' + +----------------------------------+--------+----------+ + | name | type | nullable | + +----------------------------------+--------+----------+ + | a_column_name_longer_than_twenty | string | false | + +----------------------------------+--------+----------+ + 1 rows + + SCHEMA, new ASCIISchemaFormatter(true, false)->format(schema(string_schema( + 'a_column_name_longer_than_twenty', + )))); } public function test_format_nested_schema_as_table_without_metadata(): void @@ -187,7 +202,7 @@ public function test_format_nested_schema_as_table_without_metadata(): void +-------------+--------------+----------+ 11 rows - SCHEMA, (new ASCIISchemaFormatter(true, false))->format($schema)); + SCHEMA, new ASCIISchemaFormatter(true, false)->format($schema)); } public function test_format_schema(): void @@ -210,6 +225,6 @@ public function test_format_schema(): void |-- map: map |-- list: list> - SCHEMA, (new ASCIISchemaFormatter())->format($schema)); + SCHEMA, new ASCIISchemaFormatter()->format($schema)); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/InlineSchemaFormatterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/InlineSchemaFormatterTest.php index 212d30a69a..768a398c7e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/InlineSchemaFormatterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/InlineSchemaFormatterTest.php @@ -18,14 +18,14 @@ final class InlineSchemaFormatterTest extends FlowTestCase { public function test_formatting_an_empty_schema(): void { - static::assertSame('', (new InlineSchemaFormatter())->format(schema())); + static::assertSame('', new InlineSchemaFormatter()->format(schema())); } public function test_formatting_names_nullability_and_types_in_schema_order(): void { static::assertSame( 'id: integer, name: ?string, tags: list', - (new InlineSchemaFormatter())->format(schema( + new InlineSchemaFormatter()->format(schema( int_schema('id'), str_schema('name', nullable: true), list_schema('tags', type_list(type_integer())), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/JsonSchemaFormatterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/JsonSchemaFormatterTest.php index 4257d014fd..77519f9661 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/JsonSchemaFormatterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/JsonSchemaFormatterTest.php @@ -34,14 +34,14 @@ final class JsonSchemaFormatterTest extends FlowTestCase { public function test_formatting_empty_schema(): void { - static::assertEquals('[]', (new JsonSchemaFormatter())->format(schema())); + static::assertEquals('[]', new JsonSchemaFormatter()->format(schema())); } public function test_formatting_schema(): void { static::assertEquals(<<<'JSON' [{"ref":"int","type":{"type":"integer"},"nullable":false,"metadata":[]},{"ref":"float","type":{"type":"float"},"nullable":false,"metadata":[]},{"ref":"bool","type":{"type":"boolean"},"nullable":false,"metadata":[]},{"ref":"datetime","type":{"type":"datetime","zone":"UTC"},"nullable":false,"metadata":[]},{"ref":"null","type":{"type":"string"},"nullable":true,"metadata":[]},{"ref":"uuid","type":{"type":"uuid"},"nullable":false,"metadata":[]},{"ref":"json","type":{"type":"json"},"nullable":false,"metadata":[]},{"ref":"list","type":{"type":"list","element":{"type":"integer"}},"nullable":false,"metadata":{"foo":"bar"}},{"ref":"list_of_datetimes","type":{"type":"list","element":{"type":"datetime","zone":"UTC"}},"nullable":false,"metadata":[]},{"ref":"map","type":{"type":"map","key":{"type":"integer"},"value":{"type":"string"}},"nullable":false,"metadata":[]},{"ref":"struct","type":{"type":"structure_v2","fields":[{"name":"street","type":{"type":"string"},"optional":false},{"name":"city","type":{"type":"string"},"optional":false},{"name":"zip","type":{"type":"string"},"optional":false},{"name":"country","type":{"type":"string"},"optional":false},{"name":"location","type":{"type":"structure_v2","fields":[{"name":"lat","type":{"type":"float"},"optional":false},{"name":"lon","type":{"type":"float"},"optional":false}]},"optional":false}]},"nullable":false,"metadata":[]},{"ref":"enum","type":{"type":"enum","class":"Flow\\ETL\\Tests\\Fixtures\\Enum\\BackedStringEnum"},"nullable":false,"metadata":[]},{"ref":"xml","type":{"type":"xml"},"nullable":false,"metadata":[]}] - JSON, (new JsonSchemaFormatter())->format(schema( + JSON, new JsonSchemaFormatter()->format(schema( int_schema('int'), float_schema('float'), bool_schema('bool'), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/PHPFormatter/TypeFormatterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/PHPFormatter/TypeFormatterTest.php index cd2aa97caa..dc33b7a5ef 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/PHPFormatter/TypeFormatterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/PHPFormatter/TypeFormatterTest.php @@ -39,17 +39,17 @@ final class TypeFormatterTest extends FlowTestCase { public function test_format_array_type(): void { - static::assertEquals('\\Flow\\Types\\DSL\\type_array()', (new TypeFormatter())->format(type_array())); + static::assertEquals('\\Flow\\Types\\DSL\\type_array()', new TypeFormatter()->format(type_array())); } public function test_format_time_zone_type(): void { - static::assertSame('\\Flow\\Types\\DSL\\type_time_zone()', (new TypeFormatter())->format(type_time_zone())); + static::assertSame('\\Flow\\Types\\DSL\\type_time_zone()', new TypeFormatter()->format(type_time_zone())); } public function test_a_nullable_null_type_is_not_wrapped_in_an_optional(): void { - static::assertSame('\\Flow\\Types\\DSL\\type_null()', (new TypeFormatter())->format(type_null(), true)); + static::assertSame('\\Flow\\Types\\DSL\\type_null()', new TypeFormatter()->format(type_null(), true)); } public function test_a_type_without_a_dsl_function_is_refused(): void @@ -57,14 +57,14 @@ public function test_a_type_without_a_dsl_function_is_refused(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('is not a simple definition'); - (new TypeFormatter())->format(type_mixed()); + new TypeFormatter()->format(type_mixed()); } public function test_format_list_type(): void { static::assertEquals( '\\Flow\\Types\\DSL\\type_list(element: \\Flow\\Types\\DSL\\type_integer())', - (new TypeFormatter())->format(type_list(type_integer())), + new TypeFormatter()->format(type_list(type_integer())), ); } @@ -72,7 +72,7 @@ public function test_format_map_type(): void { static::assertEquals( '\\Flow\\Types\\DSL\\type_map(key_type: \\Flow\\Types\\DSL\\type_integer(), value_type: \\Flow\\Types\\DSL\\type_string())', - (new TypeFormatter())->format(type_map(type_integer(), type_string())), + new TypeFormatter()->format(type_map(type_integer(), type_string())), ); } @@ -84,7 +84,7 @@ public function test_format_interleaved_structure_emits_marker_elements_and_roun 'b' => type_string(), ]); - $formatted = (new TypeFormatter())->format($type); + $formatted = new TypeFormatter()->format($type); static::assertSame( '\\Flow\\Types\\DSL\\type_structure(elements: ["z" => \\Flow\\Types\\DSL\\type_integer(), "a" => \\Flow\\Types\\DSL\\structure_element("a", \\Flow\\Types\\DSL\\type_integer(), optional: true), "b" => \\Flow\\Types\\DSL\\type_string()])', @@ -104,7 +104,7 @@ public function test_format_interleaved_structure_with_a_numeric_element_name_ro { $type = type_structure([0 => structure_element(0, type_integer(), optional: true), 'b' => type_string()]); - $formatted = (new TypeFormatter())->format($type); + $formatted = new TypeFormatter()->format($type); static::assertSame( '\\Flow\\Types\\DSL\\type_structure(elements: [0 => \\Flow\\Types\\DSL\\structure_element(0, \\Flow\\Types\\DSL\\type_integer(), optional: true), "b" => \\Flow\\Types\\DSL\\type_string()])', @@ -124,7 +124,7 @@ public function test_format_structure_type(): void { static::assertEquals( '\\Flow\\Types\\DSL\\type_structure(elements: ["name" => \\Flow\\Types\\DSL\\type_string(), "age" => \\Flow\\Types\\DSL\\type_integer()])', - (new TypeFormatter())->format(type_structure([ + new TypeFormatter()->format(type_structure([ 'name' => type_string(), 'age' => type_integer(), ])), @@ -132,7 +132,7 @@ public function test_format_structure_type(): void static::assertEquals( '\\Flow\\Types\\DSL\\type_structure(elements: ["name" => \\Flow\\Types\\DSL\\type_optional(\\Flow\\Types\\DSL\\type_string()), "age" => \\Flow\\Types\\DSL\\type_integer()])', - (new TypeFormatter())->format(type_structure([ + new TypeFormatter()->format(type_structure([ 'name' => type_optional(type_string()), 'age' => type_integer(), ])), @@ -143,7 +143,7 @@ public function test_format_structure_type_with_optional_elements(): void { static::assertEquals( '\\Flow\\Types\\DSL\\type_structure(elements: ["name" => \\Flow\\Types\\DSL\\type_string(), "nickname" => \\Flow\\Types\\DSL\\structure_element("nickname", \\Flow\\Types\\DSL\\type_string(), optional: true)])', - (new TypeFormatter())->format(type_structure([ + new TypeFormatter()->format(type_structure([ 'name' => type_string(), 'nickname' => structure_element('nickname', type_string(), optional: true), ])), @@ -154,7 +154,7 @@ public function test_format_nullable_structure_type_with_optional_elements(): vo { static::assertEquals( '\\Flow\\Types\\DSL\\type_optional(\\Flow\\Types\\DSL\\type_structure(elements: ["name" => \\Flow\\Types\\DSL\\type_string(), "nickname" => \\Flow\\Types\\DSL\\structure_element("nickname", \\Flow\\Types\\DSL\\type_string(), optional: true)]))', - (new TypeFormatter())->format(type_optional(type_structure([ + new TypeFormatter()->format(type_optional(type_structure([ 'name' => type_string(), 'nickname' => structure_element('nickname', type_string(), optional: true), ]))), @@ -163,35 +163,32 @@ public function test_format_nullable_structure_type_with_optional_elements(): vo public function test_formatting_simple_types(): void { - static::assertEquals('\\Flow\\Types\\DSL\\type_null()', (new TypeFormatter())->format(type_null())); - static::assertEquals('\\Flow\\Types\\DSL\\type_string()', (new TypeFormatter())->format(type_string())); - static::assertEquals('\\Flow\\Types\\DSL\\type_integer()', (new TypeFormatter())->format(type_integer())); - static::assertEquals('\\Flow\\Types\\DSL\\type_float()', (new TypeFormatter())->format(type_float())); - static::assertEquals('\\Flow\\Types\\DSL\\type_uuid()', (new TypeFormatter())->format(type_uuid())); - static::assertEquals('\\Flow\\Types\\DSL\\type_boolean()', (new TypeFormatter())->format(type_boolean())); - static::assertEquals('\\Flow\\Types\\DSL\\type_date()', (new TypeFormatter())->format(type_date())); - static::assertEquals('\\Flow\\Types\\DSL\\type_datetime()', (new TypeFormatter())->format(type_datetime())); + static::assertEquals('\\Flow\\Types\\DSL\\type_null()', new TypeFormatter()->format(type_null())); + static::assertEquals('\\Flow\\Types\\DSL\\type_string()', new TypeFormatter()->format(type_string())); + static::assertEquals('\\Flow\\Types\\DSL\\type_integer()', new TypeFormatter()->format(type_integer())); + static::assertEquals('\\Flow\\Types\\DSL\\type_float()', new TypeFormatter()->format(type_float())); + static::assertEquals('\\Flow\\Types\\DSL\\type_uuid()', new TypeFormatter()->format(type_uuid())); + static::assertEquals('\\Flow\\Types\\DSL\\type_boolean()', new TypeFormatter()->format(type_boolean())); + static::assertEquals('\\Flow\\Types\\DSL\\type_date()', new TypeFormatter()->format(type_date())); + static::assertEquals('\\Flow\\Types\\DSL\\type_datetime()', new TypeFormatter()->format(type_datetime())); static::assertEquals( "\\Flow\\Types\\DSL\\type_datetime('Europe/Warsaw')", - (new TypeFormatter())->format(type_datetime('Europe/Warsaw')), + new TypeFormatter()->format(type_datetime('Europe/Warsaw')), ); static::assertEquals( "\\Flow\\Types\\DSL\\type_optional(\\Flow\\Types\\DSL\\type_datetime('Europe/Warsaw'))", - (new TypeFormatter())->format(type_optional(type_datetime('Europe/Warsaw'))), + new TypeFormatter()->format(type_optional(type_datetime('Europe/Warsaw'))), ); - static::assertEquals('\\Flow\\Types\\DSL\\type_time()', (new TypeFormatter())->format(type_time())); - static::assertEquals('\\Flow\\Types\\DSL\\type_html()', (new TypeFormatter())->format(type_html())); + static::assertEquals('\\Flow\\Types\\DSL\\type_time()', new TypeFormatter()->format(type_time())); + static::assertEquals('\\Flow\\Types\\DSL\\type_html()', new TypeFormatter()->format(type_html())); static::assertEquals( '\\Flow\\Types\\DSL\\type_html_element()', - (new TypeFormatter())->format(type_html_element()), + new TypeFormatter()->format(type_html_element()), ); - static::assertEquals('\\Flow\\Types\\DSL\\type_xml()', (new TypeFormatter())->format(type_xml())); - static::assertEquals( - '\\Flow\\Types\\DSL\\type_xml_element()', - (new TypeFormatter())->format(type_xml_element()), - ); - static::assertEquals('\\Flow\\Types\\DSL\\type_resource()', (new TypeFormatter())->format(type_resource())); - static::assertEquals('\\Flow\\Types\\DSL\\type_callable()', (new TypeFormatter())->format(type_callable())); - static::assertEquals('\\Flow\\Types\\DSL\\type_json()', (new TypeFormatter())->format(type_json())); + static::assertEquals('\\Flow\\Types\\DSL\\type_xml()', new TypeFormatter()->format(type_xml())); + static::assertEquals('\\Flow\\Types\\DSL\\type_xml_element()', new TypeFormatter()->format(type_xml_element())); + static::assertEquals('\\Flow\\Types\\DSL\\type_resource()', new TypeFormatter()->format(type_resource())); + static::assertEquals('\\Flow\\Types\\DSL\\type_callable()', new TypeFormatter()->format(type_callable())); + static::assertEquals('\\Flow\\Types\\DSL\\type_json()', new TypeFormatter()->format(type_json())); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/PHPFormatter/ValueFormatterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/PHPFormatter/ValueFormatterTest.php index 52529aa992..3a5f049d1f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/PHPFormatter/ValueFormatterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/PHPFormatter/ValueFormatterTest.php @@ -20,6 +20,6 @@ final class ValueFormatterTest extends FlowTestCase #[TestWith(['value' => null, 'output' => 'null'])] public function test_format_values(mixed $value, string $output): void { - static::assertEquals($output, (new ValueFormatter())->format($value)); + static::assertEquals($output, new ValueFormatter()->format($value)); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/PHPSchemaFormatterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/PHPSchemaFormatterTest.php index 7a47a1eead..04c64e7ba3 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/PHPSchemaFormatterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Formatter/Schema/PHPSchemaFormatterTest.php @@ -41,7 +41,7 @@ final class PHPSchemaFormatterTest extends FlowTestCase { public function test_formatting_empty_schema(): void { - static::assertEquals('\\Flow\\ETL\\DSL\\schema();', (new PHPSchemaFormatter())->format(schema())); + static::assertEquals('\\Flow\\ETL\\DSL\\schema();', new PHPSchemaFormatter()->format(schema())); } public function test_formatting_enum_schema(): void @@ -50,7 +50,7 @@ public function test_formatting_enum_schema(): void \Flow\ETL\DSL\schema( \Flow\ETL\DSL\enum_schema("enum", type: \Flow\ETL\Tests\Fixtures\Enum\StringEnum::class, nullable: false, metadata: \Flow\ETL\DSL\schema_metadata()), ); - PHP, (new PHPSchemaFormatter())->format(schema(enum_schema( + PHP, new PHPSchemaFormatter()->format(schema(enum_schema( 'enum', type: StringEnum::class, nullable: false, @@ -64,7 +64,7 @@ public function test_formatting_float_schema(): void \Flow\ETL\DSL\schema( \Flow\ETL\DSL\float_schema("float", nullable: false, metadata: \Flow\ETL\DSL\schema_metadata()), ); - PHP, (new PHPSchemaFormatter())->format(schema(float_schema('float', nullable: false, metadata: null)))); + PHP, new PHPSchemaFormatter()->format(schema(float_schema('float', nullable: false, metadata: null)))); } public function test_formatting_list_schema(): void @@ -73,7 +73,7 @@ public function test_formatting_list_schema(): void \Flow\ETL\DSL\schema( \Flow\ETL\DSL\list_schema("list", type: \Flow\Types\DSL\type_list(element: \Flow\Types\DSL\type_integer()), nullable: false, metadata: \Flow\ETL\DSL\schema_metadata()), ); - PHP, (new PHPSchemaFormatter())->format(schema(list_schema('list', type: type_list(type_integer()))))); + PHP, new PHPSchemaFormatter()->format(schema(list_schema('list', type: type_list(type_integer()))))); } public function test_formatting_map_schema(): void @@ -82,7 +82,7 @@ public function test_formatting_map_schema(): void \Flow\ETL\DSL\schema( \Flow\ETL\DSL\map_schema("map", type: \Flow\Types\DSL\type_map(key_type: \Flow\Types\DSL\type_integer(), value_type: \Flow\Types\DSL\type_string()), nullable: false, metadata: \Flow\ETL\DSL\schema_metadata()), ); - PHP, (new PHPSchemaFormatter())->format(schema(map_schema( + PHP, new PHPSchemaFormatter()->format(schema(map_schema( 'map', type_map(type_integer(), type_string()), nullable: false, @@ -96,7 +96,7 @@ public function test_formatting_numeric_string_schema(): void \Flow\ETL\DSL\schema( \Flow\ETL\DSL\definition_from_type("id", type: \Flow\Types\DSL\type_numeric_string(), nullable: true, metadata: \Flow\ETL\DSL\schema_metadata()), ); - PHP, (new PHPSchemaFormatter())->format(schema(definition_from_type('id', type_numeric_string(), true)))); + PHP, new PHPSchemaFormatter()->format(schema(definition_from_type('id', type_numeric_string(), true)))); } public function test_formatting_simple_schema(): void @@ -116,7 +116,7 @@ public function test_formatting_simple_schema(): void \\Flow\\ETL\\DSL\\html_schema("html", nullable: true, metadata: \\Flow\\ETL\\DSL\\schema_metadata()), \\Flow\\ETL\\DSL\\html_element_schema("html_element", nullable: true, metadata: \\Flow\\ETL\\DSL\\schema_metadata()), ); - PHP, (new PHPSchemaFormatter())->format(schema( + PHP, new PHPSchemaFormatter()->format(schema( int_schema('id', nullable: false), str_schema('name', nullable: true), bool_schema('active', false), @@ -138,7 +138,7 @@ public function test_formatting_simple_schema_with_metadata(): void \Flow\ETL\DSL\schema( \Flow\ETL\DSL\integer_schema("id", nullable: false, metadata: \Flow\ETL\DSL\schema_metadata(["array_of_arrays" => [[1, 2], ["a", "b"]], "array_of_ints" => [1, 2, 3], "associative_array" => ["key" => "value"], "bool" => true, "empty_array" => [], "float" => 1.1, "int" => 1, "str" => "str"])), ); - PHP, (new PHPSchemaFormatter())->format(schema(int_schema( + PHP, new PHPSchemaFormatter()->format(schema(int_schema( 'id', nullable: false, metadata: Metadata::fromArray([ @@ -165,7 +165,7 @@ public function test_php_schema_formatter_renders_a_timezone_column(): void \Flow\ETL\DSL\schema( \Flow\ETL\DSL\time_zone_schema("tz", nullable: false, metadata: \Flow\ETL\DSL\schema_metadata()), ); - PHP, (new PHPSchemaFormatter())->format(schema(time_zone_schema('tz')))); + PHP, new PHPSchemaFormatter()->format(schema(time_zone_schema('tz')))); } public function test_php_schema_formatter_renders_a_zoned_datetime_column(): void @@ -174,7 +174,7 @@ public function test_php_schema_formatter_renders_a_zoned_datetime_column(): voi \Flow\ETL\DSL\schema( \Flow\ETL\DSL\datetime_schema("at", nullable: false, metadata: \Flow\ETL\DSL\schema_metadata(), zone: "Europe/Warsaw"), ); - PHP, (new PHPSchemaFormatter())->format(schema(datetime_schema('at', zone: 'Europe/Warsaw')))); + PHP, new PHPSchemaFormatter()->format(schema(datetime_schema('at', zone: 'Europe/Warsaw')))); } public function test_formatting_structure_schema(): void @@ -183,7 +183,7 @@ public function test_formatting_structure_schema(): void \Flow\ETL\DSL\schema( \Flow\ETL\DSL\structure_schema("structure", type: \Flow\Types\DSL\type_structure(elements: ["int" => \Flow\Types\DSL\type_optional(\Flow\Types\DSL\type_integer()), "string" => \Flow\Types\DSL\type_optional(\Flow\Types\DSL\type_string())]), nullable: false, metadata: \Flow\ETL\DSL\schema_metadata()), ); - PHP, (new PHPSchemaFormatter())->format(schema(structure_schema('structure', type_structure([ + PHP, new PHPSchemaFormatter()->format(schema(structure_schema('structure', type_structure([ 'int' => type_optional(type_integer()), 'string' => type_optional(type_string()), ]))))); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/InferredTypesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/InferredTypesTest.php index 7756e004f1..44bf672525 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/InferredTypesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/InferredTypesTest.php @@ -65,7 +65,7 @@ public function test_an_empty_list_is_rejected(): void public function test_a_parameterised_type_admits_its_whole_family(): void { - static::assertTrue((new InferredTypes(type_enum(BackedStringEnum::class)))->allows(type_enum( + static::assertTrue(new InferredTypes(type_enum(BackedStringEnum::class))->allows(type_enum( BackedStringEnum::class, ))); } @@ -94,7 +94,7 @@ public function test_order_and_duplicates_do_not_matter(): void public function test_string_is_admitted_even_when_it_is_not_listed(): void { - static::assertTrue((new InferredTypes(type_integer()))->allows(type_string())); + static::assertTrue(new InferredTypes(type_integer())->allows(type_string())); } public function test_a_type_outside_the_list_is_not_allowed(): void @@ -110,7 +110,7 @@ public function test_to_array_carries_the_list_the_narrower_receives(): void { static::assertEqualsCanonicalizing( [type_integer(), type_string()], - (new InferredTypes(type_integer()))->toArray(), + new InferredTypes(type_integer())->toArray(), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SampleTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SampleTest.php index cabe8f4653..b500991608 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SampleTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SampleTest.php @@ -28,13 +28,13 @@ public function test_merge_widens_the_folds_sums_the_bytes_and_is_complete_only_ $second->observe(['id' => 'a']); $second->observe(['id' => 'b']); - $merged = (new Sample($first->folded(), 2, true))->merge(new Sample($second->folded(), 4, false)); + $merged = new Sample($first->folded(), 2, true)->merge(new Sample($second->folded(), 4, false)); static::assertEquals($first->folded()->merge($second->folded(), true), $merged->columns); static::assertSame(3, $merged->columns->rows); static::assertSame(6, $merged->bytes); static::assertFalse($merged->complete); - static::assertTrue((new Sample($first->folded(), 1, true))->merge( + static::assertTrue(new Sample($first->folded(), 1, true)->merge( new Sample($second->folded(), 1, true), )->complete); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SampledUnitsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SampledUnitsTest.php index ceb0da60c8..4bac9351d5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SampledUnitsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SampledUnitsTest.php @@ -16,7 +16,7 @@ public function test_a_partial_sample_estimates_from_the_mean_row_size(): void { static::assertEquals( Cardinality::approximately(100), - (new SampledUnits([new Sample(new SniffedColumns([], 10), 100, false)]))->estimatedRows( + new SampledUnits([new Sample(new SniffedColumns([], 10), 100, false)])->estimatedRows( 1, Cardinality::exact(1000), ), @@ -27,20 +27,20 @@ public function test_the_mean_row_size_sums_the_rows_and_bytes_of_every_sample() { static::assertEquals( Cardinality::approximately(200), - (new SampledUnits([ + new SampledUnits([ new Sample(new SniffedColumns([], 10), 100, false), new Sample(new SniffedColumns([], 30), 100, false), - ]))->estimatedRows(1, Cardinality::exact(1000)), + ])->estimatedRows(1, Cardinality::exact(1000)), ); } public function test_sampled_bytes_without_rows_are_unknown(): void { - static::assertEquals(Cardinality::unknown(), (new SampledUnits([new Sample( + static::assertEquals(Cardinality::unknown(), new SampledUnits([new Sample( new SniffedColumns([], 0), 100, false, - )]))->estimatedRows(1, Cardinality::exact(100))); + )])->estimatedRows(1, Cardinality::exact(100))); } public function test_the_estimate_rounds_to_the_nearest_row(): void @@ -74,32 +74,32 @@ public function test_an_incomplete_sample_is_never_exact(): void { static::assertEquals( Cardinality::unknown(), - (new SampledUnits([new Sample(new SniffedColumns([], 10), 0, false)]))->exactRows(1), + new SampledUnits([new Sample(new SniffedColumns([], 10), 0, false)])->exactRows(1), ); } public function test_no_listed_bytes_or_no_sampled_bytes_is_unknown(): void { - static::assertEquals(Cardinality::unknown(), (new SampledUnits([new Sample( + static::assertEquals(Cardinality::unknown(), new SampledUnits([new Sample( new SniffedColumns([], 10), 100, false, - )]))->estimatedRows(1, Cardinality::unknown())); - static::assertEquals(Cardinality::unknown(), (new SampledUnits([new Sample( + )])->estimatedRows(1, Cardinality::unknown())); + static::assertEquals(Cardinality::unknown(), new SampledUnits([new Sample( new SniffedColumns([], 10), 0, false, - )]))->estimatedRows(1, Cardinality::exact(100))); - static::assertEquals(Cardinality::unknown(), (new SampledUnits([new Sample( + )])->estimatedRows(1, Cardinality::exact(100))); + static::assertEquals(Cardinality::unknown(), new SampledUnits([new Sample( new SniffedColumns([], 0), 0, false, - )]))->estimatedRows(1, Cardinality::exact(100))); + )])->estimatedRows(1, Cardinality::exact(100))); } public function test_no_samples_over_no_listed_units_is_exactly_nothing(): void { - static::assertEquals(Cardinality::exact(0), (new SampledUnits([]))->exactRows(0)); - static::assertEquals(Cardinality::unknown(), (new SampledUnits([]))->exactRows(1)); + static::assertEquals(Cardinality::exact(0), new SampledUnits([])->exactRows(0)); + static::assertEquals(Cardinality::unknown(), new SampledUnits([])->exactRows(1)); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SchemaInferenceTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SchemaInferenceTest.php index b55a658842..ce43ee64d6 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SchemaInferenceTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SchemaInferenceTest.php @@ -32,7 +32,7 @@ public function test_defaults(): void public function test_the_default_candidate_set_is_every_rung_but_markup(): void { - $candidates = (new SchemaInference())->candidates(); + $candidates = new SchemaInference()->candidates(); static::assertTrue($candidates->allows(type_integer())); static::assertTrue($candidates->allows(type_date())); @@ -44,7 +44,7 @@ public function test_the_default_candidate_set_is_every_rung_but_markup(): void public function test_normalize_round_trips_with_and_without_candidates(): void { $default = new SchemaInference(); - $custom = (new SchemaInference(types: new InferredTypes(type_integer(), type_date()), unionByName: true)) + $custom = new SchemaInference(types: new InferredTypes(type_integer(), type_date()), unionByName: true) ->everyRow() ->everySource(); @@ -63,7 +63,7 @@ public function test_normalize_round_trips_with_and_without_candidates(): void public function test_every_row_with_a_finite_files_to_sniff_round_trips(): void { - $inference = (new SchemaInference(filesToSniff: 3))->everyRow(); + $inference = new SchemaInference(filesToSniff: 3)->everyRow(); static::assertSame([null, 3], [$inference->sampleSize, $inference->filesToSniff]); static::assertEquals($inference, SchemaInference::fromArray($inference->normalize())); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SchemaInferrerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SchemaInferrerTest.php index 8e3c6572ca..45c3f6d9bc 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SchemaInferrerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/SchemaInferrerTest.php @@ -103,7 +103,7 @@ public function test_every_unit_is_asked_with_the_budget_left(): void ['a'], ); - $schema = (new SchemaInferrer(new SchemaInference(sampleSize: 10, unionByName: true)))->infer( + $schema = new SchemaInferrer(new SchemaInference(sampleSize: 10, unionByName: true))->infer( $sniffer, new VoidProgress(), )->schema; @@ -128,7 +128,7 @@ public function test_a_unit_is_not_asked_once_the_budget_is_spent(): void $sniffer = new FakeSniffer([$tenIntegers, $tenIntegers], new StringTypeNarrower(), ['a']); - (new SchemaInferrer(new SchemaInference(sampleSize: 10)))->infer($sniffer, new VoidProgress()); + new SchemaInferrer(new SchemaInference(sampleSize: 10))->infer($sniffer, new VoidProgress()); static::assertSame([[0, 10]], $sniffer->sniffed); } @@ -146,14 +146,14 @@ public function test_a_column_that_is_free_text_in_the_first_source_and_numeric_ definition_from_type('id', type_integer(), nullable: true), definition_from_type('v', type_string(), nullable: true), ), - (new SchemaInferrer(new SchemaInference()))->infer( + new SchemaInferrer(new SchemaInference())->infer( new FakeSniffer($fixture, $typer, ['id', 'v']), new VoidProgress(), )->schema, ); static::assertEquals( definition_from_type('v', type_integer(), nullable: true), - (new FakeSniffer($fixture, $typer, ['id', 'v'])) + new FakeSniffer($fixture, $typer, ['id', 'v']) ->sniff(1, null, new VoidProgress()) ->columns ->schema(ColumnTypesMother::floor()) @@ -169,7 +169,7 @@ public function test_a_row_less_source_does_not_spend_a_files_to_sniff_slot_of_a [['c' => '1']], ], new StringTypeNarrower(InferredTypes::default()->toArray())); - $schema = (new SchemaInferrer(new SchemaInference(100, 1)))->infer($sniffer, new VoidProgress())->schema; + $schema = new SchemaInferrer(new SchemaInference(100, 1))->infer($sniffer, new VoidProgress())->schema; static::assertSame([0, 1], $sniffer->sources->started); static::assertSame(['a', 'b'], array_keys($schema->definitions())); @@ -183,7 +183,7 @@ public function test_an_unbounded_sample_counts_empty_units_toward_files_to_snif [['c' => '1']], ], new StringTypeNarrower(InferredTypes::default()->toArray())); - $schema = (new SchemaInferrer((new SchemaInference(filesToSniff: 2))->everyRow()))->infer( + $schema = new SchemaInferrer(new SchemaInference(filesToSniff: 2)->everyRow())->infer( $sniffer, new VoidProgress(), )->schema; @@ -199,7 +199,7 @@ public function test_an_unbounded_sample_sniffs_every_unit_whole(): void new StringTypeNarrower(InferredTypes::default()->toArray()), ); - (new SchemaInferrer((new SchemaInference())->everyRow()->everySource()))->infer($sniffer, new VoidProgress()); + new SchemaInferrer(new SchemaInference()->everyRow()->everySource())->infer($sniffer, new VoidProgress()); static::assertSame([[0, null], [1, null], [2, null]], $sniffer->sniffed); } @@ -207,10 +207,10 @@ public function test_an_unbounded_sample_sniffs_every_unit_whole(): void public function test_execution_order_does_not_change_the_schema(): void { $typer = new StringTypeNarrower(InferredTypes::default()->toArray()); - $inference = (new SchemaInference(unionByName: true))->everyRow()->everySource(); + $inference = new SchemaInference(unionByName: true)->everyRow()->everySource(); foreach ([[], ['z', 'a']] as $names) { - $inferred = (new SchemaInferrer($inference))->infer( + $inferred = new SchemaInferrer($inference)->infer( new FakeSniffer(self::threeSourcesOfTenRows(), $typer, $names), new VoidProgress(), )->schema; @@ -228,7 +228,7 @@ public function test_a_single_unit_is_accepted(): void { static::assertEquals( new Schema(definition_from_type('a', type_integer(), nullable: true)), - (new SchemaInferrer(new SchemaInference()))->infer(new FakeSniffer([[[ + new SchemaInferrer(new SchemaInference())->infer(new FakeSniffer([[[ 'a' => '1', ]]], new StringTypeNarrower(InferredTypes::default()->toArray())), new VoidProgress())->schema, ); @@ -268,7 +268,7 @@ public function test_the_budget_decides_how_much_of_the_sample_is_seen( new StringTypeNarrower(InferredTypes::default()->toArray()), ); - $schema = (new SchemaInferrer(new SchemaInference($sampleSize, unionByName: true)))->infer( + $schema = new SchemaInferrer(new SchemaInference($sampleSize, unionByName: true))->infer( $sniffer, new VoidProgress(), )->schema; @@ -319,7 +319,7 @@ public function test_only_the_first_unit_is_opened_when_files_to_sniff_is_one(): new StringTypeNarrower(InferredTypes::default()->toArray()), ); - (new SchemaInferrer((new SchemaInference(filesToSniff: 1))->everyRow()))->infer($sniffer, new VoidProgress()); + new SchemaInferrer(new SchemaInference(filesToSniff: 1)->everyRow())->infer($sniffer, new VoidProgress()); static::assertSame([0], $sniffer->sources->started); static::assertSame([0 => 10], $sniffer->sources->rowsRead); @@ -327,10 +327,10 @@ public function test_only_the_first_unit_is_opened_when_files_to_sniff_is_one(): public function test_types_outside_the_candidate_set_are_floored_to_string(): void { - $schema = (new SchemaInferrer(new SchemaInference( + $schema = new SchemaInferrer(new SchemaInference( types: new InferredTypes(type_string()), unionByName: true, - )))->infer( + ))->infer( new FakeSniffer(self::threeSourcesOfTenRows(), new StringTypeNarrower([type_string()])), new VoidProgress(), )->schema; @@ -344,11 +344,11 @@ public function test_union_by_name_decides_whether_a_later_sources_column_joins_ { $typer = new StringTypeNarrower(InferredTypes::default()->toArray()); - $unioned = (new SchemaInferrer(new SchemaInference(unionByName: true)))->infer( + $unioned = new SchemaInferrer(new SchemaInference(unionByName: true))->infer( new FakeSniffer(self::threeSourcesOfTenRows(), $typer), new VoidProgress(), )->schema; - $firstSourceWins = (new SchemaInferrer(new SchemaInference()))->infer( + $firstSourceWins = new SchemaInferrer(new SchemaInference())->infer( new FakeSniffer(self::threeSourcesOfTenRows(), $typer), new VoidProgress(), )->schema; @@ -365,7 +365,7 @@ public function test_the_candidate_set_reaches_the_floor_through_infer(): void definition_from_type('f', type_string(), nullable: true), definition_from_type('d', type_string(), nullable: true), ), - (new SchemaInferrer(new SchemaInference(types: new InferredTypes(type_integer(), type_string()))))->infer( + new SchemaInferrer(new SchemaInference(types: new InferredTypes(type_integer(), type_string())))->infer( new FakeSniffer([[[ 'i' => '42', 'f' => '1.5', @@ -384,7 +384,7 @@ public function test_union_by_name_over_sources_where_one_column_saturates_to_st definition_from_type('v', type_string(), nullable: true), definition_from_type('w', type_date(), nullable: true), ), - (new SchemaInferrer(new SchemaInference(unionByName: true)))->infer(new FakeSniffer([ + new SchemaInferrer(new SchemaInference(unionByName: true))->infer(new FakeSniffer([ [['id' => '1', 'v' => 'free text']], [['id' => '2', 'v' => '42', 'w' => '2024-01-01']], ], new StringTypeNarrower(InferredTypes::default()->toArray())), new VoidProgress())->schema, @@ -398,7 +398,7 @@ public function test_unbounded_bounds_read_every_row_of_every_unit(): void new StringTypeNarrower(InferredTypes::default()->toArray()), ); - (new SchemaInferrer((new SchemaInference())->everyRow()->everySource()))->infer($sniffer, new VoidProgress()); + new SchemaInferrer(new SchemaInference()->everyRow()->everySource())->infer($sniffer, new VoidProgress()); static::assertSame([0, 1, 2], $sniffer->sources->started); static::assertSame([0 => 10, 1 => 10, 2 => 10], $sniffer->sources->rowsRead); @@ -413,7 +413,7 @@ public function test_an_unbounded_sample_asks_the_launcher_once_and_sniffs_here_ ['id'], ); - $inferred = (new SchemaInferrer((new SchemaInference(sniffs: $launcher))->everyRow()->everySource()))->infer( + $inferred = new SchemaInferrer(new SchemaInference(sniffs: $launcher)->everyRow()->everySource())->infer( $sniffer, new VoidProgress(), ); @@ -422,7 +422,7 @@ public function test_an_unbounded_sample_asks_the_launcher_once_and_sniffs_here_ static::assertSame(3, $launcher->sniffs[0][1]); static::assertCount(3, $inferred->units->samples); static::assertEquals( - (new SchemaInferrer((new SchemaInference())->everyRow()->everySource()))->infer( + new SchemaInferrer(new SchemaInference()->everyRow()->everySource())->infer( $sniffer, new VoidProgress(), )->schema, @@ -436,7 +436,7 @@ public function test_files_to_sniff_caps_the_units_handed_to_the_launcher(): voi $units = self::threeSourcesOfTenRows(); $units[] = $units[0]; - (new SchemaInferrer((new SchemaInference(filesToSniff: 2, sniffs: $launcher))->everyRow()))->infer( + new SchemaInferrer(new SchemaInference(filesToSniff: 2, sniffs: $launcher)->everyRow())->infer( new FakeSniffer($units, new StringTypeNarrower(InferredTypes::default()->toArray()), ['id']), new VoidProgress(), ); @@ -448,7 +448,7 @@ public function test_a_bounded_sample_never_asks_the_launcher(): void { $launcher = new RecordingLauncher(); - (new SchemaInferrer(new SchemaInference(sampleSize: 5, sniffs: $launcher)))->infer( + new SchemaInferrer(new SchemaInference(sampleSize: 5, sniffs: $launcher))->infer( new FakeSniffer( self::threeSourcesOfTenRows(), new StringTypeNarrower(InferredTypes::default()->toArray()), @@ -471,7 +471,7 @@ public function test_the_samples_the_launcher_returns_are_merged_in_the_order_re static::assertSame( ['b', 'a'], array_keys( - (new SchemaInferrer((new SchemaInference(unionByName: true))->everyRow())) + new SchemaInferrer(new SchemaInference(unionByName: true)->everyRow()) ->infer( new PresniffedSniffer([], [ $sniffer->sniff(1, null, new VoidProgress()), @@ -488,7 +488,7 @@ public function test_every_row_reports_the_rows_of_every_unit_to_one_progress(): { $progress = new ProgressSpy(); - (new SchemaInferrer((new SchemaInference())->everyRow()->everySource()))->infer(new FakeSniffer([ + new SchemaInferrer(new SchemaInference()->everyRow()->everySource())->infer(new FakeSniffer([ [['a' => '1'], ['a' => '2'], ['a' => '3']], [['a' => '4'], ['a' => '5']], ], new StringTypeNarrower(InferredTypes::default()->toArray())), $progress); @@ -501,7 +501,7 @@ public function test_every_row_hands_its_progress_to_the_launcher(): void $launcher = new RecordingLauncher(); $progress = new ProgressSpy(); - (new SchemaInferrer((new SchemaInference(sniffs: $launcher))->everyRow()))->infer( + new SchemaInferrer(new SchemaInference(sniffs: $launcher)->everyRow())->infer( new FakeSniffer(self::threeSourcesOfTenRows(), new StringTypeNarrower(InferredTypes::default()->toArray())), $progress, ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/TypeFloorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/TypeFloorTest.php index 4beb3826ae..e44f620da2 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/TypeFloorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Inference/TypeFloorTest.php @@ -224,7 +224,7 @@ public static function scalarsKeptTable(): array #[DataProvider('allStringsTable')] public function test_flooring_with_all_strings(Type $input, Type $expected, string $definition): void { - $floored = (new TypeFloor(new InferredTypes(type_string())))->floor($input); + $floored = new TypeFloor(new InferredTypes(type_string()))->floor($input); static::assertTrue(type_equals($expected, $floored), $expected->toString() . ' !== ' . $floored->toString()); static::assertInstanceOf($definition, definition_from_type('c', $floored, nullable: true)); @@ -238,7 +238,7 @@ public function test_flooring_with_all_strings(Type $input, Type $expected, stri #[DataProvider('scalarsKeptTable')] public function test_flooring_with_scalars_kept(Type $input, Type $expected, string $definition): void { - $floored = (new TypeFloor(self::everyLeaf()))->floor($input); + $floored = new TypeFloor(self::everyLeaf())->floor($input); static::assertTrue(type_equals($expected, $floored), $expected->toString() . ' !== ' . $floored->toString()); static::assertInstanceOf($definition, definition_from_type('c', $floored, nullable: true)); @@ -246,7 +246,7 @@ public function test_flooring_with_scalars_kept(Type $input, Type $expected, str public function test_structure_element_order_and_optional_flags_survive_the_floor(): void { - $floored = (new TypeFloor(new InferredTypes(type_string())))->floor(type_structure([ + $floored = new TypeFloor(new InferredTypes(type_string()))->floor(type_structure([ 'b' => structure_element('b', type_null(), optional: true), 'a' => type_integer(), ])); @@ -261,10 +261,10 @@ public function test_the_array_to_json_projection_happens_at_depth(): void { static::assertTrue(type_equals( type_list(type_json()), - (new TypeFloor(self::everyLeaf()))->floor(type_list(type_array())), + new TypeFloor(self::everyLeaf())->floor(type_list(type_array())), )); static::assertTrue(type_equals(type_structure([ 'a' => type_json(), - ]), (new TypeFloor(self::everyLeaf()))->floor(type_structure(['a' => type_empty_array()])))); + ]), new TypeFloor(self::everyLeaf())->floor(type_structure(['a' => type_empty_array()])))); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/File/FileCommitTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/File/FileCommitTest.php index 034f277fcd..4a682336b0 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/File/FileCommitTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/File/FileCommitTest.php @@ -175,7 +175,7 @@ public function test_commit_reports_after_every_file_operation(): void public function test_location_is_the_directory_the_files_land_in(string $destination, string $location): void { static::assertSame([$location, $location], [ - (new FileCommit($this->memory, path($destination), overwrite(), 'r1'))->location(), + new FileCommit($this->memory, path($destination), overwrite(), 'r1')->location(), FileCommit::locationOf(path($destination)), ]); } @@ -247,14 +247,14 @@ public function test_commit_reports_removing_what_a_task_without_a_result_staged { $job = new FileCommit($this->recording, path('memory://out/part-{part}.csv'), overwrite(), 'r1', 2); $job->admit(true); - (new FileCommit( + new FileCommit( $this->memory, path('memory://out/part-{part}.csv'), overwrite(), 'r1', 2, $job->task(0), - ))->open([new Partition('dept', 'a')])->append('a'); + )->open([new Partition('dept', 'a')])->append('a'); $job->commit([1], new ProgressSpy(StageName::commit, advancedLog: $this->log)); @@ -285,7 +285,7 @@ public function test_a_placeholder_destination_without_partitions_is_refused(): $this->expectException(RuntimeException::class); $this->expectExceptionMessage('contains partition placeholders but rows are not partitioned'); - (new FileCommit(memory_filesystem(), path('memory://out/{name}.csv'), exception_if_exists(), 'r1'))->open(); + new FileCommit(memory_filesystem(), path('memory://out/{name}.csv'), exception_if_exists(), 'r1')->open(); } public function test_the_same_destination_returns_the_same_stream(): void @@ -321,7 +321,7 @@ public function test_append_over_an_existing_plain_file_names_the_run_after_a_da static::assertSame( 'memory://out/orders-r1.csv', - (new FileCommit($filesystem, path('memory://out/orders.csv'), append(), 'r1'))->open()->path()->uri(), + new FileCommit($filesystem, path('memory://out/orders.csv'), append(), 'r1')->open()->path()->uri(), ); } @@ -355,7 +355,7 @@ public function test_exception_if_exists_refuses_an_existing_plain_file(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Destination path "memory://out/orders.csv" already exists'); - (new FileCommit($filesystem, path('memory://out/orders.csv'), exception_if_exists(), 'r1'))->admit(false); + new FileCommit($filesystem, path('memory://out/orders.csv'), exception_if_exists(), 'r1')->admit(false); } public function test_ignore_does_not_admit_an_existing_plain_file(): void @@ -363,9 +363,7 @@ public function test_ignore_does_not_admit_an_existing_plain_file(): void $filesystem = memory_filesystem(); $filesystem->writeTo(path('memory://out/orders.csv'))->append('old')->close(); - static::assertFalse((new FileCommit($filesystem, path('memory://out/orders.csv'), ignore(), 'r1'))->admit( - false, - )); + static::assertFalse(new FileCommit($filesystem, path('memory://out/orders.csv'), ignore(), 'r1')->admit(false)); } public function test_a_partitioned_plain_destination_is_decided_once_over_every_partition(): void @@ -373,33 +371,28 @@ public function test_a_partitioned_plain_destination_is_decided_once_over_every_ $filesystem = memory_filesystem(); $filesystem->writeTo(path('memory://out/dept=b/orders.csv'))->append('old')->close(); - static::assertFalse((new FileCommit($filesystem, path('memory://out/orders.csv'), ignore(), 'r1'))->admit( - true, - )); + static::assertFalse(new FileCommit($filesystem, path('memory://out/orders.csv'), ignore(), 'r1')->admit(true)); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Destination path "memory://out/**/orders.csv" already exists'); - (new FileCommit($filesystem, path('memory://out/orders.csv'), exception_if_exists(), 'r1'))->admit(true); + new FileCommit($filesystem, path('memory://out/orders.csv'), exception_if_exists(), 'r1')->admit(true); } public function test_admit_answers_true_for_a_fresh_destination_and_for_overwrite_and_append(): void { $filesystem = memory_filesystem(); - static::assertTrue((new FileCommit($filesystem, path('memory://out/part-{part}.csv'), ignore(), 'r1'))->admit( + static::assertTrue(new FileCommit($filesystem, path('memory://out/part-{part}.csv'), ignore(), 'r1')->admit( false, )); $filesystem->writeTo(path('memory://out/part-00003.csv'))->append('x')->close(); - static::assertTrue((new FileCommit( - $filesystem, - path('memory://out/part-{part}.csv'), - overwrite(), - 'r1', - ))->admit(false)); - static::assertTrue((new FileCommit($filesystem, path('memory://out/part-{part}.csv'), append(), 'r1'))->admit( + static::assertTrue(new FileCommit($filesystem, path('memory://out/part-{part}.csv'), overwrite(), 'r1')->admit( + false, + )); + static::assertTrue(new FileCommit($filesystem, path('memory://out/part-{part}.csv'), append(), 'r1')->admit( false, )); } @@ -409,7 +402,7 @@ public function test_admit_answers_false_for_ignore_over_an_existing_part(): voi $filesystem = memory_filesystem(); $filesystem->writeTo(path('memory://out/part-00003.csv'))->append('x')->close(); - static::assertFalse((new FileCommit($filesystem, path('memory://out/part-{part}.csv'), ignore(), 'r1'))->admit( + static::assertFalse(new FileCommit($filesystem, path('memory://out/part-{part}.csv'), ignore(), 'r1')->admit( false, )); } @@ -419,10 +412,10 @@ public function test_admit_globs_partition_directories_when_partitioned(): void $filesystem = memory_filesystem(); $filesystem->writeTo(path('memory://out/dept=a/part-00000.csv'))->append('x')->close(); - static::assertTrue((new FileCommit($filesystem, path('memory://out/part-{part}.csv'), ignore(), 'r1'))->admit( + static::assertTrue(new FileCommit($filesystem, path('memory://out/part-{part}.csv'), ignore(), 'r1')->admit( false, )); - static::assertFalse((new FileCommit($filesystem, path('memory://out/part-{part}.csv'), ignore(), 'r1'))->admit( + static::assertFalse(new FileCommit($filesystem, path('memory://out/part-{part}.csv'), ignore(), 'r1')->admit( true, )); } @@ -437,7 +430,7 @@ public function test_admit_refuses_exception_if_exists_over_an_existing_part(): 'Destination path "memory://out/part-*.csv" already exists, please change path to different or set different SaveMode', ); - (new FileCommit($filesystem, path('memory://out/part-{part}.csv'), exception_if_exists(), 'r1'))->admit(false); + new FileCommit($filesystem, path('memory://out/part-{part}.csv'), exception_if_exists(), 'r1')->admit(false); } public function test_admit_ignores_another_jobs_temporary_output(): void @@ -445,12 +438,12 @@ public function test_admit_ignores_another_jobs_temporary_output(): void $filesystem = memory_filesystem(); $filesystem->writeTo(path('memory://out/.flow-tmp-r0-abcd/00000/part-00000.csv'))->append('x')->close(); - static::assertTrue((new FileCommit( + static::assertTrue(new FileCommit( $filesystem, path('memory://out/part-{part}.csv'), exception_if_exists(), 'r1', - ))->admit(true)); + )->admit(true)); } public function test_append_refuses_a_file_at_the_static_root(): void @@ -461,20 +454,20 @@ public function test_append_refuses_a_file_at_the_static_root(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('is a file'); - (new FileCommit($filesystem, path('memory://out/orders-{part}.csv'), append(), 'r1'))->admit(false); + new FileCommit($filesystem, path('memory://out/orders-{part}.csv'), append(), 'r1')->admit(false); } public function test_the_task_names_its_part_with_the_run_under_append(): void { static::assertSame( '00001-r1', - (new FileCommit(memory_filesystem(), path('memory://out/{part}.csv'), append(), 'r1', 4)) + new FileCommit(memory_filesystem(), path('memory://out/{part}.csv'), append(), 'r1', 4) ->task(1) ->name(), ); static::assertSame( '00001', - (new FileCommit(memory_filesystem(), path('memory://out/{part}.csv'), overwrite(), 'r1', 4)) + new FileCommit(memory_filesystem(), path('memory://out/{part}.csv'), overwrite(), 'r1', 4) ->task(1) ->name(), ); @@ -482,7 +475,7 @@ public function test_the_task_names_its_part_with_the_run_under_append(): void public function test_a_serial_commit_is_one_task_and_a_negative_index_is_task_zero(): void { - $task = (new FileCommit(memory_filesystem(), path('memory://out/{part}.csv'), overwrite(), 'r1'))->task(-1); + $task = new FileCommit(memory_filesystem(), path('memory://out/{part}.csv'), overwrite(), 'r1')->task(-1); static::assertSame(0, $task->index); static::assertSame(1, $task->splits); @@ -538,7 +531,7 @@ public function test_overwrite_removes_stale_parts_of_a_bigger_run(): void $job = new FileCommit($filesystem, $destination, overwrite(), 'r1', 3); foreach (range(0, 2) as $index) { - (new FileCommit($filesystem, $destination, overwrite(), 'r1', 3, $job->task($index))) + new FileCommit($filesystem, $destination, overwrite(), 'r1', 3, $job->task($index)) ->open() ->append('new') ->close(); @@ -563,7 +556,7 @@ public function test_overwrite_with_partitions_removes_only_written_partitions() $job = new FileCommit($filesystem, $destination, overwrite(), 'r1', 2); $job->admit(true); - (new FileCommit($filesystem, $destination, overwrite(), 'r1', 2, $job->task(1))) + new FileCommit($filesystem, $destination, overwrite(), 'r1', 2, $job->task(1)) ->open([new Partition('dept', 'a')]) ->append('fresh') ->close(); @@ -586,7 +579,7 @@ public function test_overwrite_into_a_placeholder_destination_removes_only_writt $job = new FileCommit($filesystem, $destination, overwrite(), 'r1', 2); $job->admit(true); - (new FileCommit($filesystem, $destination, overwrite(), 'r1', 2, $job->task(1))) + new FileCommit($filesystem, $destination, overwrite(), 'r1', 2, $job->task(1)) ->open([new Partition('dept', 'a')]) ->append('fresh') ->close(); @@ -692,7 +685,7 @@ public function test_a_move_failing_mid_commit_keeps_every_old_part(): void $job = new FileCommit($failing, $destination, overwrite(), 'r1', 2); foreach (range(0, 1) as $index) { - (new FileCommit($failing, $destination, overwrite(), 'r1', 2, $job->task($index))) + new FileCommit($failing, $destination, overwrite(), 'r1', 2, $job->task($index)) ->open() ->append('new') ->close(); @@ -718,10 +711,7 @@ public function test_a_mode_other_than_overwrite_removes_no_part(SaveMode $mode) $filesystem = memory_filesystem(); $filesystem->writeTo(path('memory://out/part-00003.csv'))->append('stale')->close(); - (new FileCommit($filesystem, path('memory://out/part-{part}.csv'), $mode, 'r1'))->commit( - [0], - new VoidProgress(), - ); + new FileCommit($filesystem, path('memory://out/part-{part}.csv'), $mode, 'r1')->commit([0], new VoidProgress()); static::assertSame(['memory://out/part-00003.csv'], self::written($filesystem, 'memory://out/**/*')); } @@ -760,14 +750,7 @@ public function test_only_the_tasks_whose_results_arrived_commit(): void $job = new FileCommit(native_local_filesystem(), $destination, exception_if_exists(), 'r1', 3); foreach (range(0, 2) as $index) { - (new FileCommit( - native_local_filesystem(), - $destination, - exception_if_exists(), - 'r1', - 3, - $job->task($index), - )) + new FileCommit(native_local_filesystem(), $destination, exception_if_exists(), 'r1', 3, $job->task($index)) ->open() ->append('x') ->close(); @@ -793,14 +776,14 @@ public function test_two_destinations_under_one_root_commit_only_their_own_files ); foreach (range(0, 1) as $index) { - (new FileCommit( + new FileCommit( native_local_filesystem(), $this->out->suffix($file), overwrite(), 'r1', 2, $commits[$file]->task($index), - )) + ) ->open() ->append('x') ->close(); @@ -824,7 +807,7 @@ public function test_abort_removes_the_temporary_output_and_is_repeatable(): voi { $destination = $this->out->suffix('/part-{part}.csv'); $job = new FileCommit(native_local_filesystem(), $destination, overwrite(), 'r1', 2); - (new FileCommit(native_local_filesystem(), $destination, overwrite(), 'r1', 2, $job->task(0))) + new FileCommit(native_local_filesystem(), $destination, overwrite(), 'r1', 2, $job->task(0)) ->open() ->append('x') ->close(); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/File/FileWriteTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/File/FileWriteTest.php index 30589c6ab7..3634b200eb 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/File/FileWriteTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/File/FileWriteTest.php @@ -89,13 +89,13 @@ public function test_a_closure_without_rows_under_overwrite_empties_an_unpartiti $out = ReaderRoundTrip::scratch('frame-empty-overwrite'); native_local_filesystem()->writeTo($out->suffix('/part-00007.txt'))->append('old')->close(); - (new FileWrite( + new FileWrite( native_local_filesystem(), $out->suffix('/part-{part}.txt'), SaveMode::Overwrite, new PartitionRouter(Partitioning::none()), new SpyFileWriterFactory(), - ))->closure(new VoidProgress()); + )->closure(new VoidProgress()); static::assertSame([], WrittenFiles::under($out)); @@ -107,13 +107,13 @@ public function test_a_closure_without_rows_under_overwrite_keeps_every_partitio $out = ReaderRoundTrip::scratch('frame-empty-overwrite-partitioned'); native_local_filesystem()->writeTo($out->suffix('/group=a/part-00007.txt'))->append('old')->close(); - (new FileWrite( + new FileWrite( native_local_filesystem(), $out->suffix('/part-{part}.txt'), SaveMode::Overwrite, new PartitionRouter(Partitioning::by('group')), new SpyFileWriterFactory(), - ))->closure(new VoidProgress()); + )->closure(new VoidProgress()); static::assertSame(['group=a/part-00007.txt'], WrittenFiles::under($out)); @@ -127,13 +127,13 @@ public function test_a_closure_without_rows_keeps_the_destination(SaveMode $mode $out = ReaderRoundTrip::scratch('frame-empty-' . $mode->name); native_local_filesystem()->writeTo($out->suffix('/part-00007.txt'))->append('old')->close(); - (new FileWrite( + new FileWrite( native_local_filesystem(), $out->suffix('/part-{part}.txt'), $mode, new PartitionRouter(Partitioning::none()), new SpyFileWriterFactory(), - ))->closure(new VoidProgress()); + )->closure(new VoidProgress()); static::assertSame(['part-00007.txt'], WrittenFiles::under($out)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/File/PartTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/File/PartTest.php index 21b7ad2066..92a5142fa4 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/File/PartTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/File/PartTest.php @@ -25,7 +25,7 @@ final class PartTest extends FlowTestCase #[TestWith([3, 100001, false, '000003'])] public function test_name(int $index, int $splits, bool $append, string $expected): void { - static::assertSame($expected, (new Part(max(0, $index), max(1, $splits), '1a2b3c4d5e6f7a8b', $append))->name()); + static::assertSame($expected, new Part(max(0, $index), max(1, $splits), '1a2b3c4d5e6f7a8b', $append)->name()); } public function test_normalize_round_trips(): void @@ -55,11 +55,11 @@ public function test_fill_replaces_the_placeholder_in_the_basename(): void { static::assertSame( 'file:///out/orders.parquet/part-00003.parquet', - (new Part(3, 10, 'abcd', false))->fill(path('file:///out/orders.parquet/part-{part}.parquet'))->uri(), + new Part(3, 10, 'abcd', false)->fill(path('file:///out/orders.parquet/part-{part}.parquet'))->uri(), ); static::assertSame( 'file:///out/orders-00000-abcd.csv', - (new Part(0, 1, 'abcd', true))->fill(path('file:///out/orders-{part}.csv'))->uri(), + new Part(0, 1, 'abcd', true)->fill(path('file:///out/orders-{part}.csv'))->uri(), ); } @@ -67,7 +67,7 @@ public function test_fill_without_placeholder_is_identity(): void { $destination = path('file:///out/orders.csv'); - static::assertSame($destination, (new Part(3, 10, 'abcd', false))->fill($destination)); + static::assertSame($destination, new Part(3, 10, 'abcd', false)->fill($destination)); } public function test_a_placeholder_in_a_directory_is_refused(): void @@ -75,7 +75,7 @@ public function test_a_placeholder_in_a_directory_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('names a file, not a directory'); - (new Part(3, 10, 'abcd', false))->fill(path('file:///out/{part}/orders.csv')); + new Part(3, 10, 'abcd', false)->fill(path('file:///out/{part}/orders.csv')); } public function test_in(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/RowPartitionsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/RowPartitionsTest.php index 6160cc4be2..6f2eb54d06 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/RowPartitionsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/RowPartitionsTest.php @@ -56,7 +56,7 @@ public function test_a_scalar_column_becomes_its_formatted_value( ): void { static::assertSame( $expected, - (new RowPartitions(refs(ref('v'))))->of(array_to_rows([['v' => $value]], schema($definition)), 0)->get( + new RowPartitions(refs(ref('v')))->of(array_to_rows([['v' => $value]], schema($definition)), 0)->get( 'v', )->value, ); @@ -66,7 +66,7 @@ public function test_an_aliased_partition_reference_reads_its_base_column(): voi { static::assertSame( '7', - (new RowPartitions(refs(ref('v')->as('alias'))))->of( + new RowPartitions(refs(ref('v')->as('alias')))->of( array_to_rows([['v' => 7, 'alias' => 9]], schema(int_schema('v'), int_schema('alias'))), 0, )->get('alias')->value, @@ -75,7 +75,7 @@ public function test_an_aliased_partition_reference_reads_its_base_column(): voi public function test_a_null_value_stays_null(): void { - static::assertNull((new RowPartitions(refs(ref('v'))))->of(array_to_rows([[ + static::assertNull(new RowPartitions(refs(ref('v')))->of(array_to_rows([[ 'v' => null, ]], schema(str_schema('v', nullable: true))), 0)->get('v')->value); } @@ -85,7 +85,7 @@ public function test_a_list_column_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('can\'t be used as a partition'); - (new RowPartitions(refs(ref('v'))))->of(array_to_rows([['v' => [ + new RowPartitions(refs(ref('v')))->of(array_to_rows([['v' => [ 1, 2, ]]], schema(list_schema('v', type_list(type_integer())))), 0); @@ -98,7 +98,7 @@ public function test_a_structure_column_is_refused(): void $structure = type_structure(['a' => type_string()]); - (new RowPartitions(refs(ref('v'))))->of(array_to_rows([['v' => $structure->cast([ + new RowPartitions(refs(ref('v')))->of(array_to_rows([['v' => $structure->cast([ 'a' => 'x', ])]], schema(structure_schema('v', $structure))), 0); } @@ -108,7 +108,7 @@ public function test_an_aliased_reference_needs_a_column_of_the_alias_name(): vo $this->expectException(SchemaDefinitionNotFoundException::class); $this->expectExceptionMessage('Schema definition for column "day" not found.'); - (new RowPartitions(refs(ref('date')->as('day'))))->of(array_to_rows([[ + new RowPartitions(refs(ref('date')->as('day')))->of(array_to_rows([[ 'date' => '2026-11-20', ]], schema(str_schema('date'))), 0); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/SchemaValidationLoaderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/SchemaValidationLoaderTest.php index fddc05a21c..1231041684 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/SchemaValidationLoaderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/IO/Loader/SchemaValidationLoaderTest.php @@ -35,7 +35,7 @@ public function test_schema_validation_failed_by_mismatching(): void |-- expected: id, given: id EXCEPTION); - (new SchemaValidationLoader(schema(integer_schema('id')), new StrictValidator()))->load(array_to_rows([[ + new SchemaValidationLoader(schema(integer_schema('id')), new StrictValidator())->load(array_to_rows([[ 'id' => '1', ]], schema(str_schema('id'))), flow_context(config())->backend()); } @@ -51,7 +51,7 @@ public function test_schema_validation_failed_by_unexpected(): void |-- name EXCEPTION); - (new SchemaValidationLoader(schema(integer_schema('id')), new StrictValidator()))->load(array_to_rows([[ + new SchemaValidationLoader(schema(integer_schema('id')), new StrictValidator())->load(array_to_rows([[ 'name' => '1', ]], schema(str_schema('name'))), flow_context(config())->backend()); } @@ -59,10 +59,10 @@ public function test_schema_validation_failed_by_unexpected(): void public function test_schema_validation_failure_message_lists_only_definitions_rejected_by_validator(): void { try { - (new SchemaValidationLoader( + new SchemaValidationLoader( schema(string_schema('id'), datetime_schema('deleted_at', nullable: true)), new StrictValidator(), - ))->load( + )->load( array_to_rows([['id' => 1, 'deleted_at' => null]], schema(int_schema('id'), null_schema('deleted_at'))), flow_context(config())->backend(), ); @@ -75,7 +75,7 @@ public function test_schema_validation_failure_message_lists_only_definitions_re public function test_schema_validation_succeed(): void { - (new SchemaValidationLoader(schema(integer_schema('id')), new StrictValidator()))->load(array_to_rows([[ + new SchemaValidationLoader(schema(integer_schema('id')), new StrictValidator())->load(array_to_rows([[ 'id' => 1, ]], schema(int_schema('id'))), flow_context(config())->backend()); @@ -85,11 +85,11 @@ public function test_schema_validation_succeed(): void public function test_a_custom_validator_does_not_describe(): void { - static::assertNull((new SchemaValidationLoader(schema(int_schema('id')), new class implements SchemaValidator { + static::assertNull(new SchemaValidationLoader(schema(int_schema('id')), new class implements SchemaValidator { public function validate(Schema $expected, Schema $given): ValidationContext { throw new RuntimeException('never called'); } - }))->describe()); + })->describe()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/BucketRunTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/BucketRunTest.php index 7760b6c882..520d138837 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/BucketRunTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/BucketRunTest.php @@ -27,7 +27,7 @@ public function test_remove_removes_through_its_own_buckets(): void $storageB->append('shared-id', array_to_rows([['id' => 2]], schema(int_schema('id')))); $b->add(BucketMother::withTotalRows('shared-id', 1)); - (new BucketRun('shared-id', $a))->remove(); + new BucketRun('shared-id', $a)->remove(); static::assertSame([], RowsStorageContext::rows($storageA->get('shared-id'))); static::assertCount(1, RowsStorageContext::rows($storageB->get('shared-id'))); @@ -41,7 +41,7 @@ public function test_rows_are_read_through_the_buckets_that_wrote_them(): void $storageA->append('shared-id', array_to_rows([['id' => 1]], schema(int_schema('id')))); $storageB->append('shared-id', array_to_rows([['id' => 2]], schema(int_schema('id')))); - static::assertSame([1], array_column(RowsStorageContext::rows((new BucketRun('shared-id', $a))->rows()), 'id')); - static::assertSame([2], array_column(RowsStorageContext::rows((new BucketRun('shared-id', $b))->rows()), 'id')); + static::assertSame([1], array_column(RowsStorageContext::rows(new BucketRun('shared-id', $a)->rows()), 'id')); + static::assertSame([2], array_column(RowsStorageContext::rows(new BucketRun('shared-id', $b)->rows()), 'id')); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/BucketsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/BucketsTest.php index d9a17ab71d..a3dcafd585 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/BucketsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/BucketsTest.php @@ -62,7 +62,7 @@ public function test_rows_yields_storage_batches(): void $storage->append('a', array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id')))); $storage->append('a', array_to_rows([['id' => 3]], schema(int_schema('id')))); - $batches = iterator_to_array((new Buckets($storage))->rows('a'), false); + $batches = iterator_to_array(new Buckets($storage)->rows('a'), false); static::assertCount(2, $batches); static::assertSame([1, 2], $batches[0]->reduceToArray('id')); @@ -71,13 +71,13 @@ public function test_rows_yields_storage_batches(): void public function test_rows_of_missing_bucket_yields_nothing(): void { - static::assertSame([], iterator_to_array((new Buckets(new MemoryRowsStorage()))->rows('missing'), false)); + static::assertSame([], iterator_to_array(new Buckets(new MemoryRowsStorage())->rows('missing'), false)); } public function test_storage_returns_the_injected_instance(): void { $storage = new MemoryRowsStorage(); - static::assertSame($storage, (new Buckets($storage))->storage()); + static::assertSame($storage, new Buckets($storage)->storage()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/HashBucketingTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/HashBucketingTest.php index 8f29ec890c..1d0893ad20 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/HashBucketingTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/HashBucketingTest.php @@ -34,13 +34,13 @@ public function test_a_hash_offset_reads_other_digits_of_the_key_hash(): void static::assertSame( (int) hexdec(substr($hash, 0, 8)) % 16, - (new HashBucketing(new KeyEncoder(['id']), 16, new NativePHPRandomValueGenerator()))->indexOf( + new HashBucketing(new KeyEncoder(['id']), 16, new NativePHPRandomValueGenerator())->indexOf( "\x02\x01\x00\x00\x00\x00\x00\x00\x00", ), ); static::assertSame( (int) hexdec(substr($hash, 8, 8)) % 16, - (new HashBucketing(new KeyEncoder(['id']), 16, new NativePHPRandomValueGenerator(), 'bucket', 8))->indexOf( + new HashBucketing(new KeyEncoder(['id']), 16, new NativePHPRandomValueGenerator(), 'bucket', 8)->indexOf( "\x02\x01\x00\x00\x00\x00\x00\x00\x00", ), ); @@ -50,7 +50,7 @@ public function test_two_buckets_put_an_encoded_key_into_the_bucket_of_its_hash( { static::assertSame( 1, - (new HashBucketing(new KeyEncoder(['id']), 2, new NativePHPRandomValueGenerator()))->indexOf( + new HashBucketing(new KeyEncoder(['id']), 2, new NativePHPRandomValueGenerator())->indexOf( "\x02\x01\x00\x00\x00\x00\x00\x00\x00", ), ); @@ -60,7 +60,7 @@ public function test_one_bucket_takes_every_key(): void { static::assertSame( 0, - (new HashBucketing(new KeyEncoder(['id']), 1, new NativePHPRandomValueGenerator()))->indexOf( + new HashBucketing(new KeyEncoder(['id']), 1, new NativePHPRandomValueGenerator())->indexOf( "\x02\x01\x00\x00\x00\x00\x00\x00\x00", ), ); @@ -123,11 +123,11 @@ public function test_buckets_are_yielded_after_the_whole_input_is_spilled(): voi public function test_one_bucket_holds_every_row(): void { - $buckets = iterator_to_array((new HashBucketing( + $buckets = iterator_to_array(new HashBucketing( new KeyEncoder(['id']), 1, new NativePHPRandomValueGenerator(), - ))->bucketize( + )->bucketize( (static function () { yield array_to_rows([['id' => 1], ['id' => 2], ['id' => 3]], schema(int_schema('id'))); })(), @@ -209,11 +209,11 @@ public function test_same_key_lands_in_the_same_bucket(): void public function test_missing_key_column_is_bucketed_as_null_when_the_schema_allows_it(): void { - $buckets = iterator_to_array((new HashBucketing( + $buckets = iterator_to_array(new HashBucketing( new KeyEncoder(['id']), 4, new NativePHPRandomValueGenerator(), - ))->bucketize( + )->bucketize( (static function () { yield array_to_rows( [['id' => null], ['other' => 1]], @@ -233,11 +233,7 @@ public function test_rows_missing_the_key_column_throw(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Column "id" does not exist.'); - iterator_to_array((new HashBucketing( - new KeyEncoder(['id']), - 4, - new NativePHPRandomValueGenerator(), - ))->bucketize( + iterator_to_array(new HashBucketing(new KeyEncoder(['id']), 4, new NativePHPRandomValueGenerator())->bucketize( (static function () { yield array_to_rows([['other' => 1]], schema(int_schema('other'))); })(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/SeenKeysTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/SeenKeysTest.php index 5fe4882cbf..0bd8446492 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/SeenKeysTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Bucketing/SeenKeysTest.php @@ -13,7 +13,7 @@ final class SeenKeysTest extends FlowTestCase { public function test_add_answers_the_first_row_of_each_new_key_ascending(): void { - static::assertSame([0, 1, 3], (new SeenKeys())->add(['a', 'b', 'a', 'c', 'b'])); + static::assertSame([0, 1, 3], new SeenKeys()->add(['a', 'b', 'a', 'c', 'b'])); } public function test_a_key_seen_in_an_earlier_batch_is_not_new(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/JoinKeysTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/JoinKeysTest.php index b261c8aab7..ac8d204605 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/JoinKeysTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/JoinKeysTest.php @@ -24,7 +24,7 @@ public function test_each_pair_keys_in_the_type_it_compares_in(): void { static::assertEquals( [type_integer(), type_float()], - (new JoinKeys(['id', 'amount'], ['code', 'total']))->types( + new JoinKeys(['id', 'amount'], ['code', 'total'])->types( schema(int_schema('id'), int_schema('amount')), schema(str_schema('code'), float_schema('total')), ), @@ -33,12 +33,12 @@ public function test_each_pair_keys_in_the_type_it_compares_in(): void public function test_a_side_without_a_schema_keys_in_its_own_types(): void { - static::assertSame([], (new JoinKeys(['id'], ['code']))->types(schema(int_schema('id')), null)); + static::assertSame([], new JoinKeys(['id'], ['code'])->types(schema(int_schema('id')), null)); } public function test_both_encoders_give_equal_keys_to_values_equal_across_types(): void { - [$left, $right] = (new JoinKeys(['id'], ['code']))->encoders( + [$left, $right] = new JoinKeys(['id'], ['code'])->encoders( schema(int_schema('id')), schema(str_schema('code')), ); @@ -51,7 +51,7 @@ public function test_both_encoders_give_equal_keys_to_values_equal_across_types( public function test_an_integral_string_key_past_two_to_the_53_meets_only_its_own_int(): void { - [$left, $right] = (new JoinKeys(['id'], ['code']))->encoders( + [$left, $right] = new JoinKeys(['id'], ['code'])->encoders( schema(int_schema('id')), schema(str_schema('code')), ); @@ -84,7 +84,7 @@ public function test_left_keys_are_the_left_columns_cast_to_their_pair_type_name public function test_right_keys_are_the_right_columns_named_by_position(): void { - $right = (new JoinKeys(['id'], ['user_id']))->rightKeys( + $right = new JoinKeys(['id'], ['user_id'])->rightKeys( array_to_rows([['user_id' => 7, 'name' => 'x']], schema(int_schema('user_id'), str_schema('name'))), [], ); @@ -110,7 +110,7 @@ public function test_a_key_column_holding_a_null_is_nullable_and_one_without_is_ public function test_exact_keys_without_a_null_decide_the_condition(): void { - static::assertTrue((new JoinKeys(['id'], ['id'], exact: true))->decides(array_to_rows([ + static::assertTrue(new JoinKeys(['id'], ['id'], exact: true)->decides(array_to_rows([ ['0' => 1], ['0' => 2], ], schema(int_schema('0'))))); @@ -118,14 +118,14 @@ public function test_exact_keys_without_a_null_decide_the_condition(): void public function test_keys_that_are_not_exact_never_decide_the_condition(): void { - static::assertFalse((new JoinKeys(['id'], ['id']))->decides(array_to_rows([[ + static::assertFalse(new JoinKeys(['id'], ['id'])->decides(array_to_rows([[ '0' => 1, ]], schema(int_schema('0'))))); } public function test_a_null_key_leaves_the_condition_to_the_pair_check(): void { - static::assertFalse((new JoinKeys(['id'], ['id'], exact: true))->decides(array_to_rows([ + static::assertFalse(new JoinKeys(['id'], ['id'], exact: true)->decides(array_to_rows([ ['0' => 1], ['0' => null], ], schema(int_schema('0', nullable: true))))); @@ -133,7 +133,7 @@ public function test_a_null_key_leaves_the_condition_to_the_pair_check(): void public function test_a_list_key_leaves_the_condition_to_the_pair_check(): void { - static::assertFalse((new JoinKeys(['days'], ['days'], exact: true))->decides(array_to_rows([['0' => [ + static::assertFalse(new JoinKeys(['days'], ['days'], exact: true)->decides(array_to_rows([['0' => [ 1, 2, ]]], schema(list_schema('0', type_list(type_integer())))))); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/JoinerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/JoinerTest.php index 95a66bbf0d..7821c8387f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/JoinerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/JoinerTest.php @@ -294,13 +294,13 @@ public function test_unmatched_build_rows_are_flushed_in_batches_of_a_thousand_b array_map( static fn(Rows $batch): int => $batch->count(), iterator_to_array( - (new Joiner( + new Joiner( JoinType::right, $expression->schema(JoinType::right), $expression->keys(), $expression, new AdaptiveBackend(), - ))->join( + )->join( JoinSide::of($batches(array_to_rows([['id' => 0]], schema(int_schema('id'))))), JoinSide::of($batches(array_to_rows( array_map(static fn(int $id): array => ['user_id' => $id], range(1, 1001)), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/NullKeyFilterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/NullKeyFilterTest.php index 801b00cc39..63ecb3d775 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/NullKeyFilterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/NullKeyFilterTest.php @@ -21,7 +21,7 @@ public function test_a_null_only_in_a_later_key_column_drops_the_row(): void { static::assertSame( [['k' => 1, 'l' => 1]], - (new NullKeyFilter(['k', 'l']))->of(array_to_rows( + new NullKeyFilter(['k', 'l'])->of(array_to_rows( [['k' => 1, 'l' => 1], ['k' => 2, 'l' => null]], schema(int_schema('k', true), int_schema('l', true)), ))->toArray(), @@ -32,7 +32,7 @@ public function test_drops_rows_with_a_null_in_any_key_column(): void { static::assertSame( [['k' => 1, 'l' => 1]], - (new NullKeyFilter(['k', 'l']))->of(array_to_rows( + new NullKeyFilter(['k', 'l'])->of(array_to_rows( [['k' => 1, 'l' => 1], ['k' => null, 'l' => 1], ['k' => 2, 'l' => null]], schema(int_schema('k', true), int_schema('l', true)), ))->toArray(), @@ -43,14 +43,14 @@ public function test_a_batch_without_nulls_is_returned_as_it_is(): void { $batch = array_to_rows([['k' => 1], ['k' => 2]], schema(int_schema('k', true))); - static::assertSame($batch, (new NullKeyFilter(['k']))->of($batch)); + static::assertSame($batch, new NullKeyFilter(['k'])->of($batch)); } public function test_rows_drops_the_rows_and_the_emptied_batches(): void { static::assertSame( [['k' => 1], ['k' => 2], ['k' => 3]], - RowsStorageContext::rows((new NullKeyFilter(['k']))->rows(GroupByContext::batches( + RowsStorageContext::rows(new NullKeyFilter(['k'])->rows(GroupByContext::batches( array_to_rows([['k' => 1], ['k' => null], ['k' => 2]], schema(int_schema('k', true))), array_to_rows([['k' => null]], schema(int_schema('k', true))), array_to_rows([['k' => 3]], schema(int_schema('k', true))), @@ -64,7 +64,7 @@ public function test_rows_forwards_a_sent_value_and_returns(): void array_to_rows([['k' => 1]], schema(int_schema('k', true))), array_to_rows([['k' => 2]], schema(int_schema('k', true))), ); - $rows = (new NullKeyFilter(['k']))->rows($batches->rows()); + $rows = new NullKeyFilter(['k'])->rows($batches->rows()); $rows->current(); $rows->send(Signal::STOP); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/RowMergerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/RowMergerTest.php index 72d1b3a7c6..b1d9f15784 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/RowMergerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/HashJoin/RowMergerTest.php @@ -16,11 +16,11 @@ final class RowMergerTest extends FlowTestCase { public function test_columns_are_gathered_by_side_in_the_output_order_and_names(): void { - $merged = (new RowMerger( + $merged = new RowMerger( schema(int_schema('amount'), int_schema('r_id'), str_schema('r_name')), ['amount'], ['id', 'name'], - ))->merge( + )->merge( array_to_rows([['id' => 1, 'amount' => 100]], schema(int_schema('id'), int_schema('amount'))), array_to_rows([['id' => 2, 'name' => 'Alice']], schema(int_schema('id'), str_schema('name'))), ); @@ -33,7 +33,7 @@ public function test_a_column_named_on_both_sides_comes_from_the_side_it_is_list { static::assertSame( [['country' => 'PL', 'id' => 2]], - (new RowMerger(schema(str_schema('country'), int_schema('id')), ['country'], ['id'])) + new RowMerger(schema(str_schema('country'), int_schema('id')), ['country'], ['id']) ->merge( array_to_rows([['id' => 1, 'country' => 'PL']], schema(int_schema('id'), str_schema('country'))), array_to_rows([['id' => 2]], schema(int_schema('id'))), @@ -46,7 +46,7 @@ public function test_a_column_after_one_the_batch_lacks_is_kept(): void { static::assertSame( [['id' => 1]], - (new RowMerger(schema(str_schema('name'), int_schema('id')), ['name', 'id'], [])) + new RowMerger(schema(str_schema('name'), int_schema('id')), ['name', 'id'], []) ->merge( array_to_rows([['id' => 1]], schema(int_schema('id'))), array_to_rows([['other' => 'x']], schema(str_schema('other'))), @@ -59,7 +59,7 @@ public function test_a_column_a_batch_lacks_is_left_out(): void { static::assertSame( [['id' => 1]], - (new RowMerger(schema(int_schema('id'), str_schema('name')), ['id'], ['name'])) + new RowMerger(schema(int_schema('id'), str_schema('name')), ['id'], ['name']) ->merge( array_to_rows([['id' => 1]], schema(int_schema('id'))), array_to_rows([['other' => 'x']], schema(str_schema('other'))), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Join/JoinSchemaTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Join/JoinSchemaTest.php index 5ac1bbf61f..255def275f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Join/JoinSchemaTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Join/JoinSchemaTest.php @@ -24,7 +24,7 @@ public function test_the_merger_reads_numeric_column_names_of_both_sides(): void static::assertSame( [['2024' => 1, '2025' => 2]], - (new JoinSchema(type: JoinType::inner)) + new JoinSchema(type: JoinType::inner) ->merger($left, $right) ->merge(array_to_rows([['2024' => 1]], $left), array_to_rows([['2025' => 2]], $right)) ->toArray(), @@ -37,8 +37,8 @@ public function test_cross_is_the_inner_arm(): void $right = schema(str_schema('code'), str_schema('name')); static::assertEquals( - (new JoinSchema(type: JoinType::inner))->output($left, $right), - (new JoinSchema())->cross($left, $right), + new JoinSchema(type: JoinType::inner)->output($left, $right), + new JoinSchema()->cross($left, $right), ); } @@ -49,11 +49,11 @@ public function test_dropped_join_columns_are_removed_from_each_side(): void static::assertEquals( schema(int_schema('id'), str_schema('country'), str_schema('code')), - (new JoinSchema(dropRight: ['name'], type: JoinType::inner))->output($left, $right), + new JoinSchema(dropRight: ['name'], type: JoinType::inner)->output($left, $right), ); static::assertEquals( schema(int_schema('id'), str_schema('code'), str_schema('name')), - (new JoinSchema(dropLeft: ['country'], type: JoinType::inner))->output($left, $right), + new JoinSchema(dropLeft: ['country'], type: JoinType::inner)->output($left, $right), ); } @@ -63,8 +63,8 @@ public function test_dropping_a_column_neither_side_declares_is_graceful(): void $right = schema(str_schema('code'), str_schema('name')); static::assertEquals( - (new JoinSchema(type: JoinType::inner))->output($left, $right), - (new JoinSchema(dropLeft: ['nope'], dropRight: ['nope'], type: JoinType::inner))->output($left, $right), + new JoinSchema(type: JoinType::inner)->output($left, $right), + new JoinSchema(dropLeft: ['nope'], dropRight: ['nope'], type: JoinType::inner)->output($left, $right), ); } @@ -72,7 +72,7 @@ public function test_inner_keeps_both_sides_non_nullable(): void { static::assertEquals( schema(int_schema('id'), str_schema('country'), str_schema('code'), str_schema('name')), - (new JoinSchema(type: JoinType::inner))->output( + new JoinSchema(type: JoinType::inner)->output( schema(int_schema('id'), str_schema('country')), schema(str_schema('code'), str_schema('name')), ), @@ -83,7 +83,7 @@ public function test_left_anti_keeps_the_left_side_only(): void { static::assertEquals( schema(int_schema('id'), str_schema('country')), - (new JoinSchema(type: JoinType::left_anti))->output( + new JoinSchema(type: JoinType::left_anti)->output( schema(int_schema('id'), str_schema('country')), schema(str_schema('code'), str_schema('name')), ), @@ -99,7 +99,7 @@ public function test_left_makes_the_right_side_nullable(): void str_schema('code', nullable: true), str_schema('name', nullable: true), ), - (new JoinSchema(type: JoinType::left))->output( + new JoinSchema(type: JoinType::left)->output( schema(int_schema('id'), str_schema('country')), schema(str_schema('code'), str_schema('name')), ), @@ -110,7 +110,7 @@ public function test_prefix_renames_every_right_column(): void { static::assertEquals( schema(int_schema('id'), str_schema('country'), str_schema('r_code'), str_schema('r_name')), - (new JoinSchema('r_', type: JoinType::inner))->output( + new JoinSchema('r_', type: JoinType::inner)->output( schema(int_schema('id'), str_schema('country')), schema(str_schema('code'), str_schema('name')), ), @@ -126,7 +126,7 @@ public function test_right_makes_the_left_side_nullable(): void str_schema('code'), str_schema('name'), ), - (new JoinSchema(type: JoinType::right))->output( + new JoinSchema(type: JoinType::right)->output( schema(int_schema('id'), str_schema('country')), schema(str_schema('code'), str_schema('name')), ), @@ -140,7 +140,7 @@ public function test_a_cross_name_collision_suggests_a_prefix(): void '/Column definitions must be unique.*\. Please consider using join prefix option$/', ); - (new JoinSchema())->cross(schema(int_schema('id')), schema(int_schema('id'))); + new JoinSchema()->cross(schema(int_schema('id')), schema(int_schema('id'))); } public function test_a_keyed_join_name_collision_suggests_a_prefix(): void @@ -150,7 +150,7 @@ public function test_a_keyed_join_name_collision_suggests_a_prefix(): void '/Column definitions must be unique.*\. Please consider using join prefix option$/', ); - (new JoinSchema(type: JoinType::left))->output( + new JoinSchema(type: JoinType::left)->output( schema(int_schema('id'), str_schema('name')), schema(str_schema('name')), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/ExternalSortConfigTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/ExternalSortConfigTest.php index 5be7fc3b3f..d7762d0455 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/ExternalSortConfigTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/ExternalSortConfigTest.php @@ -40,10 +40,10 @@ public function test_a_missing_merge_storage_round_trips_as_null(): void public function test_an_undescribable_merge_storage_makes_the_config_undescribable(): void { static::assertNull( - (new ExternalSortConfig( + new ExternalSortConfig( new BucketingConfig(new MemoryRowsStorage(), 4, 100, Unit::fromBytes(1)), new PsrRowsStorage(new ArrayCache(), new FloeSerializer(new PhpBackend())), - ))->describe(), + )->describe(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/ExternalSortTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/ExternalSortTest.php index 0314c466c4..b54da8fa78 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/ExternalSortTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/ExternalSortTest.php @@ -640,7 +640,7 @@ public function test_both_storages_are_cleared_when_the_first_clear_throws(): vo try { iterator_to_array( - (new ExternalSort([ref('id')->asc()], $spill, $merge, new NativePHPRandomValueGenerator(), 2))->sort( + new ExternalSort([ref('id')->asc()], $spill, $merge, new NativePHPRandomValueGenerator(), 2)->sort( (static function () use ($backend): Generator { $yields = 0; diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/MemorySortConfigTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/MemorySortConfigTest.php index f1759d6651..653b5aa49f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/MemorySortConfigTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/MemorySortConfigTest.php @@ -11,6 +11,6 @@ final class MemorySortConfigTest extends FlowTestCase { public function test_describe_round_trips(): void { - static::assertSame([], (new MemorySortConfig())->describe()?->data); + static::assertSame([], new MemorySortConfig()->describe()?->data); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/Merge/BucketCursorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/Merge/BucketCursorTest.php index 4765c2cd8f..d67e39e95d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/Merge/BucketCursorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/Merge/BucketCursorTest.php @@ -49,7 +49,7 @@ public function test_empty_batch_stream_is_invalid_from_the_start(): void }; static::assertFalse( - (new BucketCursor($batches(), new RowOrder([ref('id')->asc()]), new AdaptiveBackend()))->valid(), + new BucketCursor($batches(), new RowOrder([ref('id')->asc()]), new AdaptiveBackend())->valid(), ); } @@ -105,7 +105,7 @@ public function test_stream_of_only_empty_batches_is_invalid(): void }; static::assertFalse( - (new BucketCursor($batches(), new RowOrder([ref('id')->asc()]), new AdaptiveBackend()))->valid(), + new BucketCursor($batches(), new RowOrder([ref('id')->asc()]), new AdaptiveBackend())->valid(), ); } @@ -139,7 +139,7 @@ public function test_schema_of_an_empty_stream_is_empty(): void static::assertEquals( schema(), - (new BucketCursor($batches(), new RowOrder([ref('id')->asc()]), new AdaptiveBackend()))->schema(), + new BucketCursor($batches(), new RowOrder([ref('id')->asc()]), new AdaptiveBackend())->schema(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/Merge/KWayMergeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/Merge/KWayMergeTest.php index 416c106727..435bb5c3b4 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/Merge/KWayMergeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Kernels/Sort/Merge/KWayMergeTest.php @@ -61,11 +61,11 @@ public function test_merging_sorted_runs_equals_one_in_memory_sort(int $seed): v $merged = rows($dataset['schema']); - foreach ((new KWayMerge( + foreach (new KWayMerge( $dataset['columns'], new AdaptiveBackend(), new BatchSize($dataset['mergeBatchSize']), - ))->merge(array_map(static fn(BucketRun $run): Generator => $run->rows(), $runs)) as $batch) { + )->merge(array_map(static fn(BucketRun $run): Generator => $run->rows(), $runs)) as $batch) { $merged = Rows::concat( $merged->schema(), new AdaptiveBackend(), @@ -84,7 +84,7 @@ public function test_merging_sorted_runs_equals_one_in_memory_sort(int $seed): v ), serialize($merged->toArray()), ); - static::assertNull((new SortedByConstraint(...$dataset['columns']))->firstViolation($merged)); + static::assertNull(new SortedByConstraint(...$dataset['columns'])->firstViolation($merged)); } public function test_merges_plain_sorted_streams(): void @@ -92,11 +92,11 @@ public function test_merges_plain_sorted_streams(): void static::assertSame( [1, 2, 3, 4], array_column( - RowsStorageContext::rows((new KWayMerge( + RowsStorageContext::rows(new KWayMerge( [ref('id')->asc()], new AdaptiveBackend(), new BatchSize(2), - ))->merge([ + )->merge([ (static function (): Generator { yield array_to_rows([['id' => 1], ['id' => 4]], schema(int_schema('id'))); })(), @@ -122,9 +122,9 @@ public function test_merged_batches_hold_a_thousand_rows_by_default(): void [1000, 2], array_map( static fn(Rows $batch): int => $batch->count(), - iterator_to_array((new KWayMerge([ref('id')->asc()], new AdaptiveBackend()))->merge([ - (new BucketRun('a', $buckets))->rows(), - (new BucketRun('b', $buckets))->rows(), + iterator_to_array(new KWayMerge([ref('id')->asc()], new AdaptiveBackend())->merge([ + new BucketRun('a', $buckets)->rows(), + new BucketRun('b', $buckets)->rows(), ]), false), ), ); @@ -152,10 +152,10 @@ public function test_merges_multiple_sorted_runs_ascending(): void static::assertSame( [1, 2, 3, 4, 5, 6, 7, 8, 9], array_column( - RowsStorageContext::rows((new KWayMerge([ref('id')->asc()], new AdaptiveBackend()))->merge([ - (new BucketRun('a', $buckets))->rows(), - (new BucketRun('b', $buckets))->rows(), - (new BucketRun('c', $buckets))->rows(), + RowsStorageContext::rows(new KWayMerge([ref('id')->asc()], new AdaptiveBackend())->merge([ + new BucketRun('a', $buckets)->rows(), + new BucketRun('b', $buckets)->rows(), + new BucketRun('c', $buckets)->rows(), ])), 'id', ), @@ -177,9 +177,9 @@ public function test_merge_reads_each_run_through_its_own_storage(): void static::assertSame( [1, 2, 3, 4], array_column( - RowsStorageContext::rows((new KWayMerge([ref('id')->asc()], new AdaptiveBackend()))->merge([ - (new BucketRun('sort-run-0', $spill))->rows(), - (new BucketRun('sort-merge-0', $merged))->rows(), + RowsStorageContext::rows(new KWayMerge([ref('id')->asc()], new AdaptiveBackend())->merge([ + new BucketRun('sort-run-0', $spill)->rows(), + new BucketRun('sort-merge-0', $merged)->rows(), ])), 'id', ), @@ -203,9 +203,9 @@ public function test_merges_multiple_sorted_runs_descending(): void static::assertSame( [8, 7, 5, 4, 2, 1], array_column( - RowsStorageContext::rows((new KWayMerge([ref('id')->desc()], new AdaptiveBackend()))->merge([ - (new BucketRun('a', $buckets))->rows(), - (new BucketRun('b', $buckets))->rows(), + RowsStorageContext::rows(new KWayMerge([ref('id')->desc()], new AdaptiveBackend())->merge([ + new BucketRun('a', $buckets)->rows(), + new BucketRun('b', $buckets)->rows(), ])), 'id', ), @@ -225,9 +225,9 @@ public function test_merges_runs_of_uneven_length(): void static::assertSame( [1, 2, 3, 4], array_column( - RowsStorageContext::rows((new KWayMerge([ref('id')->asc()], new AdaptiveBackend()))->merge([ - (new BucketRun('a', $buckets))->rows(), - (new BucketRun('b', $buckets))->rows(), + RowsStorageContext::rows(new KWayMerge([ref('id')->asc()], new AdaptiveBackend())->merge([ + new BucketRun('a', $buckets)->rows(), + new BucketRun('b', $buckets)->rows(), ])), 'id', ), @@ -243,9 +243,9 @@ public function test_merges_non_numeric_values(): void static::assertSame( ['a', 'b', 'c', 'd'], array_column( - RowsStorageContext::rows((new KWayMerge([ref('id')->asc()], new AdaptiveBackend()))->merge([ - (new BucketRun('a', $buckets))->rows(), - (new BucketRun('b', $buckets))->rows(), + RowsStorageContext::rows(new KWayMerge([ref('id')->asc()], new AdaptiveBackend())->merge([ + new BucketRun('a', $buckets)->rows(), + new BucketRun('b', $buckets)->rows(), ])), 'id', ), @@ -263,9 +263,9 @@ public function test_runs_under_different_schemas_are_conformed_to_the_first(): static::assertSame( [['id' => 1, 'name' => 'a'], ['id' => 2, 'name' => null]], - RowsStorageContext::rows((new KWayMerge([ref('id')->asc()], new AdaptiveBackend()))->merge([ - (new BucketRun('a', $buckets))->rows(), - (new BucketRun('b', $buckets))->rows(), + RowsStorageContext::rows(new KWayMerge([ref('id')->asc()], new AdaptiveBackend())->merge([ + new BucketRun('a', $buckets)->rows(), + new BucketRun('b', $buckets)->rows(), ])), ); } @@ -278,9 +278,10 @@ public function test_single_run_passthrough(): void static::assertSame( [1, 2], array_column( - RowsStorageContext::rows((new KWayMerge([ref( - 'id', - )->asc()], new AdaptiveBackend()))->merge([(new BucketRun('a', $buckets))->rows()])), + RowsStorageContext::rows(new KWayMerge([ref('id')->asc()], new AdaptiveBackend())->merge([new BucketRun( + 'a', + $buckets, + )->rows()])), 'id', ), ); @@ -290,7 +291,7 @@ public function test_empty_bucket_set_yields_nothing(): void { static::assertSame( [], - RowsStorageContext::rows((new KWayMerge([ref('id')->asc()], new AdaptiveBackend()))->merge([])), + RowsStorageContext::rows(new KWayMerge([ref('id')->asc()], new AdaptiveBackend())->merge([])), ); } @@ -309,8 +310,8 @@ public function test_merged_rows_are_yielded_in_batches_of_batch_size(): void $sizes = []; foreach ($merge->merge([ - (new BucketRun('a', $buckets))->rows(), - (new BucketRun('b', $buckets))->rows(), + new BucketRun('a', $buckets)->rows(), + new BucketRun('b', $buckets)->rows(), ]) as $batch) { $sizes[] = $batch->count(); } @@ -339,10 +340,10 @@ public function test_interleaves_runs_across_batch_boundaries_like_one_sort(): v $merged = []; - foreach ((new KWayMerge([ref('id')->asc()], new AdaptiveBackend(), batchSize: new BatchSize(4)))->merge([ - (new BucketRun('a', $buckets))->rows(), - (new BucketRun('b', $buckets))->rows(), - (new BucketRun('c', $buckets))->rows(), + foreach (new KWayMerge([ref('id')->asc()], new AdaptiveBackend(), batchSize: new BatchSize(4))->merge([ + new BucketRun('a', $buckets)->rows(), + new BucketRun('b', $buckets)->rows(), + new BucketRun('c', $buckets)->rows(), ]) as $batch) { static::assertLessThanOrEqual(4, $batch->count()); $merged = [...$merged, ...$batch->toArray()]; diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Constraint/SortedByConstraintTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Constraint/SortedByConstraintTest.php index dd82e8772a..06a798bd61 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Constraint/SortedByConstraintTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Constraint/SortedByConstraintTest.php @@ -23,7 +23,7 @@ final class SortedByConstraintTest extends FlowTestCase { public function test_sorted_constraint_as_a_string(): void { - static::assertSame('Sorted constraint on [id ASC]', (new SortedByConstraint(ref('id')->asc()))->toString()); + static::assertSame('Sorted constraint on [id ASC]', new SortedByConstraint(ref('id')->asc())->toString()); } public function test_sorted_constraint_ascending_integers(): void @@ -170,7 +170,7 @@ public function test_sorted_constraint_multiple_columns_as_a_string(): void { static::assertSame( 'Sorted constraint on [category ASC, price DESC, id ASC]', - (new SortedByConstraint(ref('category')->asc(), ref('price')->desc(), ref('id')->asc()))->toString(), + new SortedByConstraint(ref('category')->asc(), ref('price')->desc(), ref('id')->asc())->toString(), ); } @@ -229,7 +229,7 @@ public function test_sorted_constraint_with_dates(): void public function test_sorted_constraint_with_single_row(): void { - static::assertNull((new SortedByConstraint(ref('id')->asc()))->firstViolation(array_to_rows([[ + static::assertNull(new SortedByConstraint(ref('id')->asc())->firstViolation(array_to_rows([[ 'id' => 42, ]], schema(int_schema('id'))))); } @@ -277,7 +277,7 @@ public function test_first_violation_stops_advancing_at_the_violation(): void public function test_a_violation_without_a_previous_row_names_null(): void { - static::assertStringContainsString('previous: null', (new SortedByConstraint(ref('id')->asc()))->violation( + static::assertStringContainsString('previous: null', new SortedByConstraint(ref('id')->asc())->violation( array_to_rows([['id' => 2], ['id' => 1]], schema(int_schema('id'))), 1, )); @@ -285,7 +285,7 @@ public function test_a_violation_without_a_previous_row_names_null(): void public function test_an_empty_batch_has_no_violation(): void { - static::assertNull((new SortedByConstraint(ref('id')))->firstViolation(array_to_rows( + static::assertNull(new SortedByConstraint(ref('id'))->firstViolation(array_to_rows( [], schema(int_schema('id')), ))); @@ -295,7 +295,7 @@ public function test_datetimes_are_compared_by_instant(): void { static::assertSame( 2, - (new SortedByConstraint(ref('at')->asc()))->firstViolation(array_to_rows([ + new SortedByConstraint(ref('at')->asc())->firstViolation(array_to_rows([ ['at' => new DateTimeImmutable('2024-01-01 00:00:00.000001')], ['at' => new DateTimeImmutable('2024-01-01 00:00:00.000002')], ['at' => new DateTimeImmutable('2024-01-01 00:00:00.000001')], @@ -307,12 +307,12 @@ public function test_strings_are_in_byte_order_never_numeric(): void { static::assertSame( 1, - (new SortedByConstraint(ref('code')->asc()))->firstViolation(array_to_rows([ + new SortedByConstraint(ref('code')->asc())->firstViolation(array_to_rows([ ['code' => '9'], ['code' => '10'], ], schema(str_schema('code')))), ); - static::assertNull((new SortedByConstraint(ref('code')->asc()))->firstViolation(array_to_rows([ + static::assertNull(new SortedByConstraint(ref('code')->asc())->firstViolation(array_to_rows([ ['code' => '10'], ['code' => '9'], ], schema(str_schema('code'))))); @@ -320,7 +320,7 @@ public function test_strings_are_in_byte_order_never_numeric(): void public function test_nulls_come_first_ascending_and_nan_last(): void { - static::assertNull((new SortedByConstraint(ref('v')->asc()))->firstViolation(array_to_rows([ + static::assertNull(new SortedByConstraint(ref('v')->asc())->firstViolation(array_to_rows([ ['v' => null], ['v' => -1.5], ['v' => 2.0], @@ -329,7 +329,7 @@ public function test_nulls_come_first_ascending_and_nan_last(): void ], schema(float_schema('v', true))))); static::assertSame( 1, - (new SortedByConstraint(ref('v')->desc()))->firstViolation(array_to_rows([ + new SortedByConstraint(ref('v')->desc())->firstViolation(array_to_rows([ ['v' => null], ['v' => NAN], ], schema(float_schema('v', true)))), @@ -348,7 +348,7 @@ public function test_a_moved_null_placement_is_part_of_the_order(): void ], schema(int_schema('v', true))))); static::assertSame( 1, - (new SortedByConstraint(ref('v')->asc(NullsOrder::LAST)))->firstViolation(array_to_rows([ + new SortedByConstraint(ref('v')->asc(NullsOrder::LAST))->firstViolation(array_to_rows([ ['v' => null], ['v' => 1], ], schema(int_schema('v', true)))), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Constraint/UniqueConstraintTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Constraint/UniqueConstraintTest.php index cd4ff508e6..6298dc1a80 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Constraint/UniqueConstraintTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Constraint/UniqueConstraintTest.php @@ -19,7 +19,7 @@ public function test_a_duplicate_inside_one_batch_is_the_first_violation(): void { static::assertSame( 1, - (new UniqueConstraint('id'))->firstViolation(array_to_rows([ + new UniqueConstraint('id')->firstViolation(array_to_rows([ ['id' => 1], ['id' => 1], ['id' => 2], @@ -118,7 +118,7 @@ public function test_first_violation_within_one_batch(): void { static::assertSame( 2, - (new UniqueConstraint('id'))->firstViolation(array_to_rows([ + new UniqueConstraint('id')->firstViolation(array_to_rows([ ['id' => 1], ['id' => 2], ['id' => 1], @@ -128,7 +128,7 @@ public function test_first_violation_within_one_batch(): void public function test_an_empty_batch_has_no_violation(): void { - static::assertNull((new UniqueConstraint('id'))->firstViolation(array_to_rows([], schema(int_schema('id'))))); + static::assertNull(new UniqueConstraint('id')->firstViolation(array_to_rows([], schema(int_schema('id'))))); } public function test_a_fresh_instance_has_seen_no_key(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/AggregatedGroupsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/AggregatedGroupsTest.php index db426fc53c..ada1e94b37 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/AggregatedGroupsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/AggregatedGroupsTest.php @@ -172,12 +172,12 @@ public function test_no_input_counts_one_group(): void $groupBy = new GroupBy(refs(), new Aggregators(sum(ref('amount')))); $progress = new ProgressSpy(); - (new AggregatedGroups( + new AggregatedGroups( $groupBy, GroupByShape::of($groupBy, schema(int_schema('amount'))), flow_context(config())->backend(), $progress->stage(StageName::group_by), - ))->noInputRow(flow_context(config())->backend()); + )->noInputRow(flow_context(config())->backend()); static::assertSame(1, $progress->countIn(StageName::group_by, ProgressUnit::groups)); } @@ -235,12 +235,12 @@ public function test_flushing_without_accumulating_counts_no_groups(): void $progress = new ProgressSpy(); iterator_to_array( - (new AggregatedGroups( + new AggregatedGroups( $groupBy, GroupByShape::of($groupBy, schema(str_schema('country'), int_schema('amount'))), flow_context(config())->backend(), $progress->stage(StageName::group_by), - ))->flush(1000, flow_context(config())->backend()), + )->flush(1000, flow_context(config())->backend()), false, ); @@ -253,11 +253,11 @@ public function test_flushing_without_accumulating_yields_nothing(): void static::assertSame( [], - iterator_to_array((new AggregatedGroups( + iterator_to_array(new AggregatedGroups( $groupBy, GroupByShape::of($groupBy, schema(str_schema('country'), int_schema('amount'))), flow_context(config())->backend(), - ))->flush(1000, flow_context(config())->backend())), + )->flush(1000, flow_context(config())->backend())), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/AggregatorsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/AggregatorsTest.php index 00e3cf5106..d3953c0afb 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/AggregatorsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/AggregatorsTest.php @@ -54,19 +54,19 @@ public function test_first_is_refused_without_aggregators(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Aggregators are empty.'); - (new Aggregators())->first(); + new Aggregators()->first(); } public function test_references_are_empty_without_aggregators(): void { - static::assertSame([], (new Aggregators())->references()); + static::assertSame([], new Aggregators()->references()); } public function test_references_deduplicate_by_base_entry(): void { static::assertEquals( [ref('amount')], - (new Aggregators(sum(ref('amount')), average(ref('amount'))))->references(), + new Aggregators(sum(ref('amount')), average(ref('amount')))->references(), ); } @@ -74,15 +74,13 @@ public function test_references_union_all_aggregators(): void { static::assertEquals( [ref('order_id'), ref('discount')], - (new Aggregators(count(ref('order_id')), sum(ref('discount'))))->references(), + new Aggregators(count(ref('order_id')), sum(ref('discount')))->references(), ); } public function test_references_are_null_when_any_aggregator_cannot_enumerate_them(): void { - static::assertNull( - (new Aggregators(count(ref('order_id')), new UnenumerableSum(ref('discount'))))->references(), - ); + static::assertNull(new Aggregators(count(ref('order_id')), new UnenumerableSum(ref('discount')))->references()); } public function test_resolved_refuses_an_expand_in_an_aggregate(): void @@ -92,7 +90,7 @@ public function test_resolved_refuses_an_expand_in_an_aggregate(): void 'aggregate() cannot contain array_expand(), it turns one row into many rows. Expand with withColumn() first, then use the new column.', ); - (new Aggregators(new UnenumerableSum(ref('n'), ref('flags')->expand()->equals(lit(true)))))->resolved( + new Aggregators(new UnenumerableSum(ref('n'), ref('flags')->expand()->equals(lit(true))))->resolved( ListColumnsMother::numberAndFlagsSchema(), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/DeclaredPivotValuesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/DeclaredPivotValuesTest.php index 426e327b3a..6cd6bf5a81 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/DeclaredPivotValuesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/DeclaredPivotValuesTest.php @@ -26,7 +26,7 @@ public function test_duplicate_values_are_refused(): void public function test_it_keeps_the_declaration_order(): void { - static::assertSame(['USA', 0, 'China'], (new DeclaredPivotValues('USA', 0, 'China'))->all()); + static::assertSame(['USA', 0, 'China'], new DeclaredPivotValues('USA', 0, 'China')->all()); } public function test_no_values_are_refused(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/DiscoveredPivotValuesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/DiscoveredPivotValuesTest.php index 2ea3506cf7..1c4a03664b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/DiscoveredPivotValuesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/DiscoveredPivotValuesTest.php @@ -29,7 +29,7 @@ public function test_it_reads_the_frame_so_an_earlier_filter_narrows_the_values( { static::assertSame( ['a'], - (new DiscoveredPivotValues())->resolve( + new DiscoveredPivotValues()->resolve( df() ->read(from_array([['k' => 'a'], ['k' => 'b']])) ->filter(ref('k')->equals(lit('a'))) @@ -43,7 +43,7 @@ public function test_it_reads_the_frame_so_a_derived_column_is_visible(): void { static::assertSame( ['a!', 'b!'], - (new DiscoveredPivotValues())->resolve( + new DiscoveredPivotValues()->resolve( df() ->read(from_array([['k' => 'a'], ['k' => 'b']])) ->withColumn('k2', concat(ref('k'), lit('!'))) @@ -58,14 +58,14 @@ public function test_it_refuses_a_source_with_no_values_to_declare(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('found no values in column "country"'); - (new DiscoveredPivotValues())->resolve(df()->read(from_array([['country' => null]]))->get(), ref('country')); + new DiscoveredPivotValues()->resolve(df()->read(from_array([['country' => null]]))->get(), ref('country')); } public function test_exactly_the_bound_of_distinct_values_is_allowed(): void { static::assertSame( ['PL', 'US'], - (new DiscoveredPivotValues(2))->resolve( + new DiscoveredPivotValues(2)->resolve( df()->read(from_array([['country' => 'PL'], ['country' => 'US']]))->get(), ref('country'), )->all(), @@ -76,7 +76,7 @@ public function test_the_default_bound_allows_ten_thousand_distinct_values(): vo { static::assertCount( 10_000, - (new DiscoveredPivotValues())->resolve( + new DiscoveredPivotValues()->resolve( df()->read(from_array(array_map(static fn(int $i): array => ['k' => $i], range(1, 10_000))))->get(), ref('k'), )->all(), @@ -88,7 +88,7 @@ public function test_the_default_bound_refuses_ten_thousand_and_one_distinct_val $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('found more than 10000 distinct values in column "k"'); - (new DiscoveredPivotValues())->resolve( + new DiscoveredPivotValues()->resolve( df()->read(from_array(array_map(static fn(int $i): array => ['k' => $i], range(1, 10_001))))->get(), ref('k'), ); @@ -99,7 +99,7 @@ public function test_it_refuses_more_distinct_values_than_the_bound_allows(): vo $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('found more than 1 distinct values in column "country"'); - (new DiscoveredPivotValues(1))->resolve( + new DiscoveredPivotValues(1)->resolve( df()->read(from_array([['country' => 'PL'], ['country' => 'US']]))->get(), ref('country'), ); @@ -109,7 +109,7 @@ public function test_numeric_looking_strings_are_ordered_by_bytes_as_sort_by_doe { static::assertSame( ['10', '100', '9', 'B'], - (new DiscoveredPivotValues())->resolve( + new DiscoveredPivotValues()->resolve( df()->read(from_array([['code' => '9'], ['code' => '10'], ['code' => 'B'], ['code' => '100']]))->get(), ref('code'), )->all(), @@ -121,14 +121,14 @@ public function test_only_string_and_integer_values_can_become_pivot_columns(): $this->expectException(InvalidTypeException::class); $this->expectExceptionMessage('Expected type "integer|string", got "float".'); - (new DiscoveredPivotValues())->resolve(df()->read(from_array([['code' => 1.5]]))->get(), ref('code')); + new DiscoveredPivotValues()->resolve(df()->read(from_array([['code' => 1.5]]))->get(), ref('code')); } public function test_integers_are_ordered_numerically(): void { static::assertSame( [9, 10, 100], - (new DiscoveredPivotValues())->resolve( + new DiscoveredPivotValues()->resolve( df()->read(from_array([['code' => 100], ['code' => 9], ['code' => 10]]))->get(), ref('code'), )->all(), @@ -139,7 +139,7 @@ public function test_the_discovered_values_are_distinct_null_free_and_sorted(): { static::assertSame( ['China', 'PL', 'US'], - (new DiscoveredPivotValues())->resolve( + new DiscoveredPivotValues()->resolve( df()->read(from_array([ ['country' => 'US'], ['country' => 'PL'], diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/MergedAggregateTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/MergedAggregateTest.php index 5022ec8e80..1b40afa8db 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/MergedAggregateTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/MergedAggregateTest.php @@ -40,7 +40,7 @@ public function test_merges_the_partial_column_in_row_order(): void public function test_declares_the_inner_nullable_type_a_column_can_carry(): void { - $returns = (new MergedAggregate(AggregatorFixtures::resolved(Sum::class)))->returns(); + $returns = new MergedAggregate(AggregatorFixtures::resolved(Sum::class))->returns(); static::assertTrue(type_is_nullable($returns)); static::assertTrue(definition_from_type('out', $returns)->isNullable()); @@ -48,7 +48,7 @@ public function test_declares_the_inner_nullable_type_a_column_can_carry(): void public function test_has_no_children(): void { - static::assertSame([], (new MergedAggregate(AggregatorFixtures::resolved(Sum::class)))->children()); + static::assertSame([], new MergedAggregate(AggregatorFixtures::resolved(Sum::class))->children()); } public function test_with_children_is_fresh(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/PartialAggregateTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/PartialAggregateTest.php index 2a7a87e357..ff35cc5039 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/PartialAggregateTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupBy/PartialAggregateTest.php @@ -38,7 +38,7 @@ public function test_returns_the_partial_type(): void { $inner = AggregatorFixtures::resolved(Sum::class); - static::assertSame($inner->partialType()->toString(), (new PartialAggregate($inner))->returns()->toString()); + static::assertSame($inner->partialType()->toString(), new PartialAggregate($inner)->returns()->toString()); } public function test_merge_unwraps_another_partial_aggregate(): void @@ -66,7 +66,7 @@ public function test_describe_round_trips(): void public function test_declares_a_not_null_structure_a_column_can_carry(): void { - $returns = (new PartialAggregate(AggregatorFixtures::resolved(Sum::class)))->returns(); + $returns = new PartialAggregate(AggregatorFixtures::resolved(Sum::class))->returns(); static::assertFalse(type_is_nullable($returns)); static::assertFalse(definition_from_type('out', $returns)->isNullable()); @@ -74,7 +74,7 @@ public function test_declares_a_not_null_structure_a_column_can_carry(): void public function test_with_children_rebuilds_the_inner_aggregate(): void { - $rebuilt = (new PartialAggregate(sum(ref('v'))))->withChildren([ref('w')]); + $rebuilt = new PartialAggregate(sum(ref('v')))->withChildren([ref('w')]); static::assertEquals([ref('w')], $rebuilt->children()); static::assertSame('w_sum', $rebuilt->outputName()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupByTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupByTest.php index 82011f277c..9748e80a27 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupByTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/GroupByTest.php @@ -129,14 +129,14 @@ public function test_output_schema_declares_one_definition_per_aggregate(): void public function test_a_pivot_declares_its_output_schema(): void { - $schema = iterator_to_array((new PivotProcessor( + $schema = iterator_to_array(new PivotProcessor( new GroupBy( refs(ref('product')), new Aggregators(sum(ref('amount'))), new Pivot(ref('country'), pivot_values('USA')), ), config()->grouping, - ))->process( + )->process( (static function (): Generator { yield array_to_rows( [['product' => 'Banana', 'country' => 'USA', 'amount' => 1000]], @@ -176,14 +176,14 @@ public function test_a_pivot_over_an_empty_input_yields_nothing(): void { static::assertSame( [], - iterator_to_array((new PivotProcessor( + iterator_to_array(new PivotProcessor( new GroupBy( refs(ref('product')), new Aggregators(sum(ref('amount'))), new Pivot(ref('country'), pivot_values('USA')), ), config()->grouping, - ))->process((static fn(): Generator => yield from [])(), flow_context(config())->backend())), + )->process((static fn(): Generator => yield from [])(), flow_context(config())->backend())), ); } @@ -197,24 +197,24 @@ public function test_a_bound_pivot_over_an_empty_input_yields_nothing(): void static::assertSame( [], - iterator_to_array((new PivotProcessor( + iterator_to_array(new PivotProcessor( $group, config()->grouping, PivotShape::of($group, schema(str_schema('product'), str_schema('country'), int_schema('amount'))), - ))->process((static fn(): Generator => yield from [])(), flow_context(config())->backend())), + )->process((static fn(): Generator => yield from [])(), flow_context(config())->backend())), ); } public function test_an_unbound_pivot_resolves_an_argument_typed_aggregate(): void { - $result = iterator_to_array((new PivotProcessor( + $result = iterator_to_array(new PivotProcessor( new GroupBy( refs(ref('product')), new Aggregators(min(ref('amount'))), new Pivot(ref('country'), pivot_values('USA')), ), config()->grouping, - ))->process( + )->process( (static function (): Generator { yield array_to_rows( [ @@ -233,24 +233,24 @@ public function test_an_unbound_pivot_resolves_an_argument_typed_aggregate(): vo public function test_a_group_by_without_references_is_global(): void { - static::assertTrue((new GroupBy(refs()))->isGlobal()); + static::assertTrue(new GroupBy(refs())->isGlobal()); } public function test_a_group_by_with_references_is_not_global(): void { - static::assertFalse((new GroupBy(refs(ref('product'))))->isGlobal()); + static::assertFalse(new GroupBy(refs(ref('product')))->isGlobal()); } public function test_a_falsy_pivot_value_keeps_its_column(): void { - $result = iterator_to_array((new PivotProcessor( + $result = iterator_to_array(new PivotProcessor( new GroupBy( refs(ref('product')), new Aggregators(sum(ref('amount'))), new Pivot(ref('country'), pivot_values('0', 'USA')), ), config()->grouping, - ))->process( + )->process( (static function (): Generator { yield array_to_rows( [ @@ -521,7 +521,7 @@ public function test_pivot_schema_keeps_the_group_by_column_declarations_of_the_ { static::assertEquals( schema(str_schema('product'), float_schema('USA', nullable: true)), - (new GroupBy(refs('product')))->pivotSchema( + new GroupBy(refs('product'))->pivotSchema( schema(str_schema('product'), str_schema('country'), int_schema('amount')), ['USA'], sum(ref('amount')), @@ -531,7 +531,7 @@ public function test_pivot_schema_keeps_the_group_by_column_declarations_of_the_ public function test_pivot_schema_types_every_pivot_column_from_the_aggregate_as_nullable(): void { - $output = (new GroupBy(refs('product')))->pivotSchema( + $output = new GroupBy(refs('product'))->pivotSchema( schema(str_schema('product'), str_schema('country'), int_schema('amount')), ['USA', 'Canada'], sum(ref('amount')), @@ -547,7 +547,7 @@ public function test_pivot_schema_names_an_integer_pivot_column_by_its_digits(): { static::assertSame( ['product', '0', '7'], - (new GroupBy(refs('product'))) + new GroupBy(refs('product')) ->pivotSchema( schema(str_schema('product'), int_schema('year'), int_schema('amount')), [0, 7], @@ -562,7 +562,7 @@ public function test_pivot_schema_refuses_a_pivot_value_colliding_with_a_group_b $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Pivot value "product" collides with the group-by column of the same name'); - (new GroupBy(refs('product')))->pivotSchema( + new GroupBy(refs('product'))->pivotSchema( schema(str_schema('product'), int_schema('amount')), ['product'], sum(ref('amount')), @@ -573,7 +573,7 @@ public function test_pivot_schema_without_values_declares_only_the_group_by_colu { static::assertEquals( schema(str_schema('product')), - (new GroupBy(refs('product')))->pivotSchema( + new GroupBy(refs('product'))->pivotSchema( schema(str_schema('product'), int_schema('amount')), [], sum(ref('amount')), @@ -585,7 +585,7 @@ public function test_read_columns_are_the_grouping_columns_then_the_aggregated_o { static::assertSame( ['category', 'amount', 'qty'], - (new GroupBy(refs(ref('category')), new Aggregators(sum(ref('amount')), min(ref('qty')))))->readColumns(), + new GroupBy(refs(ref('category')), new Aggregators(sum(ref('amount')), min(ref('qty'))))->readColumns(), ); } @@ -593,17 +593,17 @@ public function test_read_columns_name_a_column_read_twice_once(): void { static::assertSame( ['category', 'amount'], - (new GroupBy( + new GroupBy( refs(ref('category')), new Aggregators(sum(ref('amount')), min(ref('amount')), count(ref('category'))), - ))->readColumns(), + )->readColumns(), ); } public function test_read_columns_are_null_when_an_aggregation_names_no_columns(): void { static::assertNull( - (new GroupBy(refs(ref('category')), new Aggregators(new UnenumerableSum(ref('amount')))))->readColumns(), + new GroupBy(refs(ref('category')), new Aggregators(new UnenumerableSum(ref('amount'))))->readColumns(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Join/CrossJoinTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Join/CrossJoinTest.php index 29ab18b7ba..c248dc0408 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Join/CrossJoinTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Join/CrossJoinTest.php @@ -27,7 +27,7 @@ public function test_bind_concatenates_the_left_and_the_right_schema(): void { static::assertEquals( schema(int_schema('id'), str_schema('name')), - (new CrossJoin())->bind(schema(int_schema('id')), schema(str_schema('name')))->output, + new CrossJoin()->bind(schema(int_schema('id')), schema(str_schema('name')))->output, ); } @@ -35,7 +35,7 @@ public function test_bind_prefixes_every_right_side_column(): void { static::assertEquals( schema(int_schema('id'), str_schema('right_name')), - (new CrossJoin('right_'))->bind(schema(int_schema('id')), schema(str_schema('name')))->output, + new CrossJoin('right_')->bind(schema(int_schema('id')), schema(str_schema('name')))->output, ); } @@ -55,7 +55,7 @@ public function test_cross_join(): void array_map( static fn(Rows $rows): array => $rows->toArray(), iterator_to_array( - (new CrossJoin('joined_'))->join( + new CrossJoin('joined_')->join( (static function () { yield array_to_rows( [ @@ -99,7 +99,7 @@ public function test_the_right_side_is_read_once_over_every_left_batch(): void array_map( static fn(Rows $rows): array => $rows->toArray(), iterator_to_array( - (new CrossJoin('r_'))->join( + new CrossJoin('r_')->join( (static function () { yield array_to_rows([['id' => 1]], schema(int_schema('id'))); yield array_to_rows([['id' => 2]], schema(int_schema('id'))); @@ -127,7 +127,7 @@ public function test_an_empty_left_never_reads_the_right_side(): void static::assertSame( [], iterator_to_array( - (new CrossJoin())->join( + new CrossJoin()->join( (static function () { yield from []; })(), @@ -145,7 +145,7 @@ public function test_an_empty_side_yields_no_batch(): void static::assertSame( [], iterator_to_array( - (new CrossJoin('joined_'))->join( + new CrossJoin('joined_')->join( (static function () { yield array_to_rows([['id' => 1]], schema(int_schema('id'))); })(), @@ -160,7 +160,7 @@ public function test_an_empty_side_yields_no_batch(): void static::assertSame( [], iterator_to_array( - (new CrossJoin('joined_'))->join( + new CrossJoin('joined_')->join( (static function () { yield rows(schema(int_schema('id'))); })(), @@ -182,7 +182,7 @@ public function test_a_stop_reaches_the_left_side(): void yield array_to_rows([['id' => 2]], schema(int_schema('id'))); })(); - $joined = (new CrossJoin())->join( + $joined = new CrossJoin()->join( $left, (static function () { yield array_to_rows([['name' => 'Alice']], schema(str_schema('name'))); @@ -204,7 +204,7 @@ public function test_a_column_on_both_sides_without_a_prefix_is_refused(): void 'Column definitions must be unique, duplicated columns: [active], all: [id, country, active, active]', ); - iterator_to_array((new CrossJoin())->join( + iterator_to_array(new CrossJoin()->join( (static function () { yield array_to_rows( [['id' => 1, 'country' => 'PL', 'active' => false]], @@ -226,7 +226,7 @@ public function test_a_prefix_resolves_a_column_on_both_sides(): void ['id' => 2, 'country' => 'PL', 'active' => false, '_active' => true], ], iterator_to_array( - (new CrossJoin('_'))->join( + new CrossJoin('_')->join( (static function () { yield array_to_rows( [ diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Join/HashJoinConfigTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Join/HashJoinConfigTest.php index 738aa6b699..2e6245e4a8 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Join/HashJoinConfigTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Join/HashJoinConfigTest.php @@ -47,7 +47,7 @@ public function test_describe_round_trips(): void public function test_an_undescribable_storage_makes_the_config_undescribable(): void { static::assertNull( - (new HashJoinConfig( + new HashJoinConfig( new BucketingConfig( new PsrRowsStorage(new ArrayCache(), new FloeSerializer(new PhpBackend())), 4, @@ -55,7 +55,7 @@ public function test_an_undescribable_storage_makes_the_config_undescribable(): Unit::fromBytes(1), ), Unit::fromBytes(1), - ))->describe(), + )->describe(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Join/HashJoinTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Join/HashJoinTest.php index bf80e78cfb..729be955ea 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Join/HashJoinTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Join/HashJoinTest.php @@ -838,6 +838,33 @@ public function test_storages_are_cleared_after_the_join(): void static::assertSame([], $storage->liveBucketIds()); } + public function test_storages_are_cleared_when_the_consumer_stops_early(): void + { + $storage = new SpyRowsStorage(new MemoryRowsStorage()); + $joined = HashJoinMother::grace( + Expression::on(['id' => 'user_id']), + JoinType::left, + $storage, + batchSize: 1, + )->join( + (static function () { + yield array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); + })(), + (static function () { + yield array_to_rows( + [['user_id' => 1, 'name' => 'Alice']], + schema(int_schema('user_id'), str_schema('name')), + ); + })(), + flow_context()->backend(), + ); + + $joined->current(); + unset($joined); + + static::assertSame([], $storage->liveBucketIds()); + } + public function test_pairs_with_a_missing_right_side_read_only_left_buckets(): void { $storage = new SpyRowsStorage(new MemoryRowsStorage()); @@ -866,7 +893,7 @@ public function test_pairs_with_a_missing_right_side_read_only_left_buckets(): v public function test_resident_join_forwards_stop_to_its_left_upstream(): void { - $upstream = (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5)))->withBatchSize(1); + $upstream = new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5))->withBatchSize(1); $joined = HashJoinMother::resident(Expression::on(['id' => 'id']), JoinType::inner, batchSize: 1)->join( FlowTestCase::extracted($upstream, flow_context()->backend(), new Criteria()), (static function () { diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/BatchingByProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/BatchingByProcessorTest.php index c85db4e4f8..638ebd4fdc 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/BatchingByProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/BatchingByProcessorTest.php @@ -42,7 +42,7 @@ public function test_a_later_batch_that_widens_the_shape_is_refused(): void $this->expectExceptionMessage('column "extra" (row 0) is not declared by the schema'); iterator_to_array( - (new BatchingByProcessor(ref('g')))->process( + new BatchingByProcessor(ref('g'))->process( FlowTestCase::extracted( new VaryingBatchesExtractor( array_to_rows([['g' => 1]], schema(int_schema('g'))), @@ -64,7 +64,7 @@ public function test_a_stop_after_a_group_reaches_the_upstream(): void array_to_rows([['id' => 2]], schema(int_schema('id'))), array_to_rows([['id' => 3]], schema(int_schema('id'))), ); - $processed = (new BatchingByProcessor(ref('id')))->process($upstream->rows(), flow_context()->backend()); + $processed = new BatchingByProcessor(ref('id'))->process($upstream->rows(), flow_context()->backend()); static::assertTrue($processed->valid()); @@ -75,8 +75,8 @@ public function test_a_stop_after_a_group_reaches_the_upstream(): void public function test_batching_by_processor_forwards_stop_to_its_upstream(): void { - $upstream = (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5)))->withBatchSize(1); - $processed = (new BatchingByProcessor(ref('id')))->process( + $upstream = new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5))->withBatchSize(1); + $processed = new BatchingByProcessor(ref('id'))->process( FlowTestCase::extracted($upstream, flow_context()->backend(), new Criteria()), flow_context()->backend(), ); @@ -114,7 +114,7 @@ public function test_batches_close_at_a_value_change_once_they_hold_the_minimum( static::assertSame($expected, array_map( static fn(Rows $batch): array => array_map(static fn(array $row): mixed => $row['g'], $batch->toArray()), iterator_to_array( - (new BatchingByProcessor(ref('g'), $minSize))->process($input, flow_context()->backend()), + new BatchingByProcessor(ref('g'), $minSize)->process($input, flow_context()->backend()), false, ), )); @@ -127,7 +127,7 @@ public function test_batches_close_at_a_value_change_once_they_hold_the_minimum( #[TestWith([1, 1])] public function test_a_rebuilt_minimum_size_is_at_least_one(int $described, int $rebuilt): void { - $description = (new BatchingByProcessor(ref('g'), 1))->describe(); + $description = new BatchingByProcessor(ref('g'), 1)->describe(); static::assertNotNull($description); $data = type_array()->assert(Json::decode(Json::encode($description->normalize()))['data'] ?? null); @@ -141,12 +141,12 @@ public function test_bind_returns_the_input_schema(): void { $input = schema(str_schema('group'), int_schema('id')); - static::assertEquals($input, (new BatchingByProcessor(ref('group')))->bind($input)->output); + static::assertEquals($input, new BatchingByProcessor(ref('group'))->bind($input)->output); } public function test_groups_rows_by_column_value(): void { - $result = iterator_to_array((new BatchingByProcessor(ref('group')))->process( + $result = iterator_to_array(new BatchingByProcessor(ref('group'))->process( (static function () { yield array_to_rows( [ @@ -173,7 +173,7 @@ public function test_an_empty_batch_is_skipped_without_reading_the_key(): void { static::assertSame( [], - iterator_to_array((new BatchingByProcessor(ref('group')))->process( + iterator_to_array(new BatchingByProcessor(ref('group'))->process( (static function () { yield array_to_rows([], schema(int_schema('id'))); })(), @@ -186,7 +186,7 @@ public function test_handles_empty_input(): void { static::assertCount( 0, - iterator_to_array((new BatchingByProcessor(ref('group')))->process( + iterator_to_array(new BatchingByProcessor(ref('group'))->process( (static function () { yield from []; })(), @@ -197,7 +197,7 @@ public function test_handles_empty_input(): void public function test_handles_single_group(): void { - $result = iterator_to_array((new BatchingByProcessor(ref('group')))->process( + $result = iterator_to_array(new BatchingByProcessor(ref('group'))->process( (static function () { yield array_to_rows( [['group' => 'a', 'id' => 1], ['group' => 'a', 'id' => 2]], @@ -212,7 +212,7 @@ public function test_handles_single_group(): void public function test_respects_min_size(): void { - $result = iterator_to_array((new BatchingByProcessor(ref('group'), minSize: 3))->process( + $result = iterator_to_array(new BatchingByProcessor(ref('group'), minSize: 3)->process( (static function () { yield array_to_rows( [ @@ -245,7 +245,7 @@ public function test_equal_datetimes_stay_in_one_batch(): void array_map( static fn(Rows $rows): array => $rows->column('id')->values(), iterator_to_array( - (new BatchingByProcessor(ref('dt')))->process( + new BatchingByProcessor(ref('dt'))->process( (static function () { yield array_to_rows( [ @@ -275,7 +275,7 @@ public function test_equal_uuids_stay_in_one_batch(): void array_map( static fn(Rows $rows): array => $rows->column('id')->values(), iterator_to_array( - (new BatchingByProcessor(ref('u')))->process( + new BatchingByProcessor(ref('u'))->process( (static function () { yield array_to_rows( [ @@ -299,7 +299,7 @@ public function test_a_batch_under_another_schema_is_conformed_to_the_first(): v static::assertSame( [['g' => 'a', 'name' => 'x'], ['g' => 'a', 'name' => null]], iterator_to_array( - (new BatchingByProcessor(ref('g')))->process( + new BatchingByProcessor(ref('g'))->process( (static function () { yield array_to_rows( [['g' => 'a', 'name' => 'x']], diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/BatchingProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/BatchingProcessorTest.php index 5a269cf234..0985b68ddf 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/BatchingProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/BatchingProcessorTest.php @@ -37,7 +37,7 @@ final class BatchingProcessorTest extends FlowTestCase public function test_a_batch_under_another_schema_is_conformed_to_the_first(int $size): void { /** @var list $result */ - $result = iterator_to_array((new BatchingProcessor(new BatchSize($size)))->process( + $result = iterator_to_array(new BatchingProcessor(new BatchSize($size))->process( (static function () { yield array_to_rows([['id' => 1, 'name' => 'a']], schema(int_schema('id'), str_schema('name', true))); yield array_to_rows([['id' => 2]], schema(int_schema('id'))); @@ -54,7 +54,7 @@ public function test_a_later_batch_that_widens_the_shape_is_refused(): void $this->expectExceptionMessage('column "extra" (row 0) is not declared by the schema'); iterator_to_array( - (new BatchingProcessor(new BatchSize(2)))->process( + new BatchingProcessor(new BatchSize(2))->process( FlowTestCase::extracted( new VaryingBatchesExtractor( array_to_rows([['id' => 1]], schema(int_schema('id'))), @@ -71,8 +71,8 @@ public function test_a_later_batch_that_widens_the_shape_is_refused(): void public function test_batching_processor_forwards_stop_to_its_upstream(): void { - $upstream = (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5)))->withBatchSize(1); - $processed = (new BatchingProcessor(new BatchSize(1)))->process( + $upstream = new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5))->withBatchSize(1); + $processed = new BatchingProcessor(new BatchSize(1))->process( FlowTestCase::extracted($upstream, flow_context()->backend(), new Criteria()), flow_context()->backend(), ); @@ -91,7 +91,7 @@ public function test_a_stop_after_a_window_reaches_the_upstream(): void array_to_rows([['id' => 1]], schema(int_schema('id'))), array_to_rows([['id' => 2]], schema(int_schema('id'))), ); - $processed = (new BatchingProcessor(new BatchSize(1)))->process($upstream->rows(), flow_context()->backend()); + $processed = new BatchingProcessor(new BatchSize(1))->process($upstream->rows(), flow_context()->backend()); static::assertTrue($processed->valid()); @@ -103,7 +103,7 @@ public function test_a_stop_after_a_window_reaches_the_upstream(): void public function test_stop_ends_the_windows_still_pending_in_one_batch(): void { - $processed = (new BatchingProcessor(new BatchSize(1)))->process( + $processed = new BatchingProcessor(new BatchSize(1))->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2], ['id' => 3]], schema(int_schema('id'))); })(), @@ -129,7 +129,7 @@ public function test_windows_built_from_many_child_batches_keep_counts_and_order } $windows = iterator_to_array( - (new BatchingProcessor(new BatchSize(1_000)))->process( + new BatchingProcessor(new BatchSize(1_000))->process( FlowTestCase::extracted( new VaryingBatchesExtractor(...$children), flow_context()->backend(), @@ -151,14 +151,14 @@ public function test_bind_returns_the_input_schema(): void { $input = schema(int_schema('id'), str_schema('name')); - static::assertEquals($input, (new BatchingProcessor(new BatchSize(2)))->bind($input)->output); + static::assertEquals($input, new BatchingProcessor(new BatchSize(2))->bind($input)->output); } public function test_handles_empty_input(): void { static::assertCount( 0, - iterator_to_array((new BatchingProcessor(new BatchSize(2)))->process( + iterator_to_array(new BatchingProcessor(new BatchSize(2))->process( (static function () { yield from []; })(), @@ -170,7 +170,7 @@ public function test_handles_empty_input(): void public function test_handles_exact_batch_size_multiple(): void { /** @var list $result */ - $result = iterator_to_array((new BatchingProcessor(new BatchSize(2)))->process( + $result = iterator_to_array(new BatchingProcessor(new BatchSize(2))->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2], ['id' => 3], ['id' => 4]], schema(int_schema('id'))); })(), @@ -184,7 +184,7 @@ public function test_handles_exact_batch_size_multiple(): void public function test_handles_single_large_batch(): void { /** @var list $result */ - $result = iterator_to_array((new BatchingProcessor(new BatchSize(3)))->process( + $result = iterator_to_array(new BatchingProcessor(new BatchSize(3))->process( (static function () { yield array_to_rows([ ['id' => 1], @@ -204,7 +204,7 @@ public function test_handles_single_large_batch(): void public function test_rebatches_rows_into_fixed_size(): void { /** @var list $result */ - $result = iterator_to_array((new BatchingProcessor(new BatchSize(2)))->process( + $result = iterator_to_array(new BatchingProcessor(new BatchSize(2))->process( (static function () { yield array_to_rows([['id' => 1]], schema(int_schema('id'))); yield array_to_rows([['id' => 2]], schema(int_schema('id'))); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/CachingProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/CachingProcessorTest.php index 6de9db195c..7d8e45ee62 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/CachingProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/CachingProcessorTest.php @@ -28,8 +28,8 @@ final class CachingProcessorTest extends FlowTestCase public function test_a_stop_still_completes_the_cache(): void { $cache = new MemoryRowsStorage(); - $upstream = (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5)))->withBatchSize(1); - $processed = (new CachingProcessor('stop-cache', $cache))->process( + $upstream = new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5))->withBatchSize(1); + $processed = new CachingProcessor('stop-cache', $cache)->process( FlowTestCase::extracted($upstream, flow_context()->backend(), new Criteria()), flow_context()->backend(), ); @@ -48,7 +48,7 @@ public function test_a_non_empty_stream_is_cached_batch_by_batch_and_closed(): v { $cache = new SpyRowsStorage(new MemoryRowsStorage()); - iterator_to_array((new CachingProcessor('closed-cache', $cache))->process( + iterator_to_array(new CachingProcessor('closed-cache', $cache)->process( (static function () { yield array_to_rows([['id' => 1]], schema(int_schema('id'))); })(), @@ -63,10 +63,7 @@ public function test_bind_returns_the_input_schema(): void { $input = schema(int_schema('id'), str_schema('name')); - static::assertEquals( - $input, - (new CachingProcessor('bind-cache', new MemoryRowsStorage()))->bind($input)->output, - ); + static::assertEquals($input, new CachingProcessor('bind-cache', new MemoryRowsStorage())->bind($input)->output); } public function test_caches_batches_and_yields_them(): void @@ -75,7 +72,7 @@ public function test_caches_batches_and_yields_them(): void static::assertCount( 2, - iterator_to_array((new CachingProcessor('test-cache', $cache))->process( + iterator_to_array(new CachingProcessor('test-cache', $cache)->process( (static function () { yield array_to_rows([['id' => 1]], schema(int_schema('id'))); yield array_to_rows([['id' => 2]], schema(int_schema('id'))); @@ -98,7 +95,7 @@ public function test_handles_empty_input(): void static::assertCount( 0, - iterator_to_array((new CachingProcessor('test-cache', $cache))->process( + iterator_to_array(new CachingProcessor('test-cache', $cache)->process( (static function () { yield from []; })(), @@ -115,7 +112,7 @@ public function test_passes_through_when_cache_exists(): void static::assertCount( 1, - iterator_to_array((new CachingProcessor('test-cache', $cache))->process( + iterator_to_array(new CachingProcessor('test-cache', $cache)->process( (static function () { yield array_to_rows([['id' => 1]], schema(int_schema('id'))); })(), @@ -129,7 +126,7 @@ public function test_a_failing_stream_leaves_no_entry(): void $cache = new MemoryRowsStorage(); try { - iterator_to_array((new CachingProcessor('failing-cache', $cache))->process( + iterator_to_array(new CachingProcessor('failing-cache', $cache)->process( (static function () { yield array_to_rows([['id' => 1]], schema(int_schema('id'))); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/CollectingProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/CollectingProcessorTest.php index 6083dcd2f5..39e50b9cbf 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/CollectingProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/CollectingProcessorTest.php @@ -18,7 +18,7 @@ final class CollectingProcessorTest extends FlowTestCase { public function test_a_processor_without_a_declared_schema_describes_a_null_schema(): void { - static::assertSame(['declared' => null], (new CollectingProcessor())->describe()?->normalize()['data'] ?? null); + static::assertSame(['declared' => null], new CollectingProcessor()->describe()?->normalize()['data'] ?? null); } public function test_a_zero_batch_input_yields_the_declared_schema(): void @@ -26,7 +26,7 @@ public function test_a_zero_batch_input_yields_the_declared_schema(): void $declared = schema(int_schema('id')); /** @var list $result */ - $result = iterator_to_array((new CollectingProcessor($declared))->process( + $result = iterator_to_array(new CollectingProcessor($declared)->process( (static function () { yield from []; })(), @@ -40,7 +40,7 @@ public function test_a_zero_batch_input_yields_the_declared_schema(): void public function test_empty_parts_of_another_schema_add_nothing(): void { /** @var list $result */ - $result = iterator_to_array((new CollectingProcessor())->process( + $result = iterator_to_array(new CollectingProcessor()->process( (static function () { yield Rows::empty(schema(str_schema('other')), flow_context()->backend()); yield array_to_rows([['id' => 1]], schema(int_schema('id'))); @@ -56,7 +56,7 @@ public function test_empty_parts_of_another_schema_add_nothing(): void public function test_bind_returns_the_input_schema_and_declares_it_on_the_rebound_step(): void { $input = schema(int_schema('id'), str_schema('name')); - $bound = (new CollectingProcessor())->bind($input); + $bound = new CollectingProcessor()->bind($input); static::assertEquals($input, $bound->output); static::assertEquals(new CollectingProcessor($input), $bound->step); @@ -65,7 +65,7 @@ public function test_bind_returns_the_input_schema_and_declares_it_on_the_reboun public function test_collects_all_rows_into_single_batch(): void { /** @var list $result */ - $result = iterator_to_array((new CollectingProcessor())->process( + $result = iterator_to_array(new CollectingProcessor()->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); yield array_to_rows([['id' => 3]], schema(int_schema('id'))); @@ -91,7 +91,7 @@ public function test_collects_all_rows_into_single_batch(): void public function test_handles_empty_input(): void { /** @var list $result */ - $result = iterator_to_array((new CollectingProcessor())->process( + $result = iterator_to_array(new CollectingProcessor()->process( (static function () { yield from []; })(), @@ -105,7 +105,7 @@ public function test_handles_empty_input(): void public function test_handles_single_batch(): void { /** @var list $result */ - $result = iterator_to_array((new CollectingProcessor())->process( + $result = iterator_to_array(new CollectingProcessor()->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); })(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/ConstrainedProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/ConstrainedProcessorTest.php index a630ccddb5..fe16ecd523 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/ConstrainedProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/ConstrainedProcessorTest.php @@ -29,8 +29,8 @@ final class ConstrainedProcessorTest extends FlowTestCase { public function test_constrained_processor_forwards_stop_to_its_upstream(): void { - $upstream = (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5)))->withBatchSize(1); - $processed = (new ConstrainedProcessor([]))->process( + $upstream = new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5))->withBatchSize(1); + $processed = new ConstrainedProcessor([])->process( FlowTestCase::extracted($upstream, flow_context()->backend(), new Criteria()), flow_context()->backend(), ); @@ -49,7 +49,7 @@ public function test_a_stop_after_a_passed_batch_reaches_the_upstream(): void array_to_rows([['id' => 1]], schema(int_schema('id'))), array_to_rows([['id' => 2]], schema(int_schema('id'))), ); - $processed = (new ConstrainedProcessor([]))->process($upstream->rows(), flow_context()->backend()); + $processed = new ConstrainedProcessor([])->process($upstream->rows(), flow_context()->backend()); static::assertTrue($processed->valid()); @@ -60,7 +60,7 @@ public function test_a_stop_after_a_passed_batch_reaches_the_upstream(): void public function test_a_stop_ends_the_stream_even_when_the_upstream_ignores_it(): void { - $processed = (new ConstrainedProcessor([]))->process( + $processed = new ConstrainedProcessor([])->process( (static function () { yield array_to_rows([['id' => 1]], schema(int_schema('id'))); yield array_to_rows([['id' => 2]], schema(int_schema('id'))); @@ -81,7 +81,7 @@ public function test_a_violation_names_its_row_across_every_earlier_batch(): voi $this->expectException(ConstraintViolationException::class); $this->expectExceptionMessageMatches('/in row: 3$/'); - iterator_to_array((new ConstrainedProcessor([constraint_unique('id')]))->process( + iterator_to_array(new ConstrainedProcessor([constraint_unique('id')])->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); yield array_to_rows([['id' => 3]], schema(int_schema('id'))); @@ -95,14 +95,14 @@ public function test_bind_returns_the_input_schema(): void { $input = schema(int_schema('id')); - static::assertEquals($input, (new ConstrainedProcessor([]))->bind($input)->output); + static::assertEquals($input, new ConstrainedProcessor([])->bind($input)->output); } public function test_handles_empty_constraints(): void { static::assertCount( 1, - iterator_to_array((new ConstrainedProcessor([]))->process( + iterator_to_array(new ConstrainedProcessor([])->process( (static function () { yield array_to_rows([['id' => 1]], schema(int_schema('id'))); })(), @@ -115,7 +115,7 @@ public function test_handles_empty_input(): void { static::assertCount( 0, - iterator_to_array((new ConstrainedProcessor([new class implements Constraint { + iterator_to_array(new ConstrainedProcessor([new class implements Constraint { public function firstViolation(Rows $rows): ?int { return null; @@ -130,7 +130,7 @@ public function violation(Rows $rows, int $index): string { return ''; } - }]))->process( + }])->process( (static function () { yield from []; })(), @@ -142,7 +142,7 @@ public function violation(Rows $rows, int $index): string public function test_passes_rows_when_all_constraints_satisfied(): void { /** @var list $result */ - $result = iterator_to_array((new ConstrainedProcessor([new class implements Constraint { + $result = iterator_to_array(new ConstrainedProcessor([new class implements Constraint { public function firstViolation(Rows $rows): ?int { // @mago-ignore analysis:mixed-assignment @@ -164,7 +164,7 @@ public function violation(Rows $rows, int $index): string { return 'id must be greater than 0'; } - }]))->process( + }])->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); })(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/CountingProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/CountingProcessorTest.php index 951dbd68a2..b0b99f8511 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/CountingProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/CountingProcessorTest.php @@ -29,7 +29,7 @@ public function test_every_batch_is_counted_into_one_row(): void static::assertEquals( [array_to_rows([['count' => 3]], schema(int_schema('count')))], - iterator_to_array((new CountingProcessor())->process($batches, flow_context()->backend())), + iterator_to_array(new CountingProcessor()->process($batches, flow_context()->backend())), ); } @@ -41,13 +41,13 @@ public function test_no_batch_counts_to_zero(): void static::assertEquals( [array_to_rows([['count' => 0]], schema(int_schema('count')))], - iterator_to_array((new CountingProcessor())->process($batches, flow_context()->backend())), + iterator_to_array(new CountingProcessor()->process($batches, flow_context()->backend())), ); } public function test_bind_outputs_the_count_column_whatever_the_input(): void { - $bound = (new CountingProcessor())->bind(schema(int_schema('id'), str_schema('name'))); + $bound = new CountingProcessor()->bind(schema(int_schema('id'), str_schema('name'))); static::assertEquals(schema(int_schema('count')), $bound->output); static::assertEquals(new CountingProcessor(), $bound->step); @@ -60,7 +60,7 @@ public function test_count_builds_with_the_configured_backend(): void yield array_to_rows([['id' => 1]], schema(int_schema('id'))); })(); - iterator_to_array((new CountingProcessor())->process( + iterator_to_array(new CountingProcessor()->process( $batches, flow_context(config_builder()->backend($backend)->build())->backend(), )); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/DistinctProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/DistinctProcessorTest.php index 7c1149cfa8..d260c3cf2a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/DistinctProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/DistinctProcessorTest.php @@ -25,10 +25,10 @@ final class DistinctProcessorTest extends FlowTestCase { public function test_a_bound_distinct_is_clustered_on_its_columns_and_runs_per_split_first(): void { - $distinct = type_instance_of(DistinctProcessor::class)->assert((new DistinctProcessor([ + $distinct = type_instance_of(DistinctProcessor::class)->assert(new DistinctProcessor([ 'country', ref('day'), - ]))->bind(schema(str_schema('country'), int_schema('day')))->step); + ])->bind(schema(str_schema('country'), int_schema('day')))->step); $distribution = $distinct->distribution(); static::assertSame(['country', 'day'], $distribution?->keys); @@ -40,7 +40,7 @@ public function test_a_distinct_over_a_column_missing_from_its_input_has_no_dist { static::assertNull( type_instance_of(DistinctProcessor::class) - ->assert((new DistinctProcessor(['country', 'day']))->bind(schema(str_schema('country')))->step) + ->assert(new DistinctProcessor(['country', 'day'])->bind(schema(str_schema('country')))->step) ->distribution(), ); } @@ -49,20 +49,20 @@ public function test_an_unbound_distinct_describes_a_null_input(): void { static::assertSame( ['columns' => ['country'], 'input' => null], - (new DistinctProcessor(['country']))->describe()?->normalize()['data'], + new DistinctProcessor(['country'])->describe()?->normalize()['data'], ); } public function test_an_unbound_distinct_has_no_distribution(): void { - static::assertNull((new DistinctProcessor(['country']))->distribution()); + static::assertNull(new DistinctProcessor(['country'])->distribution()); } public function test_a_key_seen_in_an_earlier_batch_is_dropped(): void { static::assertSame( [['k' => 'a', 'v' => 1], ['k' => 'b', 'v' => 2], ['k' => 'c', 'v' => 5]], - RowsStorageContext::rows((new DistinctProcessor(['k']))->process( + RowsStorageContext::rows(new DistinctProcessor(['k'])->process( GroupByContext::batches( array_to_rows( [['k' => 'a', 'v' => 1], ['k' => 'b', 'v' => 2], ['k' => 'a', 'v' => 3]], @@ -100,7 +100,7 @@ public function test_keys_on_every_column_given(): void { static::assertSame( [['id' => 1, 'name' => 'a'], ['id' => 1, 'name' => 'b'], ['id' => 2, 'name' => 'a']], - RowsStorageContext::rows((new DistinctProcessor(['id', ref('name')]))->process( + RowsStorageContext::rows(new DistinctProcessor(['id', ref('name')])->process( GroupByContext::batches(array_to_rows( [ ['id' => 1, 'name' => 'a'], @@ -119,7 +119,7 @@ public function test_a_null_key_is_kept_once(): void { static::assertSame( [['id' => 1, 'name' => 'a'], ['id' => null, 'name' => 'b']], - RowsStorageContext::rows((new DistinctProcessor(['id']))->process( + RowsStorageContext::rows(new DistinctProcessor(['id'])->process( GroupByContext::batches(array_to_rows( [['id' => 1, 'name' => 'a'], ['id' => null, 'name' => 'b'], ['id' => null, 'name' => 'c']], schema(int_schema('id', nullable: true), str_schema('name')), @@ -133,7 +133,7 @@ public function test_zero_and_negative_zero_are_duplicates(): void { static::assertSame( [['v' => 0.0], ['v' => 1.5]], - RowsStorageContext::rows((new DistinctProcessor(['v']))->process( + RowsStorageContext::rows(new DistinctProcessor(['v'])->process( GroupByContext::batches(array_to_rows([ ['v' => 0.0], ['v' => -0.0], @@ -157,7 +157,7 @@ public function test_a_stop_is_forwarded(): void { $stopped = false; - $rows = (new DistinctProcessor(['k']))->process( + $rows = new DistinctProcessor(['k'])->process( (static function () use (&$stopped): Generator { // @mago-ignore analysis:mixed-assignment $signal = yield array_to_rows([['k' => 1]], schema(int_schema('k'))); @@ -176,11 +176,11 @@ public function test_a_stop_is_forwarded(): void public function test_bind_keeps_the_input_schema(): void { - $bound = (new DistinctProcessor(['k']))->bind(schema(int_schema('k'), str_schema('v'))); + $bound = new DistinctProcessor(['k'])->bind(schema(int_schema('k'), str_schema('v'))); static::assertEquals(schema(int_schema('k'), str_schema('v')), $bound->output); static::assertInstanceOf(DistinctProcessor::class, $bound->step); static::assertEquals(schema(int_schema('k'), str_schema('v')), $bound->step->input); - static::assertNull((new DistinctProcessor(['k']))->input); + static::assertNull(new DistinctProcessor(['k'])->input); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/ExpandingProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/ExpandingProcessorTest.php index 72994fb186..8c2df2c948 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/ExpandingProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/ExpandingProcessorTest.php @@ -46,7 +46,7 @@ final class ExpandingProcessorTest extends FlowTestCase { public function test_an_unbound_expansion_describes_a_null_input(): void { - $data = (new ExpandingProcessor('tag', ref('tags')->expand(), RequiredColumns::all())) + $data = new ExpandingProcessor('tag', ref('tags')->expand(), RequiredColumns::all()) ->describe() ?->normalize()['data'] ?? []; @@ -92,7 +92,7 @@ public function test_bind_declares_the_output_of_the_bound_expansion(): void { static::assertEquals( schema(str_schema('id'), str_schema('tag')), - (new ExpandingProcessor('tag', ref('tags')->expand(), RequiredColumns::allBut('tags')))->bind( + new ExpandingProcessor('tag', ref('tags')->expand(), RequiredColumns::allBut('tags'))->bind( ListColumnsMother::tagsSchema(), )->output, ); @@ -120,19 +120,19 @@ public function test_bound_and_unbound_give_the_same_rows(): void public function test_stop_after_the_first_batch_is_forwarded_upstream(): void { $upstream = FlowTestCase::extracted( - (new CountingExtractor(ListColumnsMother::tagsSchema(), array_to_rows([ + new CountingExtractor(ListColumnsMother::tagsSchema(), array_to_rows([ ['id' => 'a', 'tags' => ['x', 'y']], ['id' => 'b', 'tags' => ['z']], - ], ListColumnsMother::tagsSchema())))->withBatchSize(1), + ], ListColumnsMother::tagsSchema()))->withBatchSize(1), flow_context()->backend(), new Criteria(), ); - $processed = (new ExpandingProcessor( + $processed = new ExpandingProcessor( 'tag', ref('tags')->expand(), RequiredColumns::all(), new BatchSize(1), - ))->process($upstream, flow_context()->backend()); + )->process($upstream, flow_context()->backend()); static::assertTrue($processed->valid()); @@ -170,14 +170,14 @@ public function test_bind_declares_zipped_expands_nullable(): void 'tag' => type_optional(type_string()), ])), ), - (new ExpandingProcessor( + new ExpandingProcessor( 's', structure([ 'n' => ref('nums')->expand(), 'tag' => ref('tags')->expand(), ]), RequiredColumns::all(), - ))->bind(schema( + )->bind(schema( str_schema('id'), list_schema('tags', type_list(type_string())), list_schema('nums', type_list(type_integer())), @@ -243,11 +243,9 @@ public function test_emits_one_row_per_element_and_none_for_an_empty_list(): voi ], ExpandingProcessorContext::rows( flow_context(config()), - (new ExpandingProcessor( - 's', - structure(['tag' => ref('tags')->expand()]), - RequiredColumns::all(), - ))->bind(ListColumnsMother::tagsSchema())->step, + new ExpandingProcessor('s', structure(['tag' => ref('tags')->expand()]), RequiredColumns::all())->bind( + ListColumnsMother::tagsSchema(), + )->step, array_to_rows([ ['id' => 'a', 'tags' => ['x', 'y']], ['id' => 'b', 'tags' => []], @@ -265,11 +263,11 @@ public function test_unpack_emits_one_row_per_element(): void ], ExpandingProcessorContext::rows( flow_context(config()), - (new ExpandingProcessor( + new ExpandingProcessor( 'u', structure(['tag' => ref('tags')->expand()])->unpack(schema(str_schema('tag'))), RequiredColumns::all(), - ))->bind(ListColumnsMother::tagsSchema())->step, + )->bind(ListColumnsMother::tagsSchema())->step, array_to_rows([['id' => 'a', 'tags' => ['x', 'y']]], ListColumnsMother::tagsSchema()), ), ); @@ -282,7 +280,7 @@ public function test_bind_rebinds_against_another_input(): void list_schema('tags', type_list(type_integer())), structure_schema('s', type_structure(['tag' => type_integer()])), ), - (new ExpandingProcessor('s', structure(['tag' => ref('tags')->expand()]), RequiredColumns::all())) + new ExpandingProcessor('s', structure(['tag' => ref('tags')->expand()]), RequiredColumns::all()) ->bind(ListColumnsMother::tagsSchema()) ->step->bind(schema(list_schema('tags', type_list(type_integer())))) ->output, @@ -291,11 +289,11 @@ public function test_bind_rebinds_against_another_input(): void public function test_a_definition_entry_is_declared_as_given(): void { - $bound = (new ExpandingProcessor( + $bound = new ExpandingProcessor( str_schema('s', nullable: true), concat(ref('id'), ref('tags')->expand()), RequiredColumns::all(), - ))->bind(ListColumnsMother::tagsSchema()); + )->bind(ListColumnsMother::tagsSchema()); static::assertEquals( schema(str_schema('id'), list_schema('tags', type_list(type_string())), str_schema('s', nullable: true)), @@ -317,11 +315,11 @@ public function test_a_batch_under_another_schema_than_the_bound_one_is_conforme { $batch = ExpandingProcessorContext::batches( flow_context(config()), - (new ExpandingProcessor( + new ExpandingProcessor( 's', structure(['tag' => ref('tags')->expand()]), RequiredColumns::all(), - ))->bind(schema( + )->bind(schema( str_schema('id'), list_schema('tags', type_list(type_string())), str_schema('note', nullable: true), @@ -353,7 +351,7 @@ public function test_a_null_under_a_not_null_definition_names_its_output_row(): ExpandingProcessorContext::rows( flow_context(config()), - (new ExpandingProcessor(str_schema('s'), ref('tags')->expand()->coalesce(), RequiredColumns::all()))->bind( + new ExpandingProcessor(str_schema('s'), ref('tags')->expand()->coalesce(), RequiredColumns::all())->bind( $input, )->step, array_to_rows([['tags' => ['x']], ['tags' => [null]]], $input), @@ -509,7 +507,7 @@ public function test_bind_refuses_an_expand_inside_an_expand(ScalarFunction $fun 'array_expand() cannot contain another array_expand(). Expand one level per withColumn().', ); - (new ExpandingProcessor('v', $function, RequiredColumns::all()))->bind(ListColumnsMother::schema()); + new ExpandingProcessor('v', $function, RequiredColumns::all())->bind(ListColumnsMother::schema()); } /** diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/GroupByAggregationProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/GroupByAggregationProcessorTest.php index 4867774481..4671e7e250 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/GroupByAggregationProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/GroupByAggregationProcessorTest.php @@ -77,11 +77,11 @@ final class GroupByAggregationProcessorTest extends FlowTestCase public function test_a_bound_group_by_is_clustered_on_its_keys_with_partial_and_merged_aggregates(): void { $distribution = type_instance_of(GroupByAggregationProcessor::class) - ->assert((new GroupByAggregationProcessor( + ->assert(new GroupByAggregationProcessor( new GroupBy(refs('country'), new Aggregators(sum(ref('amount')))), config()->grouping, new NativePHPRandomValueGenerator(), - ))->bind(schema(str_schema('country'), int_schema('amount')))->step) + )->bind(schema(str_schema('country'), int_schema('amount')))->step) ->distribution(); static::assertNotNull($distribution); @@ -108,11 +108,11 @@ public function test_a_bound_group_by_is_clustered_on_its_keys_with_partial_and_ public function test_a_bound_global_group_by_meets_in_one_process(): void { $distribution = type_instance_of(GroupByAggregationProcessor::class) - ->assert((new GroupByAggregationProcessor( + ->assert(new GroupByAggregationProcessor( new GroupBy(refs(), new Aggregators(sum(ref('amount')))), config()->grouping, new NativePHPRandomValueGenerator(), - ))->bind(schema(int_schema('amount')))->step) + )->bind(schema(int_schema('amount')))->step) ->distribution(); static::assertNotNull($distribution); @@ -124,11 +124,11 @@ public function test_a_bound_global_group_by_meets_in_one_process(): void public function test_an_unbound_group_by_has_no_distribution(): void { static::assertNull( - (new GroupByAggregationProcessor( + new GroupByAggregationProcessor( new GroupBy(refs('country'), new Aggregators(sum(ref('amount')))), config()->grouping, new NativePHPRandomValueGenerator(), - ))->distribution(), + )->distribution(), ); } @@ -136,7 +136,7 @@ public function test_a_pivoting_group_by_has_no_distribution(): void { static::assertNull( type_instance_of(GroupByAggregationProcessor::class) - ->assert((new GroupByAggregationProcessor( + ->assert(new GroupByAggregationProcessor( new GroupBy( refs('name'), new Aggregators(sum(ref('id'))), @@ -144,7 +144,7 @@ public function test_a_pivoting_group_by_has_no_distribution(): void ), config()->grouping, new NativePHPRandomValueGenerator(), - ))->bind(schema(str_schema('name'), int_schema('id'), str_schema('country')))->step) + )->bind(schema(str_schema('name'), int_schema('id'), str_schema('country')))->step) ->distribution(), ); } @@ -152,11 +152,11 @@ public function test_a_pivoting_group_by_has_no_distribution(): void public function test_a_processor_with_an_undescribable_random_value_generator_does_not_describe(): void { static::assertNull( - (new GroupByAggregationProcessor( + new GroupByAggregationProcessor( new GroupBy(refs('id')), config()->grouping, new FixedRandomValueGenerator('fixed'), - ))->describe(), + )->describe(), ); } @@ -224,11 +224,11 @@ public function test_a_group_by_spills_when_twice_its_growth_passes_the_limit(in // resident, so the spilled phase writes its buckets here; the fixed run id names them $storage = new MemoryRowsStorage(); $backend = new ReportedMemoryBackend(0); - $output = (new GroupByAggregationProcessor( + $output = new GroupByAggregationProcessor( new GroupBy(refs(ref('category')), new Aggregators(sum(ref('amount')))), new BucketingConfig($storage, 4, 1, Unit::fromGb(10)), new FixedRandomValueGenerator('run'), - ))->process( + )->process( (static function () use ($backend, $schema, $growth): Generator { yield array_to_rows([['category' => 'a', 'amount' => 10]], $schema); @@ -839,12 +839,12 @@ public function test_counts_the_rows_it_takes_then_the_groups_it_emits(): void $progress = new ProgressSpy(); iterator_to_array( - (new GroupByAggregationProcessor( + new GroupByAggregationProcessor( new GroupBy(refs(ref('category')), new Aggregators(sum(ref('amount')))), config()->grouping, new NativePHPRandomValueGenerator(), progress: $progress->stage(StageName::group_by), - ))->process(GroupedRows::categories(), flow_context()->backend()), + )->process(GroupedRows::categories(), flow_context()->backend()), false, ); @@ -860,12 +860,12 @@ public function test_a_distributed_group_by_counts_rows_where_it_takes_them_and_ $merged = new ProgressSpy(); $input = schema(str_schema('category'), int_schema('amount')); $distribution = type_instance_of(GroupByAggregationProcessor::class) - ->assert((new GroupByAggregationProcessor( + ->assert(new GroupByAggregationProcessor( new GroupBy(refs(ref('category')), new Aggregators(sum(ref('amount')))), config()->grouping, new NativePHPRandomValueGenerator(), progress: $partials->stage(StageName::group_by), - ))->bind($input)->step) + )->bind($input)->step) ->distribution(); $partialStep = DescribeRoundTrip::rebuilt( type_instance_of(GroupByAggregationProcessor::class)->assert($distribution?->partial), @@ -912,12 +912,12 @@ public function test_group_by_aggregation_processor_describes_its_progress(): vo public function test_group_by_aggregation_processor_is_done_after_its_last_batch(): void { $progress = new ProgressSpy(); - $output = (new GroupByAggregationProcessor( + $output = new GroupByAggregationProcessor( new GroupBy(refs('id')), config()->grouping, new NativePHPRandomValueGenerator(), progress: $progress->stage(StageName::group_by), - ))->process( + )->process( (static function (): Generator { yield array_to_rows([['id' => 1], ['id' => 1], ['id' => 2]], schema(int_schema('id'))); })(), @@ -940,12 +940,12 @@ public function test_its_distribution_holds_the_stage_it_reports_to(): void static::assertSame( $stage, type_instance_of(GroupByAggregationProcessor::class) - ->assert((new GroupByAggregationProcessor( + ->assert(new GroupByAggregationProcessor( new GroupBy(refs('country'), new Aggregators(sum(ref('amount')))), config()->grouping, new NativePHPRandomValueGenerator(), progress: $stage, - ))->bind(schema(str_schema('country'), int_schema('amount')))->step) + )->bind(schema(str_schema('country'), int_schema('amount')))->step) ->distribution() ?->progress, ); @@ -986,12 +986,12 @@ public function test_a_group_by_over_an_empty_input_is_done_once(): void $progress = new ProgressSpy(); iterator_to_array( - (new GroupByAggregationProcessor( + new GroupByAggregationProcessor( new GroupBy(refs('id')), config()->grouping, new NativePHPRandomValueGenerator(), progress: $progress->stage(StageName::group_by), - ))->process( + )->process( (static function (): Generator { yield from []; })(), @@ -1007,11 +1007,11 @@ public function test_the_group_by_that_merges_is_busy_for_each_partial_batch(): { $merged = new ProgressSpy(); $distribution = type_instance_of(GroupByAggregationProcessor::class) - ->assert((new GroupByAggregationProcessor( + ->assert(new GroupByAggregationProcessor( new GroupBy(refs(ref('category')), new Aggregators(sum(ref('amount')))), config()->grouping, new NativePHPRandomValueGenerator(), - ))->bind(schema(str_schema('category'), int_schema('amount')))->step) + )->bind(schema(str_schema('category'), int_schema('amount')))->step) ->distribution(); $partialStep = type_instance_of(GroupByAggregationProcessor::class)->assert($distribution?->partial); $partials = iterator_to_array( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/MemorySortProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/MemorySortProcessorTest.php index 3f8bb85de7..7e652dab7c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/MemorySortProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/MemorySortProcessorTest.php @@ -28,19 +28,19 @@ public function test_a_sort_is_ordered_by_its_columns(): void { $columns = [ref('id')->desc()]; - static::assertSame($columns, (new MemorySortProcessor($columns))->distribution()?->order); + static::assertSame($columns, new MemorySortProcessor($columns)->distribution()?->order); } public function test_its_distribution_carries_no_sort_configuration(): void { - static::assertNull((new MemorySortProcessor([ref('id')->asc()]))->distribution()?->sort); + static::assertNull(new MemorySortProcessor([ref('id')->asc()])->distribution()?->sort); } public function test_bind_returns_the_input_schema_and_declares_it_on_the_rebound_step(): void { $columns = [ref('id')->asc()]; $input = schema(int_schema('id')); - $bound = (new MemorySortProcessor($columns))->bind($input); + $bound = new MemorySortProcessor($columns)->bind($input); static::assertEquals($input, $bound->output); static::assertEquals(new MemorySortProcessor($columns, $input), $bound->step); @@ -55,7 +55,7 @@ public function test_the_declared_schema_wins_over_the_batch_schema(): void $declared = schema(int_schema('id', nullable: true)); /** @var list $result */ - $result = iterator_to_array((new MemorySortProcessor([ref('id')->asc()], $declared))->process( + $result = iterator_to_array(new MemorySortProcessor([ref('id')->asc()], $declared)->process( (static function () { yield array_to_rows([['id' => 2], ['id' => 1]], schema(int_schema('id'))); })(), @@ -70,7 +70,7 @@ public function test_handles_empty_input(): void { static::assertCount( 0, - iterator_to_array((new MemorySortProcessor([ref('id')->asc()]))->process( + iterator_to_array(new MemorySortProcessor([ref('id')->asc()])->process( (static function () { yield from []; })(), @@ -82,7 +82,7 @@ public function test_handles_empty_input(): void public function test_sorts_across_multiple_batches(): void { /** @var list $result */ - $result = iterator_to_array((new MemorySortProcessor([ref('id')->asc()]))->process( + $result = iterator_to_array(new MemorySortProcessor([ref('id')->asc()])->process( (static function () { yield array_to_rows([['id' => 3]], schema(int_schema('id'))); yield array_to_rows([['id' => 1]], schema(int_schema('id'))); @@ -104,7 +104,7 @@ public function test_sorts_across_multiple_batches(): void public function test_sorts_rows_ascending(): void { /** @var list $result */ - $result = iterator_to_array((new MemorySortProcessor([ref('id')->asc()]))->process( + $result = iterator_to_array(new MemorySortProcessor([ref('id')->asc()])->process( (static function () { yield array_to_rows([['id' => 3], ['id' => 1], ['id' => 2]], schema(int_schema('id'))); })(), @@ -124,7 +124,7 @@ public function test_sorts_rows_ascending(): void public function test_sorts_rows_descending(): void { /** @var list $result */ - $result = iterator_to_array((new MemorySortProcessor([ref('id')->desc()]))->process( + $result = iterator_to_array(new MemorySortProcessor([ref('id')->desc()])->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 3], ['id' => 2]], schema(int_schema('id'))); })(), @@ -164,7 +164,7 @@ public function test_a_bound_sort_counts_with_its_progress(): void $progress = new ProgressSpy(); iterator_to_array( - (new MemorySortProcessor([ref('id')->asc()], progress: $progress->stage(StageName::sort))) + new MemorySortProcessor([ref('id')->asc()], progress: $progress->stage(StageName::sort)) ->bind(schema(int_schema('id'))) ->step->process( (static function () { @@ -183,7 +183,7 @@ public function test_counts_every_row_it_takes_once_and_is_busy_while_it_emits() $progress = new ProgressSpy(); iterator_to_array( - (new MemorySortProcessor([ref('id')->asc()], progress: $progress->stage(StageName::sort)))->process( + new MemorySortProcessor([ref('id')->asc()], progress: $progress->stage(StageName::sort))->process( (static function () { yield array_to_rows([['id' => 2], ['id' => 1]], schema(int_schema('id'))); yield array_to_rows([['id' => 3]], schema(int_schema('id'))); @@ -211,7 +211,7 @@ public function test_memory_sort_processor_describes_its_progress(): void public function test_memory_sort_processor_is_done_after_its_last_batch(): void { $progress = new ProgressSpy(); - $output = (new MemorySortProcessor([ref('id')->asc()], progress: $progress->stage(StageName::sort)))->process( + $output = new MemorySortProcessor([ref('id')->asc()], progress: $progress->stage(StageName::sort))->process( (static function (): Generator { yield array_to_rows([['id' => 2], ['id' => 1]], schema(int_schema('id'))); })(), @@ -233,7 +233,7 @@ public function test_its_distribution_holds_the_stage_it_reports_to(): void static::assertSame( $stage, - (new MemorySortProcessor([ref('id')->desc()], progress: $stage))->distribution()?->progress, + new MemorySortProcessor([ref('id')->desc()], progress: $stage)->distribution()?->progress, ); } @@ -242,7 +242,7 @@ public function test_a_memory_sort_over_an_empty_input_is_done_once(): void $progress = new ProgressSpy(); iterator_to_array( - (new MemorySortProcessor([ref('id')->asc()], progress: $progress->stage(StageName::sort)))->process( + new MemorySortProcessor([ref('id')->asc()], progress: $progress->stage(StageName::sort))->process( (static function (): Generator { yield from []; })(), @@ -261,7 +261,7 @@ public function test_sorted_batches_are_no_larger_than_the_largest_input_batch() array_map( static fn(Rows $batch): array => $batch->toArray(), iterator_to_array( - (new MemorySortProcessor([ref('id')->asc()]))->process( + new MemorySortProcessor([ref('id')->asc()])->process( (static function (): Generator { yield array_to_rows([['id' => 3]], schema(int_schema('id'))); yield array_to_rows([['id' => 1]], schema(int_schema('id'))); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/MergeSortProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/MergeSortProcessorTest.php index 33eeb43871..2891fb4953 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/MergeSortProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/MergeSortProcessorTest.php @@ -39,11 +39,11 @@ public function test_a_sort_is_ordered_by_its_columns(): void static::assertSame( $columns, - (new MergeSortProcessor( + new MergeSortProcessor( new ExternalSortConfig(config()->grouping), $columns, new NativePHPRandomValueGenerator(), - ))->distribution()?->order, + )->distribution()?->order, ); } @@ -61,22 +61,22 @@ public function test_its_distribution_carries_its_configuration(): void public function test_a_sort_that_does_not_describe_has_no_distribution(): void { static::assertNull( - (new MergeSortProcessor( + new MergeSortProcessor( new ExternalSortConfig(config()->grouping), [ref('id')->asc()], new FixedRandomValueGenerator('fixed'), - ))->distribution(), + )->distribution(), ); } public function test_a_processor_with_an_undescribable_random_value_generator_does_not_describe(): void { static::assertNull( - (new MergeSortProcessor( + new MergeSortProcessor( new ExternalSortConfig(config()->grouping), [ref('id')->asc()], new FixedRandomValueGenerator('fixed'), - ))->describe(), + )->describe(), ); } @@ -86,11 +86,11 @@ public function test_bind_returns_the_input_schema(): void static::assertEquals( $input, - (new MergeSortProcessor( + new MergeSortProcessor( ExternalSortMother::inMemoryConfig(), [ref('id')->asc()], new NativePHPRandomValueGenerator(), - ))->bind($input)->output, + )->bind($input)->output, ); } @@ -102,11 +102,11 @@ public function test_process_sorts_through_the_external_sort(): void array_merge(...array_map( static fn(Rows $rows): array => $rows->reduceToArray('id'), iterator_to_array( - (new MergeSortProcessor( + new MergeSortProcessor( ExternalSortMother::spillingConfig($storage), [ref('id')->asc()], new NativePHPRandomValueGenerator(), - ))->process( + )->process( (static function (): Generator { yield array_to_rows([['id' => 3], ['id' => 1]], schema(int_schema('id'))); yield array_to_rows([['id' => 2]], schema(int_schema('id'))); @@ -127,11 +127,11 @@ public function test_an_empty_stream_sorts_to_nothing(): void static::assertSame( [], iterator_to_array( - (new MergeSortProcessor( + new MergeSortProcessor( ExternalSortMother::spillingConfig($storage), [ref('id')->asc()], new NativePHPRandomValueGenerator(), - ))->process((static fn(): Generator => yield from [])(), flow_context()->backend()), + )->process((static fn(): Generator => yield from [])(), flow_context()->backend()), false, ), ); @@ -183,12 +183,12 @@ public function test_merge_sort_processor_describes_its_progress(): void public function test_merge_sort_processor_is_done_after_its_last_batch(): void { $progress = new ProgressSpy(); - $output = (new MergeSortProcessor( + $output = new MergeSortProcessor( new ExternalSortConfig(config()->grouping), [ref('id')->asc()], new NativePHPRandomValueGenerator(), $progress->stage(StageName::sort), - ))->process( + )->process( (static function (): Generator { yield array_to_rows([['id' => 2], ['id' => 1]], schema(int_schema('id'))); })(), @@ -210,12 +210,12 @@ public function test_its_distribution_holds_the_stage_it_reports_to(): void static::assertSame( $stage, - (new MergeSortProcessor( + new MergeSortProcessor( new ExternalSortConfig(config()->grouping), [ref('id')->desc()], new NativePHPRandomValueGenerator(), $stage, - ))->distribution()?->progress, + )->distribution()?->progress, ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/OffsetProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/OffsetProcessorTest.php index 78cc0d769c..bed817749d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/OffsetProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/OffsetProcessorTest.php @@ -36,7 +36,7 @@ public function test_a_zero_offset_in_a_description_stays_zero(): void public function test_an_offset_equal_to_the_first_batch_skips_that_whole_batch(): void { $result = iterator_to_array( - (new OffsetProcessor(2))->process( + new OffsetProcessor(2)->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); yield array_to_rows([['id' => 3]], schema(int_schema('id'))); @@ -52,7 +52,7 @@ public function test_an_offset_equal_to_the_first_batch_skips_that_whole_batch() public function test_a_zero_offset_yields_every_batch_once(): void { $result = iterator_to_array( - (new OffsetProcessor(0))->process( + new OffsetProcessor(0)->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); })(), @@ -67,7 +67,7 @@ public function test_a_zero_offset_yields_every_batch_once(): void public function test_a_zero_offset_passes_an_empty_batch_through(): void { $result = iterator_to_array( - (new OffsetProcessor(0))->process( + new OffsetProcessor(0)->process( (static function () { yield rows(schema()); })(), @@ -81,8 +81,8 @@ public function test_a_zero_offset_passes_an_empty_batch_through(): void public function test_offset_processor_forwards_stop_to_its_upstream(): void { - $upstream = (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5)))->withBatchSize(1); - $processed = (new OffsetProcessor(1))->process( + $upstream = new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5))->withBatchSize(1); + $processed = new OffsetProcessor(1)->process( FlowTestCase::extracted($upstream, flow_context()->backend(), new Criteria()), flow_context()->backend(), ); @@ -102,7 +102,7 @@ public function test_a_stop_after_the_offset_reaches_the_upstream(): void array_to_rows([['id' => 2]], schema(int_schema('id'))), array_to_rows([['id' => 3]], schema(int_schema('id'))), ); - $processed = (new OffsetProcessor(1))->process($upstream->rows(), flow_context()->backend()); + $processed = new OffsetProcessor(1)->process($upstream->rows(), flow_context()->backend()); static::assertTrue($processed->valid()); @@ -114,7 +114,7 @@ public function test_a_stop_after_the_offset_reaches_the_upstream(): void public function test_an_empty_batch_inside_the_offset_is_skipped(): void { $result = iterator_to_array( - (new OffsetProcessor(2))->process( + new OffsetProcessor(2)->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); yield rows(schema()); @@ -130,7 +130,7 @@ public function test_an_empty_batch_inside_the_offset_is_skipped(): void public function test_an_offset_equal_to_the_rows_yields_no_batch(): void { - $result = iterator_to_array((new OffsetProcessor(3))->process( + $result = iterator_to_array(new OffsetProcessor(3)->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2], ['id' => 3]], schema(int_schema('id'))); })(), @@ -143,7 +143,7 @@ public function test_an_offset_equal_to_the_rows_yields_no_batch(): void public function test_an_offset_inside_the_first_batch_keeps_the_later_batches_whole(): void { $result = iterator_to_array( - (new OffsetProcessor(1))->process( + new OffsetProcessor(1)->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2], ['id' => 3]], schema(int_schema('id'))); yield array_to_rows([['id' => 4], ['id' => 5]], schema(int_schema('id'))); @@ -165,7 +165,7 @@ public function test_an_offset_inside_the_first_batch_keeps_the_later_batches_wh public function test_an_offset_spanning_batches_cuts_the_batch_it_ends_in(): void { $result = iterator_to_array( - (new OffsetProcessor(3))->process( + new OffsetProcessor(3)->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); yield array_to_rows([['id' => 3], ['id' => 4], ['id' => 5]], schema(int_schema('id'))); @@ -188,7 +188,7 @@ public function test_an_offset_spanning_batches_cuts_the_batch_it_ends_in(): voi public function test_an_offset_skips_whole_batches(): void { $result = iterator_to_array( - (new OffsetProcessor(4))->process( + new OffsetProcessor(4)->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); yield array_to_rows([['id' => 3], ['id' => 4]], schema(int_schema('id'))); @@ -206,7 +206,7 @@ public function test_keeps_every_column_of_the_rows_after_the_offset(): void { $schema = schema(int_schema('id'), bool_schema('active')); $result = iterator_to_array( - (new OffsetProcessor(1))->process( + new OffsetProcessor(1)->process( (static function () use ($schema) { yield array_to_rows([ ['id' => 1, 'active' => true], @@ -227,7 +227,7 @@ public function test_keeps_every_column_of_the_rows_after_the_offset(): void public function test_no_input_batches_yield_no_batch(): void { - $result = iterator_to_array((new OffsetProcessor(5))->process( + $result = iterator_to_array(new OffsetProcessor(5)->process( (static function () { yield from []; })(), @@ -241,7 +241,7 @@ public function test_bind_returns_the_input_schema(): void { $input = schema(int_schema('id')); - static::assertEquals($input, (new OffsetProcessor(1))->bind($input)->output); + static::assertEquals($input, new OffsetProcessor(1)->bind($input)->output); } public function test_a_fresh_instance_skips_the_same_offset(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/PivotProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/PivotProcessorTest.php index 42f8c71d19..6f9c72382a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/PivotProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/PivotProcessorTest.php @@ -54,14 +54,14 @@ final class PivotProcessorTest extends FlowTestCase public function test_a_bound_pivot_is_clustered_on_its_keys(): void { $distribution = type_instance_of(PivotProcessor::class) - ->assert((new PivotProcessor( + ->assert(new PivotProcessor( new GroupBy( refs('name'), new Aggregators(sum(ref('id'))), new Pivot(ref('country'), pivot_values('USA')), ), config()->grouping, - ))->bind(schema(str_schema('name'), int_schema('id'), str_schema('country')))->step) + )->bind(schema(str_schema('name'), int_schema('id'), str_schema('country')))->step) ->distribution(); static::assertSame(['name'], $distribution?->keys); @@ -73,14 +73,14 @@ public function test_a_global_pivot_has_no_distribution(): void { static::assertNull( type_instance_of(PivotProcessor::class) - ->assert((new PivotProcessor( + ->assert(new PivotProcessor( new GroupBy( refs(), new Aggregators(sum(ref('id'))), new Pivot(ref('country'), pivot_values('USA')), ), config()->grouping, - ))->bind(schema(int_schema('id'), str_schema('country')))->step) + )->bind(schema(int_schema('id'), str_schema('country')))->step) ->distribution(), ); } @@ -89,14 +89,14 @@ public function test_bind_derives_the_group_by_columns_and_one_nullable_column_p { static::assertEquals( schema(str_schema('date'), float_schema('norbert', nullable: true), float_schema('stloyd', nullable: true)), - (new PivotProcessor( + new PivotProcessor( new GroupBy( refs(ref('date')), new Aggregators(sum(ref('contributions'))), new Pivot(ref('user'), pivot_values('norbert', 'stloyd')), ), config()->grouping, - ))->bind(schema(str_schema('date'), str_schema('user'), int_schema('contributions')))->output, + )->bind(schema(str_schema('date'), str_schema('user'), int_schema('contributions')))->output, ); } @@ -105,28 +105,28 @@ public function test_bind_refuses_a_pivot_value_colliding_with_a_group_by_column $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Pivot value "date" collides with the group-by column of the same name'); - (new PivotProcessor( + new PivotProcessor( new GroupBy( refs(ref('date')), new Aggregators(sum(ref('contributions'))), new Pivot(ref('user'), pivot_values('date')), ), config()->grouping, - ))->bind(schema(str_schema('date'), str_schema('user'), int_schema('contributions'))); + )->bind(schema(str_schema('date'), str_schema('user'), int_schema('contributions'))); } public function test_bind_declares_the_pivot_columns_with_the_resolved_aggregate_type(): void { static::assertEquals( schema(str_schema('date'), int_schema('norbert', nullable: true), int_schema('stloyd', nullable: true)), - (new PivotProcessor( + new PivotProcessor( new GroupBy( refs(ref('date')), new Aggregators(min(ref('contributions'))), new Pivot(ref('user'), pivot_values('norbert', 'stloyd')), ), config()->grouping, - ))->bind(schema(str_schema('date'), str_schema('user'), int_schema('contributions')))->output, + )->bind(schema(str_schema('date'), str_schema('user'), int_schema('contributions')))->output, ); } @@ -150,14 +150,14 @@ public static function pivotAggregates(): Generator #[DataProvider('pivotAggregates')] public function test_bind_resolves_every_pivot_aggregate(AggregatingFunction $aggregate, string $resolvedType): void { - $output = (new PivotProcessor( + $output = new PivotProcessor( new GroupBy( refs(ref('date')), new Aggregators($aggregate), new Pivot(ref('user'), pivot_values('norbert', 'stloyd')), ), config()->grouping, - ))->bind(schema( + )->bind(schema( str_schema('date'), str_schema('user'), int_schema('contributions'), @@ -175,14 +175,14 @@ public function test_bind_resolves_every_pivot_aggregate(AggregatingFunction $ag public function test_a_bound_processor_pivots_grouped_rows(): void { $input = schema(str_schema('date'), str_schema('user'), int_schema('contributions')); - $bound = (new PivotProcessor( + $bound = new PivotProcessor( new GroupBy( refs(ref('date')), new Aggregators(sum(ref('contributions'))), new Pivot(ref('user'), pivot_values('norbert', 'stloyd')), ), config()->grouping, - ))->bind($input); + )->bind($input); static::assertInstanceOf(PivotProcessor::class, $bound->step); @@ -214,14 +214,14 @@ public function test_a_bound_processor_pivots_grouped_rows(): void public function test_pivots_grouped_rows(): void { $result = iterator_to_array( - (new PivotProcessor( + new PivotProcessor( new GroupBy( refs(ref('date')), new Aggregators(sum(ref('contributions'))), new Pivot(ref('user'), pivot_values('norbert', 'stloyd')), ), config()->grouping, - ))->process( + )->process( (static function (): Generator { yield array_to_rows( [ @@ -265,11 +265,11 @@ public function test_a_bound_aggregation_pivots_without_reading_a_schema_from_th $input = schema(str_schema('product'), str_schema('country'), int_schema('amount')); /** @var list $batches */ - $batches = iterator_to_array((new PivotProcessor( + $batches = iterator_to_array(new PivotProcessor( $groupBy, config()->grouping, PivotShape::of($groupBy, $input), - ))->process( + )->process( (static function () use ($input): Generator { yield array_to_rows([['product' => 'Banana', 'country' => 'USA', 'amount' => 30]], $input); yield array_to_rows([['product' => 'Banana', 'country' => 'USA', 'amount' => 10]], $input); @@ -290,11 +290,11 @@ public function test_a_bound_aggregation_over_an_empty_stream_yields_nothing(): static::assertSame( [], - iterator_to_array((new PivotProcessor( + iterator_to_array(new PivotProcessor( $groupBy, config()->grouping, PivotShape::of($groupBy, schema(str_schema('product'), str_schema('country'), int_schema('amount'))), - ))->process((static fn(): Generator => yield from [])(), flow_context(config())->backend())), + )->process((static fn(): Generator => yield from [])(), flow_context(config())->backend())), ); } @@ -310,11 +310,11 @@ public function test_it_splits_the_result_into_batches_of_the_requested_size(): static::assertCount( 2, - iterator_to_array((new PivotProcessor( + iterator_to_array(new PivotProcessor( $groupBy, new BucketingConfig(new MemoryRowsStorage(), 4, 2, Unit::fromMb(64)), PivotShape::of($groupBy, $input), - ))->process( + )->process( (static function () use ($input): Generator { yield array_to_rows([ ['product' => 'Banana', 'country' => 'USA', 'amount' => 1], @@ -364,7 +364,7 @@ public function test_counts_every_row_it_takes_once_and_is_busy_while_it_emits() $input = schema(str_schema('date'), str_schema('user'), int_schema('contributions')); iterator_to_array( - (new PivotProcessor( + new PivotProcessor( new GroupBy( refs(ref('date')), new Aggregators(sum(ref('contributions'))), @@ -372,7 +372,7 @@ public function test_counts_every_row_it_takes_once_and_is_busy_while_it_emits() ), config()->grouping, progress: $progress->stage(StageName::pivot), - ))->process( + )->process( (static function () use ($input): Generator { yield array_to_rows([ ['date' => '2024-01-01', 'user' => 'norbert', 'contributions' => 1], @@ -412,7 +412,7 @@ public function test_pivot_processor_is_done_after_its_last_batch(): void { $progress = new ProgressSpy(); $input = schema(str_schema('date'), str_schema('user'), int_schema('contributions')); - $output = (new PivotProcessor( + $output = new PivotProcessor( new GroupBy( refs(ref('date')), new Aggregators(sum(ref('contributions'))), @@ -420,7 +420,7 @@ public function test_pivot_processor_is_done_after_its_last_batch(): void ), config()->grouping, progress: $progress->stage(StageName::pivot), - ))->process( + )->process( (static function () use ($input): Generator { yield array_to_rows([ ['date' => '2024-01-01', 'user' => 'norbert', 'contributions' => 1], @@ -446,7 +446,7 @@ public function test_its_distribution_holds_the_stage_it_reports_to(): void static::assertSame( $stage, type_instance_of(PivotProcessor::class) - ->assert((new PivotProcessor( + ->assert(new PivotProcessor( new GroupBy( refs('name'), new Aggregators(sum(ref('id'))), @@ -454,7 +454,7 @@ public function test_its_distribution_holds_the_stage_it_reports_to(): void ), config()->grouping, progress: $stage, - ))->bind(schema(str_schema('name'), int_schema('id'), str_schema('country')))->step) + )->bind(schema(str_schema('name'), int_schema('id'), str_schema('country')))->step) ->distribution() ?->progress, ); @@ -464,14 +464,14 @@ public function test_an_unbound_pivot_accumulates_every_batch(): void { $schema = schema(str_schema('date'), str_schema('user'), int_schema('contributions')); $result = iterator_to_array( - (new PivotProcessor( + new PivotProcessor( new GroupBy( refs(ref('date')), new Aggregators(sum(ref('contributions'))), new Pivot(ref('user'), pivot_values('norbert')), ), config()->grouping, - ))->process( + )->process( (static function () use ($schema): Generator { yield array_to_rows([['date' => '2024-01-01', 'user' => 'norbert', 'contributions' => 2]], $schema); yield array_to_rows([['date' => '2024-01-01', 'user' => 'norbert', 'contributions' => 3]], $schema); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/RepartitionProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/RepartitionProcessorTest.php index d1caa806ba..d90687c3bd 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/RepartitionProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/RepartitionProcessorTest.php @@ -46,11 +46,11 @@ final class RepartitionProcessorTest extends FlowTestCase { public function test_a_repartition_is_clustered_on_its_columns(): void { - $distribution = (new RepartitionProcessor( + $distribution = new RepartitionProcessor( refs('country', 'day'), config()->repartition, new NativePHPRandomValueGenerator(), - ))->distribution(); + )->distribution(); static::assertSame(['country', 'day'], $distribution?->keys); static::assertNull($distribution->partial); @@ -59,22 +59,22 @@ public function test_a_repartition_is_clustered_on_its_columns(): void public function test_a_repartition_that_does_not_describe_has_no_distribution(): void { static::assertNull( - (new RepartitionProcessor( + new RepartitionProcessor( refs('id'), config()->repartition, new FixedRandomValueGenerator('fixed'), - ))->distribution(), + )->distribution(), ); } public function test_a_processor_with_an_undescribable_random_value_generator_does_not_describe(): void { static::assertNull( - (new RepartitionProcessor( + new RepartitionProcessor( refs('id'), config()->repartition, new FixedRandomValueGenerator('fixed'), - ))->describe(), + )->describe(), ); } @@ -152,6 +152,27 @@ public function test_past_the_limit_every_row_sharing_a_key_still_arrives_in_one static::assertSame([], $storage->liveBucketIds()); } + public function test_past_the_limit_the_buckets_are_cleared_when_the_consumer_stops_early(): void + { + $storage = new SpyRowsStorage(new MemoryRowsStorage()); + $schema = schema(str_schema('k'), int_schema('v')); + $backend = new ReportedMemoryBackend(0); + $groups = RepartitionProcessorMother::with(refs(ref('k')), $storage, Unit::fromGb(1), 1)->process( + (static function () use ($schema, $backend): Generator { + yield array_to_rows([['k' => 'a', 'v' => 1], ['k' => 'b', 'v' => 2]], $schema); + $backend->reported = Unit::fromGb(2)->inBytes(); + + yield array_to_rows([['k' => 'a', 'v' => 3], ['k' => 'b', 'v' => 4]], $schema); + })(), + $backend, + ); + + $groups->current(); + unset($groups); + + static::assertSame([], $storage->liveBucketIds()); + } + public function test_past_the_limit_the_rows_spread_over_no_more_buckets_than_configured(): void { $storage = new SpyRowsStorage(new MemoryRowsStorage()); @@ -374,14 +395,14 @@ public function test_a_description_without_a_stage_rebuilds_with_the_repartition { $spy = new ProgressSpy(); $normalized = type_array()->assert( - (new RepartitionProcessor(refs('id'), config()->repartition, new NativePHPRandomValueGenerator())) + new RepartitionProcessor(refs('id'), config()->repartition, new NativePHPRandomValueGenerator()) ->describe() ?->normalize(), ); $data = type_array()->assert($normalized['data'] ?? null); unset($data['stage']); - (new Rebuild($spy))->of([...$normalized, 'data' => $data], RepartitionProcessor::class); + new Rebuild($spy)->of([...$normalized, 'data' => $data], RepartitionProcessor::class); static::assertSame(['repartition'], $spy->stages()); } @@ -433,12 +454,12 @@ public function test_repartition_processor_describes_its_progress(): void public function test_repartition_processor_is_done_after_its_last_batch(): void { $progress = new ProgressSpy(); - $output = (new RepartitionProcessor( + $output = new RepartitionProcessor( refs('id'), config()->repartition, new NativePHPRandomValueGenerator(), $progress->stage(StageName::repartition), - ))->process( + )->process( (static function (): Generator { yield array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); })(), @@ -460,12 +481,12 @@ public function test_its_distribution_holds_the_stage_it_reports_to(): void static::assertSame( $stage, - (new RepartitionProcessor( + new RepartitionProcessor( refs('country', 'day'), config()->repartition, new NativePHPRandomValueGenerator(), $stage, - ))->distribution()?->progress, + )->distribution()?->progress, ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/TopNProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/TopNProcessorTest.php index 8fb2b6ea78..68e7ec2004 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/TopNProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/TopNProcessorTest.php @@ -66,24 +66,24 @@ public function test_a_top_n_meets_in_one_process_after_every_split_keeps_its_ow public function test_a_top_n_that_does_not_describe_has_no_distribution(): void { static::assertNull( - (new TopNProcessor( + new TopNProcessor( [ref('id')->asc()], 2, new ExternalSortConfig(config()->grouping), new FixedRandomValueGenerator('fixed'), - ))->distribution(), + )->distribution(), ); } public function test_a_processor_with_an_undescribable_random_value_generator_does_not_describe(): void { static::assertNull( - (new TopNProcessor( + new TopNProcessor( [ref('id')->asc()], 2, new ExternalSortConfig(config()->grouping), new FixedRandomValueGenerator('fixed'), - ))->describe(), + )->describe(), ); } @@ -99,12 +99,12 @@ public function test_under_the_memory_limit_it_trims_in_memory_with_zero_spills( $storage = new RecordingRowsStorage(new MemoryRowsStorage()); static::assertSame( [['score' => 0, 'name' => 'z'], ['score' => 1, 'name' => 'a']], - ScoredRows::merged((new TopNProcessor( + ScoredRows::merged(new TopNProcessor( [ref('score')->asc()], 2, ExternalSortMother::inMemoryConfig($storage), new NativePHPRandomValueGenerator(), - ))->process(ScoredRows::batches([[3, 'c'], [1, 'a']], [[2, 'b'], [0, 'z']]), flow_context()->backend())), + )->process(ScoredRows::batches([[3, 'c'], [1, 'a']], [[2, 'b'], [0, 'z']]), flow_context()->backend())), ); static::assertSame([], $storage->appended); } @@ -114,12 +114,12 @@ public function test_past_the_memory_limit_it_falls_back_to_the_spilling_sort(): $storage = new RecordingRowsStorage(new MemoryRowsStorage()); static::assertSame( [['score' => 0, 'name' => 'z'], ['score' => 1, 'name' => 'a']], - ScoredRows::merged((new TopNProcessor( + ScoredRows::merged(new TopNProcessor( [ref('score')->asc()], 2, ExternalSortMother::spillingConfig($storage), new NativePHPRandomValueGenerator(), - ))->process( + )->process( ScoredRows::batches([[3, 'c'], [1, 'a']], [[2, 'b'], [0, 'z']], [[1, 'y']]), flow_context()->backend(), )), @@ -131,13 +131,13 @@ public function test_a_fallback_counts_every_row_it_takes_once(): void { $progress = new ProgressSpy(); - ScoredRows::merged((new TopNProcessor( + ScoredRows::merged(new TopNProcessor( [ref('score')->asc()], 2, ExternalSortMother::spillingConfig(), new NativePHPRandomValueGenerator(), progress: $progress->stage(StageName::sort), - ))->process( + )->process( ScoredRows::batches([[3, 'c'], [1, 'a']], [[2, 'b'], [0, 'z']], [[1, 'y']]), flow_context()->backend(), )); @@ -157,12 +157,12 @@ public function test_fallback_sort_counts_the_rows_top_n_already_holds(): void static::assertSame( [['score' => 0, 'name' => 'z'], ['score' => 1, 'name' => 'a']], - ScoredRows::merged((new TopNProcessor( + ScoredRows::merged(new TopNProcessor( [ref('score')->asc()], 2, ExternalSortMother::config($storage, Unit::fromBytes(1_000_000_000)), new NativePHPRandomValueGenerator(), - ))->process( + )->process( (static function () use ($backend, $schema): Generator { // every batch is held for the rest of the run foreach ([[[5, 'e'], [4, 'd']], [[3, 'c'], [2, 'b']], [[1, 'a'], [0, 'z']]] as $batch) { @@ -191,12 +191,12 @@ public function test_a_fallback_on_the_last_batch_emits_the_kept_rows(): void { static::assertSame( [['score' => 1, 'name' => 'a']], - ScoredRows::merged((new TopNProcessor( + ScoredRows::merged(new TopNProcessor( [ref('score')->asc()], 1, ExternalSortMother::spillingConfig(), new NativePHPRandomValueGenerator(), - ))->process(ScoredRows::batches([[3, 'c'], [1, 'a']]), flow_context()->backend())), + )->process(ScoredRows::batches([[3, 'c'], [1, 'a']]), flow_context()->backend())), ); } @@ -214,12 +214,12 @@ public function test_the_fallback_equals_a_sort_followed_by_a_limit(int $seed): $top = rows($dataset['schema']); $storage = new RecordingRowsStorage(new MemoryRowsStorage()); - foreach ((new TopNProcessor( + foreach (new TopNProcessor( $dataset['columns'], $limit, ExternalSortMother::spillingConfig($storage, mergeFanIn: 2), new NativePHPRandomValueGenerator(), - ))->process($input, flow_context()->backend()) as $batch) { + )->process($input, flow_context()->backend()) as $batch) { $top = Rows::concat( $top->schema(), new AdaptiveBackend(), @@ -247,12 +247,12 @@ public function test_the_fallback_equals_a_sort_followed_by_a_limit(int $seed): public function test_bind_keeps_the_config(): void { $config = ExternalSortMother::inMemoryConfig(); - $bound = (new TopNProcessor( + $bound = new TopNProcessor( [ref('score')->asc()], 3, $config, new NativePHPRandomValueGenerator(), - ))->bind(schema(int_schema('score')))->step; + )->bind(schema(int_schema('score')))->step; static::assertInstanceOf(TopNProcessor::class, $bound); static::assertSame($config, $bound->config); @@ -270,16 +270,16 @@ public function test_it_emits_exactly_what_a_sort_followed_by_a_limit_emits(): v static::assertSame( array_slice( - ScoredRows::merged((new MemorySortProcessor($columns))->process($batches(), flow_context()->backend())), + ScoredRows::merged(new MemorySortProcessor($columns)->process($batches(), flow_context()->backend())), 0, 4, ), - ScoredRows::merged((new TopNProcessor( + ScoredRows::merged(new TopNProcessor( $columns, 4, new MemorySortConfig(), new NativePHPRandomValueGenerator(), - ))->process($batches(), flow_context()->backend())), + )->process($batches(), flow_context()->backend())), ); } @@ -288,12 +288,12 @@ public function test_ties_keep_the_order_they_arrived_in(): void static::assertSame( ['first', 'second', 'third'], array_column( - ScoredRows::merged((new TopNProcessor( + ScoredRows::merged(new TopNProcessor( [ref('score')->asc()], 3, new MemorySortConfig(), new NativePHPRandomValueGenerator(), - ))->process( + )->process( ScoredRows::batches([[1, 'first'], [1, 'second']], [[1, 'third'], [1, 'fourth']]), flow_context()->backend(), )), @@ -306,12 +306,12 @@ public function test_it_keeps_every_row_when_the_input_is_shorter_than_the_limit { static::assertSame( [['score' => 1, 'name' => 'a'], ['score' => 2, 'name' => 'b']], - ScoredRows::merged((new TopNProcessor( + ScoredRows::merged(new TopNProcessor( [ref('score')->asc()], 10, new MemorySortConfig(), new NativePHPRandomValueGenerator(), - ))->process(ScoredRows::batches([ + )->process(ScoredRows::batches([ [2, 'b'], [1, 'a'], ]), flow_context()->backend())), @@ -329,12 +329,12 @@ public function test_it_trims_while_reading_many_batches(): void static::assertSame( [1, 2], array_column( - ScoredRows::merged((new TopNProcessor( + ScoredRows::merged(new TopNProcessor( [ref('score')->asc()], 2, new MemorySortConfig(), new NativePHPRandomValueGenerator(), - ))->process(ScoredRows::batches(...$input), flow_context()->backend())), + )->process(ScoredRows::batches(...$input), flow_context()->backend())), 'score', ), ); @@ -344,12 +344,12 @@ public function test_an_empty_input_emits_nothing(): void { static::assertSame( [], - iterator_to_array((new TopNProcessor( + iterator_to_array(new TopNProcessor( [ref('score')->asc()], 3, new MemorySortConfig(), new NativePHPRandomValueGenerator(), - ))->process(ScoredRows::batches(), flow_context()->backend())), + )->process(ScoredRows::batches(), flow_context()->backend())), ); } @@ -357,12 +357,12 @@ public function test_an_empty_input_with_a_spilling_fallback_emits_nothing(): vo { static::assertSame( [], - iterator_to_array((new TopNProcessor( + iterator_to_array(new TopNProcessor( [ref('score')->asc()], 3, ExternalSortMother::spillingConfig(), new NativePHPRandomValueGenerator(), - ))->process(ScoredRows::batches(), flow_context()->backend())), + )->process(ScoredRows::batches(), flow_context()->backend())), ); } @@ -372,23 +372,23 @@ public function test_bind_keeps_the_input_schema_as_output(): void static::assertSame( $schema, - (new TopNProcessor( + new TopNProcessor( [ref('score')->asc()], 3, new MemorySortConfig(), new NativePHPRandomValueGenerator(), - ))->bind($schema)->output, + )->bind($schema)->output, ); } public function test_a_description_whose_config_is_no_sort_config_is_refused(): void { - $described = (new TopNProcessor( + $described = new TopNProcessor( [ref('id')->asc()], 2, new MemorySortConfig(), new NativePHPRandomValueGenerator(), - ))->describe(); + )->describe(); static::assertNotNull($described); $data = type_array()->assert(Json::decode(Json::encode($described->normalize()))['data'] ?? null); @@ -410,12 +410,12 @@ public function test_top_sorts_and_keeps_the_limit(): void { static::assertSame( [['score' => 9, 'name' => 'a'], ['score' => 7, 'name' => 'b']], - (new TopNProcessor( + new TopNProcessor( [ref('score')->desc()], 2, new MemorySortConfig(), new NativePHPRandomValueGenerator(), - ))->top( + )->top( array_to_rows( [['score' => 3, 'name' => 'c'], ['score' => 9, 'name' => 'a'], ['score' => 7, 'name' => 'b']], schema(int_schema('score'), str_schema('name')), @@ -428,12 +428,12 @@ public function test_top_sorts_and_keeps_the_limit(): void public function test_batches_are_conformed_to_the_declared_schema(): void { $declared = schema(int_schema('score', nullable: true), str_schema('name')); - $bound = (new TopNProcessor( + $bound = new TopNProcessor( [ref('score')->asc()], 5, new MemorySortConfig(), new NativePHPRandomValueGenerator(), - ))->bind($declared)->step; + )->bind($declared)->step; static::assertInstanceOf(TopNProcessor::class, $bound); $out = iterator_to_array( @@ -476,13 +476,13 @@ public function test_a_bound_top_n_counts_with_its_progress(): void $progress = new ProgressSpy(); iterator_to_array( - (new TopNProcessor( + new TopNProcessor( [ref('id')->asc()], 2, new MemorySortConfig(), new NativePHPRandomValueGenerator(), progress: $progress->stage(StageName::sort), - )) + ) ->bind(schema(int_schema('id'))) ->step->process( (static function (): Generator { @@ -501,13 +501,13 @@ public function test_counts_every_row_it_takes_once(): void $progress = new ProgressSpy(); iterator_to_array( - (new TopNProcessor( + new TopNProcessor( [ref('id')->asc()], 2, new MemorySortConfig(), new NativePHPRandomValueGenerator(), progress: $progress->stage(StageName::sort), - ))->process( + )->process( (static function (): Generator { yield array_to_rows([['id' => 4], ['id' => 3]], schema(int_schema('id'))); yield array_to_rows([['id' => 2], ['id' => 1]], schema(int_schema('id'))); @@ -541,13 +541,13 @@ public function test_top_n_processor_describes_its_progress(): void public function test_top_n_processor_is_done_after_its_last_batch(): void { $progress = new ProgressSpy(); - $output = (new TopNProcessor( + $output = new TopNProcessor( [ref('id')->asc()], 2, new MemorySortConfig(), new NativePHPRandomValueGenerator(), progress: $progress->stage(StageName::sort), - ))->process( + )->process( (static function (): Generator { yield array_to_rows([['id' => 3], ['id' => 1], ['id' => 2]], schema(int_schema('id'))); })(), @@ -569,13 +569,13 @@ public function test_its_distribution_holds_the_stage_it_reports_to(): void static::assertSame( $stage, - (new TopNProcessor( + new TopNProcessor( [ref('id')->desc()], 2, new MemorySortConfig(), new NativePHPRandomValueGenerator(), progress: $stage, - ))->distribution()?->progress, + )->distribution()?->progress, ); } @@ -583,13 +583,13 @@ public function test_a_top_n_that_falls_back_to_the_spilling_sort_is_done_once() { $progress = new ProgressSpy(); - ScoredRows::merged((new TopNProcessor( + ScoredRows::merged(new TopNProcessor( [ref('score')->asc()], 2, ExternalSortMother::spillingConfig(), new NativePHPRandomValueGenerator(), progress: $progress->stage(StageName::sort), - ))->process( + )->process( ScoredRows::batches([[3, 'c'], [1, 'a']], [[2, 'b'], [0, 'z']], [[1, 'y']]), flow_context()->backend(), )); @@ -602,13 +602,13 @@ public function test_a_top_n_over_an_empty_input_is_done_once(): void $progress = new ProgressSpy(); iterator_to_array( - (new TopNProcessor( + new TopNProcessor( [ref('id')->asc()], 2, new MemorySortConfig(), new NativePHPRandomValueGenerator(), progress: $progress->stage(StageName::sort), - ))->process( + )->process( (static function (): Generator { yield from []; })(), @@ -625,13 +625,13 @@ public function test_a_top_n_is_busy_for_each_batch_it_emits(): void $progress = new ProgressSpy(); $emitted = iterator_to_array( - (new TopNProcessor( + new TopNProcessor( [ref('id')->asc()], 2, new MemorySortConfig(), new NativePHPRandomValueGenerator(), progress: $progress->stage(StageName::sort), - ))->process( + )->process( (static function (): Generator { yield array_to_rows([['id' => 3], ['id' => 1], ['id' => 2]], schema(int_schema('id'))); })(), @@ -650,12 +650,12 @@ public function test_top_n_batches_are_no_larger_than_the_largest_input_batch(): array_map( static fn(Rows $batch): array => $batch->toArray(), iterator_to_array( - (new TopNProcessor( + new TopNProcessor( [ref('id')->asc()], 2, new MemorySortConfig(), new NativePHPRandomValueGenerator(), - ))->process( + )->process( (static function (): Generator { yield array_to_rows([['id' => 3]], schema(int_schema('id'))); yield array_to_rows([['id' => 1]], schema(int_schema('id'))); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/VoidProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/VoidProcessorTest.php index bc5b2063ae..6c59a16e90 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/VoidProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/VoidProcessorTest.php @@ -22,7 +22,7 @@ public function test_a_zero_batch_input_yields_the_declared_schema(): void $declared = schema(int_schema('id')); /** @var list $result */ - $result = iterator_to_array((new VoidProcessor($declared))->process( + $result = iterator_to_array(new VoidProcessor($declared)->process( (static function () { yield from []; })(), @@ -36,7 +36,7 @@ public function test_a_zero_batch_input_yields_the_declared_schema(): void public function test_bind_returns_the_input_schema_and_declares_it_on_the_rebound_step(): void { $input = schema(int_schema('id'), str_schema('name')); - $bound = (new VoidProcessor())->bind($input); + $bound = new VoidProcessor()->bind($input); static::assertEquals($input, $bound->output); static::assertEquals(new VoidProcessor($input), $bound->step); @@ -45,7 +45,7 @@ public function test_bind_returns_the_input_schema_and_declares_it_on_the_reboun public function test_discards_all_rows_and_yields_empty_batch(): void { /** @var list $result */ - $result = iterator_to_array((new VoidProcessor())->process( + $result = iterator_to_array(new VoidProcessor()->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); yield array_to_rows([['id' => 3], ['id' => 4]], schema(int_schema('id'))); @@ -60,7 +60,7 @@ public function test_discards_all_rows_and_yields_empty_batch(): void public function test_it_drains_every_batch_of_its_input(): void { $drained = 0; - iterator_to_array((new VoidProcessor())->process( + iterator_to_array(new VoidProcessor()->process( (static function () use (&$drained) { yield array_to_rows([['id' => 1]], schema(int_schema('id'))); $drained++; @@ -76,13 +76,13 @@ public function test_it_drains_every_batch_of_its_input(): void public function test_a_processor_without_a_declared_schema_describes_a_null_schema(): void { static::assertEquals(VoidProcessor::fromDescription(['declared' => null], new Rebuild()), new VoidProcessor()); - static::assertSame(['declared' => null], (new VoidProcessor())->describe()?->normalize()['data'] ?? null); + static::assertSame(['declared' => null], new VoidProcessor()->describe()?->normalize()['data'] ?? null); } public function test_handles_empty_input(): void { /** @var list $result */ - $result = iterator_to_array((new VoidProcessor())->process( + $result = iterator_to_array(new VoidProcessor()->process( (static function () { yield from []; })(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/WindowProcessorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/WindowProcessorTest.php index 60d9df6090..5889fbd3d6 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/WindowProcessorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Processor/WindowProcessorTest.php @@ -52,7 +52,7 @@ public function test_bind_replaces_an_input_column_named_like_the_window_column( { static::assertEquals( schema(int_schema('n'), int_schema('rank')), - (new WindowProcessor('rank', rank()->over(window()->orderBy(ref('n')))))->bind(schema( + new WindowProcessor('rank', rank()->over(window()->orderBy(ref('n'))))->bind(schema( int_schema('n'), str_schema('rank'), ))->output, @@ -63,7 +63,7 @@ public function test_bind_adds_the_window_function_column(): void { static::assertEquals( schema(str_schema('group'), int_schema('value'), int_schema('rn')), - (new WindowProcessor('rn', row_number()->over(window()->partitionBy(ref('group')))))->bind(schema( + new WindowProcessor('rn', row_number()->over(window()->partitionBy(ref('group'))))->bind(schema( str_schema('group'), int_schema('value'), ))->output, @@ -74,7 +74,7 @@ public function test_bind_refuses_a_partition_column_missing_from_the_input(): v { $this->expectException(SchemaDefinitionNotFoundException::class); - (new WindowProcessor('rn', row_number()->over(window()->partitionBy(ref('missing')))))->bind(schema(int_schema( + new WindowProcessor('rn', row_number()->over(window()->partitionBy(ref('missing'))))->bind(schema(int_schema( 'value', ))); } @@ -268,10 +268,10 @@ public function test_whole_partition_frame_gives_every_row_the_partition_total() public function test_applies_window_function(): void { /** @var list $result */ - $result = iterator_to_array((new WindowProcessor( + $result = iterator_to_array(new WindowProcessor( 'rank', rank()->over(window()->partitionBy(ref('category'))->orderBy(ref('amount')->desc())), - ))->process( + )->process( (static function () { yield array_to_rows( [ @@ -301,7 +301,7 @@ public function test_handles_empty_input(): void { static::assertCount( 0, - iterator_to_array((new WindowProcessor('rank', rank()->over(window()->orderBy(ref('amount')))))->process( + iterator_to_array(new WindowProcessor('rank', rank()->over(window()->orderBy(ref('amount'))))->process( (static function () { yield from []; })(), @@ -313,10 +313,10 @@ public function test_handles_empty_input(): void public function test_handles_single_partition(): void { /** @var list $result */ - $result = iterator_to_array((new WindowProcessor( + $result = iterator_to_array(new WindowProcessor( 'rank', rank()->over(window()->orderBy(ref('amount')->desc())), - ))->process( + )->process( (static function () { yield array_to_rows([ ['amount' => 300], @@ -397,10 +397,10 @@ public function test_a_running_sum_over_mixed_numerics_yields_one_definition(): public function test_processes_multiple_partitions(): void { /** @var list $result */ - $result = iterator_to_array((new WindowProcessor( + $result = iterator_to_array(new WindowProcessor( 'rank', rank()->over(window()->partitionBy(ref('group'))->orderBy(ref('value'))), - ))->process( + )->process( (static function () { yield array_to_rows( [ @@ -434,7 +434,7 @@ public function test_processes_multiple_partitions(): void public function test_a_leading_empty_batch_is_yielded_under_the_bound_schema(): void { $batches = iterator_to_array( - (new WindowProcessor('row_number', row_number()->over(window()->orderBy(ref('value')))))->process( + new WindowProcessor('row_number', row_number()->over(window()->orderBy(ref('value'))))->process( (static function () { yield rows(schema(int_schema('value'))); yield array_to_rows([['value' => 10], ['value' => 20]], schema(int_schema('value'))); @@ -459,10 +459,10 @@ public function test_each_input_batch_is_a_partition_of_its_own(): void { $schema = schema(str_schema('dept'), int_schema('salary')); $result = iterator_to_array( - (new WindowProcessor( + new WindowProcessor( 'row_num', row_number()->over(window()->partitionBy(ref('dept'))->orderBy(ref('salary'))), - ))->process( + )->process( (static function () use ($schema) { yield array_to_rows([ ['dept' => 'IT', 'salary' => 5000], @@ -483,7 +483,7 @@ public function test_each_input_batch_is_a_partition_of_its_own(): void public function test_row_number_counts_the_rows_in_order_without_a_partition(): void { $result = iterator_to_array( - (new WindowProcessor('row_num', row_number()->over(window()->orderBy(ref('id')))))->process( + new WindowProcessor('row_num', row_number()->over(window()->orderBy(ref('id'))))->process( (static function () { yield array_to_rows([['id' => 1], ['id' => 2], ['id' => 3]], schema(int_schema('id'))); })(), @@ -503,10 +503,10 @@ public function test_row_number_counts_the_rows_in_order_without_a_partition(): public function test_rows_come_out_sorted_by_the_order_by(): void { $result = iterator_to_array( - (new WindowProcessor( + new WindowProcessor( 'row_num', row_number()->over(window()->partitionBy(ref('dept'))->orderBy(ref('salary'))), - ))->process( + )->process( (static function () { yield array_to_rows( [ @@ -543,12 +543,12 @@ public function test_bind_refuses_an_expand_in_the_window_function(): void 'over() cannot contain array_expand(), it turns one row into many rows. Expand with withColumn() first, then use the new column.', ); - (new WindowProcessor( + new WindowProcessor( 's', - (new WindowFunctionOverOperand(ref('flags')->expand()->equals(lit(true))))->over(window()->partitionBy(ref( + new WindowFunctionOverOperand(ref('flags')->expand()->equals(lit(true)))->over(window()->partitionBy(ref( 'n', ))), - ))->bind(ListColumnsMother::numberAndFlagsSchema()); + )->bind(ListColumnsMother::numberAndFlagsSchema()); } public function test_rebuilds_with_the_rebuild_progress(): void @@ -577,11 +577,11 @@ public function test_a_bound_window_counts_with_its_progress(): void $progress = new ProgressSpy(); iterator_to_array( - (new WindowProcessor( + new WindowProcessor( 'rank', rank()->over(window()->orderBy(ref('n'))), progress: $progress->stage(StageName::window), - )) + ) ->bind(schema(int_schema('n'))) ->step->process( (static function (): Generator { @@ -614,11 +614,11 @@ public function test_window_processor_describes_its_progress(): void public function test_window_processor_is_done_after_its_last_batch(): void { $progress = new ProgressSpy(); - $output = (new WindowProcessor( + $output = new WindowProcessor( 'rank', rank()->over(window()->orderBy(ref('n'))), progress: $progress->stage(StageName::window), - ))->process( + )->process( (static function (): Generator { yield array_to_rows([['n' => 2], ['n' => 1]], schema(int_schema('n'))); })(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/AddRowIndexTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/AddRowIndexTransformerTest.php index e4403c3922..302b477513 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/AddRowIndexTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/AddRowIndexTransformerTest.php @@ -25,7 +25,7 @@ public function test_an_index_column_colliding_with_an_existing_column_is_reject $this->expectException(SchemaDefinitionNotUniqueException::class); $this->expectExceptionMessage('Column definitions must be unique, duplicated columns: [id]'); - (new AddRowIndexTransformer('id', StartFrom::ZERO))->transform(array_to_rows([[ + new AddRowIndexTransformer('id', StartFrom::ZERO)->transform(array_to_rows([[ 'id' => 1, ]], schema(int_schema('id'))), flow_context()->backend()); } @@ -34,7 +34,7 @@ public function test_bind_adds_an_int_index_column(): void { static::assertEquals( schema(int_schema('id'), int_schema('idx')), - (new AddRowIndexTransformer('idx', StartFrom::ZERO))->bind(schema(int_schema('id')))->output, + new AddRowIndexTransformer('idx', StartFrom::ZERO)->bind(schema(int_schema('id')))->output, ); } @@ -90,7 +90,7 @@ public function test_index_starting_from_one(): void { static::assertSame( [['id' => 1, 'idx' => 1]], - (new AddRowIndexTransformer('idx', StartFrom::ONE)) + new AddRowIndexTransformer('idx', StartFrom::ONE) ->transform(array_to_rows([['id' => 1]], schema(int_schema('id'))), flow_context()->backend()) ->toArray(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/CollectReferencesTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/CollectReferencesTransformerTest.php index d72f8f0f05..8889054d01 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/CollectReferencesTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/CollectReferencesTransformerTest.php @@ -24,7 +24,7 @@ public function test_bind_returns_the_input_schema(): void { $input = schema(int_schema('id'), str_schema('name')); - static::assertEquals($input, (new CollectReferencesTransformer(refs()))->bind($input)->output); + static::assertEquals($input, new CollectReferencesTransformer(refs())->bind($input)->output); } public function test_collecting_references_from_the_batch_schema(): void @@ -32,7 +32,7 @@ public function test_collecting_references_from_the_batch_schema(): void $references = refs(); $batch = array_to_rows([['id' => 1, 'name' => 'John']], schema(int_schema('id'), str_schema('name'))); - static::assertSame($batch, (new CollectReferencesTransformer($references))->transform( + static::assertSame($batch, new CollectReferencesTransformer($references)->transform( $batch, flow_context()->backend(), )); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/DerivedColumnsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/DerivedColumnsTest.php index ba51119476..468ed5ba06 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/DerivedColumnsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/DerivedColumnsTest.php @@ -26,7 +26,7 @@ public function test_stored_adopts_a_column_of_the_same_type(): void static::assertSame( [1, 2], - (new DerivedColumns()) + new DerivedColumns() ->stored(int_schema('a'), $column, $backend) ->values(), ); @@ -37,7 +37,7 @@ public function test_stored_rebuilds_a_column_of_another_type(): void { static::assertSame( [5, 6], - (new DerivedColumns()) + new DerivedColumns() ->stored(int_schema('a'), ColumnMother::of(str_schema('a'), ['5', '6']), new PhpBackend()) ->values(), ); @@ -47,7 +47,7 @@ public function test_stored_rebuilds_an_untyped_column(): void { static::assertSame( [5, null], - (new DerivedColumns()) + new DerivedColumns() ->stored(int_schema('a', nullable: true), new ValueColumn(['5', null]), new PhpBackend()) ->values(), ); @@ -57,7 +57,7 @@ public function test_stored_keeps_null_under_a_nullable_definition(): void { static::assertSame( [null], - (new DerivedColumns()) + new DerivedColumns() ->stored( int_schema('a', nullable: true), ColumnMother::of(int_schema('a', nullable: true), [null]), @@ -74,7 +74,7 @@ public function test_stored_names_the_row_of_a_null_under_a_not_null_definition( 'Rows do not match their schema: column "a" (row 3): could not convert null to integer, column is not nullable', ); - (new DerivedColumns())->stored(int_schema('a'), ColumnMother::of(int_schema('a', nullable: true), [ + new DerivedColumns()->stored(int_schema('a'), ColumnMother::of(int_schema('a', nullable: true), [ 1, 2, 3, @@ -88,13 +88,13 @@ public function test_rows_adds_the_derived_column_under_the_output_schema(): voi static::assertSame( [['a' => 1, 'note' => 'x']], - (new DerivedColumns()) + new DerivedColumns() ->rows( array_to_rows([['a' => 1]], schema(int_schema('a'))), $output, $output, 'note', - (new PhpBackend())->constant(str_schema('note', nullable: true), 'x', 1), + new PhpBackend()->constant(str_schema('note', nullable: true), 'x', 1), new PhpBackend(), ) ->toArray(), @@ -107,13 +107,13 @@ public function test_rows_matches_a_batch_declared_under_another_schema(): void static::assertSame( [['a' => 1, 'note' => 'x', 'extra' => null]], - (new DerivedColumns()) + new DerivedColumns() ->rows( array_to_rows([['a' => 1]], schema(int_schema('a'))), $declared, $declared->add(str_schema('extra', nullable: true)), 'note', - (new PhpBackend())->constant(str_schema('note', nullable: true), 'x', 1), + new PhpBackend()->constant(str_schema('note', nullable: true), 'x', 1), new PhpBackend(), ) ->toArray(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/DropColumnsTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/DropColumnsTransformerTest.php index 91b59aa56b..a8aac6c3bb 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/DropColumnsTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/DropColumnsTransformerTest.php @@ -25,14 +25,14 @@ public function test_bind_ignores_a_column_missing_from_the_input(): void { $input = schema(int_schema('id')); - static::assertEquals($input, (new DropColumnsTransformer('not_existing'))->bind($input)->output); + static::assertEquals($input, new DropColumnsTransformer('not_existing')->bind($input)->output); } public function test_bind_removes_the_dropped_columns(): void { static::assertEquals( schema(string_schema('name')), - (new DropColumnsTransformer('id', 'array'))->bind(schema( + new DropColumnsTransformer('id', 'array')->bind(schema( int_schema('id'), string_schema('name'), json_schema('array'), @@ -46,7 +46,7 @@ public function test_dropping_entries(): void [ ['name' => 'Row Name'], ], - (new DropColumnsTransformer('id', 'array')) + new DropColumnsTransformer('id', 'array') ->transform( array_to_rows( [['id' => 1, 'name' => 'Row Name', 'array' => type_json()->cast(['test'])]], @@ -64,7 +64,7 @@ public function test_removing_not_existing_entries(): void [ ['id' => 1, 'name' => 'Row Name', 'array' => ['test']], ], - (new DropColumnsTransformer('not_existing')) + new DropColumnsTransformer('not_existing') ->transform( array_to_rows( [['id' => 1, 'name' => 'Row Name', 'array' => type_json()->cast(['test'])]], diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/DuplicateRowTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/DuplicateRowTransformerTest.php index e08ff99c57..1135ef52e4 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/DuplicateRowTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/DuplicateRowTransformerTest.php @@ -34,10 +34,10 @@ public function test_bind_widens_a_column_an_entry_overwrites_with_another_type( { static::assertEquals( schema(float_schema('amount')), - (new DuplicateRowTransformer(lit(true), [new ScalarFunctionTransformer( + new DuplicateRowTransformer(lit(true), [new ScalarFunctionTransformer( 'amount', lit(1.5), - )]))->bind(schema(int_schema('amount')))->output, + )])->bind(schema(int_schema('amount')))->output, ); } @@ -48,17 +48,17 @@ public function test_bind_refuses_an_entry_without_a_common_type_with_the_column 'Cannot combine types "integer", "list" - an explicit cast is required.', ); - (new DuplicateRowTransformer(lit(true), [new ScalarFunctionTransformer( + new DuplicateRowTransformer(lit(true), [new ScalarFunctionTransformer( 'amount', lit([1, 2]), - )]))->bind(schema(int_schema('amount'))); + )])->bind(schema(int_schema('amount'))); } public function test_a_null_condition_does_not_duplicate_the_row(): void { static::assertSame( [['id' => 1, 'dup' => null]], - (new DuplicateRowTransformer(ref('dup'), [new ScalarFunctionTransformer('id', lit(9))])) + new DuplicateRowTransformer(ref('dup'), [new ScalarFunctionTransformer('id', lit(9))]) ->transform( array_to_rows( [['id' => 1, 'dup' => null]], @@ -79,7 +79,7 @@ public function test_a_literal_condition_duplicates_every_row(): void ['id' => 2, 'flag' => null], ['id' => 2, 'flag' => true], ], - (new DuplicateRowTransformer(true, [new ScalarFunctionTransformer('flag', lit(true))])) + new DuplicateRowTransformer(true, [new ScalarFunctionTransformer('flag', lit(true))]) ->transform(array_to_rows([ ['id' => 1], ['id' => 2], @@ -90,10 +90,10 @@ public function test_a_literal_condition_duplicates_every_row(): void public function test_a_transformation_that_adds_a_column_conforms_the_untouched_rows(): void { - $transformed = (new DuplicateRowTransformer( + $transformed = new DuplicateRowTransformer( ref('status')->equals(lit('inactive')), [new ScalarFunctionTransformer('flag', lit(true))], - ))->transform( + )->transform( array_to_rows( [['id' => 1, 'status' => 'active'], ['id' => 2, 'status' => 'inactive']], schema(int_schema('id'), string_schema('status')), @@ -117,10 +117,10 @@ public function test_a_transformation_that_narrows_a_column_widens_it_back(): vo // Multiply::returns() strips nullability, so the duplicated batch declares a narrower column than // the source; the emitted batch must describe both. static::assertTrue( - (new DuplicateRowTransformer(ref('status')->equals(lit('inactive')), [new ScalarFunctionTransformer( + new DuplicateRowTransformer(ref('status')->equals(lit('inactive')), [new ScalarFunctionTransformer( 'amount', ref('amount')->multiply(lit(-1)), - )])) + )]) ->transform( array_to_rows( [ @@ -173,10 +173,10 @@ public function test_applying_two_transformations(): void ), ); - $transformedRows = (new DuplicateRowTransformer(ref('status')->equals(lit('inactive')), [ + $transformedRows = new DuplicateRowTransformer(ref('status')->equals(lit('inactive')), [ new ScalarFunctionTransformer('amount', ref('amount')->multiply(lit(-1))), new ScalarFunctionTransformer('date_updated', ref('date_deactivated')), - ]))->transform($rows, flow_context()->backend()); + ])->transform($rows, flow_context()->backend()); static::assertCount(4, $transformedRows); @@ -223,10 +223,10 @@ public function test_bind_declares_a_column_added_only_to_the_matched_rows_as_nu { static::assertEquals( schema(int_schema('id'), string_schema('status'), bool_schema('flag', nullable: true)), - (new DuplicateRowTransformer(ref('status')->equals(lit('inactive')), [new ScalarFunctionTransformer( + new DuplicateRowTransformer(ref('status')->equals(lit('inactive')), [new ScalarFunctionTransformer( 'flag', lit(true), - )]))->bind(schema(int_schema('id'), string_schema('status')))->output, + )])->bind(schema(int_schema('id'), string_schema('status')))->output, ); } @@ -234,18 +234,18 @@ public function test_bind_refuses_a_condition_referencing_a_column_missing_from_ { $this->expectException(SchemaDefinitionNotFoundException::class); - (new DuplicateRowTransformer(ref('missing')->equals(lit('x')), [new ScalarFunctionTransformer( + new DuplicateRowTransformer(ref('missing')->equals(lit('x')), [new ScalarFunctionTransformer( 'flag', lit(true), - )]))->bind(schema(int_schema('id'))); + )])->bind(schema(int_schema('id'))); } public function test_doing_nothing_when_condition_is_not_satisfied(): void { - $transformedRows = (new DuplicateRowTransformer( + $transformedRows = new DuplicateRowTransformer( ref('status')->equals(lit('inactive')), [new ScalarFunctionTransformer('amount', ref('amount')->multiply(lit(-1)))], - ))->transform( + )->transform( array_to_rows( [ ['id' => 1, 'status' => 'active', 'amount' => 100], @@ -271,10 +271,10 @@ public function test_doing_nothing_when_condition_is_not_satisfied(): void public function test_duplicating_row(): void { - $transformedRows = (new DuplicateRowTransformer( + $transformedRows = new DuplicateRowTransformer( ref('status')->equals(lit('inactive')), [new ScalarFunctionTransformer('amount', ref('amount')->multiply(lit(-1)))], - ))->transform( + )->transform( array_to_rows( [ ['id' => 1, 'status' => 'active', 'amount' => 100], @@ -303,7 +303,7 @@ public function test_an_empty_batch_is_bound_against_its_own_schema(): void { $this->expectException(SchemaDefinitionNotFoundException::class); - (new DuplicateRowTransformer(ref('missing')->equals(lit(1)), []))->transform( + new DuplicateRowTransformer(ref('missing')->equals(lit(1)), [])->transform( rows(schema()), flow_context()->backend(), ); @@ -316,10 +316,10 @@ public function test_bind_refuses_an_expand_in_the_condition(): void 'duplicateRow() cannot contain array_expand(), it turns one row into many rows. Expand with withColumn() first, then use the new column.', ); - (new DuplicateRowTransformer(ref('flags')->expand()->equals(lit(true)), [new ScalarFunctionTransformer( + new DuplicateRowTransformer(ref('flags')->expand()->equals(lit(true)), [new ScalarFunctionTransformer( 'flag', lit(true), - )]))->bind(ListColumnsMother::schema()); + )])->bind(ListColumnsMother::schema()); } public function test_bind_refuses_an_expand_in_an_entry(): void @@ -329,10 +329,10 @@ public function test_bind_refuses_an_expand_in_an_entry(): void 'duplicateRow() cannot contain array_expand(), it turns one row into many rows. Expand with withColumn() first, then use the new column.', ); - (new DuplicateRowTransformer(lit(true), [new ScalarFunctionTransformer( + new DuplicateRowTransformer(lit(true), [new ScalarFunctionTransformer( 't', ref('tags')->expand(), - )]))->bind(ListColumnsMother::schema()); + )])->bind(ListColumnsMother::schema()); } public function test_an_unbound_transform_refuses_an_expand_in_an_entry(): void @@ -342,15 +342,15 @@ public function test_an_unbound_transform_refuses_an_expand_in_an_entry(): void 'duplicateRow() cannot contain array_expand(), it turns one row into many rows. Expand with withColumn() first, then use the new column.', ); - (new DuplicateRowTransformer(lit(true), [new ScalarFunctionTransformer( + new DuplicateRowTransformer(lit(true), [new ScalarFunctionTransformer( 't', ref('tags')->expand(), - )]))->transform(ListColumnsMother::rows()->matchTo(ListColumnsMother::schema(), new AdaptiveBackend()), flow_context(config())->backend()); + )])->transform(ListColumnsMother::rows()->matchTo(ListColumnsMother::schema(), new AdaptiveBackend()), flow_context(config())->backend()); } public function test_does_not_describe(): void { - static::assertNull((new DuplicateRowTransformer(lit(true), []))->describe()); + static::assertNull(new DuplicateRowTransformer(lit(true), [])->describe()); } public function test_bind_declares_every_column_added_only_to_the_matched_rows(): void @@ -362,10 +362,10 @@ public function test_bind_declares_every_column_added_only_to_the_matched_rows() bool_schema('flag', nullable: true), bool_schema('mark', nullable: true), ), - (new DuplicateRowTransformer(ref('status')->equals(lit('inactive')), [ + new DuplicateRowTransformer(ref('status')->equals(lit('inactive')), [ new ScalarFunctionTransformer('flag', lit(true)), new ScalarFunctionTransformer('mark', lit(false)), - ]))->bind(schema(int_schema('id'), string_schema('status')))->output, + ])->bind(schema(int_schema('id'), string_schema('status')))->output, ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ExpansionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ExpansionTest.php index ba71f5f351..6b5242e6ca 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ExpansionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ExpansionTest.php @@ -145,7 +145,7 @@ public function test_synthesized_declares_one_nullable_column_per_distinct_expan public function test_of_is_null_without_an_expand(): void { static::assertNull(Expansion::of( - (new ReferenceResolver())->resolve(concat(ref('id'), lit('x')), ListColumnsMother::schema()), + new ReferenceResolver()->resolve(concat(ref('id'), lit('x')), ListColumnsMother::schema()), ListColumnsMother::schema(), )); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/LimitTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/LimitTransformerTest.php index 77f884c7b5..4fc122f3f2 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/LimitTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/LimitTransformerTest.php @@ -24,7 +24,7 @@ public function test_a_batch_below_the_limit_passes_through(): void { static::assertSame( [['id' => 1], ['id' => 2]], - (new LimitTransformer(3)) + new LimitTransformer(3) ->transform(RowsMother::sequentialIds(2), flow_context(config())->backend()) ->toArray(), ); @@ -34,7 +34,7 @@ public function test_bind_returns_the_input_schema(): void { $input = schema(int_schema('id'), str_schema('name')); - static::assertEquals($input, (new LimitTransformer(2))->bind($input)->output); + static::assertEquals($input, new LimitTransformer(2)->bind($input)->output); } public function test_a_batch_below_the_limit_does_not_reach_it(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/PruneColumnsTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/PruneColumnsTransformerTest.php index 41507a069a..e633896d20 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/PruneColumnsTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/PruneColumnsTransformerTest.php @@ -22,7 +22,7 @@ public function test_bind_keeps_only_the_declared_refs_in_ref_order(): void { static::assertEquals( schema(str_schema('name'), int_schema('id')), - (new PruneColumnsTransformer(ref('name'), ref('id'), ref('missing')))->bind(schema( + new PruneColumnsTransformer(ref('name'), ref('id'), ref('missing'))->bind(schema( int_schema('id'), str_schema('name'), int_schema('dropped'), @@ -34,7 +34,7 @@ public function test_bind_with_no_ref_present_in_the_input_derives_an_empty_sche { static::assertEquals( schema(), - (new PruneColumnsTransformer(ref('missing')))->bind(schema(int_schema('id')))->output, + new PruneColumnsTransformer(ref('missing'))->bind(schema(int_schema('id')))->output, ); } @@ -42,7 +42,7 @@ public function test_keeping_only_the_given_entries(): void { static::assertSame( [['id' => 1, 'name' => 'a']], - (new PruneColumnsTransformer(ref('id'), ref('name'))) + new PruneColumnsTransformer(ref('id'), ref('name')) ->transform( array_to_rows( [['id' => 1, 'name' => 'a', 'dropped' => 9]], @@ -58,7 +58,7 @@ public function test_entry_missing_from_a_row_is_padded_from_its_nullable_declar { static::assertSame( [['id' => 1, 'name' => 'a'], ['id' => 2, 'name' => null]], - (new PruneColumnsTransformer(ref('id'), ref('name'))) + new PruneColumnsTransformer(ref('id'), ref('name')) ->transform( array_to_rows( [['id' => 1, 'name' => 'a'], ['id' => 2]], @@ -74,7 +74,7 @@ public function test_row_without_any_of_the_given_entries_becomes_empty(): void { static::assertSame( [[]], - (new PruneColumnsTransformer(ref('missing'))) + new PruneColumnsTransformer(ref('missing')) ->transform(array_to_rows([['id' => 1]], schema(int_schema('id'))), flow_context()->backend()) ->toArray(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/Rename/RenameReplaceColumnStrategyTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/Rename/RenameReplaceColumnStrategyTest.php index f3257c3eb0..e6d331fe91 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/Rename/RenameReplaceColumnStrategyTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/Rename/RenameReplaceColumnStrategyTest.php @@ -16,7 +16,7 @@ public function test_every_column_whose_name_contains_the_search_is_renamed(): v { static::assertSame( ['a_b' => 'a-b', 'c_d' => 'c-d'], - (new RenameReplaceColumnStrategy('_', '-'))->renames(schema( + new RenameReplaceColumnStrategy('_', '-')->renames(schema( int_schema('a_b'), int_schema('id'), int_schema('c_d'), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/RenameColumnTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/RenameColumnTransformerTest.php index cc2832e655..836225d561 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/RenameColumnTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/RenameColumnTransformerTest.php @@ -28,7 +28,7 @@ final class RenameColumnTransformerTest extends FlowTestCase { public function test_renaming_keeps_the_column_position_and_its_values(): void { - $renamed = (new RenameColumnTransformer('a', 'x'))->transform( + $renamed = new RenameColumnTransformer('a', 'x')->transform( array_to_rows([['a' => 1, 'b' => 2]], schema(integer_schema('a'), integer_schema('b'))), flow_context(config())->backend(), ); @@ -41,7 +41,7 @@ public function test_bind_renames_the_column_in_place(): void { static::assertEquals( schema(integer_schema('new_int'), string_schema('status')), - (new RenameColumnTransformer('old_int', 'new_int'))->bind(schema( + new RenameColumnTransformer('old_int', 'new_int')->bind(schema( integer_schema('old_int'), string_schema('status'), ))->output, @@ -52,7 +52,7 @@ public function test_bind_renaming_a_column_to_its_own_name_returns_the_input_sc { $input = schema(integer_schema('id')); - static::assertEquals($input, (new RenameColumnTransformer('id', 'id'))->bind($input)->output); + static::assertEquals($input, new RenameColumnTransformer('id', 'id')->bind($input)->output); } public function test_renaming_entries(): void @@ -80,8 +80,8 @@ public function test_renaming_entries(): void string_schema('nothing', nullable: true), ), ), - (new RenameColumnTransformer('null', 'nothing'))->transform( - (new RenameColumnTransformer('old_int', 'new_int'))->transform( + new RenameColumnTransformer('null', 'nothing')->transform( + new RenameColumnTransformer('old_int', 'new_int')->transform( array_to_rows( [[ 'old_int' => 1000, @@ -113,7 +113,7 @@ public function test_renaming_entry_preserves_metadata(): void { $metadata = schema_metadata(['description' => 'test metadata', 'priority' => 1]); - $outputRows = (new RenameColumnTransformer('old_name', 'new_name'))->transform(array_to_rows([[ + $outputRows = new RenameColumnTransformer('old_name', 'new_name')->transform(array_to_rows([[ 'old_name' => 'test value', ]], schema(string_schema('old_name', metadata: $metadata))), flow_context(config())->backend()); @@ -125,7 +125,7 @@ public function test_renaming_to_same_name_returns_same_rows_instance(): void { $inputRows = array_to_rows([['name' => 'value']], schema(string_schema('name'))); - static::assertSame($inputRows, (new RenameColumnTransformer('name', 'name'))->transform( + static::assertSame($inputRows, new RenameColumnTransformer('name', 'name')->transform( $inputRows, flow_context(config())->backend(), )); @@ -151,6 +151,6 @@ public function test_a_rename_to_the_same_name_binds_the_input_schema(): void { $schema = schema(int_schema('id'), str_schema('name')); - static::assertSame($schema, (new RenameColumnTransformer('name', 'name'))->bind($schema)->output); + static::assertSame($schema, new RenameColumnTransformer('name', 'name')->bind($schema)->output); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/RenameEachColumnTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/RenameEachColumnTransformerTest.php index 016e17babb..a255953f09 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/RenameEachColumnTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/RenameEachColumnTransformerTest.php @@ -28,10 +28,10 @@ public function test_bind_feeds_each_strategy_the_output_of_the_previous_one(): { static::assertEquals( schema(int_schema('uid'), str_schema('user_name')), - (new RenameEachColumnTransformer( + new RenameEachColumnTransformer( new RenameMapColumnStrategy(['id' => 'user_id']), new RenameMapColumnStrategy(['user_id' => 'uid', 'name' => 'user_name']), - ))->bind(schema(int_schema('id'), str_schema('name')))->output, + )->bind(schema(int_schema('id'), str_schema('name')))->output, ); } @@ -39,7 +39,7 @@ public function test_bind_renames_every_column_the_case_strategy_converts(): voi { static::assertEquals( schema(int_schema('userId'), str_schema('userName')), - (new RenameEachColumnTransformer(new RenameCaseColumnStrategy(StringStyles::CAMEL)))->bind(schema( + new RenameEachColumnTransformer(new RenameCaseColumnStrategy(StringStyles::CAMEL))->bind(schema( int_schema('user_id'), str_schema('user_name'), ))->output, @@ -50,7 +50,7 @@ public function test_bind_renames_a_numeric_entry_name(): void { static::assertEquals( schema(str_schema('broker'), int_schema('y_2023')), - (new RenameEachColumnTransformer(new RenameMapColumnStrategy(['2023' => 'y_2023'])))->bind(schema( + new RenameEachColumnTransformer(new RenameMapColumnStrategy(['2023' => 'y_2023']))->bind(schema( str_schema('broker'), int_schema('2023'), ))->output, @@ -61,10 +61,10 @@ public function test_bind_chains_strategies_through_a_numeric_entry_name(): void { static::assertEquals( schema(int_schema('year')), - (new RenameEachColumnTransformer( + new RenameEachColumnTransformer( new RenameMapColumnStrategy(['id' => '2023']), new RenameMapColumnStrategy(['2023' => 'year']), - ))->bind(schema(int_schema('id')))->output, + )->bind(schema(int_schema('id')))->output, ); } @@ -99,12 +99,12 @@ public function test_describe_round_trips(): void public function test_a_custom_strategy_does_not_describe(): void { static::assertNull( - (new RenameEachColumnTransformer(new class implements RenameColumnStrategy { + new RenameEachColumnTransformer(new class implements RenameColumnStrategy { public function renames(Schema $schema): array { return []; } - }))->describe(), + })->describe(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ScalarFunctionFilterTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ScalarFunctionFilterTransformerTest.php index c4db01b035..8e3f04aa16 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ScalarFunctionFilterTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ScalarFunctionFilterTransformerTest.php @@ -28,14 +28,14 @@ public function test_bind_refuses_a_non_boolean_predicate(): void { $this->expectException(InvalidArgumentException::class); - (new ScalarFunctionFilterTransformer(ref('a')))->bind(schema(int_schema('a'))); + new ScalarFunctionFilterTransformer(ref('a'))->bind(schema(int_schema('a'))); } public function test_bind_refuses_a_predicate_referencing_a_column_missing_from_the_input(): void { $this->expectException(SchemaDefinitionNotFoundException::class); - (new ScalarFunctionFilterTransformer(ref('missing')->equals(lit(1))))->bind(schema(int_schema('a'))); + new ScalarFunctionFilterTransformer(ref('missing')->equals(lit(1)))->bind(schema(int_schema('a'))); } public function test_bind_returns_the_input_schema(): void @@ -44,7 +44,7 @@ public function test_bind_returns_the_input_schema(): void static::assertEquals( $input, - (new ScalarFunctionFilterTransformer(ref('a')->equals(ref('b'))))->bind($input)->output, + new ScalarFunctionFilterTransformer(ref('a')->equals(ref('b')))->bind($input)->output, ); } @@ -54,7 +54,7 @@ public function test_equal(): void [ ['a' => 1, 'b' => 1], ], - (new ScalarFunctionFilterTransformer(ref('a')->equals(ref('b')))) + new ScalarFunctionFilterTransformer(ref('a')->equals(ref('b'))) ->transform( array_to_rows( [['a' => 1, 'b' => 1], ['a' => 1, 'b' => 2]], @@ -72,7 +72,7 @@ public function test_equal_on_literal(): void [ ['a' => 1, 'b' => 2], ], - (new ScalarFunctionFilterTransformer(ref('b')->equals(lit(2)))) + new ScalarFunctionFilterTransformer(ref('b')->equals(lit(2))) ->transform( array_to_rows( [['a' => 1, 'b' => 1], ['a' => 1, 'b' => 2]], @@ -90,7 +90,7 @@ public function test_greater_than(): void [ ['a' => 1, 'b' => 2], ], - (new ScalarFunctionFilterTransformer(ref('b')->greaterThan(ref('a')))) + new ScalarFunctionFilterTransformer(ref('b')->greaterThan(ref('a'))) ->transform( array_to_rows([['a' => 1, 'b' => 2]], schema(int_schema('a'), int_schema('b'))), flow_context(config())->backend(), @@ -106,7 +106,7 @@ public function test_greater_than_or_equal(): void ['a' => 1, 'b' => 1], ['a' => 1, 'b' => 2], ], - (new ScalarFunctionFilterTransformer(ref('b')->greaterThanEqual(ref('a')))) + new ScalarFunctionFilterTransformer(ref('b')->greaterThanEqual(ref('a'))) ->transform( array_to_rows( [['a' => 1, 'b' => 1], ['a' => 1, 'b' => 2]], @@ -124,7 +124,7 @@ public function test_less_than(): void [ ['a' => 1, 'b' => 2], ], - (new ScalarFunctionFilterTransformer(ref('a')->lessThan(ref('b')))) + new ScalarFunctionFilterTransformer(ref('a')->lessThan(ref('b'))) ->transform( array_to_rows( [['a' => 1, 'b' => 1], ['a' => 1, 'b' => 2]], @@ -143,7 +143,7 @@ public function test_less_than_equal(): void ['a' => 1, 'b' => 1], ['a' => 1, 'b' => 2], ], - (new ScalarFunctionFilterTransformer(ref('a')->lessThanEqual(ref('b')))) + new ScalarFunctionFilterTransformer(ref('a')->lessThanEqual(ref('b'))) ->transform( array_to_rows( [['a' => 1, 'b' => 1], ['a' => 1, 'b' => 2]], @@ -161,7 +161,7 @@ public function test_not_equal(): void [ ['a' => 1, 'b' => 2], ], - (new ScalarFunctionFilterTransformer(ref('a')->notEquals(ref('b')))) + new ScalarFunctionFilterTransformer(ref('a')->notEquals(ref('b'))) ->transform( array_to_rows( [['a' => 1, 'b' => 1], ['a' => 1, 'b' => 2]], @@ -179,7 +179,7 @@ public function test_not_same(): void [ ['a' => 1, 'b' => 2], ], - (new ScalarFunctionFilterTransformer(ref('a')->notSame(ref('b')))) + new ScalarFunctionFilterTransformer(ref('a')->notSame(ref('b'))) ->transform( array_to_rows( [['a' => 1, 'b' => 1], ['a' => 1, 'b' => 2]], @@ -197,7 +197,7 @@ public function test_same(): void [ ['a' => 1, 'b' => 1], ], - (new ScalarFunctionFilterTransformer(ref('a')->same(ref('b')))) + new ScalarFunctionFilterTransformer(ref('a')->same(ref('b'))) ->transform( array_to_rows( [['a' => 1, 'b' => 1], ['a' => 1, 'b' => 2]], @@ -214,7 +214,7 @@ public function test_a_non_boolean_predicate_is_rejected_at_bind(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('filter() requires a predicate returning boolean'); - (new ScalarFunctionFilterTransformer(ref('score')))->transform(array_to_rows([ + new ScalarFunctionFilterTransformer(ref('score'))->transform(array_to_rows([ ['score' => 1], ['score' => null], ], schema(int_schema('score', nullable: true))), flow_context(config())->backend()); @@ -226,7 +226,7 @@ public function test_a_null_propagating_predicate_over_a_nullable_column_is_acce [ ['score' => 11], ], - (new ScalarFunctionFilterTransformer(ref('score')->greaterThan(lit(10)))) + new ScalarFunctionFilterTransformer(ref('score')->greaterThan(lit(10))) ->transform(array_to_rows([ ['score' => 11], ['score' => 2], @@ -240,7 +240,7 @@ public function test_an_empty_batch_is_bound_against_its_own_schema(): void { $this->expectException(SchemaDefinitionNotFoundException::class); - (new ScalarFunctionFilterTransformer(ref('missing')->equals(lit(1))))->transform( + new ScalarFunctionFilterTransformer(ref('missing')->equals(lit(1)))->transform( rows(schema()), flow_context(config())->backend(), ); @@ -253,9 +253,7 @@ public function test_bind_refuses_an_expand_in_the_predicate(): void 'filter() cannot contain array_expand(), it turns one row into many rows. Expand with withColumn() first, then use the new column.', ); - (new ScalarFunctionFilterTransformer(ref('tags')->expand()->equals(lit('x'))))->bind( - ListColumnsMother::schema(), - ); + new ScalarFunctionFilterTransformer(ref('tags')->expand()->equals(lit('x')))->bind(ListColumnsMother::schema()); } public function test_bind_refuses_a_root_expand_over_booleans(): void @@ -265,13 +263,13 @@ public function test_bind_refuses_a_root_expand_over_booleans(): void 'filter() cannot contain array_expand(), it turns one row into many rows. Expand with withColumn() first, then use the new column.', ); - (new ScalarFunctionFilterTransformer(ref('flags')->expand()))->bind(ListColumnsMother::schema()); + new ScalarFunctionFilterTransformer(ref('flags')->expand())->bind(ListColumnsMother::schema()); } public function test_the_bound_transformer_keeps_the_rows_its_predicate_matches(): void { $input = schema(int_schema('a')); - $bound = (new ScalarFunctionFilterTransformer(ref('a')->greaterThan(lit(1))))->bind($input)->step; + $bound = new ScalarFunctionFilterTransformer(ref('a')->greaterThan(lit(1)))->bind($input)->step; static::assertInstanceOf(ScalarFunctionFilterTransformer::class, $bound); static::assertSame( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ScalarFunctionTransformer/MathTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ScalarFunctionTransformer/MathTest.php index 08a479fd90..c6e70c394f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ScalarFunctionTransformer/MathTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ScalarFunctionTransformer/MathTest.php @@ -145,7 +145,7 @@ public function test_divide( ): void { static::assertEquals( [$result], - (new ScalarFunctionTransformer('result', ref($a->name())->divide(ref($b->name()), $scale, $rounding))) + new ScalarFunctionTransformer('result', ref($a->name())->divide(ref($b->name()), $scale, $rounding)) ->transform( array_to_rows([[$a->name() => $aValue, $b->name() => $bValue]], schema($a, $b)), flow_context()->backend(), @@ -164,7 +164,7 @@ public function test_minus(Definition $a, mixed $aValue, Definition $b, mixed $b { static::assertEquals( [$result], - (new ScalarFunctionTransformer('result', ref($a->name())->minus(ref($b->name())))) + new ScalarFunctionTransformer('result', ref($a->name())->minus(ref($b->name()))) ->transform( array_to_rows([[$a->name() => $aValue, $b->name() => $bValue]], schema($a, $b)), flow_context()->backend(), @@ -183,7 +183,7 @@ public function test_multiply(Definition $a, mixed $aValue, Definition $b, mixed { static::assertEquals( [$result], - (new ScalarFunctionTransformer('result', ref($a->name())->multiply(ref($b->name())))) + new ScalarFunctionTransformer('result', ref($a->name())->multiply(ref($b->name()))) ->transform( array_to_rows([[$a->name() => $aValue, $b->name() => $bValue]], schema($a, $b)), flow_context()->backend(), @@ -202,7 +202,7 @@ public function test_plus(Definition $a, mixed $aValue, Definition $b, mixed $bV { static::assertEquals( [$result], - (new ScalarFunctionTransformer('result', ref($a->name())->plus(ref($b->name())))) + new ScalarFunctionTransformer('result', ref($a->name())->plus(ref($b->name()))) ->transform( array_to_rows([[$a->name() => $aValue, $b->name() => $bValue]], schema($a, $b)), flow_context()->backend(), @@ -221,7 +221,7 @@ public function test_power(Definition $a, mixed $aValue, Definition $b, mixed $b { static::assertEquals( [$result], - (new ScalarFunctionTransformer('result', ref($a->name())->power(ref($b->name())))) + new ScalarFunctionTransformer('result', ref($a->name())->power(ref($b->name()))) ->transform( array_to_rows([[$a->name() => $aValue, $b->name() => $bValue]], schema($a, $b)), flow_context()->backend(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ScalarFunctionTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ScalarFunctionTransformerTest.php index 5ce48f7d01..b1452fc9e7 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ScalarFunctionTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/ScalarFunctionTransformerTest.php @@ -54,7 +54,7 @@ public function test_bind_adds_the_derived_column(): void { static::assertEquals( schema(int_schema('a'), str_schema('b')), - (new ScalarFunctionTransformer('b', lit('x')))->bind(schema(int_schema('a')))->output, + new ScalarFunctionTransformer('b', lit('x'))->bind(schema(int_schema('a')))->output, ); } @@ -62,10 +62,10 @@ public function test_bind_declares_one_prefixed_nullable_column_per_unpacked_col { static::assertEquals( schema(int_schema('id'), int_schema('data.a', nullable: true), str_schema('data.b', nullable: true)), - (new ScalarFunctionTransformer( + new ScalarFunctionTransformer( 'data', new ArrayUnpack(lit(['a' => 1, 'b' => 'x']), schema(int_schema('a'), str_schema('b'))), - ))->bind(schema(int_schema('id')))->output, + )->bind(schema(int_schema('id')))->output, ); } @@ -73,7 +73,7 @@ public function test_bind_replaces_an_existing_column_with_the_derived_one(): vo { static::assertEquals( schema(str_schema('a')), - (new ScalarFunctionTransformer('a', lit('x')))->bind(schema(int_schema('a')))->output, + new ScalarFunctionTransformer('a', lit('x'))->bind(schema(int_schema('a')))->output, ); } @@ -81,7 +81,7 @@ public function test_lit_expression_on_empty_rows(): void { static::assertEquals( [], - (new ScalarFunctionTransformer('number', lit(1_000))) + new ScalarFunctionTransformer('number', lit(1_000)) ->transform(rows(schema()), flow_context(config())->backend()) ->toArray(), ); @@ -93,7 +93,7 @@ public function test_lit_expression_on_non_empty_rows(): void [ ['name' => 'Norbert', 'number' => 1], ], - (new ScalarFunctionTransformer('number', lit(1))) + new ScalarFunctionTransformer('number', lit(1)) ->transform(array_to_rows([[ 'name' => 'Norbert', ]], schema(str_schema('name'))), flow_context(config())->backend()) @@ -105,7 +105,7 @@ public function test_plus_expression_on_an_empty_batch_that_declares_its_columns { static::assertEquals( [], - (new ScalarFunctionTransformer('number', ref('num')->plus(ref('num1')))) + new ScalarFunctionTransformer('number', ref('num')->plus(ref('num1'))) ->transform(rows(schema(int_schema('num'), int_schema('num1'))), flow_context(config())->backend()) ->toArray(), ); @@ -117,7 +117,7 @@ public function test_plus_expression_on_non_empty_rows(): void [ ['a' => 1, 'b' => 2, 'c' => 3], ], - (new ScalarFunctionTransformer('c', ref('a')->plus(ref('b')))) + new ScalarFunctionTransformer('c', ref('a')->plus(ref('b'))) ->transform( array_to_rows([['a' => 1, 'b' => 2]], schema(int_schema('a'), int_schema('b'))), flow_context(config())->backend(), @@ -135,7 +135,7 @@ public function test_plus_expression_on_non_existing_rows(): void [ ['a' => 1, 'number' => 0], ], - (new ScalarFunctionTransformer('number', ref('num')->plus(ref('num1')))) + new ScalarFunctionTransformer('number', ref('num')->plus(ref('num1'))) ->transform(array_to_rows([['a' => 1]], schema(int_schema('a'))), flow_context(config())->backend()) ->toArray(), ); @@ -147,10 +147,10 @@ public function test_an_undeclared_payload_key_is_dropped(): void [ ['array.id' => 1], ], - (new ScalarFunctionTransformer( + new ScalarFunctionTransformer( 'array', new ArrayUnpack(lit(['id' => 1, 'secret' => 'dropped']), schema(int_schema('id'))), - )) + ) ->transform(array_to_rows([[]], schema()), flow_context(config())->backend()) ->toArray(), ); @@ -160,10 +160,10 @@ public function test_unpack_results_ignores_a_definition_passed_to_with_column() { // a Definition passed to withColumn() cannot describe an N-column result, so unpack's own // declared Schema is what names and types the produced columns - $result = (new ScalarFunctionTransformer( + $result = new ScalarFunctionTransformer( str_schema('array'), new ArrayUnpack(lit(['id' => 1, 'name' => 'Norbert']), schema(int_schema('id'), str_schema('name'))), - ))->transform(array_to_rows([[]], schema()), flow_context(config())->backend()); + )->transform(array_to_rows([[]], schema()), flow_context(config())->backend()); static::assertEquals([['array.id' => 1, 'array.name' => 'Norbert']], $result->toArray()); static::assertEquals( @@ -177,10 +177,10 @@ public function test_xml_xpath_expression_when_there_is_more_than_one_node_under $xml = 'barbaz'; $document = new DOMDocument(); $document->loadXML($xml); - $nodes = type_instance_of(DOMNodeList::class)->assert((new DOMXPath($document))->query('/root/foo')); + $nodes = type_instance_of(DOMNodeList::class)->assert(new DOMXPath($document)->query('/root/foo')); $expected = [$nodes->item(0), $nodes->item(1)]; - $result = (new ScalarFunctionTransformer('xpath', ref('xml')->xpath('/root/foo')))->transform(array_to_rows([[ + $result = new ScalarFunctionTransformer('xpath', ref('xml')->xpath('/root/foo'))->transform(array_to_rows([[ 'xml' => type_xml()->cast($xml), ]], schema(xml_schema('xml'))), flow_context(config())->backend()); @@ -196,7 +196,7 @@ public function test_a_declared_output_definition_coerces_the_produced_value(): ['v' => 1, 'out' => '1'], ['v' => 2, 'out' => '2'], ], - (new ScalarFunctionTransformer(str_schema('out'), ref('v'))) + new ScalarFunctionTransformer(str_schema('out'), ref('v')) ->transform(array_to_rows([ ['v' => 1], ['v' => 2], @@ -209,7 +209,7 @@ public function test_the_produced_column_takes_the_declared_definition(): void { static::assertEquals( type_string(), - (new ScalarFunctionTransformer(str_schema('out'), ref('v'))) + new ScalarFunctionTransformer(str_schema('out'), ref('v')) ->transform(array_to_rows([ ['v' => 1], ['v' => 2], @@ -222,7 +222,7 @@ public function test_the_produced_column_takes_the_declared_definition(): void public function test_the_produced_definition_does_not_depend_on_batch_size(): void { - $wholeBatch = (new ScalarFunctionTransformer('out', ref('v')->plus(lit(1))))->transform(array_to_rows([ + $wholeBatch = new ScalarFunctionTransformer('out', ref('v')->plus(lit(1)))->transform(array_to_rows([ ['v' => 1], ['v' => 2], ], schema(int_schema('v'))), flow_context(config())->backend()); @@ -248,7 +248,7 @@ public function test_a_null_produced_under_a_not_null_declaration_names_its_row( $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('column "out" (row 1)'); - (new ScalarFunctionTransformer(int_schema('out'), ref('v')))->transform(array_to_rows([ + new ScalarFunctionTransformer(int_schema('out'), ref('v'))->transform(array_to_rows([ ['v' => 1], ['v' => null], ], schema(int_schema('v', nullable: true))), flow_context(config())->backend()); @@ -259,7 +259,7 @@ public function test_a_batch_arriving_under_another_schema_than_the_bound_one_is static::assertSame( [['id' => 1, 'name' => null, 'out' => 'x']], type_instance_of(ScalarFunctionTransformer::class) - ->assert((new ScalarFunctionTransformer('out', lit('x')))->bind(schema( + ->assert(new ScalarFunctionTransformer('out', lit('x'))->bind(schema( int_schema('id'), str_schema('name', nullable: true), ))->step) @@ -272,7 +272,7 @@ public function test_an_empty_batch_is_bound_against_its_own_schema(): void { $this->expectException(SchemaDefinitionNotFoundException::class); - (new ScalarFunctionTransformer('out', ref('missing')->upper()))->transform( + new ScalarFunctionTransformer('out', ref('missing')->upper())->transform( rows(schema()), flow_context(config())->backend(), ); @@ -283,7 +283,7 @@ public function test_bind_keeps_a_tree_without_an_expand_on_itself(ScalarFunctio { static::assertInstanceOf( ScalarFunctionTransformer::class, - (new ScalarFunctionTransformer('s', $function))->bind(ListColumnsMother::schema())->step, + new ScalarFunctionTransformer('s', $function)->bind(ListColumnsMother::schema())->step, ); } @@ -304,7 +304,7 @@ public function test_bind_refuses_an_expanding_function(ScalarFunction $function . 'Expand with withColumn() first, then use the new column.', ); - (new ScalarFunctionTransformer('v', $function))->bind(ListColumnsMother::schema()); + new ScalarFunctionTransformer('v', $function)->bind(ListColumnsMother::schema()); } /** @@ -322,7 +322,7 @@ public function test_transform_refuses_an_expanding_function(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('transform() cannot contain array_expand()'); - (new ScalarFunctionTransformer('v', ref('tags')->expand()))->transform( + new ScalarFunctionTransformer('v', ref('tags')->expand())->transform( ListColumnsMother::rows()->matchTo(ListColumnsMother::schema(), new AdaptiveBackend()), flow_context(config())->backend(), ); @@ -334,14 +334,14 @@ public function test_bind_refuses_an_unpack_whose_type_is_not_a_structure(): voi $this->expectExceptionMessage(NonStructureUnpackStub::class . ' unpacks into N columns, so returns() must be a StructureType, got "string".'); - (new ScalarFunctionTransformer('u', new NonStructureUnpackStub()))->bind(schema()); + new ScalarFunctionTransformer('u', new NonStructureUnpackStub())->bind(schema()); } public function test_an_unpack_fills_one_column_per_declared_element_for_every_row(): void { static::assertSame( [['s.a' => 1, 's.b' => 'x'], ['s.a' => 2, 's.b' => null]], - (new ScalarFunctionTransformer('s', ref('s')->unpack(schema(int_schema('a'), str_schema('b'))))) + new ScalarFunctionTransformer('s', ref('s')->unpack(schema(int_schema('a'), str_schema('b')))) ->transform(array_to_rows([ ['s' => ['a' => 1, 'b' => 'x']], ['s' => ['a' => 2, 'b' => null]], @@ -374,7 +374,7 @@ public function test_describe_names_the_declared_definition(): void { static::assertSame( [['ref' => 'a', 'type' => ['type' => 'integer'], 'nullable' => true, 'metadata' => []]], - (new ScalarFunctionTransformer('s', ref('s')->unpack(schema(int_schema('a'))))) + new ScalarFunctionTransformer('s', ref('s')->unpack(schema(int_schema('a')))) ->bind(schema(json_schema('s'))) ->step ->describe() @@ -384,10 +384,10 @@ public function test_describe_names_the_declared_definition(): void public function test_an_unpack_of_no_rows_keeps_every_declared_column(): void { - $unpacked = (new ScalarFunctionTransformer( + $unpacked = new ScalarFunctionTransformer( 's', ref('s')->unpack(schema(int_schema('a'), str_schema('b'))), - ))->transform( + )->transform( array_to_rows( [], schema(structure_schema('s', type_structure([ diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/SelectColumnsTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/SelectColumnsTransformerTest.php index 8d8a36108a..3a98faf970 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/SelectColumnsTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/SelectColumnsTransformerTest.php @@ -28,7 +28,7 @@ public function test_bind_projects_and_reorders_to_the_selected_columns(): void { static::assertEquals( schema(str_schema('name'), int_schema('id')), - (new SelectColumnsTransformer('name', 'id'))->bind(schema( + new SelectColumnsTransformer('name', 'id')->bind(schema( int_schema('id'), str_schema('name'), json_schema('array'), @@ -40,7 +40,7 @@ public function test_bind_names_an_aliased_column_by_its_alias_with_the_read_col { static::assertEquals( schema(int_schema('key'), str_schema('name')), - (new SelectColumnsTransformer(ref('id')->as('key'), 'name'))->bind(schema( + new SelectColumnsTransformer(ref('id')->as('key'), 'name')->bind(schema( int_schema('id'), str_schema('name'), ))->output, @@ -52,10 +52,7 @@ public function test_bind_refuses_two_references_that_output_one_name(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('select() would output column "name" twice'); - (new SelectColumnsTransformer(ref('id')->as('name'), 'name'))->bind(schema( - int_schema('id'), - str_schema('name'), - )); + new SelectColumnsTransformer(ref('id')->as('name'), 'name')->bind(schema(int_schema('id'), str_schema('name'))); } public function test_bind_refuses_a_column_missing_from_the_input(): void @@ -63,7 +60,7 @@ public function test_bind_refuses_a_column_missing_from_the_input(): void $this->expectException(SchemaDefinitionNotFoundException::class); $this->expectExceptionMessage('Schema definition for column "not_existing" not found'); - (new SelectColumnsTransformer('not_existing'))->bind(schema(int_schema('id'))); + new SelectColumnsTransformer('not_existing')->bind(schema(int_schema('id'))); } public function test_selecting_entries(): void @@ -72,7 +69,7 @@ public function test_selecting_entries(): void [ ['name' => 'Row Name'], ], - (new SelectColumnsTransformer('name')) + new SelectColumnsTransformer('name') ->transform( array_to_rows( [['id' => 1, 'name' => 'Row Name', 'array' => type_json()->cast(['test'])]], @@ -94,14 +91,14 @@ public function test_selecting_not_existing_entries(): void $this->expectException(SchemaDefinitionNotFoundException::class); $this->expectExceptionMessage('Schema definition for column "not_existing" not found'); - (new SelectColumnsTransformer('not_existing'))->transform($rows, flow_context(config())->backend()); + new SelectColumnsTransformer('not_existing')->transform($rows, flow_context(config())->backend()); } public function test_selecting_an_entry_missing_from_some_rows_widens_to_a_nullable_real_type(): void { static::assertEquals( schema(int_schema('id', nullable: true)), - (new SelectColumnsTransformer('id')) + new SelectColumnsTransformer('id') ->transform( array_to_rows( [['id' => 1], ['name' => 'no id here']], @@ -115,7 +112,7 @@ public function test_selecting_an_entry_missing_from_some_rows_widens_to_a_nulla public function test_using_select_entries_in_order_to_change_entries_order(): void { - $result = (new SelectColumnsTransformer('name', 'id', 'array'))->transform( + $result = new SelectColumnsTransformer('name', 'id', 'array')->transform( array_to_rows( [['id' => 1, 'name' => 'Row Name', 'array' => type_json()->cast(['test'])]], schema(int_schema('id'), str_schema('name'), json_schema('array')), @@ -136,7 +133,7 @@ public function test_select_carries_a_not_null_definition_through_unchanged(): v { static::assertEquals( schema(int_schema('id')), - (new SelectColumnsTransformer('id')) + new SelectColumnsTransformer('id') ->transform( array_to_rows( [['id' => 1, 'name' => 'Alice'], ['id' => 2, 'name' => 'Bob']], diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/SerializeTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/SerializeTransformerTest.php index fa0379e511..a903e60990 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/SerializeTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/SerializeTransformerTest.php @@ -32,7 +32,7 @@ public function test_bind_adds_the_target_column_when_the_input_does_not_declare { static::assertEquals( schema(int_schema('id'), str_schema('serialized')), - (new SerializeTransformer('serialized', config()->serializer()))->bind(schema(int_schema('id')))->output, + new SerializeTransformer('serialized', config()->serializer())->bind(schema(int_schema('id')))->output, ); } @@ -40,7 +40,7 @@ public function test_bind_replaces_the_target_column_with_a_string_column(): voi { static::assertEquals( schema(int_schema('id'), str_schema('payload')), - (new SerializeTransformer('payload', config()->serializer()))->bind(schema( + new SerializeTransformer('payload', config()->serializer())->bind(schema( int_schema('id'), int_schema('payload'), ))->output, @@ -60,7 +60,7 @@ public function test_serializing_empty_row_under_one_entry(): void )), ], ], - (new SerializeTransformer('serialized', config()->serializer())) + new SerializeTransformer('serialized', config()->serializer()) ->transform($rows, flow_context()->backend()) ->toArray(), ); @@ -104,7 +104,7 @@ public function test_serializing_row_under_one_entry(): void )), ], ], - (new SerializeTransformer('serialized', config()->serializer())) + new SerializeTransformer('serialized', config()->serializer()) ->transform($rows, flow_context()->backend()) ->toArray(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/UnpackedColumnsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/UnpackedColumnsTest.php index 80b7742f91..7646ce0781 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/UnpackedColumnsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/UnpackedColumnsTest.php @@ -18,7 +18,7 @@ public function test_a_declared_column_that_collides_replaces_rather_than_duplic { static::assertEquals( schema(int_schema('id'), str_schema('p.colour', nullable: true)), - (new UnpackedColumns())->of( + new UnpackedColumns()->of( schema(int_schema('id'), int_schema('p.colour')), 'p.', schema(str_schema('colour')), @@ -30,7 +30,7 @@ public function test_every_declared_column_is_added_nullable_and_prefixed(): voi { static::assertEquals( schema(int_schema('id'), str_schema('p.colour', nullable: true), bool_schema('p.boxed', nullable: true)), - (new UnpackedColumns())->of( + new UnpackedColumns()->of( schema(int_schema('id')), 'p.', schema(str_schema('colour'), bool_schema('boxed')), @@ -42,7 +42,7 @@ public function test_values_prefixes_declared_keys_drops_undeclared_and_nulls_ab { static::assertSame( ['u.a' => 1, 'u.b' => null], - (new UnpackedColumns())->values('u.', schema(int_schema('a'), str_schema('b')), [ + new UnpackedColumns()->values('u.', schema(int_schema('a'), str_schema('b')), [ 'a' => '1', 'c' => 'x', ]), @@ -53,7 +53,7 @@ public function test_the_declaration_order_is_the_column_order(): void { static::assertSame( ['id', 'p.b', 'p.a'], - (new UnpackedColumns())->of( + new UnpackedColumns()->of( schema(int_schema('id')), 'p.', schema(str_schema('b'), str_schema('a')), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/UnserializeTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/UnserializeTransformerTest.php index a74dfefab1..8ec1e63025 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/UnserializeTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/UnserializeTransformerTest.php @@ -37,7 +37,7 @@ public function test_a_payload_written_with_another_type_is_refused(): void $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('column "id" (row 0): could not convert \'12\' (string) to integer'); - (new UnserializeTransformer('serialized', schema(int_schema('id')), config()->serializer()))->transform( + new UnserializeTransformer('serialized', schema(int_schema('id')), config()->serializer())->transform( array_to_rows([[ 'serialized' => $payload, ]], schema(str_schema('serialized'))), @@ -49,11 +49,11 @@ public function test_bind_expands_the_declared_target_into_nullable_columns(): v { static::assertEquals( schema(str_schema('serialized'), int_schema('id', nullable: true), str_schema('name', nullable: true)), - (new UnserializeTransformer( + new UnserializeTransformer( 'serialized', schema(int_schema('id'), str_schema('name')), config()->serializer(), - ))->bind(schema(str_schema('serialized')))->output, + )->bind(schema(str_schema('serialized')))->output, ); } @@ -65,12 +65,12 @@ public function test_bind_prefixes_the_expanded_columns_with_the_merge_prefix(): int_schema('row_id', nullable: true), str_schema('row_name', nullable: true), ), - (new UnserializeTransformer( + new UnserializeTransformer( 'serialized', schema(int_schema('id'), str_schema('name')), config()->serializer(), 'row_', - ))->bind(schema(str_schema('serialized')))->output, + )->bind(schema(str_schema('serialized')))->output, ); } @@ -110,7 +110,7 @@ public function test_unserializing_row_from_entry(): void 'tags' => ['tag3', 'tag4'], ], ], - (new UnserializeTransformer('serialized', $rowSchema, config()->serializer())) + new UnserializeTransformer('serialized', $rowSchema, config()->serializer()) ->transform(array_to_rows([ ['serialized' => base64_encode(serialize_to_string( new FloeSerializer(new AdaptiveBackend()), @@ -129,7 +129,7 @@ public function test_unserializing_something_that_is_not_serialized_row(): void { static::assertSame( [['serialized' => 'not-serialized', 'id' => null]], - (new UnserializeTransformer('serialized', schema(int_schema('id')), config()->serializer())) + new UnserializeTransformer('serialized', schema(int_schema('id')), config()->serializer()) ->transform(array_to_rows([[ 'serialized' => 'not-serialized', ]], schema(str_schema('serialized'))), flow_context()->backend()) @@ -141,7 +141,7 @@ public function test_unserializing_row_without_source_column_emits_the_declared_ { static::assertSame( [['id' => 1, 'name' => null]], - (new UnserializeTransformer('serialized', schema(str_schema('name')), config()->serializer())) + new UnserializeTransformer('serialized', schema(str_schema('name')), config()->serializer()) ->transform(array_to_rows([['id' => 1]], schema(int_schema('id'))), flow_context()->backend()) ->toArray(), ); @@ -151,7 +151,7 @@ public function test_unserializing_non_string_value_emits_the_declared_shape(): { static::assertSame( [['serialized' => 123, 'name' => null]], - (new UnserializeTransformer('serialized', schema(str_schema('name')), config()->serializer())) + new UnserializeTransformer('serialized', schema(str_schema('name')), config()->serializer()) ->transform(array_to_rows([[ 'serialized' => 123, ]], schema(int_schema('serialized'))), flow_context()->backend()) @@ -167,7 +167,7 @@ public function test_unserializing_multi_row_payload_emits_the_declared_shape(): ], schema(int_schema('id'))))); static::assertSame( [['serialized' => $payload, 'id' => null]], - (new UnserializeTransformer('serialized', schema(int_schema('id')), config()->serializer())) + new UnserializeTransformer('serialized', schema(int_schema('id')), config()->serializer()) ->transform(array_to_rows([[ 'serialized' => $payload, ]], schema(str_schema('serialized'))), flow_context()->backend()) @@ -183,12 +183,12 @@ public function test_the_declared_columns_land_under_the_merge_prefix(): void static::assertSame( [['serialized' => $payload, 'payload_id' => 7]], - (new UnserializeTransformer( + new UnserializeTransformer( 'serialized', schema(int_schema('id')), config()->serializer(), mergePrefix: 'payload_', - )) + ) ->transform(array_to_rows([[ 'serialized' => $payload, ]], schema(str_schema('serialized'))), flow_context()->backend()) @@ -204,7 +204,7 @@ public function test_a_declared_column_replaces_an_input_column_of_the_same_name static::assertSame( [['serialized' => $payload, 'id' => 7]], - (new UnserializeTransformer('serialized', schema(int_schema('id')), config()->serializer())) + new UnserializeTransformer('serialized', schema(int_schema('id')), config()->serializer()) ->transform( array_to_rows( [['serialized' => $payload, 'id' => 1]], @@ -224,11 +224,11 @@ public function test_a_declared_column_the_payload_does_not_carry_is_null(): voi static::assertSame( [['serialized' => $payload, 'id' => 7, 'absent' => null]], - (new UnserializeTransformer( + new UnserializeTransformer( 'serialized', schema(int_schema('id'), str_schema('absent')), config()->serializer(), - )) + ) ->transform(array_to_rows([[ 'serialized' => $payload, ]], schema(str_schema('serialized'))), flow_context()->backend()) @@ -239,7 +239,7 @@ public function test_a_declared_column_the_payload_does_not_carry_is_null(): voi public function test_describe_round_trips(): void { $schema = schema(int_schema('id'), str_schema('name')); - $serialized = (new SerializeTransformer('payload', config()->serializer())) + $serialized = new SerializeTransformer('payload', config()->serializer()) ->bind($schema) ->step->transform( array_to_rows( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/UntilTransformerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/UntilTransformerTest.php index 52582336a8..8aa6cfa46e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/UntilTransformerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Operators/Transformer/UntilTransformerTest.php @@ -44,14 +44,14 @@ public function test_bind_refuses_a_non_boolean_predicate(): void { $this->expectException(InvalidArgumentException::class); - (new UntilTransformer(ref('id')))->bind(schema(int_schema('id'))); + new UntilTransformer(ref('id'))->bind(schema(int_schema('id'))); } public function test_bind_returns_the_input_schema(): void { $input = schema(int_schema('id')); - static::assertEquals($input, (new UntilTransformer(ref('id')->lessThan(lit(3))))->bind($input)->output); + static::assertEquals($input, new UntilTransformer(ref('id')->lessThan(lit(3)))->bind($input)->output); } public function test_passes_rows_until_the_predicate_stops_holding(): void @@ -127,7 +127,7 @@ public function test_a_non_boolean_predicate_is_rejected_at_bind(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('until() requires a predicate returning boolean'); - (new UntilTransformer(ref('id')))->transform(array_to_rows([[ + new UntilTransformer(ref('id'))->transform(array_to_rows([[ 'id' => 1, ]], schema(int_schema('id'))), flow_context(config())->backend()); } @@ -136,7 +136,7 @@ public function test_an_empty_batch_is_bound_against_its_own_schema(): void { $this->expectException(SchemaDefinitionNotFoundException::class); - (new UntilTransformer(ref('missing')->equals(lit(1))))->transform( + new UntilTransformer(ref('missing')->equals(lit(1)))->transform( rows(schema()), flow_context(config())->backend(), ); @@ -160,7 +160,7 @@ public function test_bind_refuses_an_expand_in_the_predicate(): void 'until() cannot contain array_expand(), it turns one row into many rows. Expand with withColumn() first, then use the new column.', ); - (new UntilTransformer(ref('tags')->expand()->equals(lit('x'))))->bind(ListColumnsMother::schema()); + new UntilTransformer(ref('tags')->expand()->equals(lit('x')))->bind(ListColumnsMother::schema()); } public function test_describe_round_trips(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/BoxLayoutTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/BoxLayoutTest.php index 037d5b9f4a..31140d939a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/BoxLayoutTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/BoxLayoutTest.php @@ -29,7 +29,7 @@ public function test_a_single_node_is_one_box(): void │ ──────────────────── │ │ Extractor: ArrayExtractor │ └───────────────────────────┘ - PLAN, (new BoxLayout())->render((new LogicalOutline())->of(NodeMother::read()))); + PLAN, new BoxLayout()->render(new LogicalOutline()->of(NodeMother::read()))); } public function test_a_chain_stacks_boxes_joined_at_their_centers(): void @@ -56,7 +56,7 @@ public function test_a_chain_stacks_boxes_joined_at_their_centers(): void │ Extractor: ArrayExtractor │ │ Limit: 5 │ └───────────────────────────┘ - PLAN, (new BoxLayout())->render((new LogicalOutline())->of(new Result(NodeMother::limit( + PLAN, new BoxLayout()->render(new LogicalOutline()->of(new Result(NodeMother::limit( new Collect(NodeMother::read()->withLimit(5)), 5, ))))); @@ -87,7 +87,7 @@ public function test_a_later_child_hangs_off_the_right_edge_and_a_shared_node_is │ ──────────────────── │ │ Extractor: ArrayExtractor │ └───────────────────────────┘ - PLAN, (new BoxLayout())->render((new LogicalOutline())->of( + PLAN, new BoxLayout()->render(new LogicalOutline()->of( new Outputs(new Result($filter), new Write($filter, to_memory(new ArrayMemory()))), ))); } @@ -116,7 +116,7 @@ public function test_a_middle_child_branches_off_the_same_line(): void │ #1 Read │ │ (shared) │ └───────────────────────────┘ - PLAN, (new BoxLayout())->render((new LogicalOutline())->of( + PLAN, new BoxLayout()->render(new LogicalOutline()->of( new Outputs( new Result($read), new Write($read, to_memory(new ArrayMemory())), @@ -143,7 +143,7 @@ public function test_long_text_wraps_and_a_word_longer_than_the_box_is_split(): │ ──────────────────── │ │ Extractor: ArrayExtractor │ └───────────────────────────┘ - PLAN, (new BoxLayout())->render((new LogicalOutline())->of( + PLAN, new BoxLayout()->render(new LogicalOutline()->of( new Rename(NodeMother::read(), 'id', 'identifier_of_the_customer_order'), ))); } @@ -154,7 +154,7 @@ public function test_span_counts_the_leaves_under_an_entry(): void static::assertSame( 3, - (new BoxLayout())->span((new LogicalOutline())->of( + new BoxLayout()->span(new LogicalOutline()->of( new Outputs( new Result($read), new Write($read, to_memory(new ArrayMemory())), @@ -162,11 +162,11 @@ public function test_span_counts_the_leaves_under_an_entry(): void ), )), ); - static::assertSame(1, (new BoxLayout())->span((new LogicalOutline())->of($read))); + static::assertSame(1, new BoxLayout()->span(new LogicalOutline()->of($read))); } public function test_wrap_keeps_short_text_on_one_line(): void { - static::assertSame(['Limit: 5'], (new BoxLayout())->wrap('Limit: 5')); + static::assertSame(['Limit: 5'], new BoxLayout()->wrap('Limit: 5')); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/ConditionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/ConditionTest.php index 80d6f091a3..5879e5a2f5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/ConditionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/ConditionTest.php @@ -16,8 +16,8 @@ final class ConditionTest extends FlowTestCase { public function test_a_comparison_reads_as_its_two_sides_around_its_operator(): void { - static::assertSame('id = user_id', (new Condition())->of(new Equal('id', 'user_id'))); - static::assertSame('id === user_id', (new Condition())->of(new Identical('id', 'user_id'))); + static::assertSame('id = user_id', new Condition()->of(new Equal('id', 'user_id'))); + static::assertSame('id === user_id', new Condition()->of(new Identical('id', 'user_id'))); } public function test_an_and_is_one_line_per_comparison_and_anything_else_stays_one_line(): void @@ -39,7 +39,7 @@ public function test_nested_comparisons_keep_their_operators(): void { static::assertSame( 'id = id AND (name = name OR tag === tag)', - (new Condition())->of( + new Condition()->of( new All(new Equal('id', 'id'), new Any(new Equal('name', 'name'), new Identical('tag', 'tag'))), ), ); @@ -47,6 +47,6 @@ public function test_nested_comparisons_keep_their_operators(): void public function test_a_comparison_the_explain_does_not_know_reads_as_its_name(): void { - static::assertSame('AlwaysMeets', (new Condition())->of(new AlwaysMeets())); + static::assertSame('AlwaysMeets', new Condition()->of(new AlwaysMeets())); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/ExpressionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/ExpressionTest.php index 91d458f13a..bcfe701be8 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/ExpressionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/ExpressionTest.php @@ -77,26 +77,26 @@ public static function values(): Generator #[DataProvider('operators')] public function test_an_operator_reads_as_its_operands_around_it(ScalarFunction $function, string $expected): void { - static::assertSame($expected, (new Expression())->of($function)); + static::assertSame($expected, new Expression()->of($function)); } #[DataProvider('betweens')] public function test_between_reads_as_its_boundary(Boundary $boundary, string $expected): void { - static::assertSame($expected, (new Expression())->of(ref('total')->between(lit(1), lit(10), $boundary))); + static::assertSame($expected, new Expression()->of(ref('total')->between(lit(1), lit(10), $boundary))); } #[DataProvider('values')] public function test_a_literal_reads_as_its_value(mixed $value, string $expected): void { - static::assertSame($expected, (new Expression())->of(lit($value))); + static::assertSame($expected, new Expression()->of(lit($value))); } public function test_a_nested_and_or_is_parenthesized(): void { static::assertSame( 'a = 1 AND (b = 2 OR c = 3)', - (new Expression())->of(all( + new Expression()->of(all( ref('a')->equals(lit(1)), any(ref('b')->equals(lit(2)), ref('c')->equals(lit(3))), )), @@ -107,25 +107,25 @@ public function test_a_not_or_comparison_inside_an_and_is_not_parenthesized(): v { static::assertSame( 'NOT active AND a = 1', - (new Expression())->of(all(not(ref('active')), ref('a')->equals(lit(1)))), + new Expression()->of(all(not(ref('active')), ref('a')->equals(lit(1)))), ); } public function test_an_operator_compared_is_parenthesized(): void { - static::assertSame('(a = 1) = true', (new Expression())->of(ref('a')->equals(lit(1))->equals(lit(true)))); + static::assertSame('(a = 1) = true', new Expression()->of(ref('a')->equals(lit(1))->equals(lit(true)))); } public function test_a_function_without_wording_reads_as_its_name_over_its_arguments(): void { - static::assertSame("ToUpper(name) = 'X'", (new Expression())->of(ref('name')->upper()->equals(lit('X')))); + static::assertSame("ToUpper(name) = 'X'", new Expression()->of(ref('name')->upper()->equals(lit('X')))); } public function test_between_with_a_literal_that_is_not_a_boundary_reads_as_its_name(): void { static::assertSame( "Between(total, 1, 10, 'x')", - (new Expression())->of(ref('total')->between(lit(1), lit(10), lit('x'))), + new Expression()->of(ref('total')->between(lit(1), lit(10), lit('x'))), ); } @@ -133,7 +133,7 @@ public function test_between_with_a_boundary_known_only_at_run_time_reads_as_its { static::assertSame( 'Between(total, 1, 10, boundary)', - (new Expression())->of(ref('total')->between(lit(1), lit(10), ref('boundary'))), + new Expression()->of(ref('total')->between(lit(1), lit(10), ref('boundary'))), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/FlowLayoutTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/FlowLayoutTest.php index a5c3820d4e..bebbc4930f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/FlowLayoutTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/FlowLayoutTest.php @@ -32,7 +32,7 @@ public function test_a_chain_is_printed_from_its_source_to_its_result(): void │ Limit: 5 └─ #4 Result Rows this plan hands out: to the trigger, or to the node reading it - PLAN, (new FlowLayout())->render((new LogicalOutline())->of(new Result(NodeMother::limit( + PLAN, new FlowLayout()->render(new LogicalOutline()->of(new Result(NodeMother::limit( new Collect(NodeMother::read()->withLimit(5)), 5, ))))); @@ -51,7 +51,7 @@ public function test_a_node_read_by_several_consumers_branches_and_outputs_is_le │ Rows this plan hands out: to the trigger, or to the node reading it └─ #4 Write Loader: MemoryLoader - PLAN, (new FlowLayout())->render((new LogicalOutline())->of( + PLAN, new FlowLayout()->render(new LogicalOutline()->of( new Outputs(new Result($filter), new Write($filter, to_memory(new ArrayMemory()))), ))); } @@ -71,7 +71,7 @@ public function test_every_reader_of_a_node_hangs_under_it(): void │ Keeps only: id └─ #5 Write Loader: MemoryLoader - PLAN, (new FlowLayout())->render((new LogicalOutline())->of( + PLAN, new FlowLayout()->render(new LogicalOutline()->of( new Outputs( new Result($read), new Write($read, to_memory(new ArrayMemory())), @@ -93,7 +93,7 @@ public function test_every_source_starts_its_own_tree_and_a_node_reached_again_i #2 Read │ Extractor: ArrayExtractor └─ #3 CrossJoin (shared) - PLAN, (new FlowLayout())->render((new LogicalOutline())->of(new Result( + PLAN, new FlowLayout()->render(new LogicalOutline()->of(new Result( new CrossJoin(NodeMother::read(), NodeMother::joinRight(NodeMother::plan(NodeMother::read()))), )))); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/LogicalOutlineTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/LogicalOutlineTest.php index 54b3f9c5ff..2ef41e7273 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/LogicalOutlineTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/LogicalOutlineTest.php @@ -22,7 +22,7 @@ public function test_a_node_is_numbered_after_everything_it_reads(): void $read = NodeMother::read(); $select = NodeMother::select($read); - $root = (new LogicalOutline())->of($select); + $root = new LogicalOutline()->of($select); static::assertSame($select, $root->source); static::assertSame(2, $root->number); @@ -37,7 +37,7 @@ public function test_outputs_has_no_number_and_a_node_reached_again_is_a_shared_ { $select = NodeMother::select(NodeMother::read()); - $root = (new LogicalOutline())->of( + $root = new LogicalOutline()->of( new Outputs(new Result($select), new Write($select, to_memory(new ArrayMemory()))), ); @@ -59,7 +59,7 @@ public function test_a_join_is_drawn_reading_what_its_right_sides_result_reads() { $limit = NodeMother::limit(NodeMother::read(), 5); - $join = (new LogicalOutline())->of(new Result( + $join = new LogicalOutline()->of(new Result( new CrossJoin(NodeMother::read(), NodeMother::joinRight(NodeMother::plan($limit))), ))->children[0]; $side = $join->children[1]; @@ -74,7 +74,7 @@ public function test_a_node_both_sides_read_is_a_shared_entry_as_the_right_side( { $select = NodeMother::select(NodeMother::read()); - $shared = (new LogicalOutline())->of(new Result( + $shared = new LogicalOutline()->of(new Result( new CrossJoin($select, NodeMother::joinRight(NodeMother::plan($select))), ))->children[0]->children[1]; @@ -88,7 +88,7 @@ public function test_an_outputs_right_side_stays_in_the_tree(): void $read = NodeMother::read(); $frame = new Outputs(new Result($read), new Write($read, to_memory(new ArrayMemory()))); - $side = (new LogicalOutline())->of(new Result( + $side = new LogicalOutline()->of(new Result( new CrossJoin(NodeMother::read(), $frame), ))->children[0]->children[1]; diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/NodeDetailsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/NodeDetailsTest.php index 366bc223e9..b26e37fb5f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/NodeDetailsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/NodeDetailsTest.php @@ -51,7 +51,7 @@ public function test_a_sort_labels_its_columns_with_the_direction_and_a_nulls_or { static::assertSame( ['Sort by: id desc, name asc nulls last'], - (new NodeDetails())->labelled(NodeMother::sort(NodeMother::read(), [ + new NodeDetails()->labelled(NodeMother::sort(NodeMother::read(), [ ref('id')->desc(), ref('name')->asc(NullsOrder::LAST), ])), @@ -60,7 +60,7 @@ public function test_a_sort_labels_its_columns_with_the_direction_and_a_nulls_or public function test_a_read_lists_its_extractor_only_when_nothing_was_pushed_into_it(): void { - static::assertSame(['Extractor: ArrayExtractor'], (new NodeDetails())->lines(NodeMother::read())); + static::assertSame(['Extractor: ArrayExtractor'], new NodeDetails()->lines(NodeMother::read())); } public function test_a_read_lists_a_pushed_limit_file_filter_and_each_conjunct(): void @@ -74,8 +74,8 @@ public function test_a_read_lists_a_pushed_limit_file_filter_and_each_conjunct() 'Filter: year > 1', 'Filter: month IS NOT NULL', ], - (new NodeDetails())->lines( - (new Read(PartitionedSourceMother::yearMonth())) + new NodeDetails()->lines( + new Read(PartitionedSourceMother::yearMonth()) ->withLimit(3) ->withPathFilter(new KeepAll()) ->withFilter(ref('year')->greaterThan(lit(1))->and(ref('month')->isNotNull())), @@ -87,7 +87,7 @@ public function test_files_are_each_pushed_file_filter_but_the_default_one(): vo { static::assertSame( ["country IN ('PL', 'DE')", 'KeepAll', 'year > 2020'], - (new NodeDetails())->files( + new NodeDetails()->files( new Filters( new OnlyFiles(), new ScalarFunctionFilter( @@ -106,7 +106,7 @@ public function test_files_are_each_pushed_file_filter_but_the_default_one(): vo ), ), ); - static::assertSame([], (new NodeDetails())->files(new OnlyFiles())); + static::assertSame([], new NodeDetails()->files(new OnlyFiles())); } public function test_nodes_with_arguments_label_them(): void @@ -130,7 +130,7 @@ public function test_a_join_labels_its_type_and_condition(): void 'On: id = id', 'Changes columns known only at run time', ], - (new NodeDetails())->lines(NodeMother::join( + new NodeDetails()->lines(NodeMother::join( NodeMother::read(), NodeMother::joinRight(NodeMother::plan(NodeMother::read())), )), @@ -147,7 +147,7 @@ public function test_a_join_labels_a_prefix_and_an_algorithm_only_when_they_were 'Prefix: joined_', 'Algorithm: HashJoin', ], - (new NodeDetails())->labelled( + new NodeDetails()->labelled( new JoinNode( NodeMother::read(), NodeMother::joinRight(NodeMother::plan(NodeMother::read())), @@ -175,13 +175,13 @@ public function test_a_result_says_what_it_returns(): void { static::assertSame( ['Rows this plan hands out: to the trigger, or to the node reading it'], - (new NodeDetails())->lines(new Result(NodeMother::read())), + new NodeDetails()->lines(new Result(NodeMother::read())), ); } public function test_a_node_without_arguments_has_no_details(): void { - static::assertSame([], (new NodeDetails())->lines(new CollectRefs(NodeMother::read(), refs()))); + static::assertSame([], new NodeDetails()->lines(new CollectRefs(NodeMother::read(), refs()))); } public function test_an_expand_column_shows_the_columns_it_keeps(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/PhysicalOutlineTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/PhysicalOutlineTest.php index d5670000ee..6197ce26b2 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/PhysicalOutlineTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/PhysicalOutlineTest.php @@ -26,7 +26,7 @@ final class PhysicalOutlineTest extends FlowTestCase { public function test_a_plan_without_a_breaker_is_one_pipeline(): void { - $root = (new PhysicalOutline())->of(PhysicalPlanMother::reading(from_array([['id' => 1]]))); + $root = new PhysicalOutline()->of(PhysicalPlanMother::reading(from_array([['id' => 1]]))); static::assertSame('Physical plan', $root->name); static::assertSame(['Columns: id'], $root->lines); @@ -53,7 +53,7 @@ public function test_every_step_is_listed_in_the_order_the_rows_reach_it(): void Processor: CollectingProcessor Schema: declared PLAN, - (new TreeLayout())->render((new PhysicalOutline())->of(PhysicalPlanMother::of( + new TreeLayout()->render(new PhysicalOutline()->of(PhysicalPlanMother::of( data_frame() ->read(from_array([['id' => 1]])) ->collect() @@ -88,7 +88,7 @@ public function test_a_joined_frame_is_a_plan_of_its_own_under_the_step_that_rea Extractor: ArrayExtractor Statistics: rows exact 1 · size unknown PLAN, - (new TreeLayout())->render((new PhysicalOutline())->of(PhysicalPlanMother::of( + new TreeLayout()->render(new PhysicalOutline()->of(PhysicalPlanMother::of( data_frame() ->read(from_array([['id' => 1]])) ->join( @@ -111,7 +111,7 @@ public function test_a_pushed_limit_is_listed_under_the_source_that_was_handed_i ' Limit: 1', 'Transformer: LimitTransformer', ], - (new PhysicalOutline())->of(PhysicalPlanMother::of( + new PhysicalOutline()->of(PhysicalPlanMother::of( data_frame()->read(from_array([['id' => 1], ['id' => 2]]))->limit(1), ))->children[0]->lines, ); @@ -124,9 +124,9 @@ public function test_a_pushed_filter_is_listed_under_the_file_source_that_was_of 'Extractor: RecordingFileExtractor', ' Filter: id > 1', ], - (new PhysicalOutline())->of(PhysicalPlanMother::of( + new PhysicalOutline()->of(PhysicalPlanMother::of( data_frame() - ->read((new RecordingFileExtractor(schema(int_schema('id'))))->withPruning()) + ->read(new RecordingFileExtractor(schema(int_schema('id')))->withPruning()) ->filter(ref('id')->greaterThan(lit(1))), ))->children[0]->lines, ); @@ -139,7 +139,7 @@ public function test_a_filter_the_file_source_does_not_prune_with_runs_as_a_tran 'Extractor: RecordingFileExtractor', 'Transformer: ScalarFunctionFilterTransformer', ], - (new PhysicalOutline())->of(PhysicalPlanMother::of( + new PhysicalOutline()->of(PhysicalPlanMother::of( data_frame() ->read(new RecordingFileExtractor(schema(int_schema('id')))) ->filter(ref('id')->greaterThan(lit(1))), @@ -151,7 +151,7 @@ public function test_a_plan_that_could_not_derive_its_schema_says_why(): void { static::assertStringStartsWith( 'Schema: not derivable - ', - (new PhysicalOutline())->of(PhysicalPlanMother::reading(new UndescribableRowLessExtractor()))->lines[0], + new PhysicalOutline()->of(PhysicalPlanMother::reading(new UndescribableRowLessExtractor()))->lines[0], ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/StatisticsLineTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/StatisticsLineTest.php index 4a1469ee5e..70c7343f6c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/StatisticsLineTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/StatisticsLineTest.php @@ -15,90 +15,84 @@ final class StatisticsLineTest extends FlowTestCase { public function test_an_exact_count_is_written_as_exact(): void { - static::assertSame('exact 1 000', (new StatisticsLine())->cardinality(Cardinality::exact(1_000))); + static::assertSame('exact 1 000', new StatisticsLine()->cardinality(Cardinality::exact(1_000))); } public function test_an_upper_bound_alone_is_written_as_at_most(): void { - static::assertSame('≤ 25 000', (new StatisticsLine())->cardinality(Cardinality::atMost(25_000))); + static::assertSame('≤ 25 000', new StatisticsLine()->cardinality(Cardinality::atMost(25_000))); } public function test_an_estimate_alone_carries_its_relative_error_in_percent(): void { - static::assertSame('~20 000 ±50%', (new StatisticsLine())->cardinality(Cardinality::approximately(20_000))); + static::assertSame('~20 000 ±50%', new StatisticsLine()->cardinality(Cardinality::approximately(20_000))); static::assertSame( '~20 000 ±12.5%', - (new StatisticsLine())->cardinality(Cardinality::approximately(20_000, 0.125)), + new StatisticsLine()->cardinality(Cardinality::approximately(20_000, 0.125)), ); } public function test_an_estimate_with_an_error_of_zero_and_no_bound_is_not_exact(): void { - static::assertSame('~7 ±0%', (new StatisticsLine())->cardinality(Cardinality::approximately(7, 0.0))); + static::assertSame('~7 ±0%', new StatisticsLine()->cardinality(Cardinality::approximately(7, 0.0))); } public function test_an_estimate_under_a_bound_lists_both(): void { - static::assertSame( - '~800 ±25% (≤ 1 000)', - (new StatisticsLine())->cardinality(new Cardinality(1_000, 800, 0.25)), - ); + static::assertSame('~800 ±25% (≤ 1 000)', new StatisticsLine()->cardinality(new Cardinality(1_000, 800, 0.25))); } public function test_an_estimate_equal_to_its_bound_is_not_exact_while_it_carries_an_error(): void { - static::assertSame('~1 000 ±50% (≤ 1 000)', (new StatisticsLine())->cardinality(new Cardinality(1_000, 1_000))); + static::assertSame('~1 000 ±50% (≤ 1 000)', new StatisticsLine()->cardinality(new Cardinality(1_000, 1_000))); } public function test_an_unknown_count_is_written_as_unknown(): void { - static::assertSame('unknown', (new StatisticsLine())->cardinality(Cardinality::unknown())); + static::assertSame('unknown', new StatisticsLine()->cardinality(Cardinality::unknown())); } public function test_numbers_are_grouped_in_thousands(): void { - static::assertSame('exact 0', (new StatisticsLine())->cardinality(Cardinality::exact(0))); - static::assertSame('exact 999', (new StatisticsLine())->cardinality(Cardinality::exact(999))); - static::assertSame( - 'exact 1 234 567 890', - (new StatisticsLine())->cardinality(Cardinality::exact(1_234_567_890)), - ); + static::assertSame('exact 0', new StatisticsLine()->cardinality(Cardinality::exact(0))); + static::assertSame('exact 999', new StatisticsLine()->cardinality(Cardinality::exact(999))); + static::assertSame('exact 1 234 567 890', new StatisticsLine()->cardinality(Cardinality::exact(1_234_567_890))); } public function test_the_unit_follows_every_number(): void { - static::assertSame('~800 B ±25% (≤ 1 000 B)', (new StatisticsLine())->cardinality( + static::assertSame('~800 B ±25% (≤ 1 000 B)', new StatisticsLine()->cardinality( new Cardinality(1_000, 800, 0.25), ' B', )); - static::assertSame('≤ 1 000 B', (new StatisticsLine())->cardinality(Cardinality::atMost(1_000), ' B')); - static::assertSame('exact 309 188 B', (new StatisticsLine())->cardinality(Cardinality::exact(309_188), ' B')); - static::assertSame('unknown', (new StatisticsLine())->cardinality(Cardinality::unknown(), ' B')); + static::assertSame('≤ 1 000 B', new StatisticsLine()->cardinality(Cardinality::atMost(1_000), ' B')); + static::assertSame('exact 309 188 B', new StatisticsLine()->cardinality(Cardinality::exact(309_188), ' B')); + static::assertSame('unknown', new StatisticsLine()->cardinality(Cardinality::unknown(), ' B')); } public function test_a_relative_error_is_written_in_percent(): void { - static::assertSame('0%', (new StatisticsLine())->percent(0.0)); - static::assertSame('45%', (new StatisticsLine())->percent(0.45)); - static::assertSame('33.33%', (new StatisticsLine())->percent(1 / 3)); - static::assertSame('250%', (new StatisticsLine())->percent(2.5)); + static::assertSame('0%', new StatisticsLine()->percent(0.0)); + static::assertSame('45%', new StatisticsLine()->percent(0.45)); + static::assertSame('33.33%', new StatisticsLine()->percent(1 / 3)); + static::assertSame('250%', new StatisticsLine()->percent(2.5)); } public function test_an_infinite_relative_error_is_written_as_infinity(): void { - static::assertSame('∞', (new StatisticsLine())->percent(INF)); + static::assertSame('∞', new StatisticsLine()->percent(INF)); } public function test_a_missing_relative_error_is_written_as_unknown(): void { - static::assertSame('unknown', (new StatisticsLine())->percent(null)); + static::assertSame('unknown', new StatisticsLine()->percent(null)); } public function test_the_line_lists_rows_then_size_in_bytes(): void { static::assertSame( 'rows exact 1 000 · size exact 309 188 B', - (new StatisticsLine())->of(new Statistics(Cardinality::exact(1_000), Cardinality::exact(309_188))), + new StatisticsLine()->of(new Statistics(Cardinality::exact(1_000), Cardinality::exact(309_188))), ); } @@ -106,16 +100,16 @@ public function test_the_line_lists_an_unknown_fact_next_to_a_known_one(): void { static::assertSame( 'rows unknown · size exact 10 B', - (new StatisticsLine())->of(new Statistics(size: Cardinality::exact(10))), + new StatisticsLine()->of(new Statistics(size: Cardinality::exact(10))), ); static::assertSame( 'rows ≤ 5 · size unknown', - (new StatisticsLine())->of(new Statistics(rows: Cardinality::atMost(5))), + new StatisticsLine()->of(new Statistics(rows: Cardinality::atMost(5))), ); } public function test_there_is_no_line_when_both_facts_are_unknown(): void { - static::assertNull((new StatisticsLine())->of(new Statistics())); + static::assertNull(new StatisticsLine()->of(new Statistics())); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/StepDetailsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/StepDetailsTest.php index 73a198b131..d7b1f09f9b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/StepDetailsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/StepDetailsTest.php @@ -83,7 +83,7 @@ public function test_a_hash_join_lists_its_condition_and_the_storage_it_was_give ' Buckets: 8', ' Batch: 500', ], - (new StepDetails())->lines( + new StepDetails()->lines( new JoinStep( HashJoinMother::with( Expression::on([new Equal('id', 'id')], 'joined_'), @@ -147,7 +147,7 @@ public function test_a_group_by_lists_its_columns_and_aggregations(): void { static::assertSame( ['Group by: name', 'Aggregations: Sum', 'Memory: 64 MiB', 'Storage: MemoryRowsStorage', 'Batch: 25'], - (new StepDetails())->settings(GroupByAggregationProcessorMother::with( + new StepDetails()->settings(GroupByAggregationProcessorMother::with( new GroupBy(refs(ref('name')), new Aggregators(sum(ref('id')))), new MemoryRowsStorage(), Unit::fromMb(64), @@ -185,7 +185,7 @@ public function test_a_repartition_lists_its_columns_and_storage(): void { static::assertSame( ['By: id', 'Memory: 64 MiB', 'Storage: MemoryRowsStorage'], - (new StepDetails())->settings(RepartitionProcessorMother::with( + new StepDetails()->settings(RepartitionProcessorMother::with( refs(ref('id')), new MemoryRowsStorage(), Unit::fromMb(64), @@ -243,7 +243,7 @@ public function test_a_window_lists_the_column_it_writes_and_its_function(): voi { static::assertSame( ['Column: rn', 'Function: RowNumber'], - (new StepDetails())->settings( + new StepDetails()->settings( new WindowProcessor('rn', row_number()->over(window()->partitionBy(ref('id')))), ), ); @@ -251,14 +251,14 @@ public function test_a_window_lists_the_column_it_writes_and_its_function(): voi public function test_a_step_the_explain_does_not_know_lists_nothing(): void { - static::assertSame([], (new StepDetails())->settings(new VoidProcessor())); + static::assertSame([], new StepDetails()->settings(new VoidProcessor())); } public function test_a_source_lists_the_statistics_it_declares(): void { static::assertSame( ['Statistics: rows exact 1 000 · size ~309 188 B ±50%'], - (new StepDetails())->settings(new DeclaringExtractor( + new StepDetails()->settings(new DeclaringExtractor( new Statistics(Cardinality::exact(1_000), Cardinality::approximately(309_188)), )), ); @@ -266,6 +266,6 @@ public function test_a_source_lists_the_statistics_it_declares(): void public function test_a_source_that_declares_nothing_lists_no_statistics(): void { - static::assertSame([], (new StepDetails())->settings(new DeclaringExtractor(new Statistics()))); + static::assertSame([], new StepDetails()->settings(new DeclaringExtractor(new Statistics()))); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/TreeLayoutTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/TreeLayoutTest.php index a4270d8614..4591bfaa2b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/TreeLayoutTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Explain/TreeLayoutTest.php @@ -37,7 +37,7 @@ final class TreeLayoutTest extends FlowTestCase { public function test_a_leaf_has_no_branches(): void { - static::assertSame([], (new TreeLayout())->branches(RenderedNodeMother::named('Read', 1), '│ ')); + static::assertSame([], new TreeLayout()->branches(RenderedNodeMother::named('Read', 1), '│ ')); } public function test_branches_keep_the_rail_open_for_every_child_but_the_last(): void @@ -52,7 +52,7 @@ public function test_branches_keep_the_rail_open_for_every_child_but_the_last(): [$second, '│ ├─ ', '│ │ '], [$third, '│ └─ ', '│ '], ], - (new TreeLayout())->branches(RenderedNodeMother::named('Read', 1, [$first, $second, $third]), '│ '), + new TreeLayout()->branches(RenderedNodeMother::named('Read', 1, [$first, $second, $third]), '│ '), ); } @@ -67,7 +67,7 @@ public function test_details_sit_under_their_node_inside_its_branch(): void └─ #1 Read Extractor: ArrayExtractor Limit: 5 - PLAN, (new TreeLayout())->render((new LogicalOutline())->of(new Result(NodeMother::limit( + PLAN, new TreeLayout()->render(new LogicalOutline()->of(new Result(NodeMother::limit( new Collect(NodeMother::read()->withLimit(5)), 5, ))))); @@ -88,7 +88,7 @@ public function test_a_shared_node_is_referenced_by_number_and_name(): void └─ #4 Write │ Loader: MemoryLoader └─ #2 Filter (shared) - PLAN, (new TreeLayout())->render((new LogicalOutline())->of( + PLAN, new TreeLayout()->render(new LogicalOutline()->of( new Outputs(new Result($filter), new Write($filter, to_memory(new ArrayMemory()))), ))); } @@ -111,7 +111,7 @@ public function test_every_child_but_the_last_keeps_the_rail_open(): void └─ #4 Select │ Keeps only: id └─ #1 Read (shared) - PLAN, (new TreeLayout())->render((new LogicalOutline())->of( + PLAN, new TreeLayout()->render(new LogicalOutline()->of( new Outputs( new Result($read), new Write($read, to_memory(new ArrayMemory())), @@ -131,9 +131,9 @@ public function test_with_declarations_a_single_chain_prints_one_line_per_node_w │ Keeps only: id └─ #1 Read source · transparent Extractor: ArrayExtractor - PLAN, (new TreeLayout())->render((new LogicalOutline( + PLAN, new TreeLayout()->render(new LogicalOutline( declarations: true, - ))->of((new LogicalPlan(new Result(NodeMother::limit(NodeMother::select(NodeMother::read()), 5))))->root))); + )->of(new LogicalPlan(new Result(NodeMother::limit(NodeMother::select(NodeMother::read()), 5)))->root))); } public function test_with_declarations_a_subtree_two_consumers_share_is_printed_once(): void @@ -151,9 +151,9 @@ public function test_with_declarations_a_subtree_two_consumers_share_is_printed_ └─ #4 Write preserving · opaque │ Loader: MemoryLoader └─ #2 Filter (shared) - PLAN, (new TreeLayout())->render((new LogicalOutline(declarations: true))->of((new LogicalPlan( + PLAN, new TreeLayout()->render(new LogicalOutline(declarations: true)->of(new LogicalPlan( new Outputs(new Result($filter), new Write($filter, to_memory(new ArrayMemory()))), - ))->root))); + )->root))); } public function test_with_declarations_payloads_and_redefinitions(): void @@ -172,7 +172,7 @@ public function test_with_declarations_payloads_and_redefinitions(): void └─ #2 RenameEach preserving · transparent · redefines unknown └─ #1 Read source · transparent Extractor: ArrayExtractor - PLAN, (new TreeLayout())->render((new LogicalOutline(declarations: true))->of((new LogicalPlan(new Result( + PLAN, new TreeLayout()->render(new LogicalOutline(declarations: true)->of(new LogicalPlan(new Result( new Until( new Offset( new Rename( @@ -188,7 +188,7 @@ public function test_with_declarations_payloads_and_redefinitions(): void ), lit(true), ), - )))->root))); + ))->root))); } public function test_with_declarations_a_joined_frame_is_part_of_the_tree(): void @@ -202,18 +202,18 @@ public function test_with_declarations_a_joined_frame_is_part_of_the_tree(): voi │ Extractor: ArrayExtractor └─ #2 Read source · transparent Extractor: ArrayExtractor - PLAN, (new TreeLayout())->render((new LogicalOutline(declarations: true))->of((new LogicalPlan(new Result( + PLAN, new TreeLayout()->render(new LogicalOutline(declarations: true)->of(new LogicalPlan(new Result( new CrossJoin(NodeMother::read(), NodeMother::joinRight(NodeMother::plan(NodeMother::read()))), - )))->root))); + ))->root))); } public function test_with_declarations_a_pushed_limit_shows_on_the_read_line(): void { static::assertStringContainsString( "Read source · transparent\n Extractor: ArrayExtractor\n Limit: 3", - (new TreeLayout())->render((new LogicalOutline( + new TreeLayout()->render(new LogicalOutline( declarations: true, - ))->of((new LogicalPlan(new Result(NodeMother::read()->withLimit(3))))->root)), + )->of(new LogicalPlan(new Result(NodeMother::read()->withLimit(3)))->root)), ); } @@ -232,7 +232,7 @@ public function test_with_declarations_a_run_trigger_keeps_a_result_beside_the_w └─ #4 Write preserving · opaque │ Loader: MemoryLoader └─ #1 Read (shared) - PLAN, (new TreeLayout())->render((new LogicalOutline(declarations: true))->of(Trigger::run->plan( + PLAN, new TreeLayout()->render(new LogicalOutline(declarations: true)->of(Trigger::run->plan( NodeMother::select($read), new Writes(new Write($read, to_memory(new ArrayMemory()))), )->root))); @@ -257,7 +257,7 @@ public function test_with_declarations_a_transaction_root_child_lists_its_writes └─ #4 Select preserving · transparent · redefines all but id │ Keeps only: id └─ #1 Read (shared) - PLAN, (new TreeLayout())->render((new LogicalOutline(declarations: true))->of((new LogicalPlan( + PLAN, new TreeLayout()->render(new LogicalOutline(declarations: true)->of(new LogicalPlan( new Outputs( new Result($read), new Transaction( @@ -266,6 +266,6 @@ public function test_with_declarations_a_transaction_root_child_lists_its_writes new Write(NodeMother::select($read), to_memory(new ArrayMemory())), ), ), - ))->root))); + )->root))); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/ExplainTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/ExplainTest.php index 329a997c25..edc4f8ab92 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/ExplainTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/ExplainTest.php @@ -20,23 +20,20 @@ public function test_the_tree_is_the_default(): void { $plan = NodeMother::plan(new Result(NodeMother::limit(NodeMother::read(), 5))); - static::assertSame( - (new TreeLayout())->render((new LogicalOutline())->of($plan->root)), - (new Explain())->of($plan), - ); + static::assertSame(new TreeLayout()->render(new LogicalOutline()->of($plan->root)), new Explain()->of($plan)); } public function test_each_format_renders_with_its_layout(): void { $plan = NodeMother::plan(new Result(NodeMother::limit(NodeMother::read(), 5))); - $outline = (new LogicalOutline())->of($plan->root); + $outline = new LogicalOutline()->of($plan->root); - static::assertSame((new TreeLayout())->render($outline), (new Explain())->of($plan, Format::tree)); - static::assertSame((new BoxLayout())->render($outline), (new Explain())->of($plan, Format::boxes)); - static::assertSame((new FlowLayout())->render($outline), (new Explain())->of($plan, Format::flow)); + static::assertSame(new TreeLayout()->render($outline), new Explain()->of($plan, Format::tree)); + static::assertSame(new BoxLayout()->render($outline), new Explain()->of($plan, Format::boxes)); + static::assertSame(new FlowLayout()->render($outline), new Explain()->of($plan, Format::flow)); static::assertSame( - (new TreeLayout())->render((new LogicalOutline(declarations: true))->of($plan->root)), - (new Explain())->of($plan, Format::declarations), + new TreeLayout()->render(new LogicalOutline(declarations: true)->of($plan->root)), + new Explain()->of($plan, Format::declarations), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/LogicalPlanTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/LogicalPlanTest.php index 5af9e9c4dc..564e7f8bbe 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/LogicalPlanTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/LogicalPlanTest.php @@ -34,13 +34,13 @@ public function test_writes_are_the_outputs_children_after_the_result(): void static::assertSame( [$first, $second], - (new LogicalPlan(new Outputs(new Result($read), $first, $second)))->writes()->all(), + new LogicalPlan(new Outputs(new Result($read), $first, $second))->writes()->all(), ); } public function test_writes_is_empty_for_a_result_root(): void { - static::assertSame([], (new LogicalPlan(new Result(NodeMother::read())))->writes()->all()); + static::assertSame([], new LogicalPlan(new Result(NodeMother::read()))->writes()->all()); } public function test_consumer_inputs_are_the_nodes_the_result_and_every_write_read(): void @@ -51,7 +51,7 @@ public function test_consumer_inputs_are_the_nodes_the_result_and_every_write_re static::assertSame( [$select, $read, $limit, $select], - (new LogicalPlan( + new LogicalPlan( new Outputs( new Result($select), new Write($read, to_memory(new ArrayMemory())), @@ -61,7 +61,7 @@ public function test_consumer_inputs_are_the_nodes_the_result_and_every_write_re new Write($select, to_memory(new ArrayMemory())), ), ), - ))->consumerInputs(), + )->consumerInputs(), ); } @@ -74,7 +74,7 @@ public function test_writes_on_spine_are_the_root_writes_then_the_writes_of_ever static::assertSame( [$outer, $inner], - (new LogicalPlan(new Outputs(new Result($select), $outer)))->writesOnSpine()->all(), + new LogicalPlan(new Outputs(new Result($select), $outer))->writesOnSpine()->all(), ); } @@ -129,9 +129,9 @@ public function test_transform_up_rewrites_a_node_shared_by_the_spine_and_a_writ { $select = NodeMother::select(NodeMother::read()); - $rewritten = (new LogicalPlan( + $rewritten = new LogicalPlan( new Outputs(new Result(NodeMother::limit($select, 5)), new Write($select, to_memory(new ArrayMemory()))), - ))->transformUp(new RenameSelectRewrite()); + )->transformUp(new RenameSelectRewrite()); $spineSelect = $rewritten->root->children()[0]->children()[0]->children()[0]; static::assertInstanceOf(Node\Select::class, $spineSelect); @@ -235,16 +235,16 @@ public function test_a_plan_whose_consumers_share_a_source_repeats(): void $read = NodeMother::read(); static::assertTrue( - (new LogicalPlan( + new LogicalPlan( new Outputs(new Result($read), new Write($read, to_memory(new ArrayMemory()))), - ))->isRepeatable(), + )->isRepeatable(), ); } public function test_a_plan_is_not_repeatable_when_a_write_reads_a_join_whose_right_side_is_not(): void { static::assertFalse( - (new LogicalPlan( + new LogicalPlan( new Outputs( new Result(NodeMother::read()), new Write( @@ -255,7 +255,7 @@ public function test_a_plan_is_not_repeatable_when_a_write_reads_a_join_whose_ri to_memory(new ArrayMemory()), ), ), - ))->isRepeatable(), + )->isRepeatable(), ); } @@ -305,12 +305,12 @@ public function test_spine_is_the_chain_under_the_first_consumer(): void { $select = NodeMother::select(NodeMother::read()); - static::assertSame($select, (new LogicalPlan(new Result($select)))->spine()); + static::assertSame($select, new LogicalPlan(new Result($select))->spine()); static::assertSame( $select, - (new LogicalPlan( + new LogicalPlan( new Outputs(new Result($select), new Write($select, to_memory(new ArrayMemory()))), - ))->spine(), + )->spine(), ); } @@ -318,7 +318,7 @@ public function test_spine_of_a_write_root_is_the_chain_that_write_reads(): void { $select = NodeMother::select(NodeMother::read()); - static::assertSame($select, (new LogicalPlan(new Write($select, to_memory(new ArrayMemory()))))->spine()); + static::assertSame($select, new LogicalPlan(new Write($select, to_memory(new ArrayMemory())))->spine()); } public function test_spine_throws_when_the_root_carries_no_consumer(): void @@ -328,7 +328,7 @@ public function test_spine_throws_when_the_root_carries_no_consumer(): void $this->expectException(InvalidLogicException::class); $this->expectExceptionMessage('A logical plan must have a consumer root, ' . $read::class . ' found'); - (new LogicalPlan($read))->spine(); + new LogicalPlan($read)->spine(); } public function test_spine_throws_when_the_first_consumer_is_a_transaction(): void @@ -336,16 +336,16 @@ public function test_spine_throws_when_the_first_consumer_is_a_transaction(): vo $this->expectException(InvalidLogicException::class); $this->expectExceptionMessage('The first consumer of a plan cannot be a Transaction'); - (new LogicalPlan( + new LogicalPlan( new Transaction(new RecordingTransaction(), new Write(NodeMother::read(), to_memory(new ArrayMemory()))), - ))->spine(); + )->spine(); } public function test_writes_of_a_write_root_are_that_write(): void { $write = new Write(NodeMother::read(), to_memory(new ArrayMemory())); - static::assertSame([$write], (new LogicalPlan($write))->writes()->all()); + static::assertSame([$write], new LogicalPlan($write)->writes()->all()); } public function test_writes_of_a_transaction_root_are_that_transaction(): void @@ -355,7 +355,7 @@ public function test_writes_of_a_transaction_root_are_that_transaction(): void new Write(NodeMother::read(), to_memory(new ArrayMemory())), ); - static::assertSame([$transaction], (new LogicalPlan($transaction))->writes()->all()); + static::assertSame([$transaction], new LogicalPlan($transaction)->writes()->all()); } public function test_consumer_inputs_of_a_write_root_are_the_chain_it_reads(): void @@ -364,7 +364,7 @@ public function test_consumer_inputs_of_a_write_root_are_the_chain_it_reads(): v static::assertSame( [$select], - (new LogicalPlan(new Write($select, to_memory(new ArrayMemory()))))->consumerInputs(), + new LogicalPlan(new Write($select, to_memory(new ArrayMemory())))->consumerInputs(), ); } @@ -375,9 +375,9 @@ public function test_consumer_inputs_of_a_result_and_a_write_are_the_chains_both static::assertSame( [$read, $select], - (new LogicalPlan( + new LogicalPlan( new Outputs(new Result($read), new Write($select, to_memory(new ArrayMemory()))), - ))->consumerInputs(), + )->consumerInputs(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/CrossJoinTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/CrossJoinTest.php index 2584437fff..5ade0e7067 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/CrossJoinTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/CrossJoinTest.php @@ -64,7 +64,7 @@ public function test_an_outputs_root_is_accepted_as_the_right_side(): void $read = NodeMother::read(); $frame = new Outputs(new Result($read), new Write($read, to_memory(new ArrayMemory()))); - static::assertSame([$input, $frame], (new CrossJoin($input, $frame, 'r_'))->children()); + static::assertSame([$input, $frame], new CrossJoin($input, $frame, 'r_')->children()); } public function test_a_right_side_that_is_not_a_plan_root_is_refused(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/ExpandColumnTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/ExpandColumnTest.php index 1a296b1eb9..5dac6fe9b2 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/ExpandColumnTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/ExpandColumnTest.php @@ -25,14 +25,14 @@ public function test_children_returns_its_input(): void { $input = NodeMother::read(); - static::assertSame([$input], (new ExpandColumn($input, 'item', array_expand(ref('items'))))->children()); + static::assertSame([$input], new ExpandColumn($input, 'item', array_expand(ref('items')))->children()); } public function test_carries_every_column_until_told_otherwise(): void { static::assertEquals( RequiredColumns::all(), - (new ExpandColumn(NodeMother::read(), 'item', array_expand(ref('items'))))->carries, + new ExpandColumn(NodeMother::read(), 'item', array_expand(ref('items')))->carries, ); } @@ -48,12 +48,12 @@ public function test_with_children_keeps_entry_function_and_carries(): void { $other = NodeMother::read(); $function = array_expand(ref('items')); - $rebuilt = (new ExpandColumn( + $rebuilt = new ExpandColumn( NodeMother::read(), 'item', $function, RequiredColumns::only('item'), - ))->withChildren([$other]); + )->withChildren([$other]); static::assertSame([$other], $rebuilt->children()); static::assertSame('item', $rebuilt->column); @@ -64,7 +64,7 @@ public function test_with_children_keeps_entry_function_and_carries(): void public function test_with_carries_replaces_only_the_carries(): void { $input = NodeMother::read(); - $node = (new ExpandColumn($input, 'item', array_expand(ref('items'))))->withCarries(RequiredColumns::allBut( + $node = new ExpandColumn($input, 'item', array_expand(ref('items')))->withCarries(RequiredColumns::allBut( 'items', )); @@ -83,9 +83,9 @@ public function test_declarations(): void public function test_an_expand_nested_in_a_structure_is_expanding_too(): void { - static::assertSame(RowCount::expanding, (new ExpandColumn(NodeMother::read(), 'item', structure([ + static::assertSame(RowCount::expanding, new ExpandColumn(NodeMother::read(), 'item', structure([ 'tag' => array_expand(ref('items')), - ])))->rowCount()); + ]))->rowCount()); } public function test_redefines_the_definitions_name_when_the_entry_is_a_definition(): void @@ -100,11 +100,11 @@ public function test_an_expand_column_replaces_its_own_name_with_what_it_reads() { static::assertEquals( RequiredColumns::only('items'), - (new ExpandColumn( + new ExpandColumn( NodeMother::read(), 'item', ref('items')->expand(), - ))->requiredInputColumns(RequiredColumns::only('item')), + )->requiredInputColumns(RequiredColumns::only('item')), ); } @@ -112,11 +112,11 @@ public function test_an_unpack_keeps_the_demand_and_adds_what_it_reads(): void { static::assertEquals( RequiredColumns::only('s.a', 'items'), - (new ExpandColumn( + new ExpandColumn( NodeMother::read(), 's', structure(['a' => ref('items')->expand()])->unpack(schema(int_schema('a'))), - ))->requiredInputColumns(RequiredColumns::only('s.a')), + )->requiredInputColumns(RequiredColumns::only('s.a')), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/FilterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/FilterTest.php index ebe9ad9bef..c34bab9805 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/FilterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/FilterTest.php @@ -54,10 +54,10 @@ public function test_a_filter_adds_the_source_columns_its_predicate_reads(): voi { static::assertEquals( RequiredColumns::only('x', 'id'), - (new Filter( + new Filter( NodeMother::read(), ref('id')->as('alias')->isNotNull(), - ))->requiredInputColumns(RequiredColumns::only('x')), + )->requiredInputColumns(RequiredColumns::only('x')), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/JoinTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/JoinTest.php index 94895437db..3896ef0f18 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/JoinTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/JoinTest.php @@ -73,7 +73,7 @@ public function test_an_outputs_root_is_accepted_as_the_right_side(): void static::assertSame( [$input, $frame], - (new Join($input, $frame, join_on(['id' => 'id']), JoinType::inner, hash_join()))->children(), + new Join($input, $frame, join_on(['id' => 'id']), JoinType::inner, hash_join())->children(), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/OffsetTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/OffsetTest.php index d1d6dde435..2d5917a756 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/OffsetTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/OffsetTest.php @@ -17,7 +17,7 @@ final class OffsetTest extends FlowTestCase { public function test_a_zero_offset_is_allowed(): void { - static::assertSame(0, (new Offset(NodeMother::read(), 0))->offset); + static::assertSame(0, new Offset(NodeMother::read(), 0)->offset); } public function test_with_children_returns_the_same_instance_when_children_are_identical(): void @@ -65,7 +65,7 @@ public function test_an_offset_passes_the_demand_through(): void { static::assertEquals( RequiredColumns::only('x'), - (new Offset(NodeMother::read(), 5))->requiredInputColumns(RequiredColumns::only('x')), + new Offset(NodeMother::read(), 5)->requiredInputColumns(RequiredColumns::only('x')), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/OutputsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/OutputsTest.php index 09fa951c82..2e61115da4 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/OutputsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/OutputsTest.php @@ -28,7 +28,7 @@ public function test_the_consumers_are_the_children_in_order(): void $write = new Write($read, to_memory(new ArrayMemory())); $transaction = new Transaction(new RecordingTransaction(), new Write($read, to_memory(new ArrayMemory()))); - static::assertSame([$result, $write, $transaction], (new Outputs($result, $write, $transaction))->children()); + static::assertSame([$result, $write, $transaction], new Outputs($result, $write, $transaction)->children()); } public function test_writes_are_the_write_and_transaction_consumers(): void @@ -39,7 +39,7 @@ public function test_writes_are_the_write_and_transaction_consumers(): void static::assertSame( [$write, $transaction], - (new Outputs(new Result($read), $write, $transaction))->writes()->all(), + new Outputs(new Result($read), $write, $transaction)->writes()->all(), ); } @@ -57,7 +57,7 @@ public function test_a_write_is_accepted_as_the_spine_consumer(): void $first = new Write($read, to_memory(new ArrayMemory())); $second = new Write($read, to_memory(new ArrayMemory())); - static::assertSame([$first, $second], (new Outputs($first, $second))->children()); + static::assertSame([$first, $second], new Outputs($first, $second)->children()); } public function test_the_spine_consumer_cannot_be_a_transaction(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/ReadTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/ReadTest.php index 19f1bec928..984f300a20 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/ReadTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/ReadTest.php @@ -25,7 +25,7 @@ final class ReadTest extends FlowTestCase { public function test_children_is_empty(): void { - static::assertSame([], (new Read(from_array([['id' => 1]])))->children()); + static::assertSame([], new Read(from_array([['id' => 1]]))->children()); } public function test_with_children_is_a_no_op(): void @@ -65,7 +65,7 @@ public function test_with_path_filter_and_with_filter_push_into_the_criteria_and static::assertEquals(new Criteria(3), $read->criteria()); static::assertEquals( - (new Criteria(3)) + new Criteria(3) ->withPathFilter($pathFilter) ->withFilter($filter), $pushed->criteria(), @@ -85,7 +85,7 @@ public function test_with_offset_pushes_into_the_criteria_of_a_file_extractor(): { static::assertSame( 7, - (new Read(PartitionedSourceMother::yearMonth()))->withOffset(3)->withOffset(4)->criteria()->offset, + new Read(PartitionedSourceMother::yearMonth())->withOffset(3)->withOffset(4)->criteria()->offset, ); } @@ -93,7 +93,7 @@ public function test_with_offset_is_refused_on_an_extractor_that_is_no_file_extr { $this->expectException(InvalidArgumentException::class); - (new Read(from_array([['id' => 1]])))->withOffset(3); + new Read(from_array([['id' => 1]]))->withOffset(3); } public function test_with_limit_refuses_zero_or_less(): void @@ -101,7 +101,7 @@ public function test_with_limit_refuses_zero_or_less(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Limit must be greater than 0'); - (new Read(from_array([['id' => 1]])))->withLimit(0); + new Read(from_array([['id' => 1]]))->withLimit(0); } public function test_a_filter_is_refused_for_an_extractor_that_is_no_file_extractor(): void @@ -111,7 +111,7 @@ public function test_a_filter_is_refused_for_an_extractor_that_is_no_file_extrac 'Only a FileExtractor reads a pushed filter, Flow\ETL\IO\Extractor\ArrayExtractor does not', ); - (new Read(from_array([['id' => 1]])))->withFilter(ref('id')->greaterThan(lit(1))); + new Read(from_array([['id' => 1]]))->withFilter(ref('id')->greaterThan(lit(1))); } public function test_a_path_filter_is_refused_for_an_extractor_that_is_no_file_extractor(): void @@ -121,7 +121,7 @@ public function test_a_path_filter_is_refused_for_an_extractor_that_is_no_file_e 'Only a FileExtractor reads a pushed filter, Flow\ETL\IO\Extractor\ArrayExtractor does not', ); - (new Read(from_array([['id' => 1]])))->withPathFilter(new RejectingFilter()); + new Read(from_array([['id' => 1]]))->withPathFilter(new RejectingFilter()); } public function test_pushed_columns_are_refused_for_an_extractor_that_is_no_file_extractor(): void @@ -131,14 +131,14 @@ public function test_pushed_columns_are_refused_for_an_extractor_that_is_no_file 'Only a FileExtractor reads a pushed filter, Flow\ETL\IO\Extractor\ArrayExtractor does not', ); - (new Read(from_array([['id' => 1]])))->withColumns('id'); + new Read(from_array([['id' => 1]]))->withColumns('id'); } public function test_schema_delegates_to_the_extractor(): void { static::assertEquals( schema(int_schema('id')), - (new Read(from_array([['id' => 1]], schema(int_schema('id')))))->schema(), + new Read(from_array([['id' => 1]], schema(int_schema('id'))))->schema(), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/RenameTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/RenameTest.php index 3a8aa190d4..9151f38b7f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/RenameTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/RenameTest.php @@ -51,7 +51,7 @@ public function test_any_other_node_requires_every_column(): void { static::assertEquals( RequiredColumns::all(), - (new Rename(NodeMother::read(), 'a', 'b'))->requiredInputColumns(RequiredColumns::only('b')), + new Rename(NodeMother::read(), 'a', 'b')->requiredInputColumns(RequiredColumns::only('b')), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/SelectTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/SelectTest.php index 3b3b9b2f83..1338b4381a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/SelectTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/SelectTest.php @@ -52,10 +52,10 @@ public function test_a_select_requires_exactly_its_columns_whatever_is_above(): { static::assertEquals( RequiredColumns::only('a', 'b'), - (new Select(NodeMother::read(), [ + new Select(NodeMother::read(), [ 'a', ref('b'), - ]))->requiredInputColumns(RequiredColumns::allBut('x')), + ])->requiredInputColumns(RequiredColumns::allBut('x')), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/TopNTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/TopNTest.php index e1efdb0960..e8a236a2a9 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/TopNTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/TopNTest.php @@ -18,14 +18,14 @@ final class TopNTest extends FlowTestCase { public function test_a_limit_of_one_is_allowed(): void { - static::assertSame(1, (new TopN(NodeMother::read(), [ref('id')->asc()], 1))->limit); + static::assertSame(1, new TopN(NodeMother::read(), [ref('id')->asc()], 1)->limit); } public function test_children_is_the_input(): void { $input = NodeMother::read(); - static::assertSame([$input], (new TopN($input, [ref('id')->asc()], 3))->children()); + static::assertSame([$input], new TopN($input, [ref('id')->asc()], 3)->children()); } public function test_with_children_returns_the_same_instance_when_children_are_identical(): void @@ -41,7 +41,7 @@ public function test_with_children_keeps_columns_and_limit_over_a_new_input(): v $columns = [ref('id')->asc()]; $replacement = NodeMother::read(); - $rebuilt = (new TopN(NodeMother::read(), $columns, 3))->withChildren([$replacement]); + $rebuilt = new TopN(NodeMother::read(), $columns, 3)->withChildren([$replacement]); static::assertSame([$replacement], $rebuilt->children()); static::assertSame($columns, $rebuilt->columns); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/TransactionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/TransactionTest.php index a9037b6ade..bbca8e844b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/TransactionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/TransactionTest.php @@ -29,10 +29,7 @@ public function test_children_are_the_writes_in_declaration_order(): void $first = new Write($read, to_memory(new ArrayMemory())); $second = new Write($read, to_memory(new ArrayMemory())); - static::assertSame( - [$first, $second], - (new Transaction(new RecordingTransaction(), $first, $second))->children(), - ); + static::assertSame([$first, $second], new Transaction(new RecordingTransaction(), $first, $second)->children()); } public function test_writes_given_by_key_are_kept_as_a_list(): void @@ -41,10 +38,10 @@ public function test_writes_given_by_key_are_kept_as_a_list(): void $first = new Write($read, to_memory(new ArrayMemory())); $second = new Write($read, to_memory(new ArrayMemory())); - static::assertSame([$first, $second], (new Transaction(new RecordingTransaction(), ...[ + static::assertSame([$first, $second], new Transaction(new RecordingTransaction(), ...[ 'a' => $first, 'b' => $second, - ]))->children()); + ])->children()); } public function test_a_transaction_without_a_write_is_refused(): void @@ -97,12 +94,12 @@ public function test_the_source_is_reached_through_a_transaction(): void static::assertSame( $read, - (new LogicalPlan(new Result( + new LogicalPlan(new Result( new Transaction( new RecordingTransaction(), new Write(NodeMother::select($read), to_memory(new ArrayMemory())), ), - )))->source(), + ))->source(), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/WithColumnTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/WithColumnTest.php index 066bf4e78c..ab1cf5d5a1 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/WithColumnTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/Node/WithColumnTest.php @@ -24,7 +24,7 @@ public function test_children_returns_its_inputs(): void { $input = NodeMother::read(); - static::assertSame([$input], (new WithColumn($input, 'doubled', ref('id')->multiply(lit(2))))->children()); + static::assertSame([$input], new WithColumn($input, 'doubled', ref('id')->multiply(lit(2)))->children()); } public function test_with_children_returns_the_same_instance_when_children_are_identical(): void @@ -106,11 +106,11 @@ public function test_an_unpack_keeps_the_demand_and_adds_what_it_reads(): void { static::assertEquals( RequiredColumns::only('s', 'm'), - (new WithColumn( + new WithColumn( NodeMother::read(), 's', ref('m')->unpack(schema(int_schema('a'))), - ))->requiredInputColumns(RequiredColumns::only('s')), + )->requiredInputColumns(RequiredColumns::only('s')), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/PlanTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/PlanTest.php index 6e1250d78f..656c53c167 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/PlanTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/PlanTest.php @@ -48,7 +48,7 @@ public function test_to_string_prints_the_tree_its_optimizer_rewrites_by_default ); static::assertSame( - (new Explain())->of(NodeMother::plan(new Limit(NodeMother::read(), 3)), Format::tree), + new Explain()->of(NodeMother::plan(new Limit(NodeMother::read(), 3)), Format::tree), $plan->toString(), ); } @@ -61,7 +61,7 @@ public function test_to_string_prints_the_requested_stage_and_format(): void ); static::assertSame( - (new Explain())->of($plan->logical, Format::boxes), + new Explain()->of($plan->logical, Format::boxes), $plan->toString(Stage::unoptimized, Format::boxes), ); static::assertNotSame($plan->toString(), $plan->toString(Stage::unoptimized)); @@ -72,7 +72,7 @@ public function test_the_physical_stage_prints_the_plan_the_executor_would_run() $plan = Plan::of(NodeMother::plan(NodeMother::read()), config()->planner()); static::assertSame( - (new Explain())->physical($plan->planner->plan($plan->logical), Format::tree), + new Explain()->physical($plan->planner->plan($plan->logical), Format::tree), $plan->toString(Stage::physical), ); static::assertStringStartsWith('Physical plan', $plan->toString(Stage::physical)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/ReplaceNodesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/ReplaceNodesTest.php index df46aaa60a..82cd04e131 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/ReplaceNodesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/ReplaceNodesTest.php @@ -48,7 +48,7 @@ public function test_a_removed_node_gives_way_to_its_rewritten_child(): void /** @var SplObjectStorage $replacements */ $replacements = new SplObjectStorage(); - static::assertSame($read, (new ReplaceNodes($replacements, [$target]))->of($target, $rebuilt)); + static::assertSame($read, new ReplaceNodes($replacements, [$target])->of($target, $rebuilt)); } public function test_a_target_replaced_by_its_own_child_keeps_the_childs_rewritten_children(): void @@ -69,7 +69,7 @@ public function test_a_node_of_other_than_one_child_is_not_removed(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Only a node of one child gives way to it, ' . $target::class . ' has 0'); - (new ReplaceNodes($replacements, [$target]))->of($target, $target); + new ReplaceNodes($replacements, [$target])->of($target, $target); } public function test_a_node_both_replaced_and_removed_is_refused(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/TransformUpTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/TransformUpTest.php index 6080db6e2f..df73dd6e99 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/TransformUpTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/TransformUpTest.php @@ -24,7 +24,7 @@ public function test_children_are_rewritten_before_their_parent(): void { $visited = []; - (new TransformUp())->of(NodeMother::limit(NodeMother::select(NodeMother::read()), 5), new class( + new TransformUp()->of(NodeMother::limit(NodeMother::select(NodeMother::read()), 5), new class( $visited, ) implements Rewrite { /** @@ -49,7 +49,7 @@ public function test_a_rewrite_that_changes_nothing_returns_the_same_root_object { $root = NodeMother::limit(NodeMother::select(NodeMother::read()), 5); - static::assertSame($root, (new TransformUp())->of($root, new class implements Rewrite { + static::assertSame($root, new TransformUp()->of($root, new class implements Rewrite { public function of(Node $original, Node $rebuilt): Node { return $rebuilt; @@ -71,7 +71,7 @@ public function test_one_instance_rewrites_a_node_once_however_often_it_is_reach public function test_a_parent_sees_its_rewritten_child(): void { - $rewritten = (new TransformUp())->of( + $rewritten = new TransformUp()->of( NodeMother::limit(NodeMother::select(NodeMother::read()), 5), new RenameSelectRewrite(), ); @@ -100,7 +100,7 @@ public static function joins_sharing_a_node(): Generator public function test_a_joins_right_side_is_handed_back_untouched_even_when_it_shares_a_node_with_the_left( JoinsFrame $join, ): void { - $rewritten = (new TransformUp())->of($join, new RenameSelectRewrite()); + $rewritten = new TransformUp()->of($join, new RenameSelectRewrite()); static::assertInstanceOf(JoinsFrame::class, $rewritten); $left = $rewritten->children()[0]; diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/WritesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/WritesTest.php index 95471262df..95d4cab888 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/WritesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Logical/WritesTest.php @@ -43,7 +43,7 @@ public function test_writes_given_by_key_are_kept_as_a_list(): void $first = new Write($read, to_memory(new ArrayMemory())); $second = new Write($read, to_memory(new ArrayMemory())); - static::assertSame([$first, $second], (new Writes(...['a' => $first, 'b' => $second]))->all()); + static::assertSame([$first, $second], new Writes(...['a' => $first, 'b' => $second])->all()); } public function test_merge_appends_the_given_writes_after_its_own(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/JoinSidesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/JoinSidesTest.php index 9cbe8c4ec0..d6ea02a6fa 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/JoinSidesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/JoinSidesTest.php @@ -20,17 +20,17 @@ public function test_a_node_that_is_not_a_join_is_returned_as_it_is(): void { $limit = NodeMother::limit(NodeMother::read(), 5); - static::assertSame($limit, (new JoinSides(Optimizer::default(), config()->backend()))->of($limit, $limit)); + static::assertSame($limit, new JoinSides(Optimizer::default(), config()->backend())->of($limit, $limit)); } public function test_a_joins_right_side_is_optimized_as_its_own_plan(): void { $join = NodeMother::join(NodeMother::read(), NodeMother::plan(NodeMother::limit(NodeMother::read(), 3))->root); - $rewritten = (new JoinSides(Optimizer::default(), config()->backend()))->of($join, $join); + $rewritten = new JoinSides(Optimizer::default(), config()->backend())->of($join, $join); static::assertInstanceOf(Join::class, $rewritten); - static::assertSame(3, (new LogicalPlan($rewritten->right()))->source()->criteria()->limit); + static::assertSame(3, new LogicalPlan($rewritten->right())->source()->criteria()->limit); static::assertSame($join->children()[0], $rewritten->children()[0]); } @@ -41,16 +41,16 @@ public function test_a_cross_joins_right_side_is_optimized_as_its_own_plan(): vo NodeMother::plan(NodeMother::limit(NodeMother::read(), 3))->root, ); - $rewritten = (new JoinSides(Optimizer::default(), config()->backend()))->of($join, $join); + $rewritten = new JoinSides(Optimizer::default(), config()->backend())->of($join, $join); static::assertInstanceOf(CrossJoin::class, $rewritten); - static::assertSame(3, (new LogicalPlan($rewritten->right()))->source()->criteria()->limit); + static::assertSame(3, new LogicalPlan($rewritten->right())->source()->criteria()->limit); } public function test_a_join_whose_right_side_does_not_change_keeps_its_identity(): void { $join = NodeMother::crossJoin(NodeMother::read(), NodeMother::plan(NodeMother::read())->root); - static::assertSame($join, (new JoinSides(new Optimizer(), config()->backend()))->of($join, $join)); + static::assertSame($join, new JoinSides(new Optimizer(), config()->backend())->of($join, $join)); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/OptimizerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/OptimizerTest.php index 9243015eb2..364e0edd0f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/OptimizerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/OptimizerTest.php @@ -30,7 +30,7 @@ public function test_optimize_applies_every_rule_once_in_registration_order(): v $log = new ArrayObject(); $plan = NodeMother::plan(NodeMother::read()); - $optimized = (new Optimizer(new RecordingRule('first', $log), new RecordingRule('second', $log)))->optimize( + $optimized = new Optimizer(new RecordingRule('first', $log), new RecordingRule('second', $log))->optimize( $plan, config()->backend(), ); @@ -45,7 +45,7 @@ public function test_optimize_applies_the_rules_to_a_joins_right_side_first(): v $log = new ArrayObject(); $plan = NodeMother::plan(NodeMother::crossJoin(NodeMother::read(), NodeMother::plan(NodeMother::read())->root)); - (new Optimizer(new RecordingRule('first', $log), new RecordingRule('second', $log)))->optimize( + new Optimizer(new RecordingRule('first', $log), new RecordingRule('second', $log))->optimize( $plan, config()->backend(), ); @@ -57,7 +57,7 @@ public function test_an_optimizer_without_rules_returns_the_plan_it_was_given(): { $plan = NodeMother::plan(NodeMother::read()); - static::assertSame($plan, (new Optimizer())->optimize($plan, config()->backend())); + static::assertSame($plan, new Optimizer()->optimize($plan, config()->backend())); } public function test_default_registers_combine_limits_combine_sort_and_limit_push_filter_push_offset_push_limit_then_count_from_statistics(): void @@ -120,7 +120,7 @@ public function test_with_appends_the_rules_after_the_registered_ones(): void [CombineLimits::class, RecordingRule::class], array_map( static fn($rule) => $rule::class, - (new Optimizer(new CombineLimits())) + new Optimizer(new CombineLimits()) ->with(new RecordingRule('first', $log)) ->rules(), ), @@ -147,6 +147,6 @@ public function test_with_throws_on_the_same_rule_class_given_twice(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage(CombineLimits::class . ' is already a registered optimizer rule'); - (new Optimizer())->with(new CombineLimits(), new CombineLimits()); + new Optimizer()->with(new CombineLimits(), new CombineLimits()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/CombineLimitsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/CombineLimitsTest.php index ec8aa0dbc6..55034ca1b3 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/CombineLimitsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/CombineLimitsTest.php @@ -19,7 +19,7 @@ public function test_two_adjacent_limits_fold_to_the_minimum(): void $read = NodeMother::read(); $plan = NodeMother::plan(NodeMother::limit(NodeMother::limit($read, 10), 3)); - $root = (new CombineLimits())->apply($plan, config()->backend())->root->children()[0]; + $root = new CombineLimits()->apply($plan, config()->backend())->root->children()[0]; static::assertInstanceOf(Limit::class, $root); static::assertSame(3, $root->limit); @@ -31,7 +31,7 @@ public function test_three_adjacent_limits_fold_to_the_minimum(): void $read = NodeMother::read(); $plan = NodeMother::plan(NodeMother::limit(NodeMother::limit(NodeMother::limit($read, 10), 2), 7)); - $root = (new CombineLimits())->apply($plan, config()->backend())->root->children()[0]; + $root = new CombineLimits()->apply($plan, config()->backend())->root->children()[0]; static::assertInstanceOf(Limit::class, $root); static::assertSame(2, $root->limit); @@ -42,7 +42,7 @@ public function test_non_adjacent_limits_are_left_alone(): void { $plan = NodeMother::plan(NodeMother::limit(NodeMother::select(NodeMother::limit(NodeMother::read(), 10)), 3)); - $root = (new CombineLimits())->apply($plan, config()->backend())->root->children()[0]; + $root = new CombineLimits()->apply($plan, config()->backend())->root->children()[0]; static::assertSame($plan->root->children()[0], $root); static::assertInstanceOf(Limit::class, $root); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/CombineSortAndLimitTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/CombineSortAndLimitTest.php index 3179d8f062..1779486c98 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/CombineSortAndLimitTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/CombineSortAndLimitTest.php @@ -28,7 +28,7 @@ public function test_a_limit_over_a_sort_becomes_a_top_n_over_the_sorts_input(): $read = NodeMother::read(); $columns = [ref('id')->asc()]; - $topN = (new CombineSortAndLimit()) + $topN = new CombineSortAndLimit() ->apply(NodeMother::plan(NodeMother::limit(new Sort($read, $columns), 5)), config()->backend()) ->spine(); static::assertInstanceOf(TopN::class, $topN); @@ -41,7 +41,7 @@ public function test_a_limit_over_anything_else_is_left_alone(): void { $plan = NodeMother::plan(NodeMother::limit(NodeMother::select(NodeMother::sort(NodeMother::read())), 5)); - static::assertSame($plan->root, (new CombineSortAndLimit())->apply($plan, config()->backend())->root); + static::assertSame($plan->root, new CombineSortAndLimit()->apply($plan, config()->backend())->root); } public function test_a_sort_another_consumer_reads_stays_for_that_consumer(): void @@ -49,7 +49,7 @@ public function test_a_sort_another_consumer_reads_stays_for_that_consumer(): vo $sort = NodeMother::sort(NodeMother::read()); $write = new Write($sort, to_memory(new ArrayMemory())); - $plan = (new CombineSortAndLimit())->apply( + $plan = new CombineSortAndLimit()->apply( new LogicalPlan(new Outputs(new Result(NodeMother::limit($sort, 5)), $write)), config()->backend(), ); @@ -63,14 +63,14 @@ public function test_a_node_that_is_not_a_limit_is_returned_as_is(): void { $sort = NodeMother::sort(NodeMother::read()); - static::assertSame($sort, (new CombineSortAndLimit())->of($sort, $sort)); + static::assertSame($sort, new CombineSortAndLimit()->of($sort, $sort)); } public function test_a_limit_over_anything_but_a_sort_is_returned_as_is(): void { $limit = NodeMother::limit(NodeMother::select(NodeMother::sort(NodeMother::read())), 5); - static::assertSame($limit, (new CombineSortAndLimit())->of($limit, $limit)); + static::assertSame($limit, new CombineSortAndLimit()->of($limit, $limit)); } public function test_a_limit_over_a_sort_becomes_a_top_n_over_the_sorts_input_columns_and_limit(): void @@ -79,7 +79,7 @@ public function test_a_limit_over_a_sort_becomes_a_top_n_over_the_sorts_input_co $columns = [ref('id')->asc()]; $limit = NodeMother::limit(new Sort($read, $columns), 5); - $topN = (new CombineSortAndLimit())->of($limit, $limit); + $topN = new CombineSortAndLimit()->of($limit, $limit); static::assertInstanceOf(TopN::class, $topN); static::assertSame([$read], $topN->children()); @@ -92,7 +92,7 @@ public function test_a_limit_over_any_sort_is_rewritten_and_keeps_the_pinned_alg $algorithm = external_sort()->memoryLimit(Unit::fromMb(1)); $limit = NodeMother::limit(new Sort(NodeMother::read(), [ref('id')->asc()], $algorithm), 1_000_000); - $topN = (new CombineSortAndLimit())->of($limit, $limit); + $topN = new CombineSortAndLimit()->of($limit, $limit); static::assertInstanceOf(TopN::class, $topN); static::assertSame($algorithm, $topN->algorithm); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/CountFromStatisticsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/CountFromStatisticsTest.php index df7d3c5e85..68b303bd17 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/CountFromStatisticsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/CountFromStatisticsTest.php @@ -41,7 +41,7 @@ public function test_a_count_over_a_plain_array_read_reads_the_number_instead(): { static::assertEquals( from_rows(array_to_rows([['count' => 3]], schema(int_schema('count')))), - (new CountFromStatistics()) + new CountFromStatistics() ->apply( df()->read(from_array([['id' => 1], ['id' => 2], ['id' => 3]]))->explain(Trigger::count)->logical, config()->backend(), @@ -55,7 +55,7 @@ public function test_a_count_over_a_plain_sequence_read_reads_the_number_instead { static::assertEquals( from_rows(array_to_rows([['count' => 10]], schema(int_schema('count')))), - (new CountFromStatistics()) + new CountFromStatistics() ->apply( df()->read(from_sequence_number('id', 1, 10))->explain(Trigger::count)->logical, config()->backend(), @@ -75,7 +75,7 @@ public function test_a_count_over_a_plain_floe_read_reads_the_number_instead(): static::assertEquals( from_rows(array_to_rows([['count' => 25]], schema(int_schema('count')))), - (new CountFromStatistics()) + new CountFromStatistics() ->apply( df() ->read(from_floe(path('memory://count/file.floe'), filesystem: $memory)) @@ -101,14 +101,14 @@ public function test_a_source_that_does_not_know_its_rows_exactly_is_counted_by_ { $plan = Trigger::count->plan(NodeMother::read(new DeclaringExtractor(new Statistics($rows)))); - static::assertSame($plan, (new CountFromStatistics())->apply($plan, config()->backend())); + static::assertSame($plan, new CountFromStatistics()->apply($plan, config()->backend())); } public function test_a_read_with_a_pushed_limit_is_counted_by_running(): void { $plan = Trigger::count->plan(NodeMother::read()->withLimit(1)); - static::assertSame($plan, (new CountFromStatistics())->apply($plan, config()->backend())); + static::assertSame($plan, new CountFromStatistics()->apply($plan, config()->backend())); } public function test_a_floe_read_of_exact_statistics_is_counted_from_them(): void @@ -120,7 +120,7 @@ public function test_a_floe_read_of_exact_statistics_is_counted_from_them(): voi ->run(); $plan = Trigger::count->plan(new Read(from_floe(path('memory://count/file.floe'), filesystem: $memory))); - static::assertNotSame($plan, (new CountFromStatistics())->apply($plan, config()->backend())); + static::assertNotSame($plan, new CountFromStatistics()->apply($plan, config()->backend())); } public function test_a_read_with_a_pushed_path_filter_is_counted_by_running(): void @@ -130,12 +130,12 @@ public function test_a_read_with_a_pushed_path_filter_is_counted_by_running(): v ->read(from_sequence_number('id', 1, 25)) ->write(to_floe(path('memory://count/file.floe'), filesystem: $memory)) ->run(); - $plan = Trigger::count->plan((new Read(from_floe( + $plan = Trigger::count->plan(new Read(from_floe( path('memory://count/file.floe'), filesystem: $memory, - )))->withPathFilter(new RejectingFilter())); + ))->withPathFilter(new RejectingFilter())); - static::assertSame($plan, (new CountFromStatistics())->apply($plan, config()->backend())); + static::assertSame($plan, new CountFromStatistics()->apply($plan, config()->backend())); } public function test_a_read_with_a_pushed_filter_is_counted_by_running(): void @@ -145,12 +145,12 @@ public function test_a_read_with_a_pushed_filter_is_counted_by_running(): void ->read(from_sequence_number('id', 1, 25)) ->write(to_floe(path('memory://count/file.floe'), filesystem: $memory)) ->run(); - $plan = Trigger::count->plan((new Read(from_floe( + $plan = Trigger::count->plan(new Read(from_floe( path('memory://count/file.floe'), filesystem: $memory, - )))->withFilter(ref('id')->greaterThan(lit(20)))); + ))->withFilter(ref('id')->greaterThan(lit(20)))); - static::assertSame($plan, (new CountFromStatistics())->apply($plan, config()->backend())); + static::assertSame($plan, new CountFromStatistics()->apply($plan, config()->backend())); } public function test_a_count_over_a_filtered_floe_read_is_counted_by_running(): void @@ -167,7 +167,7 @@ public function test_a_count_over_a_filtered_floe_read_is_counted_by_running(): $plan = $frame->explain(Trigger::count)->logical; static::assertSame(5, $frame->count()); - static::assertSame($plan, (new CountFromStatistics())->apply($plan, config()->backend())); + static::assertSame($plan, new CountFromStatistics()->apply($plan, config()->backend())); } public static function frames_counted_by_running(): Generator @@ -191,13 +191,13 @@ public function test_a_frame_that_does_more_than_read_is_counted_by_running(Data { $plan = $frame->explain(Trigger::count)->logical; - static::assertSame($plan, (new CountFromStatistics())->apply($plan, config()->backend())); + static::assertSame($plan, new CountFromStatistics()->apply($plan, config()->backend())); } public function test_a_plan_that_does_not_count_is_left_alone(): void { $plan = df()->read(from_array([['id' => 1]]))->explain(Trigger::rows)->logical; - static::assertSame($plan, (new CountFromStatistics())->apply($plan, config()->backend())); + static::assertSame($plan, new CountFromStatistics()->apply($plan, config()->backend())); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushFilterIntoSourceTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushFilterIntoSourceTest.php index 956dc5b484..4c45d7aa6b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushFilterIntoSourceTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushFilterIntoSourceTest.php @@ -322,15 +322,15 @@ public function test_a_non_file_extractor_is_never_pushed_into(): void new Filter(new Read(new RecordingExtractor(schema(int_schema('year')))), ref('year')->equals(lit(2023))), ); - static::assertSame($plan, (new PushFilterIntoSource())->apply($plan, config()->backend())); + static::assertSame($plan, new PushFilterIntoSource()->apply($plan, config()->backend())); } public function test_a_data_conjunct_is_pushed_into_a_source_without_partition_columns(): void { - $extractor = (new RecordingFileExtractor( + $extractor = new RecordingFileExtractor( schema(int_schema('year')), array_to_rows([['year' => 2023]], schema(int_schema('year'))), - ))->withPruning(); + )->withPruning(); df() ->read($extractor) @@ -343,7 +343,7 @@ public function test_a_data_conjunct_is_pushed_into_a_source_without_partition_c public function test_a_data_conjunct_the_source_does_not_prune_with_stays_in_its_filter_node(): void { - $filter = (new PushFilterIntoSource()) + $filter = new PushFilterIntoSource() ->apply( NodeMother::plan( new Filter(new Read(PartitionedSourceMother::yearMonth()), $value = ref('value')->isNotNull()), @@ -378,7 +378,7 @@ public function test_only_the_partition_conjunct_is_pushed_into_a_source_that_do public function test_a_partition_conjunct_after_a_kept_one_is_pushed_and_prunes_the_listing(): void { - $filter = (new PushFilterIntoSource()) + $filter = new PushFilterIntoSource() ->apply( NodeMother::plan( new Filter( @@ -401,7 +401,7 @@ public function test_a_partition_conjunct_after_a_kept_one_is_pushed_and_prunes_ public function test_a_partition_filter_above_a_kept_conjunct_is_pushed_and_prunes_the_listing(): void { - $filter = (new PushFilterIntoSource()) + $filter = new PushFilterIntoSource() ->apply( NodeMother::plan( new Filter( @@ -597,7 +597,7 @@ public function test_a_filter_on_an_alias_of_a_body_column_is_pushed_as_the_orig public function test_a_filter_node_whose_only_conjunct_is_pushed_is_removed(): void { - $read = (new PushFilterIntoSource()) + $read = new PushFilterIntoSource() ->apply( NodeMother::plan( new Filter(new Read(PartitionedSourceMother::yearMonth()), $year = ref('year')->equals(lit(2023))), @@ -612,7 +612,7 @@ public function test_a_filter_node_whose_only_conjunct_is_pushed_is_removed(): v public function test_a_pushed_conjunct_leaves_its_filter_node_and_the_rest_stays_in_it(): void { - $filter = (new PushFilterIntoSource()) + $filter = new PushFilterIntoSource() ->apply( NodeMother::plan( new Filter( @@ -633,7 +633,7 @@ public function test_a_pushed_conjunct_leaves_its_filter_node_and_the_rest_stays public function test_stacked_filter_nodes_are_pushed_leaf_first(): void { - $read = (new PushFilterIntoSource()) + $read = new PushFilterIntoSource() ->apply( NodeMother::plan( new Filter( @@ -654,7 +654,7 @@ public function test_stacked_filter_nodes_are_pushed_leaf_first(): void public function test_a_filter_above_a_node_that_keeps_a_conjunct_is_pushed(): void { - $filter = (new PushFilterIntoSource()) + $filter = new PushFilterIntoSource() ->apply( NodeMother::plan( new Filter( @@ -680,7 +680,7 @@ public function test_a_filter_above_a_node_that_keeps_a_conjunct_is_pushed(): vo public function test_a_filter_node_keeping_two_conjuncts_keeps_them_as_one_all(): void { - $filter = (new PushFilterIntoSource()) + $filter = new PushFilterIntoSource() ->apply( NodeMother::plan( new Filter( @@ -729,7 +729,7 @@ public function test_a_limit_above_a_filter_node_that_keeps_a_conjunct_is_not_pu public function test_the_conjuncts_kept_in_php_stay_in_written_order_and_the_others_are_pushed(): void { - $filter = (new PushFilterIntoSource()) + $filter = new PushFilterIntoSource() ->apply( NodeMother::plan( new Filter( @@ -767,7 +767,7 @@ public static function nodes_removing_year(): iterable #[DataProvider('nodes_removing_year')] public function test_a_filter_on_a_column_a_node_removes_is_not_pushed_past_it(Node $node): void { - $filter = (new PushFilterIntoSource()) + $filter = new PushFilterIntoSource() ->apply(NodeMother::plan(new Filter($node, $year = ref('year')->equals(lit(2023)))), config()->backend()) ->root->children()[0]; @@ -825,7 +825,7 @@ public function test_a_consumer_reading_through_the_filter_is_reached(): void { $filter = new Filter(NodeMother::read(), lit(true)); - static::assertTrue((new PushFilterIntoSource())->reachedByEveryConsumer( + static::assertTrue(new PushFilterIntoSource()->reachedByEveryConsumer( $filter, NodeMother::select($filter), $filter, @@ -837,7 +837,7 @@ public function test_a_consumer_bypassing_the_filter_is_not_reached(): void $read = NodeMother::read(); $filter = new Filter($read, lit(true)); - static::assertFalse((new PushFilterIntoSource())->reachedByEveryConsumer( + static::assertFalse(new PushFilterIntoSource()->reachedByEveryConsumer( $filter, NodeMother::select($filter), NodeMother::limit($read, 5), @@ -848,7 +848,7 @@ public function test_a_chain_that_never_reaches_the_filter_is_not_reached(): voi { $filter = new Filter(NodeMother::read(), lit(true)); - static::assertFalse((new PushFilterIntoSource())->reachedByEveryConsumer( + static::assertFalse(new PushFilterIntoSource()->reachedByEveryConsumer( $filter, NodeMother::select(NodeMother::read()), )); @@ -858,7 +858,7 @@ public function test_a_transparent_preserving_chain_reaches_the_leaf(): void { $read = NodeMother::read(); - static::assertNotNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNotNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(NodeMother::select($read, 'year'), lit(true)), $read, ref('year')->isNotNull(), @@ -869,7 +869,7 @@ public function test_another_filter_below_is_transparent(): void { $read = NodeMother::read(); - static::assertNotNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNotNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Filter($read, lit(true)), lit(true)), $read, ref('year')->isNotNull(), @@ -880,7 +880,7 @@ public function test_a_limit_below_blocks(): void { $read = NodeMother::read(); - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(NodeMother::limit($read, 5), lit(true)), $read, ref('year')->isNotNull(), @@ -891,7 +891,7 @@ public function test_an_offset_below_blocks(): void { $read = NodeMother::read(); - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Offset($read, 5), lit(true)), $read, ref('year')->isNotNull(), @@ -902,7 +902,7 @@ public function test_an_until_below_blocks(): void { $read = NodeMother::read(); - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Until($read, lit(true)), lit(true)), $read, ref('year')->isNotNull(), @@ -913,7 +913,7 @@ public function test_a_distinct_below_blocks(): void { $read = NodeMother::read(); - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Distinct($read, ['id']), lit(true)), $read, ref('year')->isNotNull(), @@ -924,7 +924,7 @@ public function test_a_discard_below_blocks(): void { $read = NodeMother::read(); - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Discard($read), lit(true)), $read, ref('year')->isNotNull(), @@ -935,7 +935,7 @@ public function test_an_opaque_node_below_blocks(): void { $read = NodeMother::read(); - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(NodeMother::sort($read), lit(true)), $read, ref('year')->isNotNull(), @@ -946,7 +946,7 @@ public function test_a_with_column_redefining_a_referenced_name_blocks(): void { $read = NodeMother::read(); - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Node\WithColumn($read, 'year', lit(1)), lit(true)), $read, ref('year')->isNotNull(), @@ -957,7 +957,7 @@ public function test_a_with_column_over_a_definition_redefining_a_referenced_nam { $read = NodeMother::read(); - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Node\WithColumn($read, int_schema('year'), lit(1)), lit(true)), $read, ref('year')->isNotNull(), @@ -968,7 +968,7 @@ public function test_a_with_column_over_another_name_does_not_block(): void { $read = NodeMother::read(); - static::assertNotNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNotNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Node\WithColumn($read, 'other', lit(1)), lit(true)), $read, ref('year')->isNotNull(), @@ -981,7 +981,7 @@ public function test_a_rename_to_a_referenced_name_rewrites_the_predicate_to_the static::assertEquals( ref('id')->isNotNull(), - (new PushFilterIntoSource())->predicateAtLeaf( + new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Rename($read, 'id', 'year'), lit(true)), $read, ref('year')->isNotNull(), @@ -993,7 +993,7 @@ public function test_a_rename_to_another_name_does_not_block(): void { $read = NodeMother::read(); - static::assertNotNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNotNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Rename($read, 'id', 'other'), lit(true)), $read, ref('year')->isNotNull(), @@ -1004,7 +1004,7 @@ public function test_a_rename_each_always_blocks(): void { $read = NodeMother::read(); - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new RenameEach($read, [rename_replace('_', '-')]), lit(true)), $read, ref('year')->isNotNull(), @@ -1013,7 +1013,7 @@ public function test_a_rename_each_always_blocks(): void public function test_a_chain_that_does_not_end_in_the_leaf_does_not_reach(): void { - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(NodeMother::read(), lit(true)), NodeMother::read(), ref('year')->isNotNull(), @@ -1024,7 +1024,7 @@ public function test_a_duplicate_row_defining_a_referenced_name_blocks(): void { $read = NodeMother::read(); - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf(new Filter(new DuplicateRow( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf(new Filter(new DuplicateRow( $read, lit(true), [new ScalarFunctionTransformer('year', lit(2023))], @@ -1035,7 +1035,7 @@ public function test_a_duplicate_row_defining_another_name_does_not_block(): voi { $read = NodeMother::read(); - static::assertNotNull((new PushFilterIntoSource())->predicateAtLeaf(new Filter(new DuplicateRow( + static::assertNotNull(new PushFilterIntoSource()->predicateAtLeaf(new Filter(new DuplicateRow( $read, lit(true), [new ScalarFunctionTransformer('copy', lit(1))], @@ -1046,7 +1046,7 @@ public function test_a_node_redefining_a_referenced_column_blocks(): void { $read = NodeMother::read(); - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new RedefiningNode($read, Redefined::names('year')), lit(true)), $read, ref('year')->isNotNull(), @@ -1057,7 +1057,7 @@ public function test_a_node_redefining_another_column_does_not_block(): void { $read = NodeMother::read(); - static::assertNotNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNotNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new RedefiningNode($read, Redefined::names('other')), lit(true)), $read, ref('year')->isNotNull(), @@ -1068,7 +1068,7 @@ public function test_an_unknown_redefinition_blocks(): void { $read = NodeMother::read(); - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new RedefiningNode($read, Redefined::unknown()), lit(true)), $read, ref('year')->isNotNull(), @@ -1081,7 +1081,7 @@ public function test_a_with_column_aliasing_a_column_rewrites_the_predicate_to_t static::assertEquals( ref('id')->isNotNull(), - (new PushFilterIntoSource())->predicateAtLeaf( + new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Node\WithColumn($read, 'year', ref('id')), lit(true)), $read, ref('year')->isNotNull(), @@ -1093,7 +1093,7 @@ public function test_a_with_column_aliasing_a_column_under_a_definition_blocks() { $read = NodeMother::read(); - static::assertNull((new PushFilterIntoSource())->predicateAtLeaf( + static::assertNull(new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Node\WithColumn($read, int_schema('year'), ref('id')), lit(true)), $read, ref('year')->isNotNull(), @@ -1106,7 +1106,7 @@ public function test_stacked_aliases_rewrite_the_predicate_through_every_one(): static::assertEquals( ref('id')->equals(ref('month')), - (new PushFilterIntoSource())->predicateAtLeaf( + new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Rename(new Node\WithColumn($read, 'copy', ref('id')), 'copy', 'year'), lit(true)), $read, ref('year')->equals(ref('month')), @@ -1119,7 +1119,7 @@ public function test_a_predicate_reading_no_redefined_name_arrives_unchanged(): $read = NodeMother::read(); $predicate = ref('month')->isNotNull(); - static::assertSame($predicate, (new PushFilterIntoSource())->predicateAtLeaf( + static::assertSame($predicate, new PushFilterIntoSource()->predicateAtLeaf( new Filter(new Rename($read, 'id', 'year'), lit(true)), $read, $predicate, diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushLimitIntoSourceTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushLimitIntoSourceTest.php index 342d260910..211b7455af 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushLimitIntoSourceTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushLimitIntoSourceTest.php @@ -39,7 +39,7 @@ public function test_a_limit_directly_above_the_read_is_pushed(): void { static::assertSame( 10, - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply(NodeMother::plan(NodeMother::limit(NodeMother::read(), 10)), config()->backend()) ->source() ->criteria() @@ -51,7 +51,7 @@ public function test_a_limit_passes_a_select(): void { static::assertSame( 10, - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( NodeMother::plan(NodeMother::limit(NodeMother::select(NodeMother::read()), 10)), config()->backend(), @@ -66,7 +66,7 @@ public function test_a_limit_passes_a_select(): void public function test_a_limit_does_not_pass_an_expand_column(ScalarFunction $function): void { static::assertNull( - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( NodeMother::plan(NodeMother::limit( new Node\ExpandColumn(NodeMother::read(), 'expanded', $function), @@ -89,7 +89,7 @@ public static function expanding_expressions(): Generator public function test_a_limit_does_not_pass_a_filter(): void { static::assertNull( - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( NodeMother::plan(NodeMother::limit( new Node\Filter(NodeMother::select(NodeMother::read()), ref('id')->equals(lit(1))), @@ -106,7 +106,7 @@ public function test_a_limit_does_not_pass_a_filter(): void public function test_a_limit_does_not_pass_a_write(): void { static::assertNull( - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( NodeMother::plan(NodeMother::limit( new Node\Write(NodeMother::read(), to_memory(new ArrayMemory())), @@ -124,7 +124,7 @@ public function test_a_blocker_discards_the_limit_collected_above_it_and_the_wal { static::assertSame( 5, - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( NodeMother::plan(NodeMother::limit( new Node\Sort(NodeMother::limit(NodeMother::read(), 5), [ref('id')->asc()], memory_sort()), @@ -143,7 +143,7 @@ public function test_the_push_rewrites_the_leaf_and_keeps_the_spine(): void $extractor = new RecordingFileExtractor(schema(int_schema('id'))); $plan = NodeMother::plan(NodeMother::limit(NodeMother::select(new Read($extractor)), 10)); - $pushed = (new PushLimitIntoSource())->apply($plan, config()->backend()); + $pushed = new PushLimitIntoSource()->apply($plan, config()->backend()); static::assertNotSame($plan, $pushed); $limit = $pushed->root->children()[0]; @@ -160,7 +160,7 @@ public function test_the_minimum_of_two_limits_is_pushed(): void { static::assertSame( 3, - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( NodeMother::plan(NodeMother::limit( NodeMother::select(NodeMother::limit(NodeMother::read(), 10)), @@ -178,7 +178,7 @@ public function test_a_limit_narrows_an_already_pushed_limit(): void { static::assertSame( 4, - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( NodeMother::plan(NodeMother::limit( new Node\Rename(NodeMother::read()->withLimit(4), 'id', 'new_id'), @@ -195,7 +195,7 @@ public function test_a_limit_narrows_an_already_pushed_limit(): void public function test_a_plan_without_a_limit_pushes_nothing(): void { static::assertNull( - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply(NodeMother::plan(NodeMother::select(NodeMother::read())), config()->backend()) ->source() ->criteria() @@ -208,7 +208,7 @@ public function test_a_row_input_chain_that_does_not_end_in_a_read_throws(): voi $this->expectException(InvalidLogicException::class); $this->expectExceptionMessage('A logical plan must end in a Read, ' . ChildlessNode::class . ' found'); - (new PushLimitIntoSource())->apply( + new PushLimitIntoSource()->apply( NodeMother::plan(NodeMother::limit(NodeMother::select(new ChildlessNode()), 10)), config()->backend(), ); @@ -220,7 +220,7 @@ public function test_a_transaction_contributes_one_walk_per_child(): void static::assertSame( 3, - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( new LogicalPlan( new Outputs( @@ -246,7 +246,7 @@ public function test_one_transaction_child_whose_walk_yields_no_limit_blocks_the $limit = NodeMother::limit($read, 3); static::assertNull( - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( new LogicalPlan( new Outputs( @@ -272,7 +272,7 @@ public function test_a_limit_below_a_write_is_pushed(): void static::assertSame( 3, - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( new LogicalPlan(new Outputs(new Result($limit), new Write($limit, to_memory(new ArrayMemory())))), config()->backend(), @@ -288,7 +288,7 @@ public function test_a_limit_above_a_write_does_not_narrow_the_write(): void $read = NodeMother::read(); static::assertNull( - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( new LogicalPlan( new Outputs( @@ -310,7 +310,7 @@ public function test_the_widest_limit_of_every_root_is_pushed(): void static::assertSame( 5, - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( new LogicalPlan( new Outputs( @@ -331,7 +331,7 @@ public function test_a_write_whose_walk_yields_no_limit_blocks_the_push(): void $read = NodeMother::read(); static::assertNull( - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( new LogicalPlan( new Outputs( @@ -354,7 +354,7 @@ public function test_the_push_reaches_the_writes_through_the_shared_leaf(): void { $limit = NodeMother::limit(NodeMother::read(), 3); - $plan = (new PushLimitIntoSource())->apply( + $plan = new PushLimitIntoSource()->apply( new LogicalPlan(new Outputs(new Result($limit), new Write($limit, to_memory(new ArrayMemory())))), config()->backend(), ); @@ -366,7 +366,7 @@ public function test_a_limit_above_an_offset_pushes_the_limit_plus_the_offset(): { static::assertSame( 110, - (new PushLimitIntoSource()) + new PushLimitIntoSource() ->apply( NodeMother::plan(NodeMother::limit(new Node\Offset(NodeMother::read(), 100), 10)), config()->backend(), @@ -383,7 +383,7 @@ public function test_a_limit_above_an_offset_pushes_the_limit_plus_the_offset(): #[DataProvider('walks')] public function test_the_limit_one_root_lets_through_to_the_leaf(Node $from, Read $leaf, ?int $expected): void { - static::assertSame($expected, (new PushLimitIntoSource())->limitAt($from, $leaf)); + static::assertSame($expected, new PushLimitIntoSource()->limitAt($from, $leaf)); } public static function walks(): Generator diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushOffsetIntoSourceTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushOffsetIntoSourceTest.php index 855b5803ed..d15be0bdd3 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushOffsetIntoSourceTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushOffsetIntoSourceTest.php @@ -26,7 +26,7 @@ final class PushOffsetIntoSourceTest extends FlowTestCase { public function test_an_offset_directly_above_a_file_read_is_pushed_and_removed(): void { - $plan = (new PushOffsetIntoSource())->apply( + $plan = new PushOffsetIntoSource()->apply( NodeMother::plan(new Offset(NodeMother::read(PartitionedSourceMother::yearMonth()), 5)), config()->backend(), ); @@ -39,7 +39,7 @@ public function test_stacked_offsets_add_up(): void { static::assertSame( 7, - (new PushOffsetIntoSource()) + new PushOffsetIntoSource() ->apply( NodeMother::plan( new Offset(new Offset(NodeMother::read(PartitionedSourceMother::yearMonth()), 3), 4), @@ -56,7 +56,7 @@ public function test_an_offset_passes_a_select(): void { static::assertSame( 5, - (new PushOffsetIntoSource()) + new PushOffsetIntoSource() ->apply( NodeMother::plan( new Offset( @@ -81,7 +81,7 @@ public function test_an_offset_does_not_pass_a_filter(): void ), ); - static::assertSame($plan, (new PushOffsetIntoSource())->apply($plan, config()->backend())); + static::assertSame($plan, new PushOffsetIntoSource()->apply($plan, config()->backend())); } public function test_an_offset_does_not_pass_a_limit(): void @@ -90,14 +90,14 @@ public function test_an_offset_does_not_pass_a_limit(): void new Offset(NodeMother::limit(NodeMother::read(PartitionedSourceMother::yearMonth()), 3), 1), ); - static::assertSame($plan, (new PushOffsetIntoSource())->apply($plan, config()->backend())); + static::assertSame($plan, new PushOffsetIntoSource()->apply($plan, config()->backend())); } public function test_an_offset_over_a_source_that_is_no_file_extractor_stays(): void { $plan = NodeMother::plan(new Offset(NodeMother::read(), 5)); - static::assertSame($plan, (new PushOffsetIntoSource())->apply($plan, config()->backend())); + static::assertSame($plan, new PushOffsetIntoSource()->apply($plan, config()->backend())); } public function test_an_offset_of_one_consumer_never_narrows_another(): void @@ -107,7 +107,7 @@ public function test_an_offset_of_one_consumer_never_narrows_another(): void new Outputs(new Result(new Offset($read, 5)), new Write($read, to_memory(new ArrayMemory()))), ); - static::assertSame($plan, (new PushOffsetIntoSource())->apply($plan, config()->backend())); + static::assertSame($plan, new PushOffsetIntoSource()->apply($plan, config()->backend())); } public function test_the_default_optimizer_pushes_the_offset_then_the_limit_counted_after_it(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushProjectionIntoExpandTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushProjectionIntoExpandTest.php index 68575328b5..721730e0e5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushProjectionIntoExpandTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushProjectionIntoExpandTest.php @@ -26,7 +26,7 @@ public function test_a_select_above_an_expand_keeps_only_the_selected_columns(): { static::assertEquals( ['record' => RequiredColumns::only('record')], - ExpandColumnsContext::carries((new PushProjectionIntoExpand())->apply( + ExpandColumnsContext::carries(new PushProjectionIntoExpand()->apply( NodeMother::plan(NodeMother::select( new Node\ExpandColumn(NodeMother::read(), 'record', ref('body')->expand()), 'record', @@ -40,7 +40,7 @@ public function test_a_drop_above_an_expand_keeps_every_column_but_the_dropped_o { static::assertEquals( ['record' => RequiredColumns::allBut('body')], - ExpandColumnsContext::carries((new PushProjectionIntoExpand())->apply( + ExpandColumnsContext::carries(new PushProjectionIntoExpand()->apply( NodeMother::plan( new Node\Drop(new Node\ExpandColumn(NodeMother::read(), 'record', ref('body')->expand()), ['body']), ), @@ -53,7 +53,7 @@ public function test_a_column_derived_between_the_expand_and_the_select_adds_wha { static::assertEquals( ['record' => RequiredColumns::only('record', 'id')], - ExpandColumnsContext::carries((new PushProjectionIntoExpand())->apply( + ExpandColumnsContext::carries(new PushProjectionIntoExpand()->apply( NodeMother::plan(NodeMother::select( new Node\WithColumn( new Node\ExpandColumn(NodeMother::read(), 'record', ref('body')->expand()), @@ -75,21 +75,21 @@ public function test_a_node_it_does_not_understand_leaves_the_plan_as_it_is(): v 'r', )); - static::assertSame($plan, (new PushProjectionIntoExpand())->apply($plan, config()->backend())); + static::assertSame($plan, new PushProjectionIntoExpand()->apply($plan, config()->backend())); } public function test_an_expand_whose_rows_are_all_consumed_is_left_as_it_is(): void { $plan = NodeMother::plan(new Node\ExpandColumn(NodeMother::read(), 'record', ref('body')->expand())); - static::assertSame($plan, (new PushProjectionIntoExpand())->apply($plan, config()->backend())); + static::assertSame($plan, new PushProjectionIntoExpand()->apply($plan, config()->backend())); } public function test_stacked_expands_are_both_pruned(): void { static::assertEquals( ['b' => RequiredColumns::only('b'), 'a' => RequiredColumns::only('more')], - ExpandColumnsContext::carries((new PushProjectionIntoExpand())->apply( + ExpandColumnsContext::carries(new PushProjectionIntoExpand()->apply( NodeMother::plan(NodeMother::select( new Node\ExpandColumn( new Node\ExpandColumn(NodeMother::read(), 'a', ref('items')->expand()), @@ -109,7 +109,7 @@ public function test_an_expand_shared_by_two_consumers_keeps_what_either_reads() static::assertEquals( ['record' => RequiredColumns::only('record', 'id')], - ExpandColumnsContext::carries((new PushProjectionIntoExpand())->apply( + ExpandColumnsContext::carries(new PushProjectionIntoExpand()->apply( new LogicalPlan( new Outputs( new Result(NodeMother::select($expand, 'record')), @@ -131,6 +131,6 @@ public function test_a_consumer_reading_every_column_keeps_the_shared_expand_as_ ), ); - static::assertSame($plan, (new PushProjectionIntoExpand())->apply($plan, config()->backend())); + static::assertSame($plan, new PushProjectionIntoExpand()->apply($plan, config()->backend())); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushProjectionIntoSourceTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushProjectionIntoSourceTest.php index 0a46affd7d..a795da5f16 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushProjectionIntoSourceTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Optimizer/Rule/PushProjectionIntoSourceTest.php @@ -132,7 +132,7 @@ public function test_a_read_that_is_no_file_source_is_left_alone(): void public function test_a_file_read_is_narrowed_after_a_read_that_is_left_alone(): void { - $plan = (new PushProjectionIntoSource())->apply( + $plan = new PushProjectionIntoSource()->apply( new LogicalPlan( new Outputs( new Result(NodeMother::select( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/BranchPipelineTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/BranchPipelineTest.php index 5d3e00814d..7234047055 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/BranchPipelineTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/BranchPipelineTest.php @@ -22,7 +22,7 @@ public function test_a_branch_ending_in_two_writes_returns_both_in_order(): void static::assertSame( [$first, $second], - (new BranchPipeline(new Pipeline(0, null, new PipelineSteps([$first, $second])), new Schema()))->writes(), + new BranchPipeline(new Pipeline(0, null, new PipelineSteps([$first, $second])), new Schema())->writes(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PhysicalPlanTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PhysicalPlanTest.php index e0008f3eba..3096dc1271 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PhysicalPlanTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PhysicalPlanTest.php @@ -32,10 +32,10 @@ public function test_a_described_plan_returns_the_values_it_was_built_with(): vo public function test_a_plan_does_not_count_only_by_default(): void { static::assertFalse( - (new PhysicalPlan( + new PhysicalPlan( PipelinesMother::root(from_array([['id' => 1]]), []), schema(int_schema('id')), - ))->countsOnly(), + )->countsOnly(), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PipelineStepsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PipelineStepsTest.php index c66c9ab8c7..0bce6dffef 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PipelineStepsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PipelineStepsTest.php @@ -22,7 +22,7 @@ public function test_from_a_step_keeps_it_the_steps_after_it_and_the_breaker(): static::assertEquals( new PipelineSteps([$offset], $collect), - (new PipelineSteps([$first, $offset], $collect))->from($offset), + new PipelineSteps([$first, $offset], $collect)->from($offset), ); } @@ -32,14 +32,14 @@ public function test_from_the_breaker_keeps_only_the_breaker(): void static::assertEquals( new PipelineSteps([], $collect), - (new PipelineSteps([new LimitTransformer(1)], $collect))->from($collect), + new PipelineSteps([new LimitTransformer(1)], $collect)->from($collect), ); } public function test_from_null_leaves_nothing(): void { static::assertTrue( - (new PipelineSteps([new LimitTransformer(1)], new CollectingProcessor())) + new PipelineSteps([new LimitTransformer(1)], new CollectingProcessor()) ->from(null) ->isEmpty(), ); @@ -47,14 +47,14 @@ public function test_from_null_leaves_nothing(): void public function test_steps_with_only_a_breaker_are_not_empty(): void { - static::assertFalse((new PipelineSteps([], new CollectingProcessor()))->isEmpty()); + static::assertFalse(new PipelineSteps([], new CollectingProcessor())->isEmpty()); } public function test_a_later_step_of_another_class_is_not_a_follower(): void { $limit = new LimitTransformer(1); - static::assertFalse((new PipelineSteps([$limit, new RenameColumnTransformer('b', 'c')]))->followedBy( + static::assertFalse(new PipelineSteps([$limit, new RenameColumnTransformer('b', 'c')])->followedBy( $limit, LimitTransformer::class, )); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PlannedNodesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PlannedNodesTest.php index aa4aa6d69b..c7407dfa1f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PlannedNodesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PlannedNodesTest.php @@ -42,7 +42,7 @@ public function test_of_throws_for_a_node_never_planned(): void $this->expectException(InvalidLogicException::class); $this->expectExceptionMessage('was never planned'); - (new PlannedNodes())->of(NodeMother::read()); + new PlannedNodes()->of(NodeMother::read()); } public function test_it_keeps_the_first_refusal(): void @@ -107,7 +107,7 @@ public function test_a_datastore_loaders_collection_is_the_subject_of_its_write_ { $spy = new ProgressSpy(); - (new PlannedNodes($spy))->planWrite(new RecordingDatastoreLoader()); + new PlannedNodes($spy)->planWrite(new RecordingDatastoreLoader()); static::assertSame([['write', ProgressUnit::rows, null, 'crm.contacts']], $spy->built()); } @@ -116,7 +116,7 @@ public function test_a_datastore_loader_has_no_subject_without_a_heartbeat(): vo { $loader = new RecordingDatastoreLoader(); - (new PlannedNodes())->planWrite($loader); + new PlannedNodes()->planWrite($loader); static::assertSame(0, $loader->collectionCalls); } @@ -128,7 +128,7 @@ public function test_with_nobody_listening_a_commit_stage_asks_its_write_for_not filesystem: memory_filesystem(), )); - (new PlannedNodes())->planWrite($loader); + new PlannedNodes()->planWrite($loader); static::assertSame(0, $loader->destinationCalls->count()); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PlannerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PlannerTest.php index 6049fcd574..b0dd744bbc 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PlannerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Planning/Physical/PlannerTest.php @@ -954,7 +954,7 @@ public function test_a_write_with_its_own_steps_is_fed_through_one_side_pipeline static::assertInstanceOf(BranchPipeline::class, $steps[0]); static::assertSame(1, $plan->root()->id); - foreach ((new Executor())->executePipeline($plan->root(), NodeMother::context()) as $_) { + foreach (new Executor()->executePipeline($plan->root(), NodeMother::context()) as $_) { } static::assertSame([['id' => 1]], $memory->dump()); @@ -982,7 +982,7 @@ public function test_a_node_two_writes_share_off_the_spine_runs_once_in_one_side static::assertSame([BranchPipeline::class], PipelineStepList::classes($plan->root())); - foreach ((new Executor())->executePipeline($plan->root(), NodeMother::context()) as $_) { + foreach (new Executor()->executePipeline($plan->root(), NodeMother::context()) as $_) { } static::assertSame(2, $spy->seen); @@ -1014,7 +1014,7 @@ public function test_a_transaction_whose_children_share_a_node_opens_inside_the_ static::assertSame([BranchPipeline::class], PipelineStepList::classes($plan->root())); - foreach ((new Executor())->executePipeline($plan->root(), NodeMother::context()) as $_) { + foreach (new Executor()->executePipeline($plan->root(), NodeMother::context()) as $_) { } static::assertSame(2, $spy->seen); @@ -1047,7 +1047,7 @@ public function test_transaction_children_sharing_a_node_among_some_siblings_are static::assertSame([TransactionGroup::class], PipelineStepList::classes($plan->root())); - foreach ((new Executor())->executePipeline($plan->root(), NodeMother::context()) as $_) { + foreach (new Executor()->executePipeline($plan->root(), NodeMother::context()) as $_) { } static::assertSame(2, $spy->seen); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/CacheConfigTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/CacheConfigTest.php index 542f8ed960..5d92b5be30 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/CacheConfigTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/CacheConfigTest.php @@ -14,7 +14,7 @@ final class CacheConfigTest extends FlowTestCase { public function test_cache_config_no_longer_carries_a_filesystem_mount(): void { - $constructor = (new ReflectionClass(CacheConfig::class))->getConstructor(); + $constructor = new ReflectionClass(CacheConfig::class)->getConstructor(); static::assertNotNull($constructor); static::assertSame( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/AdoptedBatchesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/AdoptedBatchesTest.php index d3956c4ea4..bb54178887 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/AdoptedBatchesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/AdoptedBatchesTest.php @@ -46,7 +46,7 @@ public function test_a_failure_thrown_in_ends_a_source_suspended_in_its_finally( } })(); $context = flow_context(); - $adopted = (new AdoptedBatches($context->backend()))->of($source); + $adopted = new AdoptedBatches($context->backend())->of($source); $adopted->current(); $runner = new StepRunner(); $failure = new RuntimeException('failed'); @@ -68,7 +68,7 @@ public function test_every_column_of_every_batch_goes_through_the_backend(): voi yield array_to_rows([['id' => 2, 'name' => 'b']], $schema, new PhpBackend()); })(); - static::assertCount(2, iterator_to_array((new AdoptedBatches($backend))->of($source), false)); + static::assertCount(2, iterator_to_array(new AdoptedBatches($backend)->of($source), false)); static::assertSame(4, $backend->adopts()); } @@ -81,7 +81,7 @@ public function test_a_batch_the_backend_already_owns_passes_as_the_same_instanc yield $batch; })(); - static::assertSame($batch, (new AdoptedBatches(new PhpBackend()))->of($source)->current()); + static::assertSame($batch, new AdoptedBatches(new PhpBackend())->of($source)->current()); } public function test_a_stop_ends_the_source_without_sending_it_on(): void @@ -97,7 +97,7 @@ public function test_a_stop_ends_the_source_without_sending_it_on(): void $ended[] = 'finally'; } })(); - $adopted = (new AdoptedBatches(new PhpBackend()))->of($source); + $adopted = new AdoptedBatches(new PhpBackend())->of($source); unset($source); $adopted->current(); @@ -118,7 +118,7 @@ public function test_a_corrupted_record_passes_through_unchanged(): void yield $rows; })(); - $adopted = iterator_to_array((new AdoptedBatches(new PhpBackend()))->of($source), false); + $adopted = iterator_to_array(new AdoptedBatches(new PhpBackend())->of($source), false); static::assertSame([$corrupted, $rows], $adopted); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/ExecutorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/ExecutorTest.php index a764db859e..c937a027fe 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/ExecutorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/ExecutorTest.php @@ -146,7 +146,7 @@ public function test_consumed_pipelines_are_skipped_and_rest_replaces_the_last() ); $limit = new LimitTransformer(1); $spy = new SpyTransformer(); - $rows = iterator_to_array((new Executor())->executePlan( + $rows = iterator_to_array(new Executor()->executePlan( PipelinesMother::plan([$processor, $limit, $spy], $extractor), NodeMother::context( config_builder() @@ -166,7 +166,7 @@ public function test_merge_concatenates_the_batches_once(): void static::assertSame( [1, 2, 3, 4, 5], - (new Executor()) + new Executor() ->merge( (static function () use ($schema, $calls) { foreach ([[1], [2], [3], [4], [5]] as $ids) { @@ -197,7 +197,7 @@ public function test_merge_of_empty_batches_keeps_the_last_batch(): void static::assertSame( ['other'], array_keys( - (new Executor()) + new Executor() ->merge( (static function () { yield array_to_rows([], schema(int_schema('id'))); @@ -217,7 +217,7 @@ public function test_a_single_pipeline_runs_its_steps_in_order(): void { $loader = new SpyLoader(); - $batches = iterator_to_array((new Executor())->executePipeline( + $batches = iterator_to_array(new Executor()->executePipeline( new Pipeline( 0, new Read(from_rows(RowsMother::sequentialIds(3))), @@ -239,7 +239,7 @@ public function test_an_input_chain_runs_pipeline_by_pipeline(): void { $context = NodeMother::context(); - $batches = iterator_to_array((new Executor())->executePipeline( + $batches = iterator_to_array(new Executor()->executePipeline( new Pipeline( 1, new Pipeline( @@ -270,7 +270,7 @@ public function test_stop_reaches_the_source_across_a_cut(): void static::assertCount( 1, - iterator_to_array((new Executor())->executePipeline( + iterator_to_array(new Executor()->executePipeline( new Pipeline( 1, new Pipeline( @@ -293,7 +293,7 @@ public function test_every_stage_loads_on_the_runs_backend(): void $upstreamLoader = new SpyLoader(); $downstreamLoader = new SpyLoader(); - iterator_to_array((new Executor())->executePipeline( + iterator_to_array(new Executor()->executePipeline( new Pipeline( 1, new Pipeline( @@ -326,7 +326,7 @@ public static function sources_building_on_the_php_backend(): Generator public function test_every_source_yields_its_batches_on_the_pipelines_backend(Extractor $source): void { $batches = iterator_to_array( - (new Executor())->executePipeline( + new Executor()->executePipeline( new Pipeline(0, new Read($source), new PipelineSteps()), NodeMother::context(config_builder()->backend(new RustBackend())->build()), ), @@ -342,7 +342,7 @@ public function test_the_source_is_extracted_on_the_runs_backend(): void $context = NodeMother::context(config()); $extractor = new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(1)); - iterator_to_array((new Executor())->executePipeline( + iterator_to_array(new Executor()->executePipeline( new Pipeline( 1, new Pipeline(0, new Read($extractor), new PipelineSteps([], new CollectingProcessor())), @@ -359,7 +359,7 @@ public function test_a_file_source_receives_the_pipelines_criteria(): void $extractor = new RecordingFileExtractor(schema(int_schema('id')), RowsMother::sequentialIds(1)); $criteria = new Criteria(7, pathFilter: new RejectingFilter()); - iterator_to_array((new Executor())->executePipeline( + iterator_to_array(new Executor()->executePipeline( new Pipeline(0, new Read($extractor, $criteria), new PipelineSteps()), NodeMother::context(), )); @@ -371,7 +371,7 @@ public function test_a_source_that_lists_no_files_receives_the_pipelines_limit() { $extractor = new RecordingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(1)); - iterator_to_array((new Executor())->executePipeline( + iterator_to_array(new Executor()->executePipeline( new Pipeline(0, new Read($extractor, new Criteria(7)), new PipelineSteps()), NodeMother::context(), )); @@ -384,7 +384,7 @@ public function test_a_pipeline_run_opens_no_dataframe_span_for_any_stage(): voi $upstream = new MemoryTelemetryContext(); $own = new MemoryTelemetryContext(); - iterator_to_array((new Executor())->executePipeline( + iterator_to_array(new Executor()->executePipeline( new Pipeline( 1, new Pipeline( @@ -403,7 +403,7 @@ public function test_a_pipeline_run_opens_no_dataframe_span_for_any_stage(): voi public function test_execute_plan_runs_the_plans_root_pipeline(): void { - $batches = iterator_to_array((new Executor())->executePlan(new PhysicalPlan(PipelinesMother::root( + $batches = iterator_to_array(new Executor()->executePlan(new PhysicalPlan(PipelinesMother::root( from_rows(RowsMother::sequentialIds(3)), [new BatchingProcessor(new BatchSize(2)), new RenameColumnTransformer('id', 'b')], ), schema(int_schema('b'))), NodeMother::context())); @@ -416,7 +416,7 @@ public function test_fetch_merges_every_batch_into_one_rows(): void { static::assertSame( [['id' => 1], ['id' => 2], ['id' => 3]], - (new Executor()) + new Executor() ->fetch( NodeMother::plan( new Batch(NodeMother::read(from_rows(RowsMother::sequentialIds(3))), new BatchSize(1)), @@ -429,7 +429,7 @@ public function test_fetch_merges_every_batch_into_one_rows(): void public function test_fetch_of_an_empty_plan_returns_rows_with_the_output_schema(): void { - $rows = (new Executor())->fetch( + $rows = new Executor()->fetch( NodeMother::plan(NodeMother::read(from_rows(rows(schema(int_schema('id')))))), NodeMother::context(), ); @@ -442,7 +442,7 @@ public function test_merge_merges_every_batch_into_one_rows(): void { static::assertSame( [['id' => 1], ['id' => 2]], - (new Executor()) + new Executor() ->merge( (static function () { yield RowsMother::sequentialIds(1); @@ -462,7 +462,7 @@ public function test_merge_merges_every_batch_into_one_rows(): void public function test_merge_of_no_batches_takes_the_schema_of_the_plan_the_generator_returns(): void { - $rows = (new Executor())->merge( + $rows = new Executor()->merge( (static function () { yield from []; @@ -481,7 +481,7 @@ public function test_merge_of_no_batches_takes_the_schema_of_the_plan_the_genera public function test_merge_of_no_batches_from_a_refused_plan_returns_rows_with_an_empty_schema(): void { - $rows = (new Executor())->merge( + $rows = new Executor()->merge( (static function () { yield from []; @@ -501,7 +501,7 @@ public function test_merge_of_no_batches_from_a_refused_plan_returns_rows_with_a public function test_execute_opens_and_closes_the_plans_dataframe_span(): void { $telemetry = new MemoryTelemetryContext(); - iterator_to_array((new Executor())->execute( + iterator_to_array(new Executor()->execute( NodeMother::plan(NodeMother::read(from_rows(RowsMother::sequentialIds(1)))), $telemetry->flowContext, )); @@ -519,7 +519,7 @@ public function test_a_failing_frame_closes_its_span_as_failed_and_rethrows(): v ); try { - (new Executor())->fetch($plan, $telemetry->flowContext); + new Executor()->fetch($plan, $telemetry->flowContext); static::fail('Expected the frame failure to be rethrown.'); } catch (RuntimeException $e) { @@ -535,7 +535,7 @@ public function test_a_planning_failure_closes_the_dataframe_span_as_failed_once $telemetry = new MemoryTelemetryContext(); try { - iterator_to_array((new Executor())->execute( + iterator_to_array(new Executor()->execute( NodeMother::plan(NodeMother::select(NodeMother::read(), 'nope')), $telemetry->flowContext, )); @@ -1083,7 +1083,7 @@ public function test_a_plan_with_two_breakers_returns_the_rows_of_one_pass(): vo public function test_a_stop_from_a_limit_after_a_join_still_stops_the_left_source(): void { - $left = (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(10)))->withBatchSize(1); + $left = new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(10))->withBatchSize(1); static::assertSame( [['id' => 1, 'r_id' => 1]], @@ -1270,7 +1270,7 @@ public function test_every_source_is_adopted_once_per_column_and_batch(): void $backend = new SpyBackend(); $context = NodeMother::context(config_builder()->backend($backend)->build()); - iterator_to_array((new Executor())->executePipeline( + iterator_to_array(new Executor()->executePipeline( PipelinesMother::root( new RecordingFileExtractor(schema(int_schema('id')), RowsMother::sequentialIds(2)), [], @@ -1280,7 +1280,7 @@ public function test_every_source_is_adopted_once_per_column_and_batch(): void static::assertSame(1, $backend->adopts()); - iterator_to_array((new Executor())->executePipeline( + iterator_to_array(new Executor()->executePipeline( PipelinesMother::root(new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(2)), []), $context, )); @@ -1300,7 +1300,7 @@ public function test_a_parallel_source_is_read_through_the_configs_launcher(): v null, ); - iterator_to_array((new Executor())->executePlan($plan, $context)); + iterator_to_array(new Executor()->executePlan($plan, $context)); static::assertCount(1, $launcher->reads); static::assertSame($plan, $launcher->reads[0][0]); @@ -1321,7 +1321,7 @@ public function test_without_a_launcher_a_parallel_source_runs_here(): void [[3, 4]], array_map(static fn(Rows $batch): array => $batch->reduceToArray( 'id', - ), iterator_to_array((new Executor())->executePlan($plan, $context))), + ), iterator_to_array(new Executor()->executePlan($plan, $context))), ); } @@ -1335,7 +1335,7 @@ public function test_a_launcher_that_launches_nothing_leaves_a_parallel_source_t static::assertSame([], $launcher->reads); - $rows = iterator_to_array((new Executor())->executePlan($plan, $context)); + $rows = iterator_to_array(new Executor()->executePlan($plan, $context)); static::assertCount(1, $launcher->reads); static::assertSame([[3, 4]], array_map(static fn(Rows $batch): array => $batch->reduceToArray('id'), $rows)); @@ -1346,7 +1346,7 @@ public function test_a_source_that_cannot_be_split_never_reaches_the_launcher(): $launcher = new RecordingLauncher(new StubLauncher()); $context = NodeMother::context(config_builder()->launcher($launcher)->build()); - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( $context ->config ->planner() @@ -1364,7 +1364,7 @@ public function test_the_launcher_gets_the_sources_and_the_parent_resumes_after_ $sources = new RunCounts(); $launcher = new RecordingLauncher(new StubLauncher(new PipelineSteps([$filter]))); - $rows = iterator_to_array((new Executor())->executePlan( + $rows = iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline(0, new Read($extractor), new PipelineSteps([$filter])), schema(int_schema('id')), @@ -1384,7 +1384,7 @@ public function test_the_rest_replaces_the_leaf_pipelines_steps(): void $extractor = new RecordingSplittableExtractor(schema(int_schema('id')), [RowsMother::sequentialIds(4)]); $filter = new ScalarFunctionFilterTransformer(ref('id')->greaterThan(lit(2))); $spy = new SpyTransformer(); - $rows = iterator_to_array((new Executor())->executePlan( + $rows = iterator_to_array(new Executor()->executePlan( PipelinesMother::plan([$filter, $spy], $extractor), NodeMother::context( config_builder() @@ -1402,7 +1402,7 @@ public function test_only_the_pipeline_that_reads_the_source_counts_its_rows(): $sources = new RunCounts(); $context = NodeMother::context(); - iterator_to_array((new Executor())->execute( + iterator_to_array(new Executor()->execute( new LogicalPlan(new Result(NodeMother::limit( NodeMother::sort(NodeMother::read(from_array([ ['id' => 1], @@ -1428,7 +1428,7 @@ public function test_a_failed_run_ends_its_source_while_the_failure_is_still_hel ]); try { - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline(0, new Read($extractor), new PipelineSteps([$step])), schema(int_schema('id')), @@ -1458,7 +1458,7 @@ public function test_a_failed_run_discards_its_loaders_and_never_closes_them(): ]); try { - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline(0, new Read($extractor), new PipelineSteps([$loader, $step])), schema(int_schema('id')), @@ -1488,7 +1488,7 @@ public function test_a_failed_run_discards_the_loaders_of_a_run_before_a_process ]); try { - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline( 0, @@ -1522,7 +1522,7 @@ public function test_a_failed_run_discards_the_loaders_of_runs_two_processors_be ]); try { - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline( 0, @@ -1561,7 +1561,7 @@ public function test_a_failed_run_discards_the_loaders_of_a_run_before_a_delegat ]); try { - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline( 0, @@ -1595,7 +1595,7 @@ public function test_a_processor_that_fails_discards_the_loaders_of_the_run_befo ]); try { - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline(0, new Read($extractor), new PipelineSteps([$loader, $processor])), schema(int_schema('id')), @@ -1624,7 +1624,7 @@ public function test_a_failed_launched_run_ends_the_launch_while_the_failure_is_ ]); try { - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline(0, new Read($extractor), new PipelineSteps()), schema(int_schema('id')), @@ -1656,7 +1656,7 @@ public function test_a_failed_launched_run_discards_the_launchs_loaders_and_neve ]); try { - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline(0, new Read($extractor), new PipelineSteps()), schema(int_schema('id')), @@ -1690,7 +1690,7 @@ public function test_a_failed_launched_run_discards_its_parent_side_loaders_and_ ]); try { - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline(0, new Read($extractor), new PipelineSteps()), schema(int_schema('id')), @@ -1720,7 +1720,7 @@ public function test_a_failed_run_ends_a_launch_that_delegates_its_batches(): vo ]); try { - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline(0, new Read($extractor), new PipelineSteps()), schema(int_schema('id')), @@ -1749,7 +1749,7 @@ public function test_a_join_whose_right_side_fails_ends_the_right_source_and_nev ]); try { - (new Executor())->fetch( + new Executor()->fetch( NodeMother::plan(NodeMother::join( NodeMother::read($left), NodeMother::joinRight(NodeMother::plan(new Transform(NodeMother::read($right), $step))), @@ -1779,7 +1779,7 @@ public function test_a_join_that_fails_while_it_builds_ends_the_right_source(): $backend->scripted = array_map(static fn(int $read): int => $read * Unit::fromGb(2)->inBytes(), range(0, 50)); try { - (new Executor())->fetch( + new Executor()->fetch( NodeMother::plan(NodeMother::join( NodeMother::read($left), NodeMother::joinRight(NodeMother::plan(NodeMother::read($right))), @@ -1808,7 +1808,7 @@ public function test_a_processor_that_fails_before_reading_under_another_never_s $extractor = new RecordingSplittableExtractor(schema(int_schema('id')), [RowsMother::sequentialIds(1)]); try { - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline( 0, @@ -1838,7 +1838,7 @@ public function test_a_launch_that_fails_to_end_leaves_the_run_failure_to_surfac $extractor = new RecordingSplittableExtractor(schema(int_schema('id')), [RowsMother::sequentialIds(1)]); try { - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline(0, new Read($extractor), new PipelineSteps()), schema(int_schema('id')), @@ -1874,7 +1874,7 @@ public function test_a_run_that_fails_after_its_source_ended_leaves_it_ended(): $extractor = new RecordingSplittableExtractor(schema(int_schema('id')), [RowsMother::sequentialIds(1)]); try { - iterator_to_array((new Executor())->executePlan( + iterator_to_array(new Executor()->executePlan( new PhysicalPlan( new Pipeline(0, new Read($extractor), new PipelineSteps([new ClosureThrowingLoader($failure)])), schema(int_schema('id')), @@ -2165,10 +2165,9 @@ public function test_a_read_location_keeps_no_user_password_query_or_fragment(): $recording = new RecordingHeartbeat(); df(config_builder()->clock(new FakeClock())->heartbeat($recording, everySeconds: 60)) - ->read((new RecordingFileExtractor( - schema(int_schema('id')), - RowsMother::sequentialIds(2), - ))->withSource(path('sftp://user:secret@host:22/in/orders.csv?X-Amz-Signature=abc&token=t#frag')))->run(); + ->read(new RecordingFileExtractor(schema(int_schema('id')), RowsMother::sequentialIds(2))->withSource(path( + 'sftp://user:secret@host:22/in/orders.csv?X-Amz-Signature=abc&token=t#frag', + )))->run(); static::assertSame( ['sftp://host/in/orders.csv'], diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/OfferedFailureTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/OfferedFailureTest.php index 7b4e83321d..b5c50ea2b4 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/OfferedFailureTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/OfferedFailureTest.php @@ -25,7 +25,7 @@ final class OfferedFailureTest extends FlowTestCase { public function test_nothing_is_offered_before_the_first_failure(): void { - static::assertNull((new OfferedFailure(null))->undecided(new RuntimeException('boom'))); + static::assertNull(new OfferedFailure(null)->undecided(new RuntimeException('boom'))); } public function test_an_extraction_failure_is_left_to_the_handler_and_not_remembered(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/PartitionedOutputHasherTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/PartitionedOutputHasherTest.php index af622b60f4..f9701de966 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/PartitionedOutputHasherTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/PartitionedOutputHasherTest.php @@ -197,7 +197,7 @@ public function test_a_float_partition_column_is_refused(): void . 'partition names. Cast it to a decimal string or an integer first.', ); - (new PartitionedOutputHasher(refs('price'), HashAlgorithm::xxh128))->add(array_to_rows([[ + new PartitionedOutputHasher(refs('price'), HashAlgorithm::xxh128)->add(array_to_rows([[ 'price' => 1.5, ]], schema(float_schema('price'))), new PhpBackend()); } @@ -207,7 +207,7 @@ public function test_a_json_partition_column_is_refused(): void $this->expectException(PartitionException::class); $this->expectExceptionMessage('Column "payload" of type json can\'t be used as a partition'); - (new PartitionedOutputHasher(refs('payload'), HashAlgorithm::xxh128))->add(array_to_rows([[ + new PartitionedOutputHasher(refs('payload'), HashAlgorithm::xxh128)->add(array_to_rows([[ 'payload' => '{"a":1}', ]], schema(json_schema('payload'))), new PhpBackend()); } @@ -220,7 +220,7 @@ public function test_a_first_batch_without_a_named_column_is_refused(): void . 'that every row of the output has.', ); - (new PartitionedOutputHasher(refs('country'), HashAlgorithm::xxh128))->add(array_to_rows([[ + new PartitionedOutputHasher(refs('country'), HashAlgorithm::xxh128)->add(array_to_rows([[ 'id' => 1, ]], schema(int_schema('id'))), new PhpBackend()); } @@ -339,7 +339,7 @@ public function test_an_aliased_partition_reference_fails_as_the_partitioned_loa $this->expectException(SchemaDefinitionNotFoundException::class); $this->expectExceptionMessage('Schema definition for column "day" not found.'); - (new PartitionedOutputHasher(refs(ref('date')->as('day')), HashAlgorithm::xxh128))->add( + new PartitionedOutputHasher(refs(ref('date')->as('day')), HashAlgorithm::xxh128)->add( array_to_rows([['date' => '2026-11-20', 'id' => 1]], schema(str_schema('date'), int_schema('id'))), new PhpBackend(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/RunCountsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/RunCountsTest.php index 207843f415..0c54bd7000 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/RunCountsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/RunCountsTest.php @@ -99,7 +99,7 @@ public function test_a_worker_keeps_its_largest_peak_in_the_order_workers_were_f public function test_a_run_without_workers_reports_the_parent_only(): void { - static::assertEquals(new Processes(Unit::fromBytes(7), []), (new RunCounts())->processes(Unit::fromBytes(7))); + static::assertEquals(new Processes(Unit::fromBytes(7), []), new RunCounts()->processes(Unit::fromBytes(7))); } public function test_absorb_takes_over_the_worker_peaks_with_the_reads(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/StatisticsCollectorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/StatisticsCollectorTest.php index 8f51f6ecd9..87ceab12de 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/StatisticsCollectorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/StatisticsCollectorTest.php @@ -116,22 +116,22 @@ public function test_column_statistics_is_null_when_not_enabled(): void public function test_report_returns_null_when_analyze_is_false(): void { - static::assertNull((new StatisticsCollector(false, flow_context()))->report()); + static::assertNull(new StatisticsCollector(false, flow_context())->report()); } public function test_report_returns_null_when_analyze_is_null(): void { - static::assertNull((new StatisticsCollector(null, flow_context()))->report()); + static::assertNull(new StatisticsCollector(null, flow_context())->report()); } public function test_report_returns_report_when_analyze_is_true(): void { - static::assertInstanceOf(Report::class, (new StatisticsCollector(true, flow_context()))->report()); + static::assertInstanceOf(Report::class, new StatisticsCollector(true, flow_context())->report()); } public function test_report_returns_report_when_using_analyze_instance(): void { - static::assertInstanceOf(Report::class, (new StatisticsCollector(analyze(), flow_context()))->report()); + static::assertInstanceOf(Report::class, new StatisticsCollector(analyze(), flow_context())->report()); } public function test_report_returns_report_with_correct_execution_time(): void @@ -140,7 +140,7 @@ public function test_report_returns_report_with_correct_execution_time(): void $collector = new StatisticsCollector( true, flow_context( - (new ConfigBuilder()) + new ConfigBuilder() ->clock($clock) ->build(), ), @@ -225,12 +225,12 @@ public function test_sources_are_counted_but_not_reported_when_not_enabled(): vo public function test_nothing_is_counted_when_analyze_is_false(): void { - static::assertNull((new StatisticsCollector(false, flow_context()))->counts()); + static::assertNull(new StatisticsCollector(false, flow_context())->counts()); } public function test_a_serial_run_reports_the_parent_peak_and_no_workers(): void { - $processes = (new StatisticsCollector(analyze(), flow_context()))->report()->statistics()->processes; + $processes = new StatisticsCollector(analyze(), flow_context())->report()->statistics()->processes; static::assertSame([], $processes->workers); static::assertGreaterThanOrEqual(memory_get_peak_usage(true), $processes->parent->inBytes()); @@ -262,14 +262,10 @@ public function test_schema_is_null_when_not_enabled(): void public function test_reads_columns(): void { - static::assertTrue((new StatisticsCollector(analyze()->withSchema(), flow_context()))->readsColumns()); - static::assertTrue( - (new StatisticsCollector(analyze()->withColumnStatistics(), flow_context()))->readsColumns(), - ); - static::assertFalse( - (new StatisticsCollector(analyze()->withSourceStatistics(), flow_context()))->readsColumns(), - ); - static::assertFalse((new StatisticsCollector(false, flow_context()))->readsColumns()); + static::assertTrue(new StatisticsCollector(analyze()->withSchema(), flow_context())->readsColumns()); + static::assertTrue(new StatisticsCollector(analyze()->withColumnStatistics(), flow_context())->readsColumns()); + static::assertFalse(new StatisticsCollector(analyze()->withSourceStatistics(), flow_context())->readsColumns()); + static::assertFalse(new StatisticsCollector(false, flow_context())->readsColumns()); } public function test_reading_columns_under_a_launcher_warns_that_writes_do_not_run_in_parallel(): void @@ -340,7 +336,7 @@ public function test_a_dataset_hash_of_no_rows_is_zero(): void { static::assertEquals( new Hash(0, '00000000000000000000000000000000'), - (new StatisticsCollector(analyze()->withDatasetHash(), flow_context()))->report()->datasetHash()?->total, + new StatisticsCollector(analyze()->withDatasetHash(), flow_context())->report()->datasetHash()?->total, ); } @@ -357,10 +353,10 @@ public function test_without_the_dataset_hash_no_accumulator_is_created_and_none static::assertNull($collector->report()->datasetHash()); static::assertSame(0, $backend->groupedMultisetHashesCreated()); static::assertFalse( - (new StatisticsCollector( + new StatisticsCollector( analyze()->withSourceStatistics(), flow_context(config_builder()->backend($backend)->build()), - ))->readsColumns(), + )->readsColumns(), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/StepRunnerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/StepRunnerTest.php index c8cee47869..c52997c833 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/StepRunnerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/StepRunnerTest.php @@ -114,7 +114,7 @@ public function test_unwinding_an_input_that_rethrows_surfaces_the_same_failure( })(); $input->current(); - (new StepRunner())->unwind($input, new RuntimeException('failed'), $telemetry->flowContext); + new StepRunner()->unwind($input, new RuntimeException('failed'), $telemetry->flowContext); static::assertSame([['finally'], 0], [ $ended->getArrayCopy(), @@ -135,7 +135,7 @@ public function test_unwinding_an_input_that_swallows_the_failure_logs_nothing() })(); $input->current(); - (new StepRunner())->unwind($input, new RuntimeException('failed'), $telemetry->flowContext); + new StepRunner()->unwind($input, new RuntimeException('failed'), $telemetry->flowContext); static::assertSame([], $telemetry->logs->entriesContaining('The input of a failed run failed to end')); } @@ -153,7 +153,7 @@ public function test_unwinding_an_input_that_replaces_the_failure_logs_the_repla })(); $input->current(); - (new StepRunner())->unwind($input, new RuntimeException('failed'), $telemetry->flowContext); + new StepRunner()->unwind($input, new RuntimeException('failed'), $telemetry->flowContext); static::assertCount(1, $telemetry->logs->entriesContaining('The input of a failed run failed to end')); } @@ -168,7 +168,7 @@ public function test_unwinding_a_finished_input_leaves_the_failure_as_it_is(): v iterator_to_array($input); $failure = new RuntimeException('failed'); - (new StepRunner())->unwind($input, $failure, $telemetry->flowContext); + new StepRunner()->unwind($input, $failure, $telemetry->flowContext); static::assertSame([null, []], [ $failure->getPrevious(), @@ -194,7 +194,7 @@ public function test_unwinding_an_aborted_input_leaves_the_failure_as_it_is(): v $failure = new RuntimeException('failed'); - (new StepRunner())->unwind($input, $failure, $telemetry->flowContext); + new StepRunner()->unwind($input, $failure, $telemetry->flowContext); static::assertSame([null, []], [ $failure->getPrevious(), @@ -215,10 +215,10 @@ public function test_unwinding_a_traced_operator_ends_the_processor_it_holds(): $ended->append('processor finally'); } })(); - $operator = (new StepTelemetry())->operator(VoidProcessor::class, $processor, $telemetry->flowContext); + $operator = new StepTelemetry()->operator(VoidProcessor::class, $processor, $telemetry->flowContext); unset($processor); $operator->current(); - (new StepRunner())->unwind($operator, new RuntimeException('failed'), $telemetry->flowContext); + new StepRunner()->unwind($operator, new RuntimeException('failed'), $telemetry->flowContext); static::assertSame(['processor finally'], $ended->getArrayCopy()); } @@ -228,7 +228,7 @@ public function test_unwinding_a_traced_operator_ends_the_processor_it_holds(): public function test_a_failed_run_throws_its_failure_into_a_processor_before_it_ends_the_source(bool $traced): void { $log = new ArrayObject(); - $steps = (new StepRunner())->steps( + $steps = new StepRunner()->steps( new PipelineSteps([new RecordingProcessor($log), new TracedFailureTransformer()]), (static function () use ($log): Generator { try { @@ -238,7 +238,7 @@ public function test_a_failed_run_throws_its_failure_into_a_processor_before_it_ $log->append('source finally'); } })(), - (new MemoryTelemetryContext(new TelemetryOptions(traceTransformations: $traced)))->flowContext, + new MemoryTelemetryContext(new TelemetryOptions(traceTransformations: $traced))->flowContext, ); try { @@ -292,7 +292,7 @@ static function (Generator $left): Generator { } })(); $operator->current(); - (new StepRunner())->unwind($operator, new RuntimeException('failed'), flow_context()); + new StepRunner()->unwind($operator, new RuntimeException('failed'), flow_context()); static::assertSame(['buckets cleared', 'reader closed'], $ended->getArrayCopy()); } @@ -323,7 +323,7 @@ static function (Generator $rows): Generator { })(), ); $processor->current(); - (new StepRunner())->unwind($processor, new RuntimeException('failed'), flow_context()); + new StepRunner()->unwind($processor, new RuntimeException('failed'), flow_context()); static::assertSame(['input finally'], $ended->getArrayCopy()); } @@ -337,7 +337,7 @@ public function test_a_run_drops_empty_batches_and_closes_its_loaders_when_it_co array_map( static fn(Rows $rows): array => $rows->toArray(), iterator_to_array( - (new StepRunner())->run( + new StepRunner()->run( [$loader], (static function (): Generator { yield rows(schema(int_schema('id'))); @@ -356,7 +356,7 @@ public function test_ending_an_incomplete_run_discards_its_loaders(): void { $loader = new RecordingLoader(); - static::assertSame([], (new StepRunner())->endLoaders([$loader], flow_context(config()), false)); + static::assertSame([], new StepRunner()->endLoaders([$loader], flow_context(config()), false)); static::assertSame(['discard'], $loader->log); } @@ -365,7 +365,7 @@ public function test_a_failing_closure_is_returned_and_its_loader_discarded(): v $failure = new RuntimeException('closure failed'); $loader = new RecordingLoader(closureFailure: $failure); - static::assertSame([$failure], (new StepRunner())->endLoaders([$loader], flow_context(config()), true)); + static::assertSame([$failure], new StepRunner()->endLoaders([$loader], flow_context(config()), true)); static::assertSame(['closure THROW', 'discard'], $loader->log); } @@ -375,7 +375,7 @@ public function test_a_failing_closure_still_closes_the_loaders_after_it(): void $failing = new ClosureThrowingLoader($failure); $next = new RecordingLoader(); - static::assertSame([$failure], (new StepRunner())->endLoaders([$failing, $next], flow_context(config()), true)); + static::assertSame([$failure], new StepRunner()->endLoaders([$failing, $next], flow_context(config()), true)); static::assertSame(1, $failing->discarded); static::assertSame(['closure'], $next->log); } @@ -397,7 +397,7 @@ public function test_a_commit_entry_has_the_location_of_its_write(): void $loader->load(RowsMother::sequentialIds(2), $context->backend()); } - (new StepRunner())->endLoaders($loaders, $context, true); + new StepRunner()->endLoaders($loaders, $context, true); $context->config->heartbeat()?->completed(); static::assertSame( @@ -417,7 +417,7 @@ public function test_steps_without_a_source_rethrow_their_input_error_untouched( $thrown = null; try { - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( new PipelineSteps(), (static function () use ($failure): Generator { yield RowsMother::sequentialIds(1); @@ -445,7 +445,7 @@ public function test_extraction_error_after_the_first_batch_reaches_the_handler( array_map( static fn(Rows $rows): array => $rows->toArray(), iterator_to_array( - (new StepRunner())->steps( + new StepRunner()->steps( new PipelineSteps([$loader]), (static function (): Generator { yield RowsMother::sequentialIds(2); @@ -474,7 +474,7 @@ public function test_extraction_error_propagates_under_throw_error(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('source failed'); - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( $steps, (static function (): Generator { yield from []; @@ -494,7 +494,7 @@ public function test_extraction_error_reaches_the_handler(): void static::assertSame( [], - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( new PipelineSteps([$loader]), (static function (): Generator { yield from []; @@ -517,12 +517,12 @@ public function test_ignore_error_drops_the_half_transformed_batch(): void static::assertSame( [], - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( new PipelineSteps([ new ThrowingTransformer(new RuntimeException('first')), new ThrowingTransformer(new RuntimeException('second')), ]), - (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)))->extract( + new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))->extract( flow_context()->backend(), new Criteria(), ), @@ -540,9 +540,9 @@ public function test_loading_error_skips_only_the_failing_loader(): void $throwing = new ThrowingLoader(new RuntimeException('write failed')); $spy = new SpyLoader(); - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( new PipelineSteps([$throwing, $spy]), - (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)))->extract( + new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))->extract( flow_context()->backend(), new Criteria(), ), @@ -563,9 +563,9 @@ public function test_skip_rows_drops_the_batch_and_continues_with_the_next(): vo array_merge(...array_map( static fn(Rows $rows): array => $rows->toArray(), iterator_to_array( - (new StepRunner())->steps( + new StepRunner()->steps( new PipelineSteps([new ThrowWhenRowMatches('id', 2, new RuntimeException('boom'))]), - (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))) + new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)) ->withBatchSize(1) ->extract(flow_context()->backend(), new Criteria()), flow_context(config())->withErrorHandler(new SkipRows()), @@ -578,10 +578,10 @@ public function test_skip_rows_drops_the_batch_and_continues_with_the_next(): vo public function test_stop_is_forwarded_upstream_without_pulling_another_batch(): void { - $extractor = (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)))->withBatchSize(1); + $extractor = new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))->withBatchSize(1); static::assertCount(1, iterator_to_array( - (new StepRunner())->steps( + new StepRunner()->steps( new PipelineSteps([new LimitTransformer(1)]), $extractor->extract(flow_context()->backend(), new Criteria()), flow_context(config()), @@ -593,14 +593,14 @@ public function test_stop_is_forwarded_upstream_without_pulling_another_batch(): public function test_a_limit_reached_at_a_batch_boundary_stops_the_source_before_the_next_batch(): void { - $extractor = (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(6)))->withBatchSize(2); + $extractor = new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(6))->withBatchSize(2); static::assertSame( [['id' => 1], ['id' => 2], ['id' => 3], ['id' => 4]], array_merge(...array_map( static fn(Rows $rows): array => $rows->toArray(), iterator_to_array( - (new StepRunner())->steps( + new StepRunner()->steps( new PipelineSteps([new LimitTransformer(4)]), $extractor->extract(flow_context()->backend(), new Criteria()), flow_context(config()), @@ -614,12 +614,12 @@ public function test_a_limit_reached_at_a_batch_boundary_stops_the_source_before public function test_until_failing_on_the_first_row_yields_nothing_and_stops_the_source(): void { - $extractor = (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)))->withBatchSize(1); + $extractor = new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))->withBatchSize(1); $loader = new SpyLoader(); static::assertSame( [], - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( new PipelineSteps([new UntilTransformer(ref('id')->lessThan(lit(1))), $loader]), $extractor->extract(flow_context()->backend(), new Criteria()), flow_context(config()), @@ -631,11 +631,11 @@ public function test_until_failing_on_the_first_row_yields_nothing_and_stops_the public function test_a_batch_skipped_after_a_reached_limit_still_stops_the_source(): void { - $extractor = (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(6)))->withBatchSize(2); + $extractor = new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(6))->withBatchSize(2); static::assertSame( [], - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( new PipelineSteps([ new LimitTransformer(2), new ThrowingTransformer(new RuntimeException('after the limit')), @@ -656,9 +656,9 @@ public function test_every_limit_reached_in_one_batch_is_logged_with_its_step(): array_merge(...array_map( static fn(Rows $rows): array => $rows->toArray(), iterator_to_array( - (new StepRunner())->steps( + new StepRunner()->steps( new PipelineSteps([new LimitTransformer(5), new LimitTransformer(3)]), - (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(10)))->extract( + new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(10))->extract( flow_context()->backend(), new Criteria(), ), @@ -685,7 +685,7 @@ public function test_a_propagated_extraction_error_is_logged(): void $thrown = null; try { - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( $steps, (static function (): Generator { yield from []; @@ -708,7 +708,7 @@ public function test_steps_hand_the_rows_of_a_joins_right_plan_to_the_join(): vo static::assertSame( [['id' => 1, 'r_name' => 'Alice'], ['id' => 2, 'r_name' => 'Alice']], iterator_to_array( - (new StepRunner())->steps( + new StepRunner()->steps( new PipelineSteps([new JoinStep( new CrossJoin('r_'), PhysicalPlanMother::reading(from_rows(array_to_rows([[ @@ -734,9 +734,9 @@ public function test_steps_run_streaming_processors_and_the_breaker_in_order(): array_map( static fn(Rows $batch): array => $batch->toArray(), iterator_to_array( - (new StepRunner())->steps( + new StepRunner()->steps( new PipelineSteps([new OffsetProcessor(2), $spy], new CollectingProcessor()), - (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5))) + new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(5)) ->withBatchSize(2) ->extract(flow_context()->backend(), new Criteria()), flow_context(config()), @@ -753,9 +753,9 @@ public function test_an_empty_batch_the_breaker_emits_is_dropped(): void static::assertSame( [], iterator_to_array( - (new StepRunner())->steps( + new StepRunner()->steps( new PipelineSteps([], new VoidProcessor()), - (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(2)))->extract( + new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(2))->extract( flow_context()->backend(), new Criteria(), ), @@ -769,9 +769,9 @@ public function test_an_empty_batch_the_breaker_emits_is_dropped(): void public function test_a_loader_before_a_processor_is_closed_before_the_processor_emits(): void { $spy = new SpyLoader(); - $steps = (new StepRunner())->steps( + $steps = new StepRunner()->steps( new PipelineSteps([$spy, new BatchingProcessor(new BatchSize(10))]), - (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))) + new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)) ->withBatchSize(1) ->extract(flow_context()->backend(), new Criteria()), flow_context(config()), @@ -791,7 +791,7 @@ public function test_a_corrupted_record_is_loaded_into_the_sources_reject_loader ->withBatchSize(2) ->withCorruptedRecords($rejects); - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( new PipelineSteps([$loader]), $extractor->extract(flow_context()->backend(), new Criteria()), flow_context(config()), @@ -822,7 +822,7 @@ public function test_corrupted_records_left_after_the_last_rows_are_loaded_befor static::assertSame( [], - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( new PipelineSteps(), $extractor->extract(flow_context()->backend(), new Criteria()), flow_context(config()), @@ -838,7 +838,7 @@ public function test_without_a_reject_loader_a_corrupted_record_is_thrown_as_an_ $this->expectException(CorruptedRecordException::class); - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( new PipelineSteps(), $extractor->extract(flow_context()->backend(), new Criteria()), flow_context(config())->withErrorHandler(new ThrowError()), @@ -864,7 +864,7 @@ public function test_without_a_reject_loader_a_corrupted_record_fails_the_run_wh $thrown = null; try { - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( new PipelineSteps(), $extractor->extract(flow_context()->backend(), new Criteria()), flow_context(config())->withErrorHandler($handler), @@ -886,7 +886,7 @@ public function test_a_failed_run_discards_the_reject_loader(): void ->withCorruptedRecords($rejects); try { - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( new PipelineSteps([new RecordingLoader(new RuntimeException('write failed'))]), $extractor->extract(flow_context()->backend(), new Criteria()), flow_context(config())->withErrorHandler(new ThrowError()), @@ -909,7 +909,7 @@ public function test_a_failing_reject_loader_reaches_the_loading_handler(): void static::assertCount( 1, - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( new PipelineSteps(), $extractor->extract(flow_context()->backend(), new Criteria()), flow_context(config())->withErrorHandler($handler), @@ -930,7 +930,7 @@ public function test_a_run_that_routed_records_logs_how_many_and_where(): void ['id' => 'y'], ], schema(int_schema('id')))->withCorruptedRecords(new SpyLoader()); - iterator_to_array((new StepRunner())->steps( + iterator_to_array(new StepRunner()->steps( new PipelineSteps(), $extractor->extract(flow_context()->backend(), new Criteria()), $telemetry->flowContext, @@ -960,7 +960,7 @@ public function test_end_loaders_is_done_after_every_loader(): void $loader->load(RowsMother::sequentialIds(2), $context->backend()); } - (new StepRunner())->endLoaders($loaders, $context, true); + new StepRunner()->endLoaders($loaders, $context, true); $context->config->heartbeat()?->beatNow(); static::assertSame( @@ -979,9 +979,9 @@ public function test_a_processor_that_fails_in_its_own_body_fails_the_run_under_ { ini_set('zend.exception_ignore_args', $ignoreArgs); $processor = new FrameRecordingProcessor(FailsWhen::secondBatch); - $steps = (new StepRunner())->steps( + $steps = new StepRunner()->steps( new PipelineSteps([$processor]), - (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))) + new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)) ->withBatchSize(1) ->extract(flow_context()->backend(), new Criteria()), flow_context(config()), @@ -1007,12 +1007,12 @@ public function test_a_traced_processor_that_fails_in_its_own_body_fails_the_run ): void { ini_set('zend.exception_ignore_args', $ignoreArgs); $processor = new FrameRecordingProcessor(FailsWhen::secondBatch); - $steps = (new StepRunner())->steps( + $steps = new StepRunner()->steps( new PipelineSteps([$processor]), - (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))) + new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)) ->withBatchSize(1) ->extract(flow_context()->backend(), new Criteria()), - (new MemoryTelemetryContext(telemetry_options(trace_transformations: true)))->flowContext, + new MemoryTelemetryContext(telemetry_options(trace_transformations: true))->flowContext, ); VmStackContext::fillWithInts(); @@ -1034,9 +1034,9 @@ public function test_a_processor_that_fails_on_stop_fails_the_run_under_user_cod { ini_set('zend.exception_ignore_args', $ignoreArgs); $processor = new FrameRecordingProcessor(FailsWhen::stop); - $steps = (new StepRunner())->steps( + $steps = new StepRunner()->steps( new PipelineSteps([$processor, new LimitTransformer(1)]), - (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))) + new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)) ->withBatchSize(1) ->extract(flow_context()->backend(), new Criteria()), flow_context(config()), @@ -1061,9 +1061,9 @@ public function test_a_processor_that_swallows_the_failure_is_logged(string $ign { ini_set('zend.exception_ignore_args', $ignoreArgs); $telemetry = new MemoryTelemetryContext(); - $steps = (new StepRunner())->steps( + $steps = new StepRunner()->steps( new PipelineSteps([new SwallowingProcessor(), new ThrowingLoader(new RuntimeException('write failed'))]), - (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))) + new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)) ->withBatchSize(1) ->extract(flow_context()->backend(), new Criteria()), $telemetry->flowContext, @@ -1090,7 +1090,7 @@ public function test_a_process_that_returns_a_generator_past_its_first_yield_fai string $ignoreArgs, ): void { ini_set('zend.exception_ignore_args', $ignoreArgs); - $steps = (new StepRunner())->steps( + $steps = new StepRunner()->steps( new PipelineSteps([new class() implements Processor { public static function fromDescription(#[SensitiveParameter] array $data, Rebuild $rebuild): static { @@ -1123,7 +1123,7 @@ public function process(Generator $rows, Backend $backend): Generator return $batches; } }]), - (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))) + new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)) ->withBatchSize(1) ->extract(flow_context()->backend(), new Criteria()), flow_context(config()), @@ -1141,7 +1141,7 @@ public function test_a_stop_reaches_a_traced_operator(): void $received = new ArrayObject(); iterator_to_array( - (new StepRunner())->steps( + new StepRunner()->steps( new PipelineSteps([ new class($received) implements Processor { /** @@ -1196,10 +1196,10 @@ public function process(Generator $rows, Backend $backend): Generator }, new LimitTransformer(1), ]), - (new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3))) + new CountingExtractor(schema(int_schema('id')), RowsMother::sequentialIds(3)) ->withBatchSize(1) ->extract(flow_context()->backend(), new Criteria()), - (new MemoryTelemetryContext(telemetry_options(trace_transformations: true)))->flowContext, + new MemoryTelemetryContext(telemetry_options(trace_transformations: true))->flowContext, ), false, ); @@ -1216,7 +1216,7 @@ public function test_a_write_stage_advances_by_the_rows_written_and_is_done_when $writes->offsetSet($loader, $stage); iterator_to_array( - (new StepRunner())->run( + new StepRunner()->run( [$loader], (static function (): Generator { yield RowsMother::sequentialIds(2); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/StepTelemetryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/StepTelemetryTest.php index a54243744e..08352120f8 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/StepTelemetryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/StepTelemetryTest.php @@ -38,7 +38,7 @@ public function test_a_transformation_span_carries_the_row_counts_and_the_step_a $telemetry = new MemoryTelemetryContext(telemetry_options(trace_transformations: true)); $telemetry->flowContext->telemetry()->dataFrameStarted([]); - (new StepTelemetry())->transform( + new StepTelemetry()->transform( new ScalarFunctionTransformer('b', lit(1)), array_to_rows([['a' => 1], ['a' => 2]], schema(int_schema('a'))), $telemetry->flowContext, @@ -55,7 +55,7 @@ public function test_a_reached_limit_completes_its_span_with_the_trimmed_row_cou $telemetry = new MemoryTelemetryContext(telemetry_options(trace_transformations: true)); $telemetry->flowContext->telemetry()->dataFrameStarted([]); - static::assertCount(1, (new StepTelemetry())->transform( + static::assertCount(1, new StepTelemetry()->transform( new LimitTransformer(1), array_to_rows([['a' => 1], ['a' => 2]], schema(int_schema('a'))), $telemetry->flowContext, @@ -75,7 +75,7 @@ public function test_a_failing_transformation_ends_its_span_as_an_error_and_reac $this->expectExceptionObject(new RuntimeException('refused')); try { - (new StepTelemetry())->transform( + new StepTelemetry()->transform( new ThrowingTransformer(new RuntimeException('refused')), array_to_rows([['a' => 1]], schema(int_schema('a'))), $telemetry->flowContext, @@ -90,7 +90,7 @@ public function test_a_loading_span_carries_the_destination_of_a_file_loader(): $telemetry = new MemoryTelemetryContext(telemetry_options(trace_loading: true)); $telemetry->flowContext->telemetry()->dataFrameStarted([]); - (new StepTelemetry())->load( + new StepTelemetry()->load( to_floe(path('memory://out/file.floe'), filesystem: memory_filesystem()), array_to_rows([['a' => 1]], schema(int_schema('a'))), $telemetry->flowContext, @@ -106,7 +106,7 @@ public function test_a_loading_span_carries_the_collection_of_a_datastore_loader $telemetry = new MemoryTelemetryContext(telemetry_options(trace_loading: true)); $telemetry->flowContext->telemetry()->dataFrameStarted([]); - (new StepTelemetry())->load( + new StepTelemetry()->load( new RecordingDatastoreLoader(), array_to_rows([['a' => 1]], schema(int_schema('a'))), $telemetry->flowContext, @@ -123,7 +123,7 @@ public function test_a_loading_span_carries_the_loader_attributes(): void $telemetry = new MemoryTelemetryContext(telemetry_options(trace_loading: true)); $telemetry->flowContext->telemetry()->dataFrameStarted([]); - (new StepTelemetry())->load( + new StepTelemetry()->load( to_stream('php://memory'), array_to_rows([['a' => 1]], schema(int_schema('a'))), $telemetry->flowContext, @@ -140,7 +140,7 @@ public function test_an_untraced_transformation_opens_no_span(): void $telemetry = new MemoryTelemetryContext(telemetry_options(trace_transformations: false)); $telemetry->flowContext->telemetry()->dataFrameStarted([]); - (new StepTelemetry())->transform( + new StepTelemetry()->transform( new ScalarFunctionTransformer('b', lit(1)), array_to_rows([['a' => 1]], schema(int_schema('a'))), $telemetry->flowContext, @@ -157,7 +157,7 @@ public function test_an_untraced_loading_opens_no_span(): void $telemetry = new MemoryTelemetryContext(telemetry_options(trace_loading: false)); $telemetry->flowContext->telemetry()->dataFrameStarted([]); - (new StepTelemetry())->load( + new StepTelemetry()->load( to_stream('php://memory'), array_to_rows([['a' => 1]], schema(int_schema('a'))), $telemetry->flowContext, @@ -174,7 +174,7 @@ public function test_an_untraced_operator_is_its_own_generator(): void $telemetry = new MemoryTelemetryContext(telemetry_options(trace_transformations: false)); $batches = GroupByContext::batches(array_to_rows([['a' => 1]], schema(int_schema('a')))); - static::assertSame($batches, (new StepTelemetry())->operator( + static::assertSame($batches, new StepTelemetry()->operator( DistinctProcessor::class, $batches, $telemetry->flowContext, @@ -188,7 +188,7 @@ public function test_a_traced_operator_yields_its_batches_and_returns_its_return $first = array_to_rows([['a' => 1]], schema(int_schema('a'))); $second = array_to_rows([['a' => 2]], schema(int_schema('a'))); - $traced = (new StepTelemetry())->operator( + $traced = new StepTelemetry()->operator( DistinctProcessor::class, (static function () use ($first, $second) { yield $first; @@ -217,7 +217,7 @@ public function test_a_failing_operator_ends_its_span_as_an_error_and_reaches_th $this->expectExceptionObject(new RuntimeException('refused')); try { - iterator_to_array((new StepTelemetry())->operator( + iterator_to_array(new StepTelemetry()->operator( DistinctProcessor::class, (static function () { yield array_to_rows([['a' => 1]], schema(int_schema('a'))); @@ -237,7 +237,7 @@ public function test_an_abandoned_operator_completes_its_span_without_an_error() $telemetry = new MemoryTelemetryContext(telemetry_options(trace_transformations: true)); $telemetry->flowContext->telemetry()->dataFrameStarted([]); - $traced = (new StepTelemetry())->operator( + $traced = new StepTelemetry()->operator( DistinctProcessor::class, GroupByContext::batches( array_to_rows([['a' => 1]], schema(int_schema('a'))), @@ -263,7 +263,7 @@ public function test_a_failing_loader_ends_its_span_as_an_error_and_reaches_the_ $this->expectExceptionObject(new RuntimeException('refused')); try { - (new StepTelemetry())->load( + new StepTelemetry()->load( new ThrowingLoader(new RuntimeException('refused')), array_to_rows([['a' => 1]], schema(int_schema('a'))), $telemetry->flowContext, diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/TransactionLoaderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/TransactionLoaderTest.php index 02976dc666..360e22f35d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/TransactionLoaderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/TransactionLoaderTest.php @@ -81,7 +81,7 @@ public function test_closure_forwards_its_progress_to_every_child(): void $second = new SpyLoader(); $spy = new ProgressSpy(StageName::commit); - (new TransactionLoader(new RecordingTransaction(), [$first, $second], NodeMother::context()))->closure($spy); + new TransactionLoader(new RecordingTransaction(), [$first, $second], NodeMother::context())->closure($spy); static::assertSame($spy, $first->closedWith); static::assertSame($spy, $second->closedWith); @@ -98,12 +98,12 @@ public function test_load_advances_the_write_stage_of_each_child(): void $writes->offsetSet($first, $firstWrite); $writes->offsetSet($second, $secondWrite); - (new TransactionLoader( + new TransactionLoader( new RecordingTransaction(), [$first, $second], NodeMother::context(), writes: $writes, - ))->load(array_to_rows([['id' => 1], ['id' => 2], ['id' => 3]], schema(int_schema('id')))); + )->load(array_to_rows([['id' => 1], ['id' => 2], ['id' => 3]], schema(int_schema('id')))); static::assertSame([3, 3], [$firstWrite->countOf(StageName::write), $secondWrite->countOf(StageName::write)]); } @@ -116,12 +116,12 @@ public function test_an_empty_batch_advances_no_write_stage(): void $writes = new SplObjectStorage(); $writes->offsetSet($loader, $write); - (new TransactionLoader( + new TransactionLoader( new RecordingTransaction(), [$loader], NodeMother::context(), writes: $writes, - ))->load(array_to_rows([], schema(int_schema('id')))); + )->load(array_to_rows([], schema(int_schema('id')))); static::assertSame([], $write->advancedCalls()); } @@ -139,18 +139,18 @@ public function test_closure_and_discard_end_every_write_stage(): void $discardedWrites = new SplObjectStorage(); $discardedWrites->offsetSet($discarded, $discardedWrite); - (new TransactionLoader( + new TransactionLoader( new RecordingTransaction(), [$closed], NodeMother::context(), writes: $closedWrites, - ))->closure(new VoidProgress()); - (new TransactionLoader( + )->closure(new VoidProgress()); + new TransactionLoader( new RecordingTransaction(), [$discarded], NodeMother::context(), writes: $discardedWrites, - ))->discard(); + )->discard(); static::assertSame([1, 1], [ $closedWrite->doneCalls(StageName::write), @@ -168,12 +168,12 @@ public function test_closure_gives_a_child_with_a_planned_stage_that_stage(): vo $stages = new SplObjectStorage(); $stages->offsetSet($planned, $stage); - (new TransactionLoader( + new TransactionLoader( new RecordingTransaction(), [$planned, $unplanned], NodeMother::context(), $stages, - ))->closure($own); + )->closure($own); static::assertSame([$stage, $own], [$planned->closedWith, $unplanned->closedWith]); } @@ -204,7 +204,7 @@ public function test_a_child_failure_rolls_back_with_its_cause(): void $boom = new RuntimeException('boom'); $transaction = new RecordingTransaction(); - (new TransactionLoader($transaction, [new RecordingLoader($boom)], $telemetry->flowContext))->load( + new TransactionLoader($transaction, [new RecordingLoader($boom)], $telemetry->flowContext)->load( BranchLoaderMother::batch(), ); @@ -217,11 +217,11 @@ public function test_a_failing_child_stops_the_batch_before_the_next_child(): vo { $next = new RecordingLoader(); - (new TransactionLoader( + new TransactionLoader( new RecordingTransaction(), [new RecordingLoader(new RuntimeException('boom')), $next], NodeMother::context(), - ))->load(BranchLoaderMother::batch()); + )->load(BranchLoaderMother::batch()); static::assertSame([], $next->log); } @@ -231,7 +231,7 @@ public function test_a_bare_child_failure_is_reported_against_that_child(): void $boom = new RuntimeException('boom'); $failing = new RecordingLoader($boom); - $offered = (new TransactionLoader(new RecordingTransaction(), [$failing], NodeMother::context()))->load( + $offered = new TransactionLoader(new RecordingTransaction(), [$failing], NodeMother::context())->load( BranchLoaderMother::batch(), ); @@ -325,7 +325,7 @@ public function test_a_failing_commit_rolls_the_batch_back(): void $transaction = new RecordingTransaction(commitFailure: $failure); try { - (new TransactionLoader($transaction, [new RecordingLoader()], NodeMother::context()))->load( + new TransactionLoader($transaction, [new RecordingLoader()], NodeMother::context())->load( BranchLoaderMother::batch(), ); static::fail('load() must rethrow the commit failure'); @@ -343,7 +343,7 @@ public function test_a_failing_commit_rolls_the_drain_back(): void $transaction = new RecordingTransaction(commitFailure: $failure); try { - (new TransactionLoader($transaction, [new RecordingLoader()], NodeMother::context()))->closure( + new TransactionLoader($transaction, [new RecordingLoader()], NodeMother::context())->closure( new VoidProgress(), ); static::fail('closure() must rethrow the commit failure'); @@ -361,7 +361,7 @@ public function test_a_failing_begin_does_not_roll_back(): void $loader = new RecordingLoader(); try { - (new TransactionLoader($transaction, [$loader], NodeMother::context()))->load(BranchLoaderMother::batch()); + new TransactionLoader($transaction, [$loader], NodeMother::context())->load(BranchLoaderMother::batch()); static::fail('load() must rethrow the begin failure'); } catch (RuntimeException $thrown) { static::assertSame($failure, $thrown); @@ -378,11 +378,11 @@ public function test_a_rollback_failure_is_logged_and_does_not_mask_the_cause(): static::assertSame( $boom, - (new TransactionLoader( + new TransactionLoader( new RecordingTransaction(rollbackFailure: new RuntimeException('rollback failed')), [new RecordingLoader($boom)], $telemetry->flowContext, - ))->load(BranchLoaderMother::batch())?->cause, + )->load(BranchLoaderMother::batch())?->cause, ); static::assertCount(1, $telemetry->logs->entriesContaining('Transaction failed to roll back.')); @@ -394,14 +394,14 @@ public function test_a_rollback_failure_on_a_failing_batch_commit_is_logged(): v $failure = new RuntimeException('commit failed'); try { - (new TransactionLoader( + new TransactionLoader( new RecordingTransaction( commitFailure: $failure, rollbackFailure: new RuntimeException('rollback failed'), ), [new RecordingLoader()], $telemetry->flowContext, - ))->load(BranchLoaderMother::batch()); + )->load(BranchLoaderMother::batch()); static::fail('load() must rethrow the commit failure'); } catch (RuntimeException $thrown) { static::assertSame($failure, $thrown); @@ -416,14 +416,14 @@ public function test_a_rollback_failure_on_a_failing_drain_commit_is_logged(): v $failure = new RuntimeException('commit failed'); try { - (new TransactionLoader( + new TransactionLoader( new RecordingTransaction( commitFailure: $failure, rollbackFailure: new RuntimeException('rollback failed'), ), [new RecordingLoader()], $telemetry->flowContext, - ))->closure(new VoidProgress()); + )->closure(new VoidProgress()); static::fail('closure() must rethrow the commit failure'); } catch (RuntimeException $thrown) { static::assertSame($failure, $thrown); @@ -438,7 +438,7 @@ public function test_a_closure_failure_rethrows_the_users_class(): void $transaction = new RecordingTransaction(); try { - (new TransactionLoader( + new TransactionLoader( $transaction, [ BranchLoaderMother::branchLoader( @@ -447,7 +447,7 @@ public function test_a_closure_failure_rethrows_the_users_class(): void ), ], NodeMother::context(), - ))->closure(new VoidProgress()); + )->closure(new VoidProgress()); static::fail('closure() must rethrow the drain failure'); } catch (DomainException $thrown) { static::assertSame($drain, $thrown); @@ -462,14 +462,14 @@ public function test_discard_forwards_to_every_child_without_a_transaction(): vo $bare = new RecordingLoader(); $side = new RecordingLoader(); - (new TransactionLoader( + new TransactionLoader( $transaction, [ $bare, BranchLoaderMother::branchLoader(new OfferedFailure(null), $side), ], NodeMother::context(), - ))->discard(); + )->discard(); static::assertSame(['discard'], $bare->log); static::assertSame(['discard'], $side->log); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/WholeOutputHasherTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/WholeOutputHasherTest.php index 6d8f3c9890..188bd735d5 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/WholeOutputHasherTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/WholeOutputHasherTest.php @@ -26,7 +26,7 @@ final class WholeOutputHasherTest extends TestCase public function test_it_gives_the_hash_of_all_rows_and_no_partitions(): void { $rows = array_to_rows([['a' => 1], ['a' => 2]], schema(int_schema('a'))); - $kernel = (new PhpBackend())->groupedMultisetHashes(HashAlgorithm::xxh128); + $kernel = new PhpBackend()->groupedMultisetHashes(HashAlgorithm::xxh128); $kernel->add($rows->columns(), ColumnMother::of(int_schema('id'), [0, 0])); $hasher = new WholeOutputHasher(HashAlgorithm::xxh128); $hasher->add(array_to_rows([['a' => 2]], schema(int_schema('a'))), new PhpBackend()); @@ -56,7 +56,7 @@ public function test_absorb_refuses_a_partial_of_another_algorithm(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('A md5 dataset hash cannot be added to a xxh128 dataset hash'); - (new WholeOutputHasher(HashAlgorithm::xxh128))->absorb(new DatasetHash(Hash::empty(), [], HashAlgorithm::md5)); + new WholeOutputHasher(HashAlgorithm::xxh128)->absorb(new DatasetHash(Hash::empty(), [], HashAlgorithm::md5)); } public function test_absorb_reads_only_the_total_of_a_partial(): void @@ -86,7 +86,7 @@ public function test_a_hasher_that_saw_nothing_gives_the_empty_digest(): void { static::assertEquals( new DatasetHash(new Hash(0, '00000000000000000000000000000000'), [], HashAlgorithm::xxh128), - (new WholeOutputHasher(HashAlgorithm::xxh128))->hash(), + new WholeOutputHasher(HashAlgorithm::xxh128)->hash(), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/WriteLoaderFactoryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/WriteLoaderFactoryTest.php index 8fc8413258..582aa363ff 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/WriteLoaderFactoryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Executor/WriteLoaderFactoryTest.php @@ -39,8 +39,8 @@ public function test_rows_fed_to_the_branch_reach_its_write(): void $context->config->planner()->node($select, $planned); $spy = new SpyLoader(); - $feed = (new WriteLoaderFactory())->feed( - (new WritePlanner($planned))->branch([$select], [$spy], $read), + $feed = new WriteLoaderFactory()->feed( + new WritePlanner($planned)->branch([$select], [$spy], $read), $context->errorHandler(), $context, ); @@ -58,9 +58,9 @@ public function test_a_host_without_a_schema_feeds_an_empty_schema(): void $planned = new PlannedNodes(); $context->config->planner()->node($read, $planned); $spy = new SpyLoader(); - $branch = (new WritePlanner($planned))->branch([], [$spy], $read); + $branch = new WritePlanner($planned)->branch([], [$spy], $read); - $feed = (new WriteLoaderFactory())->feed($branch, $context->errorHandler(), $context); + $feed = new WriteLoaderFactory()->feed($branch, $context->errorHandler(), $context); $feed->load(array_to_rows([['id' => 1]], schema(int_schema('id')))); $feed->closure(new VoidProgress()); @@ -77,8 +77,8 @@ public function test_a_throw_only_handler_surfaces_a_failing_step(): void $planned = new PlannedNodes(); $context->config->planner()->node($transform, $planned); - $feed = (new WriteLoaderFactory())->feed( - (new WritePlanner($planned))->branch([$transform], [new SpyLoader()], $read), + $feed = new WriteLoaderFactory()->feed( + new WritePlanner($planned)->branch([$transform], [new SpyLoader()], $read), new ThrowError(), $context, ); @@ -99,7 +99,7 @@ public function test_a_branch_inside_a_branch_runs_as_the_feed_of_its_parents_pi $inner = $planner->branch([], [$spy], $read); $outer = $planner->branch([], [$inner], $read); - $feed = (new WriteLoaderFactory())->feed($outer, $context->errorHandler(), $context); + $feed = new WriteLoaderFactory()->feed($outer, $context->errorHandler(), $context); $feed->load(array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id')))); $feed->closure(new VoidProgress()); @@ -112,7 +112,7 @@ public function test_a_transaction_group_runs_as_one_transaction_over_its_writes $transaction = new RecordingTransaction(); $spy = new SpyLoader(); - $loader = (new WriteLoaderFactory())->transactional(new TransactionGroup($transaction, [$spy]), $context); + $loader = new WriteLoaderFactory()->transactional(new TransactionGroup($transaction, [$spy]), $context); $loader->load(array_to_rows([['id' => 1]], schema(int_schema('id')))); $loader->closure(new VoidProgress()); @@ -127,7 +127,7 @@ public function test_a_branch_is_built_once_per_factory(): void $read = NodeMother::read(from_array([['id' => 1]], schema(int_schema('id')))); $planned = new PlannedNodes(); $context->config->planner()->node($read, $planned); - $branch = (new WritePlanner($planned))->branch([], [new SpyLoader()], $read); + $branch = new WritePlanner($planned)->branch([], [new SpyLoader()], $read); $writes = new WriteLoaderFactory(); static::assertSame( @@ -136,7 +136,7 @@ public function test_a_branch_is_built_once_per_factory(): void ); static::assertNotSame( $writes->step($branch, $context->errorHandler(), $context), - (new WriteLoaderFactory())->step($branch, $context->errorHandler(), $context), + new WriteLoaderFactory()->step($branch, $context->errorHandler(), $context), ); } @@ -152,7 +152,7 @@ public function test_a_transaction_is_built_once_per_factory(): void ); static::assertNotSame( $writes->step($group, $context->errorHandler(), $context), - (new WriteLoaderFactory())->step($group, $context->errorHandler(), $context), + new WriteLoaderFactory()->step($group, $context->errorHandler(), $context), ); } @@ -160,7 +160,7 @@ public function test_a_loader_write_is_itself(): void { $spy = new SpyLoader(); - static::assertSame($spy, (new WriteLoaderFactory())->write( + static::assertSame($spy, new WriteLoaderFactory()->write( $spy, NodeMother::context()->errorHandler(), NodeMother::context(), @@ -171,7 +171,7 @@ public function test_a_step_that_is_no_branch_is_itself(): void { $limit = new LimitTransformer(1); - static::assertSame($limit, (new WriteLoaderFactory())->step( + static::assertSame($limit, new WriteLoaderFactory()->step( $limit, NodeMother::context()->errorHandler(), NodeMother::context(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/FlowContextTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/FlowContextTest.php index e537825632..c35c0580b9 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/FlowContextTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/FlowContextTest.php @@ -50,7 +50,7 @@ public function test_with_error_handler_returns_a_new_context_and_leaves_this_on public function test_config_constructor_takes_no_filesystem_table(): void { - $constructor = (new ReflectionClass(Config::class))->getConstructor(); + $constructor = new ReflectionClass(Config::class)->getConstructor(); static::assertNotNull($constructor); static::assertCount(18, $constructor->getParameters()); @@ -77,7 +77,7 @@ public function test_flow_context_exposes_no_filesystem_and_no_streams(): void ], array_map( static fn(ReflectionMethod $m): string => $m->getName(), - (new ReflectionClass(FlowContext::class))->getMethods(ReflectionMethod::IS_PUBLIC), + new ReflectionClass(FlowContext::class)->getMethods(ReflectionMethod::IS_PUBLIC), ), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Heartbeat/HeartbeatStageTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Heartbeat/HeartbeatStageTest.php index 740ef58a67..bdc5d64e2a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Heartbeat/HeartbeatStageTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Heartbeat/HeartbeatStageTest.php @@ -141,7 +141,7 @@ public function test_ended_neither_beats_nor_throws_and_the_next_due_check_does( $throttle = $context->throttle(new ScheduledHeartbeat($recording, 1)); $context->seconds(1); - (new HeartbeatStage(StageName::parallel, ProgressUnit::rows, null, null, $throttle, 0))->ended( + new HeartbeatStage(StageName::parallel, ProgressUnit::rows, null, null, $throttle, 0)->ended( 500, [new StageProgress(7, StageName::join, ProgressUnit::rows, null, 120, null, 0.0, null)], 1000, @@ -165,7 +165,7 @@ public function test_an_unchanged_ended_report_is_no_progress(): void $throttle = $context->throttle(new ScheduledHeartbeat($recording, 5)); $context->seconds(5); - (new HeartbeatStage(StageName::parallel, ProgressUnit::rows, null, null, $throttle, 0))->ended(0, [], 0, 0); + new HeartbeatStage(StageName::parallel, ProgressUnit::rows, null, null, $throttle, 0)->ended(0, [], 0, 0); $throttle->stage(StageName::sort)->advanced(0); static::assertSame(5.0, $recording->pulses()[0]->idleSeconds); @@ -233,7 +233,7 @@ public function test_done_without_a_call_before_does_nothing(): void $recording = new RecordingHeartbeat(); $throttle = $context->throttle(new ScheduledHeartbeat($recording, 1)); - (new HeartbeatStage(StageName::sort, ProgressUnit::rows, 7, null, $throttle, 0))->done(); + new HeartbeatStage(StageName::sort, ProgressUnit::rows, 7, null, $throttle, 0)->done(); $context->seconds(1); $throttle->beatWhenDue(); @@ -260,7 +260,7 @@ public function test_a_second_done_does_nothing(): void public function test_describes_its_name_id_and_location(): void { - $throttle = (new HeartbeatContext())->throttle(new ScheduledHeartbeat(new RecordingHeartbeat(), 1)); + $throttle = new HeartbeatContext()->throttle(new ScheduledHeartbeat(new RecordingHeartbeat(), 1)); static::assertEquals( Description::compose(HeartbeatStage::class, [ @@ -268,18 +268,11 @@ public function test_describes_its_name_id_and_location(): void 'id' => 7, 'subject' => 'memory://in/', ]), - (new HeartbeatStage( - StageName::group_by, - ProgressUnit::groups, - 7, - 'memory://in/', - $throttle, - 3, - ))->describe(), + new HeartbeatStage(StageName::group_by, ProgressUnit::groups, 7, 'memory://in/', $throttle, 3)->describe(), ); static::assertEquals( Description::compose(VoidProgress::class, []), - (new HeartbeatStage(StageName::sort, ProgressUnit::rows, null, null, $throttle, 4))->describe(), + new HeartbeatStage(StageName::sort, ProgressUnit::rows, null, null, $throttle, 4)->describe(), ); } @@ -295,7 +288,7 @@ public function test_reports_every_as_often_as_its_most_frequent_heartbeat(): vo { static::assertSame( 0.25, - (new HeartbeatContext()) + new HeartbeatContext() ->throttle( new ScheduledHeartbeat(new RecordingHeartbeat(), 120), new ScheduledHeartbeat(new RecordingHeartbeat(), 0.25), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Heartbeat/HeartbeatThrottleTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Heartbeat/HeartbeatThrottleTest.php index 997367d97c..9b2e6fdd04 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Heartbeat/HeartbeatThrottleTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Heartbeat/HeartbeatThrottleTest.php @@ -123,7 +123,7 @@ public function test_counts_rows_read_from_the_source(): void public function test_a_stop_signal_reaches_the_source(): void { $stopped = new ArrayObject(); - $throttle = (new HeartbeatContext())->throttle(new ScheduledHeartbeat(new RecordingHeartbeat(), 120)); + $throttle = new HeartbeatContext()->throttle(new ScheduledHeartbeat(new RecordingHeartbeat(), 120)); $generator = $throttle->reading(HeartbeatContext::stoppable($stopped), $throttle->stage(StageName::read)); $generator->current(); @@ -714,7 +714,7 @@ public function test_unread_rows_leave_the_rows_read(): void public function test_unread_rows_add_up(): void { - $throttle = (new HeartbeatContext())->throttle(new ScheduledHeartbeat(new RecordingHeartbeat(), 120)); + $throttle = new HeartbeatContext()->throttle(new ScheduledHeartbeat(new RecordingHeartbeat(), 120)); iterator_to_array( $throttle->reading( @@ -1563,7 +1563,7 @@ public function test_its_interval_is_the_smallest_of_its_heartbeats(): void { static::assertSame( 0.25, - (new HeartbeatContext()) + new HeartbeatContext() ->throttle( new ScheduledHeartbeat(new RecordingHeartbeat(), 120), new ScheduledHeartbeat(new RecordingHeartbeat(), 0.25), @@ -1859,7 +1859,7 @@ public function test_a_serial_run_peak_is_at_least_its_sampled_memory_and_at_mos public function test_the_read_stage_is_the_planned_one_when_the_plan_has_it(): void { - $throttle = (new HeartbeatContext())->throttle(new ScheduledHeartbeat(new RecordingHeartbeat(), 120)); + $throttle = new HeartbeatContext()->throttle(new ScheduledHeartbeat(new RecordingHeartbeat(), 120)); $planned = $throttle->stage(StageName::read); static::assertSame($planned, $throttle->readStage($planned, from_array([['id' => 1]]), null)); @@ -1875,7 +1875,7 @@ public function test_a_plan_without_a_read_stage_reads_into_a_new_one_at_the_fil $throttle ->readStage( new VoidProgress(), - (new RecordingFileExtractor(schema(int_schema('id'))))->withSource(path('memory://in/orders.csv')), + new RecordingFileExtractor(schema(int_schema('id')))->withSource(path('memory://in/orders.csv')), null, ) ->read(1); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Heartbeat/ScheduledHeartbeatTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Heartbeat/ScheduledHeartbeatTest.php index d2b43716ac..aa4022c468 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Heartbeat/ScheduledHeartbeatTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Heartbeat/ScheduledHeartbeatTest.php @@ -144,6 +144,6 @@ public function test_an_interval_below_a_tenth_of_a_second_is_refused(): void public function test_a_tenth_of_a_second_is_the_smallest_interval(): void { - static::assertSame(0.1, (new ScheduledHeartbeat(new RecordingHeartbeat(), 0.1))->everySeconds); + static::assertSame(0.1, new ScheduledHeartbeat(new RecordingHeartbeat(), 0.1)->everySeconds); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/DatasetHashTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/DatasetHashTest.php index 5a997fa1ed..608d5b2272 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/DatasetHashTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/DatasetHashTest.php @@ -40,7 +40,7 @@ public function test_plus_adds_the_totals_and_the_hashes_of_equal_partitions(): ], HashAlgorithm::xxh128, ), - (new DatasetHash( + new DatasetHash( new Hash(1, '00000000000000000000000000000001'), [ new PartitionHash( @@ -49,7 +49,7 @@ public function test_plus_adds_the_totals_and_the_hashes_of_equal_partitions(): ), ], HashAlgorithm::xxh128, - ))->plus( + )->plus( new DatasetHash( new Hash(2, '00000000000000000000000000000002'), [ @@ -81,7 +81,7 @@ public function test_plus_keeps_different_partitions_in_order_of_first_appearanc static::assertEquals( [$pl, $de, $us], - (new DatasetHash(new Hash(2, '00000000000000000000000000000003'), [$pl, $de], HashAlgorithm::xxh128))->plus( + new DatasetHash(new Hash(2, '00000000000000000000000000000003'), [$pl, $de], HashAlgorithm::xxh128)->plus( new DatasetHash(new Hash(1, '00000000000000000000000000000004'), [$us], HashAlgorithm::xxh128), )->partitions, ); @@ -94,7 +94,7 @@ public function test_plus_merges_equal_partitions_of_one_operand(): void new Partitions(new Partition('country', 'PL')), new Hash(2, '00000000000000000000000000000003'), )], - (new DatasetHash( + new DatasetHash( new Hash(2, '00000000000000000000000000000003'), [ new PartitionHash( @@ -107,7 +107,7 @@ public function test_plus_merges_equal_partitions_of_one_operand(): void ), ], HashAlgorithm::xxh128, - ))->plus(new DatasetHash(Hash::empty(), [], HashAlgorithm::xxh128))->partitions, + )->plus(new DatasetHash(Hash::empty(), [], HashAlgorithm::xxh128))->partitions, ); } @@ -118,7 +118,7 @@ public function test_plus_takes_null_and_the_null_folder_name_as_one_partition() new Partitions(new Partition('country', null)), new Hash(2, '00000000000000000000000000000003'), )], - (new DatasetHash( + new DatasetHash( new Hash(1, '00000000000000000000000000000001'), [ new PartitionHash( @@ -127,7 +127,7 @@ public function test_plus_takes_null_and_the_null_folder_name_as_one_partition() ), ], HashAlgorithm::xxh128, - ))->plus( + )->plus( new DatasetHash( new Hash(1, '00000000000000000000000000000002'), [ @@ -156,14 +156,14 @@ public function test_plus_with_the_empty_hash_is_the_identity(): void ); static::assertEquals($hash, $hash->plus(new DatasetHash(Hash::empty(), [], HashAlgorithm::xxh128))); - static::assertEquals($hash, (new DatasetHash(Hash::empty(), [], HashAlgorithm::xxh128))->plus($hash)); + static::assertEquals($hash, new DatasetHash(Hash::empty(), [], HashAlgorithm::xxh128)->plus($hash)); } public function test_plus_of_two_whole_hashes_adds_the_totals_and_has_no_partitions(): void { static::assertEquals( new DatasetHash(new Hash(5, 'ffffffffffffffff0000000000000000'), [], HashAlgorithm::xxh128), - (new DatasetHash(new Hash(2, 'ffffffffffffffffffffffffffffffff'), [], HashAlgorithm::xxh128))->plus( + new DatasetHash(new Hash(2, 'ffffffffffffffffffffffffffffffff'), [], HashAlgorithm::xxh128)->plus( new DatasetHash(new Hash(3, '00000000000000000000000000000001'), [], HashAlgorithm::xxh128), ), ); @@ -186,7 +186,7 @@ public function test_normalize_writes_the_total_and_each_partition(): void ], ], ], - (new DatasetHash( + new DatasetHash( new Hash(3, '31be1d609a26d996382e2a23855ebbe5'), [ new PartitionHash( @@ -199,7 +199,7 @@ public function test_normalize_writes_the_total_and_each_partition(): void ), ], HashAlgorithm::xxh128, - ))->normalize(), + )->normalize(), ); } @@ -273,7 +273,7 @@ public function test_plus_refuses_a_hash_of_another_algorithm(): void 'A sha256 dataset hash cannot be added to a xxh128 dataset hash, hash both datasets with the same algorithm', ); - (new DatasetHash(Hash::empty(), [], HashAlgorithm::xxh128))->plus( + new DatasetHash(Hash::empty(), [], HashAlgorithm::xxh128)->plus( new DatasetHash(Hash::empty(), [], HashAlgorithm::sha256), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/HashTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/HashTest.php index 114c0d6957..d59bf73a28 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/HashTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/HashTest.php @@ -14,7 +14,7 @@ public function test_normalize_writes_the_rows_and_the_value(): void { static::assertSame( ['rows' => 120, 'value' => 'ab8476f29c95212a306bffff897d7afb'], - (new Hash(120, 'ab8476f29c95212a306bffff897d7afb'))->normalize(), + new Hash(120, 'ab8476f29c95212a306bffff897d7afb')->normalize(), ); } @@ -22,7 +22,7 @@ public function test_plus_adds_the_rows_and_each_lane_of_the_value_with_wrapping { static::assertEquals( new Hash(5, 'ffffffffffffffff0000000000000000'), - (new Hash(2, 'ffffffffffffffffffffffffffffffff'))->plus(new Hash(3, '00000000000000000000000000000001')), + new Hash(2, 'ffffffffffffffffffffffffffffffff')->plus(new Hash(3, '00000000000000000000000000000001')), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/PartitionHashTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/PartitionHashTest.php index 3f2cf15953..5a9ef5c089 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/PartitionHashTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/PartitionHashTest.php @@ -20,10 +20,10 @@ public function test_normalize_writes_the_partitions_in_declaration_order_with_a 'partitions' => ['date' => '2026-11-20', 'country' => null], 'hash' => ['rows' => 120, 'value' => 'ab8476f29c95212a306bffff897d7afb'], ], - (new PartitionHash( + new PartitionHash( new Partitions(new Partition('date', '2026-11-20'), new Partition('country', null)), new Hash(120, 'ab8476f29c95212a306bffff897d7afb'), - ))->normalize(), + )->normalize(), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/ProcessesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/ProcessesTest.php index 571b0b5c77..d70f9b8f92 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/ProcessesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/ProcessesTest.php @@ -20,31 +20,31 @@ public function test_a_serial_run_has_no_worker_peak(): void public function test_the_worker_peak_is_the_largest_worker(): void { - static::assertEquals(Unit::fromBytes(41), (new Processes(Unit::fromBytes(25), [ + static::assertEquals(Unit::fromBytes(41), new Processes(Unit::fromBytes(25), [ Unit::fromBytes(40), Unit::fromBytes(41), Unit::fromBytes(39), - ]))->workerPeak()); + ])->workerPeak()); } public function test_the_peak_sum_adds_the_parent_and_every_worker(): void { - static::assertEquals(Unit::fromBytes(145), (new Processes(Unit::fromBytes(25), [ + static::assertEquals(Unit::fromBytes(145), new Processes(Unit::fromBytes(25), [ Unit::fromBytes(40), Unit::fromBytes(41), Unit::fromBytes(39), - ]))->peakSum()); + ])->peakSum()); } public function test_normalize_gives_every_peak_in_bytes(): void { static::assertSame( ['parent' => 25, 'workers' => [40, 41], 'worker_peak' => 41, 'peak_sum' => 106], - (new Processes(Unit::fromBytes(25), [Unit::fromBytes(40), Unit::fromBytes(41)]))->normalize(), + new Processes(Unit::fromBytes(25), [Unit::fromBytes(40), Unit::fromBytes(41)])->normalize(), ); static::assertSame( ['parent' => 25, 'workers' => [], 'worker_peak' => null, 'peak_sum' => 25], - (new Processes(Unit::fromBytes(25), []))->normalize(), + new Processes(Unit::fromBytes(25), [])->normalize(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/SourceStatisticsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/SourceStatisticsTest.php index 0128591c07..f58e9daf67 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/SourceStatisticsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/SourceStatisticsTest.php @@ -24,12 +24,12 @@ public function test_the_rows_error_is_the_estimates_distance_relative_to_the_ro ): void { static::assertEqualsWithDelta( $error, - (new SourceStatistics( + new SourceStatistics( 'Source', new Statistics(Cardinality::approximately($estimate)), $measured, true, - ))->rowsError(), + )->rowsError(), 0.000_001, ); } @@ -38,26 +38,26 @@ public function test_an_exact_declaration_that_holds_has_no_error(): void { static::assertSame( 0.0, - (new SourceStatistics('Source', new Statistics(Cardinality::exact(5)), 5, true))->rowsError(), + new SourceStatistics('Source', new Statistics(Cardinality::exact(5)), 5, true)->rowsError(), ); } public function test_an_incomplete_read_has_no_error(): void { static::assertNull( - (new SourceStatistics('Source', new Statistics(Cardinality::exact(100)), 10, false))->rowsError(), + new SourceStatistics('Source', new Statistics(Cardinality::exact(100)), 10, false)->rowsError(), ); } public function test_there_is_no_error_without_declared_rows(): void { - static::assertNull((new SourceStatistics('Source', new Statistics(), 5, true))->rowsError()); + static::assertNull(new SourceStatistics('Source', new Statistics(), 5, true)->rowsError()); } public function test_an_upper_bound_alone_has_no_error(): void { static::assertNull( - (new SourceStatistics('Source', new Statistics(Cardinality::atMost(10)), 5, true))->rowsError(), + new SourceStatistics('Source', new Statistics(Cardinality::atMost(10)), 5, true)->rowsError(), ); } @@ -65,7 +65,7 @@ public function test_an_estimate_of_zero_against_zero_rows_has_no_error(): void { static::assertSame( 0.0, - (new SourceStatistics('Source', new Statistics(Cardinality::approximately(0)), 0, true))->rowsError(), + new SourceStatistics('Source', new Statistics(Cardinality::approximately(0)), 0, true)->rowsError(), ); } @@ -73,7 +73,7 @@ public function test_a_positive_estimate_against_zero_rows_is_infinitely_off(): { static::assertSame( INF, - (new SourceStatistics('Source', new Statistics(Cardinality::approximately(500)), 0, true))->rowsError(), + new SourceStatistics('Source', new Statistics(Cardinality::approximately(500)), 0, true)->rowsError(), ); } @@ -90,26 +90,21 @@ public function test_normalize(): void 'complete' => true, 'rows_error' => 0.0, ], - (new SourceStatistics('Source', new Statistics(Cardinality::exact(5)), 5, true))->normalize(), + new SourceStatistics('Source', new Statistics(Cardinality::exact(5)), 5, true)->normalize(), ); } public function test_normalize_gives_no_rows_error_when_it_is_infinite_or_unknown(): void { static::assertNull( - (new SourceStatistics('Source', new Statistics(Cardinality::exact(5)), 0, true))->normalize()['rows_error'], + new SourceStatistics('Source', new Statistics(Cardinality::exact(5)), 0, true)->normalize()['rows_error'], ); static::assertNull( - (new SourceStatistics( - 'Source', - new Statistics(Cardinality::exact(5)), - 2, - false, - ))->normalize()['rows_error'], + new SourceStatistics('Source', new Statistics(Cardinality::exact(5)), 2, false)->normalize()['rows_error'], ); static::assertSame( 0.5, - (new SourceStatistics('Source', new Statistics(Cardinality::exact(3)), 2, true))->normalize()['rows_error'], + new SourceStatistics('Source', new Statistics(Cardinality::exact(3)), 2, true)->normalize()['rows_error'], ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/Statistics/ColumnTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/Statistics/ColumnTest.php index 4c30bf1d50..5c9ff0680e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/Statistics/ColumnTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/Statistics/ColumnTest.php @@ -256,10 +256,10 @@ public function test_datetimes_differing_only_in_microseconds_are_distinct(): vo static::assertSame( 2, - (new Column($definition, ColumnMother::of($definition, [ + new Column($definition, ColumnMother::of($definition, [ new DateTimeImmutable('2026-01-01 10:00:00.000001'), new DateTimeImmutable('2026-01-01 10:00:00.000002'), - ])))->distinctCount(), + ]))->distinctCount(), ); } @@ -267,17 +267,14 @@ public function test_zero_and_negative_zero_are_one_distinct_value(): void { $definition = float_schema('f'); - static::assertSame(1, (new Column($definition, ColumnMother::of($definition, [0.0, -0.0])))->distinctCount()); + static::assertSame(1, new Column($definition, ColumnMother::of($definition, [0.0, -0.0]))->distinctCount()); } public function test_nans_are_one_distinct_value(): void { $definition = float_schema('f'); - static::assertSame( - 2, - (new Column($definition, ColumnMother::of($definition, [NAN, NAN, 1.0])))->distinctCount(), - ); + static::assertSame(2, new Column($definition, ColumnMother::of($definition, [NAN, NAN, 1.0]))->distinctCount()); } public function test_nan_is_never_a_bound_whatever_its_position(): void @@ -309,18 +306,18 @@ public function test_normalize_gives_every_statistic_and_dates_as_text(): void 'min_elements_count' => null, 'max_elements_count' => null, ], - (new Column($definition, ColumnMother::of($definition, [ + new Column($definition, ColumnMother::of($definition, [ new DateTimeImmutable('2024-01-02 00:00:00 UTC'), null, new DateTimeImmutable('2024-01-01 00:00:00 UTC'), - ])))->normalize(), + ]))->normalize(), ); } public function test_normalize_keeps_scalar_bounds(): void { $definition = str_schema('name'); - $normalized = (new Column($definition, ColumnMother::of($definition, ['a', 'abc'])))->normalize(); + $normalized = new Column($definition, ColumnMother::of($definition, ['a', 'abc']))->normalize(); static::assertSame([1, 3], [$normalized['min_length'], $normalized['max_length']]); } @@ -329,7 +326,7 @@ public function test_normalize_names_float_bounds_json_cannot_hold(): void { $definition = float_schema('f'); - $infinite = (new Column($definition, ColumnMother::of($definition, [INF, NAN, -INF, 1.0])))->normalize(); + $infinite = new Column($definition, ColumnMother::of($definition, [INF, NAN, -INF, 1.0]))->normalize(); static::assertSame(['-INF', 'INF'], [$infinite['min'], $infinite['max']]); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/Statistics/ExecutionTimeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/Statistics/ExecutionTimeTest.php index 9bc9c87fff..a1c5c1dc47 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/Statistics/ExecutionTimeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Metrics/Statistics/ExecutionTimeTest.php @@ -15,11 +15,11 @@ public function test_a_start_equal_to_the_finish_is_allowed(): void { static::assertSame( 0, - (new ExecutionTime( + new ExecutionTime( new DateTimeImmutable('2025-01-01 00:00:00 UTC'), new DateTimeImmutable('2025-01-01 00:00:00 UTC'), new HighResolutionTime(0, 0), - ))->normalize()['duration_ns'], + )->normalize()['duration_ns'], ); } @@ -31,11 +31,11 @@ public function test_normalize(): void 'finished_at' => '2025-01-01T00:05:00.250+00:00', 'duration_ns' => 300_250_000_000, ], - (new ExecutionTime( + new ExecutionTime( new DateTimeImmutable('2025-01-01 00:00:00 UTC'), new DateTimeImmutable('2025-01-01 00:05:00.250 UTC'), new HighResolutionTime(300, 250_000_000), - ))->normalize(), + )->normalize(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Telemetry/SpanStackTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Telemetry/SpanStackTest.php index 180be763e9..10c3eb59fd 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Telemetry/SpanStackTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Telemetry/SpanStackTest.php @@ -77,7 +77,7 @@ public function test_drain_on_empty_stack_completes_nothing(): void { $context = new MemoryTelemetryContext(); - (new SpanStack())->drain($context->telemetry->tracer('flow-php'), 'Span was never completed.'); + new SpanStack()->drain($context->telemetry->tracer('flow-php'), 'Span was never completed.'); static::assertEmpty($context->spans->endedSpans()); } @@ -116,9 +116,9 @@ public function test_drain_detaches_every_scope(): void public function test_remove_of_a_span_never_pushed_returns_false(): void { - $tracer = (new MemoryTelemetryContext())->telemetry->tracer('flow-php'); + $tracer = new MemoryTelemetryContext()->telemetry->tracer('flow-php'); - static::assertFalse((new SpanStack())->remove(new SpanScope($tracer->span('outer'), null))); + static::assertFalse(new SpanStack()->remove(new SpanScope($tracer->span('outer'), null))); } public function test_remove_takes_out_that_span_only_whatever_its_position(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Telemetry/TelemetryContextTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Telemetry/TelemetryContextTest.php index c8ecb73465..bcccb5e2e6 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Telemetry/TelemetryContextTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Telemetry/TelemetryContextTest.php @@ -344,7 +344,7 @@ public function test_dataframe_started_creates_span_and_logs_the_configuration_w new LoggerProvider($logProcessor, $clock, $contextStorage), ); - (new TelemetryContext( + new TelemetryContext( 'id', 'flow_dataframe', new PhpBackend(), @@ -352,7 +352,7 @@ public function test_dataframe_started_creates_span_and_logs_the_configuration_w $telemetry->tracer('flow-php'), $telemetry->meter('flow-php'), new TelemetryOptions(), - ))->dataFrameStarted(['cache' => 'memory']); + )->dataFrameStarted(['cache' => 'memory']); $startedSpans = $spanProcessor->startedSpans(); static::assertCount(1, $startedSpans); @@ -772,7 +772,7 @@ public function test_optimizer_rules_are_logged(): void new LoggerProvider($logProcessor, $clock, $contextStorage), ); - (new TelemetryContext( + new TelemetryContext( 'id', 'flow_dataframe', new PhpBackend(), @@ -780,7 +780,7 @@ public function test_optimizer_rules_are_logged(): void $telemetry->tracer('flow-php'), $telemetry->meter('flow-php'), new TelemetryOptions(), - ))->dataFrameStarted(config()->telemetryAttributes()); + )->dataFrameStarted(config()->telemetryAttributes()); $debugLogs = $logProcessor->entriesWithSeverity(Severity::DEBUG); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Telemetry/TraceableRowsStorageTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Telemetry/TraceableRowsStorageTest.php index d0793151db..fff878ca11 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Telemetry/TraceableRowsStorageTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Runtime/Telemetry/TraceableRowsStorageTest.php @@ -63,7 +63,7 @@ protected function setUp(): void public function test_remove_creates_span_with_correct_name_and_attributes(): void { - (new TraceableRowsStorage(new MemoryRowsStorage(), $this->telemetry))->remove('test-key'); + new TraceableRowsStorage(new MemoryRowsStorage(), $this->telemetry)->remove('test-key'); $this->telemetry->flush(); $spans = $this->spanProcessor->endedSpans(); @@ -97,11 +97,9 @@ public function test_has_increments_hit_counter_when_key_exists(): void public function test_has_increments_miss_counter_when_key_does_not_exist(): void { - static::assertFalse((new TraceableRowsStorage( - new MemoryRowsStorage(), - $this->telemetry, - 'test_dataframe', - ))->has('non-existing-key')); + static::assertFalse(new TraceableRowsStorage(new MemoryRowsStorage(), $this->telemetry, 'test_dataframe')->has( + 'non-existing-key', + )); $this->telemetry->flush(); $hitMetrics = $this->metricProcessor->metricsWithName('flow.cache.hits'); @@ -118,7 +116,7 @@ public function test_close_goes_to_the_inner_storage(): void $inner = new SpyRowsStorage(new MemoryRowsStorage()); $inner->append('key', array_to_rows([['id' => 1]], schema(int_schema('id')))); - (new TraceableRowsStorage($inner, $this->telemetry))->close('key'); + new TraceableRowsStorage($inner, $this->telemetry)->close('key'); static::assertSame(['key'], $inner->closedBucketIds()); } @@ -137,7 +135,7 @@ public function test_reads_go_to_the_inner_storage(): void public function test_append_creates_span_with_rows_value_type(): void { - (new TraceableRowsStorage(new MemoryRowsStorage(), $this->telemetry))->append('test-key', rows(schema())); + new TraceableRowsStorage(new MemoryRowsStorage(), $this->telemetry)->append('test-key', rows(schema())); $this->telemetry->flush(); $spans = $this->spanProcessor->endedSpans(); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/BucketingConfigTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/BucketingConfigTest.php index 713200035a..973a56a814 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/BucketingConfigTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/BucketingConfigTest.php @@ -34,7 +34,7 @@ public function test_a_rebuilt_config_keeps_one_bucket_and_a_batch_of_one(): voi public function test_a_rebuilt_zero_bucket_count_and_batch_size_become_one(): void { - $described = (new BucketingConfig(new MemoryRowsStorage(), 3, 500, Unit::fromBytes(1)))->describe(); + $described = new BucketingConfig(new MemoryRowsStorage(), 3, 500, Unit::fromBytes(1))->describe(); static::assertNotNull($described); $data = type_array()->assert(Json::decode(Json::encode($described->normalize()))['data'] ?? null); $rebuilt = BucketingConfig::fromDescription(['buckets_count' => 0, 'batch_size' => 0] + $data, new Rebuild()); @@ -82,12 +82,12 @@ public function test_spilling_keeps_a_resident_storage_and_wraps_any_other(): vo $resident = new MemoryRowsStorage(); $disk = new SpyRowsStorage(new MemoryRowsStorage()); - static::assertSame($resident, (new BucketingConfig($resident, 64, 1000, Unit::fromMb(1)))->spilling( + static::assertSame($resident, new BucketingConfig($resident, 64, 1000, Unit::fromMb(1))->spilling( new PhpBackend(), new MemoryBudget(new PhpBackend(), Unit::fromMb(1), null), )); - $wrapped = (new BucketingConfig($disk, 64, 1, Unit::fromGb(64)))->spilling( + $wrapped = new BucketingConfig($disk, 64, 1, Unit::fromGb(64))->spilling( new PhpBackend(), new MemoryBudget(new PhpBackend(), Unit::fromBytes(1), null), ); @@ -101,12 +101,12 @@ public function test_spilling_keeps_a_resident_storage_and_wraps_any_other(): vo public function test_a_psr_cache_storage_does_not_describe(): void { static::assertNull( - (new BucketingConfig( + new BucketingConfig( new PsrRowsStorage(new ArrayCache(), new FloeSerializer(new PhpBackend())), 3, 500, Unit::fromMb(1), - ))->describe(), + )->describe(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeFilesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeFilesTest.php index 43f5f9ba7d..74d649138c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeFilesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeFilesTest.php @@ -48,12 +48,12 @@ public function test_all_column_types_round_trip(): void $path = path('memory://all-types.floe'); $rows = RowsMother::withAllColumnTypes(); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $rows->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $rows->schema()); $writer->write($rows); $writer->close(); $batches = iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(), ); @@ -74,11 +74,11 @@ public function test_batches_follow_requested_size(): void ['id' => 4], ['id' => 5], ], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); - $reader = (new FloeFiles($filesystem, new AdaptiveBackend()))->read($path); + $reader = new FloeFiles($filesystem, new AdaptiveBackend())->read($path); $sizes = /** @@ -103,13 +103,13 @@ public function test_limit_caps_returned_rows(): void $path = path('memory://limit.floe'); $data = array_to_rows([['id' => 1], ['id' => 2], ['id' => 3], ['id' => 4]], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); $ids = []; - foreach ((new FloeFiles($filesystem, new AdaptiveBackend())) + foreach (new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(batchSize: 100, offset: 0, limit: 2) as $batch) { foreach ($batch->toArray() as $row) { @@ -126,12 +126,12 @@ public function test_limit_stops_within_a_batch(): void $path = path('memory://limit-batch.floe'); $data = array_to_rows([['id' => 1], ['id' => 2], ['id' => 3]], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); $batches = iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(batchSize: 100, limit: 2), ); @@ -144,7 +144,7 @@ public function test_negative_offset_throws(): void { $filesystem = memory_filesystem(); $path = path('memory://neg-offset.floe'); - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->create($path, schema()) ->close(); @@ -152,7 +152,7 @@ public function test_negative_offset_throws(): void $this->expectExceptionMessage('offset must be greater or equal to 0'); iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(offset: -1), ); @@ -162,7 +162,7 @@ public function test_non_positive_limit_throws(): void { $filesystem = memory_filesystem(); $path = path('memory://zero-limit.floe'); - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->create($path, schema()) ->close(); @@ -170,7 +170,7 @@ public function test_non_positive_limit_throws(): void $this->expectExceptionMessage('limit must be greater than 0'); iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(limit: 0), ); @@ -182,13 +182,13 @@ public function test_offset_skips_leading_rows_within_a_single_section(): void $path = path('memory://offset-single.floe'); $data = array_to_rows([['id' => 1], ['id' => 2], ['id' => 3], ['id' => 4]], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); $ids = []; - foreach ((new FloeFiles($filesystem, new AdaptiveBackend())) + foreach (new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(offset: 2) as $batch) { foreach ($batch->toArray() as $row) { @@ -216,7 +216,7 @@ public function test_offset_skips_whole_sections(): void ], schema(int_schema('id'), str_schema('email', nullable: true)), ); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); @@ -224,7 +224,7 @@ public function test_offset_skips_whole_sections(): void $names = []; $emails = []; - foreach ((new FloeFiles($filesystem, new AdaptiveBackend())) + foreach (new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(offset: 4) as $batch) { foreach ($batch->toArray() as $row) { @@ -246,14 +246,14 @@ public function test_offset_beyond_total_rows_yields_nothing(): void $path = path('memory://offset-past-end.floe'); $data = array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); static::assertSame( [], iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(offset: 2), ), @@ -261,7 +261,7 @@ public function test_offset_beyond_total_rows_yields_nothing(): void static::assertSame( [], iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(offset: 5), ), @@ -274,7 +274,7 @@ public function test_offset_respects_batch_size(): void $path = path('memory://offset-batches.floe'); $data = array_to_rows([['id' => 1], ['id' => 2], ['id' => 3], ['id' => 4]], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); @@ -283,7 +283,7 @@ public function test_offset_respects_batch_size(): void array_map( static fn(Rows $batch): int => $batch->count(), iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(batchSize: 1, offset: 1), ), @@ -303,13 +303,13 @@ public function test_offset_and_limit_combined(): void ['id' => 4], ['id' => 5], ], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); $ids = []; - foreach ((new FloeFiles($filesystem, new AdaptiveBackend())) + foreach (new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(batchSize: 100, offset: 1, limit: 2) as $batch) { foreach ($batch->toArray() as $row) { @@ -337,11 +337,11 @@ public function test_offset_matches_tail_of_full_read(): void ], schema(int_schema('id'), str_schema('email', nullable: true)), ); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); - $reader = (new FloeFiles($filesystem, new AdaptiveBackend()))->read($path); + $reader = new FloeFiles($filesystem, new AdaptiveBackend())->read($path); $full = []; foreach ($reader->rows() as $batch) { @@ -369,7 +369,7 @@ public function test_offset_reads_through_a_custom_identity_codec(): void $path = path('memory://offset-codec.floe'); $data = array_to_rows([['id' => 1], ['id' => 2], ['id' => 3]], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend(), new Options(codec: new CodecStub(0x00))))->create( + $writer = new FloeFiles($filesystem, new AdaptiveBackend(), new Options(codec: new CodecStub(0x00)))->create( $path, $data->schema(), ); @@ -378,7 +378,7 @@ public function test_offset_reads_through_a_custom_identity_codec(): void $ids = []; - foreach ((new FloeFiles($filesystem, new AdaptiveBackend(), new Options(codec: new CodecStub(0x00)))) + foreach (new FloeFiles($filesystem, new AdaptiveBackend(), new Options(codec: new CodecStub(0x00))) ->read($path) ->rows(offset: 1) as $batch) { foreach ($batch->toArray() as $extractedRow) { @@ -405,7 +405,7 @@ public function test_corrupt_row_body_throws_wrapped_exception(): void $this->expectExceptionMessage('Floe BATCH frame is truncated, its directory is incomplete'); iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(), ); @@ -427,7 +427,7 @@ public function test_corrupted_frame_chain_throws(): void $this->expectExceptionMessage('frame body is incomplete'); iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(), ); @@ -439,12 +439,12 @@ public function test_dead_footers_of_appended_files_are_skipped(): void $path = path('memory://appended.floe'); $created = array_to_rows([['id' => 1]], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $created->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $created->schema()); $writer->write($created); $writer->close(); $appended = array_to_rows([['id' => 2]], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, $appended->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->append($path, $appended->schema()); $writer->write($appended); $writer->close(); @@ -453,7 +453,7 @@ public function test_dead_footers_of_appended_files_are_skipped(): void array_map( static fn(Rows $batch) => $batch->toArray(), iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(), false, @@ -467,11 +467,11 @@ public function test_empty_file_yields_no_batches(): void $filesystem = memory_filesystem(); $path = path('memory://empty.floe'); - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->create($path, schema()) ->close(); - $reader = (new FloeFiles($filesystem, new AdaptiveBackend()))->read($path); + $reader = new FloeFiles($filesystem, new AdaptiveBackend())->read($path); static::assertSame([], iterator_to_array($reader->rows(), false)); static::assertSame(0, $reader->totalRows()); @@ -488,7 +488,7 @@ public function test_evolved_file_rows_match_merged_schema(): void $evolvedFile = path('memory://evolved-new.floe'); $baseRows = array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($baseFile, $baseRows->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($baseFile, $baseRows->schema()); $writer->write($baseRows); $writer->close(); @@ -496,14 +496,14 @@ public function test_evolved_file_rows_match_merged_schema(): void [['id' => 3, 'email' => null], ['id' => 4, 'email' => 'x@flow.php']], schema(int_schema('id'), str_schema('email', nullable: true)), ); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($evolvedFile, $evolvedRows->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($evolvedFile, $evolvedRows->schema()); $writer->write($evolvedRows); $writer->close(); - (new FloeMerger($filesystem, new AdaptiveBackend()))->merge([$baseFile, $evolvedFile], $path); + new FloeMerger($filesystem, new AdaptiveBackend())->merge([$baseFile, $evolvedFile], $path); $batches = iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(), false, @@ -536,7 +536,7 @@ public function test_footer_length_exceeding_file_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('footer does not fit inside the file'); - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->footer(); } @@ -552,7 +552,7 @@ public function test_footer_of_file_smaller_than_header_and_trailer_throws(): vo $this->expectException(FloeException::class); $this->expectExceptionMessage('too small'); - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->footer(); } @@ -562,14 +562,14 @@ public function test_footer_over_unsized_stream_throws(): void $filesystem = memory_filesystem(); $path = path('memory://unsized.floe'); - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->create($path, schema()) ->close(); $this->expectException(FloeException::class); $this->expectExceptionMessage('requires a sized stream'); - (new FloeFiles(new UnsizedStreamFilesystem($filesystem), new AdaptiveBackend())) + new FloeFiles(new UnsizedStreamFilesystem($filesystem), new AdaptiveBackend()) ->read($path) ->footer(); } @@ -580,7 +580,7 @@ public function test_footer_accessors(): void $path = path('memory://accessors.floe'); $data = array_to_rows([['id' => 1, 'name' => 'x']], schema(int_schema('id'), str_schema('name'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create( + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create( $path, $data->schema(), Metadata::fromArray(['source' => 'unit']), @@ -588,7 +588,7 @@ public function test_footer_accessors(): void $writer->write($data); $writer->close(); - $reader = (new FloeFiles($filesystem, new AdaptiveBackend()))->read($path); + $reader = new FloeFiles($filesystem, new AdaptiveBackend())->read($path); static::assertSame(Format::VERSION, $reader->footer()->version); static::assertSame(['source' => 'unit'], $reader->metadata()->normalize()); @@ -601,14 +601,14 @@ public function test_open_with_non_noop_codec_throws(): void { $filesystem = memory_filesystem(); $path = path('memory://x.floe'); - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->create($path, schema()) ->close(); $this->expectException(FloeException::class); $this->expectExceptionMessage('supports only the no-op codec, got codec 0x09'); - (new FloeFiles($filesystem, new AdaptiveBackend(), new Options(codec: new CodecStub(0x09))))->read($path); + new FloeFiles($filesystem, new AdaptiveBackend(), new Options(codec: new CodecStub(0x09)))->read($path); } public function test_reader_with_mismatched_codec_flags_throws(): void @@ -622,7 +622,7 @@ public function test_reader_with_mismatched_codec_flags_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('written with codec 0x07'); - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->footer(); } @@ -633,7 +633,7 @@ public function test_rows_through_a_custom_identity_codec(): void $path = path('memory://custom-codec.floe'); $data = array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend(), new Options(codec: new CodecStub(0x00))))->create( + $writer = new FloeFiles($filesystem, new AdaptiveBackend(), new Options(codec: new CodecStub(0x00)))->create( $path, $data->schema(), ); @@ -641,7 +641,7 @@ public function test_rows_through_a_custom_identity_codec(): void $writer->close(); $batches = iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend(), new Options(codec: new CodecStub(0x00)))) + new FloeFiles($filesystem, new AdaptiveBackend(), new Options(codec: new CodecStub(0x00))) ->read($path) ->rows(), ); @@ -663,7 +663,7 @@ public function test_torn_file_without_footer_throws_in_strict_mode(): void $this->expectExceptionMessage('magic'); iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(), ); @@ -685,7 +685,7 @@ public function test_unknown_frame_type_throws(): void $this->expectExceptionMessage('unknown frame type 0x55'); iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(), ); @@ -702,7 +702,7 @@ public function test_create_for_stream_is_byte_identical_to_create_by_path(): vo ); $schema = $data->schema(); - $byPath = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($viaPath, $schema); + $byPath = new FloeFiles($filesystem, new AdaptiveBackend())->create($viaPath, $schema); $byPath->write($data); $byPath->close(); @@ -725,11 +725,11 @@ public function test_buffer_size_only_changes_flush_cadence_not_bytes(): void $schema = $data->schema(); - $defaultWriter = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($default, $schema); + $defaultWriter = new FloeFiles($filesystem, new AdaptiveBackend())->create($default, $schema); $defaultWriter->write($data); $defaultWriter->close(); - $tinyWriter = (new FloeFiles($filesystem, new AdaptiveBackend(), new Options(bufferSize: 4)))->create( + $tinyWriter = new FloeFiles($filesystem, new AdaptiveBackend(), new Options(bufferSize: 4))->create( $tiny, $schema, ); @@ -744,7 +744,7 @@ public function test_append_on_missing_file_behaves_like_create(): void $filesystem = memory_filesystem(); $path = path('memory://missing.floe'); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->append($path, schema(int_schema('id'))); $writer->write(array_to_rows([['id' => 1]], schema(int_schema('id')))); $writer->close(); @@ -757,7 +757,7 @@ public function test_append_on_empty_file_behaves_like_create(): void $path = path('memory://zero-bytes.floe'); $filesystem->writeTo($path)->close(); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->append($path, schema(int_schema('id'))); $writer->write(array_to_rows([['id' => 1]], schema(int_schema('id')))); $writer->close(); @@ -769,10 +769,10 @@ public function test_append_to_a_closed_zero_row_file_derives_the_schema_from_th $filesystem = memory_filesystem(); $path = path('memory://zero-rows.floe'); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, schema()); $writer->close(); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->append($path, schema(int_schema('id'))); $writer->write(array_to_rows([['id' => 1]], schema(int_schema('id')))); $writer->close(); @@ -784,10 +784,10 @@ public function test_append_to_a_zero_row_file_with_an_explicit_schema_validates $filesystem = memory_filesystem(); $path = path('memory://zero-rows-schema.floe'); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, schema(int_schema('id'))); $writer->close(); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->append($path, schema(int_schema('id'))); $this->expectException(IncompatibleSchemaException::class); $this->expectExceptionMessage('new column "name"'); @@ -800,7 +800,7 @@ public function test_create_with_an_explicit_schema_and_no_writes_records_the_sc $filesystem = memory_filesystem(); $path = path('memory://schema-only.floe'); - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->create($path, schema(int_schema('id'))) ->close(); @@ -815,14 +815,14 @@ public function test_append_over_unsized_stream_throws(): void $filesystem = memory_filesystem(); $path = path('memory://unsized.floe'); - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->create($path, schema()) ->close(); $this->expectException(FloeException::class); $this->expectExceptionMessage('requires a sized stream'); - (new FloeFiles(new UnsizedStreamFilesystem($filesystem), new AdaptiveBackend()))->append($path, schema()); + new FloeFiles(new UnsizedStreamFilesystem($filesystem), new AdaptiveBackend())->append($path, schema()); } public function test_append_with_footer_length_exceeding_file_throws(): void @@ -836,7 +836,7 @@ public function test_append_with_footer_length_exceeding_file_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('footer does not fit inside the file'); - (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, schema()); + new FloeFiles($filesystem, new AdaptiveBackend())->append($path, schema()); } public function test_append_metadata_merges_over_existing_footer_metadata(): void @@ -844,13 +844,13 @@ public function test_append_metadata_merges_over_existing_footer_metadata(): voi $filesystem = memory_filesystem(); $path = path('memory://meta.floe'); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create( + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create( $path, schema(), Metadata::fromArray(['source' => 'create', 'kept' => 'yes']), ); $writer->close(); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->append( + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->append( $path, schema(), Metadata::fromArray(['source' => 'append']), @@ -874,7 +874,7 @@ public function test_append_to_file_with_different_codec_flags_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('written with codec 0x05'); - (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, schema()); + new FloeFiles($filesystem, new AdaptiveBackend())->append($path, schema()); } public function test_append_to_torn_file_throws(): void @@ -888,7 +888,7 @@ public function test_append_to_torn_file_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('torn'); - (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, schema()); + new FloeFiles($filesystem, new AdaptiveBackend())->append($path, schema()); } public function test_append_to_truncated_stub_throws(): void @@ -902,7 +902,7 @@ public function test_append_to_truncated_stub_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('too small'); - (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, schema()); + new FloeFiles($filesystem, new AdaptiveBackend())->append($path, schema()); } public function test_append_with_incompatible_schema_keeps_previous_rows_readable(): void @@ -910,11 +910,11 @@ public function test_append_with_incompatible_schema_keeps_previous_rows_readabl $filesystem = memory_filesystem(); $path = path('memory://safe.floe'); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, schema(int_schema('id'))); $writer->write(array_to_rows([['id' => 1]], schema(int_schema('id')))); $writer->close(); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->append($path, schema(int_schema('id'))); try { $writer->write(array_to_rows([['id' => 'no longer an int']], schema(str_schema('id')))); @@ -935,14 +935,14 @@ public function test_append_with_new_non_nullable_column_throws(): void $filesystem = memory_filesystem(); $path = path('memory://evolve.floe'); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, schema(int_schema('id'))); $writer->write(array_to_rows([['id' => 1]], schema(int_schema('id')))); $writer->close(); $this->expectException(IncompatibleSchemaException::class); $this->expectExceptionMessage('new column "email"'); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->append($path, schema(int_schema('id'))); $writer->write(array_to_rows([['id' => 2, 'email' => 'x']], schema(int_schema('id'), str_schema('email')))); } @@ -951,11 +951,11 @@ public function test_append_with_new_nullable_column_throws(): void $filesystem = memory_filesystem(); $path = path('memory://merge.floe'); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, schema(int_schema('id'))); $writer->write(array_to_rows([['id' => 1]], schema(int_schema('id')))); $writer->close(); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->append($path, schema(int_schema('id'))); $this->expectException(IncompatibleSchemaException::class); $this->expectExceptionMessage('new column "email"'); @@ -971,11 +971,11 @@ public function test_append_with_same_schema_adds_a_section_reusing_the_footer_s $filesystem = memory_filesystem(); $path = path('memory://same-schema.floe'); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, schema(int_schema('id'))); $writer->write(array_to_rows([['id' => 1]], schema(int_schema('id')))); $writer->close(); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->append($path, schema(int_schema('id'))); $writer->write(array_to_rows([['id' => 2]], schema(int_schema('id')))); $writer->close(); @@ -993,7 +993,7 @@ public function test_append_with_same_schema_adds_a_section_reusing_the_footer_s public function test_close_twice_throws(): void { - $writer = (new FloeFiles(memory_filesystem(), new AdaptiveBackend()))->create( + $writer = new FloeFiles(memory_filesystem(), new AdaptiveBackend())->create( path('memory://closed.floe'), schema(), ); @@ -1010,7 +1010,7 @@ public function test_closing_empty_file_writes_header_and_footer_only(): void $filesystem = memory_filesystem(); $path = path('memory://empty.floe'); - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->create($path, schema()) ->close(); @@ -1028,7 +1028,7 @@ public function test_create_with_non_noop_codec_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('supports only the no-op codec, got codec 0x05'); - (new FloeFiles(memory_filesystem(), new AdaptiveBackend(), new Options(codec: new CodecStub(0x05))))->create( + new FloeFiles(memory_filesystem(), new AdaptiveBackend(), new Options(codec: new CodecStub(0x05)))->create( path('memory://codec.floe'), schema(), ); @@ -1039,7 +1039,7 @@ public function test_two_writes_with_the_same_schema_in_one_session_share_one_se $filesystem = memory_filesystem(); $path = path('memory://continuation.floe'); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, schema(int_schema('id'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, schema(int_schema('id'))); $writer->write(array_to_rows([['id' => 1]], schema(int_schema('id')))); $writer->write(array_to_rows([['id' => 2]], schema(int_schema('id')))); $writer->close(); @@ -1059,7 +1059,7 @@ public function test_nothing_reaches_the_stream_before_buffer_fills_or_close(): $filesystem = memory_filesystem(); $path = path('memory://buffered.floe'); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, schema(str_schema('data'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, schema(str_schema('data'))); $writer->write(array_to_rows([['data' => 'x']], schema(str_schema('data')))); static::assertSame(0, $filesystem->readFrom($path)->size()); @@ -1079,7 +1079,7 @@ public function test_within_batch_heterogeneous_rows_encode_under_one_union_sche schema(int_schema('a'), str_schema('b', nullable: true), str_schema('c', nullable: true)), ); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); @@ -1107,7 +1107,7 @@ public function test_section_offsets_point_at_frames(): void schema(int_schema('a', nullable: true), str_schema('b', nullable: true)), ); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); @@ -1123,7 +1123,7 @@ public function test_section_offsets_point_at_frames(): void public function test_write_after_close_throws(): void { - $writer = (new FloeFiles(memory_filesystem(), new AdaptiveBackend()))->create( + $writer = new FloeFiles(memory_filesystem(), new AdaptiveBackend())->create( path('memory://done.floe'), schema(), ); @@ -1140,7 +1140,7 @@ public function test_append_refuses_a_different_datetime_zone(): void $filesystem = memory_filesystem(); $path = path('memory://zoned.floe'); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, schema(datetime_schema('at'))); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, schema(datetime_schema('at'))); $writer->write(array_to_rows([[ 'at' => new DateTimeImmutable('2026-01-02 03:04:05'), ]], schema(datetime_schema('at')))); @@ -1149,7 +1149,7 @@ public function test_append_refuses_a_different_datetime_zone(): void $this->expectException(IncompatibleSchemaException::class); $this->expectExceptionMessage('Floe append schema does not match the existing file schema.'); - (new FloeFiles($filesystem, new AdaptiveBackend()))->append( + new FloeFiles($filesystem, new AdaptiveBackend())->append( $path, schema(datetime_schema('at', zone: 'Europe/Warsaw')), ); @@ -1163,7 +1163,7 @@ public function test_the_default_read_chunk_is_64_kib(): void 'x', 70_000, )]], schema(str_schema('s')))); - $reader = (new FloeFiles($filesystem, new AdaptiveBackend()))->read($path); + $reader = new FloeFiles($filesystem, new AdaptiveBackend())->read($path); $reader->footer(); $footerReads = count($filesystem->openedStreams[0]->reads); @@ -1178,7 +1178,7 @@ public function test_append_to_an_existing_file_closes_the_stream_it_read_the_fo $path = path('memory://append-close.floe'); FloeStreamReaderContext::write($filesystem, $path, array_to_rows([['id' => 1]], schema(int_schema('id')))); - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->append($path, schema(int_schema('id'))) ->close(); @@ -1192,7 +1192,7 @@ public function test_append_to_an_empty_file_closes_the_stream_it_sized(): void $path = path('memory://append-empty-close.floe'); $filesystem->writeTo($path)->close(); - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->append($path, schema(int_schema('id'))) ->close(); @@ -1204,13 +1204,13 @@ public function test_append_over_an_unsized_stream_closes_it_and_names_the_path( { $memory = memory_filesystem(); $path = path('memory://unsized-close.floe'); - (new FloeFiles($memory, new AdaptiveBackend())) + new FloeFiles($memory, new AdaptiveBackend()) ->create($path, schema()) ->close(); $filesystem = new CountingFilesystem(new UnsizedStreamFilesystem($memory)); try { - (new FloeFiles($filesystem, new AdaptiveBackend()))->append($path, schema()); + new FloeFiles($filesystem, new AdaptiveBackend())->append($path, schema()); static::fail('An append over an unsized stream must be refused'); } catch (FloeException $e) { static::assertSame( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeMergerTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeMergerTest.php index 600c15cfac..f70250f95f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeMergerTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeMergerTest.php @@ -51,11 +51,11 @@ public function test_compact_reads_identically_to_splice(): void array_to_rows([['id' => 3]], schema(int_schema('id'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://a.floe'), path('memory://b.floe'), ], path('memory://splice.floe')); - (new FloeMerger($fs, new AdaptiveBackend()))->merge( + new FloeMerger($fs, new AdaptiveBackend())->merge( [path('memory://a.floe'), path('memory://b.floe')], path('memory://compact.floe'), compact: true, @@ -81,7 +81,7 @@ public function test_compact_coalesces_same_schema_sources_into_one_section(): v array_to_rows([['id' => 2]], schema(int_schema('id'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge( + new FloeMerger($fs, new AdaptiveBackend())->merge( [path('memory://a.floe'), path('memory://b.floe')], path('memory://compact.floe'), compact: true, @@ -89,7 +89,7 @@ public function test_compact_coalesces_same_schema_sources_into_one_section(): v static::assertCount( 1, - (new FloeFiles($fs, new AdaptiveBackend()))->read(path('memory://compact.floe'))->footer()->sections, + new FloeFiles($fs, new AdaptiveBackend())->read(path('memory://compact.floe'))->footer()->sections, ); } @@ -107,7 +107,7 @@ public function test_merge_of_same_columns_in_different_order_re_encodes_instead array_to_rows([['b' => 200, 'a' => 2]], schema(int_schema('b'), int_schema('a'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://a.floe'), path('memory://b.floe'), ], path('memory://out.floe')); @@ -122,7 +122,7 @@ public function test_merge_of_same_columns_in_different_order_re_encodes_instead // the compact path coalesces sources into one section - splicing would keep one per source static::assertCount( 1, - (new FloeFiles($fs, new AdaptiveBackend()))->read(path('memory://out.floe'))->footer()->sections, + new FloeFiles($fs, new AdaptiveBackend())->read(path('memory://out.floe'))->footer()->sections, ); } @@ -140,7 +140,7 @@ public function test_merge_of_same_columns_in_different_order_with_mixed_types_r array_to_rows([['b' => 'two', 'a' => 2]], schema(str_schema('b'), int_schema('a'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://a.floe'), path('memory://b.floe'), ], path('memory://out.floe')); @@ -169,7 +169,7 @@ public function test_empty_source_contributes_no_rows(): void array_to_rows([['id' => 2]], schema(int_schema('id'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://a.floe'), path('memory://empty.floe'), path('memory://b.floe'), @@ -186,7 +186,7 @@ public function test_empty_sources_list_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('at least one source'); - (new FloeMerger(memory_filesystem(), new AdaptiveBackend()))->merge([], path('memory://out.floe')); + new FloeMerger(memory_filesystem(), new AdaptiveBackend())->merge([], path('memory://out.floe')); } public function test_merging_a_source_that_adds_a_non_nullable_column_throws(): void @@ -208,7 +208,7 @@ public function test_merging_a_source_that_adds_a_non_nullable_column_throws(): $this->expectException(IncompatibleSchemaException::class); $this->expectExceptionMessage('Floe merge cannot reconcile the schema of'); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://a.floe'), path('memory://b.floe'), ], path('memory://out.floe')); @@ -231,7 +231,7 @@ public function test_merging_a_source_that_drops_a_non_nullable_column_throws(): $this->expectException(IncompatibleSchemaException::class); $this->expectExceptionMessage('Floe merge cannot reconcile the schema of'); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://a.floe'), path('memory://b.floe'), ], path('memory://out.floe')); @@ -254,7 +254,7 @@ public function test_merging_sources_with_a_nullable_column_pads_missing_rows(): array_to_rows([['id' => 2]], schema(int_schema('id'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://a.floe'), path('memory://b.floe'), ], path('memory://out.floe')); @@ -297,7 +297,7 @@ public function test_metadata_is_merged_with_new_keys_winning(): void ], ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge( + new FloeMerger($fs, new AdaptiveBackend())->merge( [path('memory://a.floe'), path('memory://b.floe')], path('memory://out.floe'), metadata: Metadata::fromArray(['shared' => 'override']), @@ -305,7 +305,7 @@ public function test_metadata_is_merged_with_new_keys_winning(): void static::assertSame( ['a' => '1', 'b' => '2', 'shared' => 'override'], - (new FloeFiles($fs, new AdaptiveBackend())) + new FloeFiles($fs, new AdaptiveBackend()) ->read(path('memory://out.floe')) ->metadata() ->normalize(), @@ -317,7 +317,7 @@ public function test_missing_source_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('does not exist'); - (new FloeMerger(memory_filesystem(), new AdaptiveBackend()))->merge([path( + new FloeMerger(memory_filesystem(), new AdaptiveBackend())->merge([path( 'memory://missing.floe', )], path('memory://out.floe')); } @@ -336,14 +336,14 @@ public function test_offset_read_after_merge_seeks_across_sources(): void array_to_rows([['id' => 3], ['id' => 4]], schema(int_schema('id'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://a.floe'), path('memory://b.floe'), ], path('memory://out.floe')); $read = []; - foreach ((new FloeFiles($fs, new AdaptiveBackend())) + foreach (new FloeFiles($fs, new AdaptiveBackend()) ->read(path('memory://out.floe')) ->rows(batchSize: 100, offset: 3) as $batch) { $read = [...$read, ...$batch->column('id')->values()]; @@ -358,7 +358,7 @@ public function test_single_source_is_a_copy(): void $value = array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); FloeStreamReaderContext::write($fs, path('memory://a.floe'), $value); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([path('memory://a.floe')], path('memory://out.floe')); + new FloeMerger($fs, new AdaptiveBackend())->merge([path('memory://a.floe')], path('memory://out.floe')); static::assertEquals($value, FloeStreamReaderContext::readAll($fs, path('memory://out.floe'))); } @@ -382,7 +382,7 @@ public function test_splices_three_files(): void array_to_rows([['id' => 3]], schema(int_schema('id'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://a.floe'), path('memory://b.floe'), path('memory://c.floe'), @@ -408,12 +408,12 @@ public function test_a_splice_keeps_every_section_and_counts_every_row_and_byte( array_to_rows([['id' => 3], ['id' => 4]], schema(int_schema('id'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://a.floe'), path('memory://b.floe'), ], path('memory://spliced.floe')); - $footer = (new FloeFiles($fs, new AdaptiveBackend())) + $footer = new FloeFiles($fs, new AdaptiveBackend()) ->read(path('memory://spliced.floe')) ->footer(); @@ -442,7 +442,7 @@ public function test_splices_two_files_with_the_same_schema(): void array_to_rows([['id' => 3], ['id' => 4]], schema(int_schema('id'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://a.floe'), path('memory://b.floe'), ], path('memory://out.floe')); @@ -470,7 +470,7 @@ public function test_type_conflict_throws(): void $this->expectException(IncompatibleSchemaException::class); $this->expectExceptionMessage('Floe merge cannot reconcile the schema of'); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://a.floe'), path('memory://b.floe'), ], path('memory://out.floe')); @@ -488,7 +488,7 @@ public function test_unsized_source_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('does not report its size'); - (new FloeMerger(new UnsizedStreamFilesystem($fs), new AdaptiveBackend()))->merge([path( + new FloeMerger(new UnsizedStreamFilesystem($fs), new AdaptiveBackend())->merge([path( 'memory://a.floe', )], path('memory://out.floe')); } @@ -504,7 +504,7 @@ public function test_source_smaller_than_header_and_trailer_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('too small'); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([path('memory://tiny.floe')], path('memory://out.floe')); + new FloeMerger($fs, new AdaptiveBackend())->merge([path('memory://tiny.floe')], path('memory://out.floe')); } public function test_non_noop_codec_source_throws(): void @@ -518,7 +518,7 @@ public function test_non_noop_codec_source_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('written with codec 0x05'); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([path('memory://codec.floe')], path('memory://out.floe')); + new FloeMerger($fs, new AdaptiveBackend())->merge([path('memory://codec.floe')], path('memory://out.floe')); } public function test_source_with_footer_larger_than_file_throws(): void @@ -532,7 +532,7 @@ public function test_source_with_footer_larger_than_file_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('footer does not fit'); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([path('memory://torn.floe')], path('memory://out.floe')); + new FloeMerger($fs, new AdaptiveBackend())->merge([path('memory://torn.floe')], path('memory://out.floe')); } public function test_merge_of_different_datetime_zones_widens_to_utc(): void @@ -551,7 +551,7 @@ public function test_merge_of_different_datetime_zones_widens_to_utc(): void array_to_rows([['at' => $utc]], schema(datetime_schema('at'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://warsaw.floe'), path('memory://utc.floe'), ], path('memory://merged.floe')); @@ -589,11 +589,11 @@ public function test_splice_and_compact_close_every_source_stream(): void array_to_rows([['id' => 2]], schema(int_schema('id'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://a.floe'), path('memory://b.floe'), ], path('memory://splice.floe')); - (new FloeMerger($fs, new AdaptiveBackend()))->merge( + new FloeMerger($fs, new AdaptiveBackend())->merge( [path('memory://a.floe'), path('memory://b.floe')], path('memory://compact.floe'), compact: true, @@ -616,7 +616,7 @@ public function test_compact_closes_a_source_whose_rows_fail(): void $fs = new CountingFilesystem($memory); try { - (new FloeMerger($fs, new AdaptiveBackend()))->merge( + new FloeMerger($fs, new AdaptiveBackend())->merge( [path('memory://broken.floe')], path('memory://out.floe'), compact: true, @@ -640,7 +640,7 @@ public function test_splice_closes_the_destination(): void ); $fs = new RecordingFilesystem($memory); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([path('memory://a.floe')], path('memory://out.floe')); + new FloeMerger($fs, new AdaptiveBackend())->merge([path('memory://a.floe')], path('memory://out.floe')); static::assertSame(['close'], array_slice($fs->calls, -1)); } @@ -661,7 +661,7 @@ public function test_compact_keeps_the_metadata_of_every_source(): void ['b' => '2'], ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge( + new FloeMerger($fs, new AdaptiveBackend())->merge( [path('memory://a.floe'), path('memory://b.floe')], path('memory://out.floe'), compact: true, @@ -669,7 +669,7 @@ public function test_compact_keeps_the_metadata_of_every_source(): void static::assertSame( ['a' => '1', 'b' => '2'], - (new FloeFiles($fs, new AdaptiveBackend())) + new FloeFiles($fs, new AdaptiveBackend()) ->read(path('memory://out.floe')) ->metadata() ->normalize(), @@ -691,7 +691,7 @@ public function test_an_empty_source_does_not_hide_a_column_order_mismatch_behin array_to_rows([['b' => 200, 'a' => 2]], schema(int_schema('b'), int_schema('a'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://empty.floe'), path('memory://a.floe'), path('memory://b.floe'), @@ -699,7 +699,7 @@ public function test_an_empty_source_does_not_hide_a_column_order_mismatch_behin static::assertCount( 1, - (new FloeFiles($fs, new AdaptiveBackend()))->read(path('memory://out.floe'))->footer()->sections, + new FloeFiles($fs, new AdaptiveBackend())->read(path('memory://out.floe'))->footer()->sections, ); } @@ -713,7 +713,7 @@ public function test_splice_does_not_open_an_empty_source_for_copying(): void array_to_rows([['id' => 1]], schema(int_schema('id'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://empty.floe'), path('memory://a.floe'), ], path('memory://out.floe')); @@ -726,7 +726,7 @@ public function test_splice_of_empty_sources_only_writes_an_empty_file(): void $fs = memory_filesystem(); FloeStreamReaderContext::write($fs, path('memory://empty.floe'), rows(schema())); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([path('memory://empty.floe')], path('memory://out.floe')); + new FloeMerger($fs, new AdaptiveBackend())->merge([path('memory://empty.floe')], path('memory://out.floe')); static::assertSame(0, FloeStreamReaderContext::footer($fs, path('memory://out.floe'))->statistics->rows); static::assertSame([], FloeStreamReaderContext::footer($fs, path('memory://out.floe'))->sections); @@ -746,7 +746,7 @@ public function test_splice_copies_a_source_larger_than_one_copy_chunk(): void array_to_rows([['s' => 'z']], schema(str_schema('s'))), ); - (new FloeMerger($fs, new AdaptiveBackend()))->merge([ + new FloeMerger($fs, new AdaptiveBackend())->merge([ path('memory://large.floe'), path('memory://small.floe'), ], path('memory://out.floe')); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeStreamReaderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeStreamReaderTest.php index 747ec5535f..921e85f20a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeStreamReaderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeStreamReaderTest.php @@ -46,13 +46,13 @@ public function test_close_closes_the_source_stream(): void $path = path('memory://close.floe'); $data = array_to_rows([['id' => 1]], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); $source = new ClosingSpySourceStream($filesystem->readFrom($path)); - (new FloeStreamReader($source, new NoopCodec(), 65_536, new AdaptiveBackend()))->close(); + new FloeStreamReader($source, new NoopCodec(), 65_536, new AdaptiveBackend())->close(); static::assertSame(1, $source->closeCount); } @@ -73,7 +73,7 @@ public function test_a_row_frame_is_an_unknown_frame_type(): void $this->expectExceptionMessage('Floe found unknown frame type 0x02'); iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(), false, @@ -88,8 +88,8 @@ public function test_offset_skips_a_whole_batch_frame_and_slices_the_next(): voi $filesystem, $path, schema(int_schema('id')), - Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())) - . Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame( + Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())) + . Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame( RowsMother::ids(4, 6), new NoopCodec(), )), @@ -101,7 +101,7 @@ public function test_offset_skips_a_whole_batch_frame_and_slices_the_next(): voi array_map( static fn(Rows $batch) => $batch->toArray(), iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(offset: 4), false, @@ -125,8 +125,8 @@ public function test_offset_and_limit_across_two_batch_frames(int $offset, ?int $filesystem, $path, schema(int_schema('id')), - Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())) - . Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame( + Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())) + . Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame( RowsMother::ids(4, 6), new NoopCodec(), )), @@ -136,7 +136,7 @@ public function test_offset_and_limit_across_two_batch_frames(int $offset, ?int static::assertSame($expected, array_map( static fn(Rows $batch) => $batch->toArray(), iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(offset: $offset, limit: $limit), false, @@ -152,7 +152,7 @@ public function test_limit_slices_a_batch_frame(): void $filesystem, $path, schema(int_schema('id')), - Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame(RowsMother::ids(1, 5), new NoopCodec())), + Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame(RowsMother::ids(1, 5), new NoopCodec())), 5, ); @@ -161,7 +161,7 @@ public function test_limit_slices_a_batch_frame(): void array_map( static fn(Rows $batch) => $batch->toArray(), iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(limit: 2), false, @@ -179,15 +179,15 @@ public function test_batch_size_is_an_upper_bound(): void $filesystem, $one, schema(int_schema('id')), - Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame(RowsMother::ids(1, 5), new NoopCodec())), + Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame(RowsMother::ids(1, 5), new NoopCodec())), 5, ); FloeStreamReaderContext::writeFrames( $filesystem, $two, schema(int_schema('id')), - Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame(RowsMother::ids(1, 2), new NoopCodec())) - . Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame( + Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame(RowsMother::ids(1, 2), new NoopCodec())) + . Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame( RowsMother::ids(3, 4), new NoopCodec(), )), @@ -199,7 +199,7 @@ public function test_batch_size_is_an_upper_bound(): void array_map( static fn(Rows $batch) => $batch->count(), iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($one) ->rows(2), false, @@ -211,7 +211,7 @@ public function test_batch_size_is_an_upper_bound(): void array_map( static fn(Rows $batch) => $batch->count(), iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($two) ->rows(10), false, @@ -228,8 +228,8 @@ public function test_chunked_frames_yield_unique_keys(): void $filesystem, $path, schema(int_schema('id')), - Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())) - . Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame( + Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())) + . Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame( RowsMother::ids(4, 6), new NoopCodec(), )), @@ -239,7 +239,7 @@ public function test_chunked_frames_yield_unique_keys(): void static::assertSame( [0, 1, 2, 3], array_keys(iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(2), )), @@ -250,7 +250,7 @@ public function test_a_frame_of_a_chunk_or_more_is_read_whole_in_one_read(): voi { $filesystem = memory_filesystem(); $path = path('memory://large-frames.floe'); - $frame = (new PhpBackend())->encodeFrame(array_to_rows([['s' => str_repeat( + $frame = new PhpBackend()->encodeFrame(array_to_rows([['s' => str_repeat( 'x', 65_536, )]], schema(str_schema('s'))), new NoopCodec()); @@ -286,7 +286,7 @@ public function test_small_frames_take_no_more_reads_than_chunks_of_the_file(): $path, schema(int_schema('id')), implode('', array_map( - static fn(int $id): string => Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame( + static fn(int $id): string => Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame( RowsMother::ids($id, $id), new NoopCodec(), )), @@ -320,8 +320,8 @@ public function test_a_chunk_of_one_byte_reads_every_frame(): void $filesystem, $path, schema(int_schema('id')), - Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())) - . Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame( + Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())) + . Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame( RowsMother::ids(4, 6), new NoopCodec(), )), @@ -336,11 +336,11 @@ public function test_a_chunk_of_one_byte_reads_every_frame(): void ], array_map(static fn(Rows $batch) => $batch->toArray(), [ ...iterator_to_array( - (new FloeStreamReader($filesystem->readFrom($path), new NoopCodec(), 1, new PhpBackend()))->rows(), + new FloeStreamReader($filesystem->readFrom($path), new NoopCodec(), 1, new PhpBackend())->rows(), false, ), ...iterator_to_array( - (new FloeStreamReader($filesystem->readFrom($path), new NoopCodec(), 1, new PhpBackend()))->rows( + new FloeStreamReader($filesystem->readFrom($path), new NoopCodec(), 1, new PhpBackend())->rows( offset: 4, ), false, @@ -371,7 +371,7 @@ public function test_the_default_batch_size_is_1000_rows(): void $filesystem, $path, schema(int_schema('id')), - Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame( + Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame( RowsMother::ids(1, 1001), new NoopCodec(), )), @@ -383,7 +383,7 @@ public function test_the_default_batch_size_is_1000_rows(): void array_map( static fn(Rows $batch): int => $batch->count(), iterator_to_array( - (new FloeFiles($filesystem, new PhpBackend())) + new FloeFiles($filesystem, new PhpBackend()) ->read($path) ->rows(), false, @@ -400,7 +400,7 @@ public function test_a_file_smaller_than_a_chunk_is_read_in_one_read_of_its_size $filesystem, $path, schema(int_schema('id')), - Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())), + Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())), 3, ); $source = new ClosingSpySourceStream($filesystem->readFrom($path)); @@ -417,7 +417,7 @@ public function test_a_frame_of_exactly_one_chunk_is_read_whole(): void { $filesystem = memory_filesystem(); $path = path('memory://exact-chunk.floe'); - $frame = (new PhpBackend())->encodeFrame(array_to_rows([['s' => str_repeat( + $frame = new PhpBackend()->encodeFrame(array_to_rows([['s' => str_repeat( 'x', 8192, )]], schema(str_schema('s'))), new NoopCodec()); @@ -473,7 +473,7 @@ public function test_a_batch_frame_of_zero_rows_is_skipped(): void $path, schema(int_schema('id')), Format::frame(Format::FRAME_BATCH, "\x00\x00\x00\x00") - . Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame( + . Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame( RowsMother::ids(1, 2), new NoopCodec(), )), @@ -485,7 +485,7 @@ public function test_a_batch_frame_of_zero_rows_is_skipped(): void array_map( static fn(Rows $batch) => $batch->toArray(), iterator_to_array( - (new FloeFiles($filesystem, new PhpBackend())) + new FloeFiles($filesystem, new PhpBackend()) ->read($path) ->rows(), false, @@ -502,9 +502,9 @@ public function test_a_batch_frame_of_zero_rows_after_an_offset_is_skipped(): vo $filesystem, $path, schema(int_schema('id')), - Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())) + Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())) . Format::frame(Format::FRAME_BATCH, "\x00\x00\x00\x00") - . Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame( + . Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame( RowsMother::ids(4, 5), new NoopCodec(), )), @@ -516,7 +516,7 @@ public function test_a_batch_frame_of_zero_rows_after_an_offset_is_skipped(): vo array_map( static fn(Rows $batch) => $batch->toArray(), iterator_to_array( - (new FloeFiles($filesystem, new PhpBackend())) + new FloeFiles($filesystem, new PhpBackend()) ->read($path) ->rows(offset: 1), false, @@ -533,7 +533,7 @@ public function test_an_offset_at_the_row_count_reads_no_frame(): void $filesystem, $path, schema(int_schema('id')), - Format::frame(Format::FRAME_BATCH, (new PhpBackend())->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())), + Format::frame(Format::FRAME_BATCH, new PhpBackend()->encodeFrame(RowsMother::ids(1, 3), new NoopCodec())), 3, ); $source = new ClosingSpySourceStream($filesystem->readFrom($path)); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeStreamWriterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeStreamWriterTest.php index 6fa9500fae..33274e2670 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeStreamWriterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeStreamWriterTest.php @@ -45,7 +45,7 @@ public function test_create_on_stream_is_byte_identical_to_path_create(): void ); $schema = $data->schema(); - $create = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($viaCreate, $schema); + $create = new FloeFiles($filesystem, new AdaptiveBackend())->create($viaCreate, $schema); $create->write($data); $create->close(); @@ -174,7 +174,7 @@ public function test_a_multi_batch_session_reads_back_the_rows_of_a_single_batch FloeStreamReaderContext::frameTypes($filesystem, $multi), ); static::assertSame( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($single) ->rows() ->current() @@ -182,7 +182,7 @@ public function test_a_multi_batch_session_reads_back_the_rows_of_a_single_batch array_merge(...array_map( static fn(Rows $batch) => $batch->toArray(), iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($multi) ->rows(), false, @@ -424,7 +424,7 @@ public function test_an_overflowing_batch_is_split_in_halves(): void array_map( static fn(Rows $batch) => $batch->reduceToArray('id'), iterator_to_array( - (new FloeFiles($filesystem, new AdaptiveBackend())) + new FloeFiles($filesystem, new AdaptiveBackend()) ->read($path) ->rows(), false, diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeValueRoundTripTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeValueRoundTripTest.php index 4373cf8da8..6cedb155cb 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeValueRoundTripTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FloeValueRoundTripTest.php @@ -11,7 +11,6 @@ use Flow\ETL\Tests\Context\FloeStreamReaderContext; use Flow\ETL\Tests\Fixtures\Enum\BackedStringEnum; use Flow\ETL\Tests\Fixtures\Enum\BasicEnum; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\ETL\DSL\array_to_rows; @@ -133,7 +132,6 @@ public function test_enum_columns(): void ); } - #[RequiresPhp('>= 8.4.0')] public function test_html_columns(): void { $rows = array_to_rows([[ diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FooterReaderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FooterReaderTest.php index 25a307810f..9afb886902 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FooterReaderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FooterReaderTest.php @@ -31,11 +31,11 @@ public function test_reads_footer_location_of_a_written_file(): void $fs = memory_filesystem(); $path = path('memory://footer.floe'); $data = array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); - $writer = (new FloeFiles($fs, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($fs, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); - $location = (new FooterReader())->read($fs->readFrom($path), new NoopCodec()); + $location = new FooterReader()->read($fs->readFrom($path), new NoopCodec()); static::assertSame(2, $location->footer->statistics->rows); static::assertGreaterThan(Format::HEADER_LENGTH, $location->footerFrameStart); @@ -46,14 +46,14 @@ public function test_unsized_stream_throws(): void { $fs = memory_filesystem(); $path = path('memory://unsized.floe'); - (new FloeFiles($fs, new AdaptiveBackend())) + new FloeFiles($fs, new AdaptiveBackend()) ->create($path, schema()) ->close(); $this->expectException(FloeException::class); $this->expectExceptionMessage('requires a sized stream'); - (new FooterReader())->read(new UnsizedSourceStream($fs->readFrom($path)), new NoopCodec()); + new FooterReader()->read(new UnsizedSourceStream($fs->readFrom($path)), new NoopCodec()); } public function test_stream_too_small_throws(): void @@ -61,7 +61,7 @@ public function test_stream_too_small_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('too small'); - (new FooterReader())->read(new MemorySourceStream('FLOE'), new NoopCodec()); + new FooterReader()->read(new MemorySourceStream('FLOE'), new NoopCodec()); } public function test_codec_mismatch_throws(): void @@ -69,7 +69,7 @@ public function test_codec_mismatch_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('written with codec 0x05, expected 0x00'); - (new FooterReader())->read( + new FooterReader()->read( new MemorySourceStream('FLOE' . chr(Format::VERSION) . "\x05" . str_repeat("\0", 10)), new NoopCodec(), ); @@ -87,7 +87,7 @@ public function test_footer_that_does_not_fit_throws(): void $this->expectException(FloeException::class); $this->expectExceptionMessage('footer does not fit inside the file'); - (new FooterReader())->read($fs->readFrom($path), new NoopCodec()); + new FooterReader()->read($fs->readFrom($path), new NoopCodec()); } public function test_leaves_the_source_open_on_success(): void @@ -95,13 +95,13 @@ public function test_leaves_the_source_open_on_success(): void $fs = memory_filesystem(); $path = path('memory://close-ok.floe'); $data = array_to_rows([['id' => 1]], schema(int_schema('id'))); - $writer = (new FloeFiles($fs, new AdaptiveBackend()))->create($path, $data->schema()); + $writer = new FloeFiles($fs, new AdaptiveBackend())->create($path, $data->schema()); $writer->write($data); $writer->close(); $spy = new ClosingSpySourceStream($fs->readFrom($path)); - (new FooterReader())->read($spy, new NoopCodec()); + new FooterReader()->read($spy, new NoopCodec()); static::assertSame(0, $spy->closeCount); } @@ -111,7 +111,7 @@ public function test_leaves_the_source_open_on_error(): void $spy = new ClosingSpySourceStream(new MemorySourceStream('FLOE')); try { - (new FooterReader())->read($spy, new NoopCodec()); + new FooterReader()->read($spy, new NoopCodec()); } catch (FloeException) { } @@ -122,7 +122,7 @@ public function test_a_footer_one_byte_too_long_to_fit_is_torn(): void { $this->expectExceptionMessage('is torn, footer does not fit inside the file'); - (new FooterReader())->read( + new FooterReader()->read( new MemorySourceStream( Format::header(0x00) . str_repeat("\0", 10) . Format::trailer(10 - Format::FRAME_HEADER_LENGTH + 1), ), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FooterStatisticsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FooterStatisticsTest.php index 50a9d34751..b402e192e8 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FooterStatisticsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FooterStatisticsTest.php @@ -29,7 +29,7 @@ public function test_an_unknown_key_is_ignored(): void public function test_it_normalizes_to_rows_and_byte_size(): void { - static::assertSame(['rows' => 3, 'byteSize' => 120], (new FooterStatistics(3, 120))->normalize()); + static::assertSame(['rows' => 3, 'byteSize' => 120], new FooterStatistics(3, 120)->normalize()); } public function test_it_round_trips_through_from_array(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FooterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FooterTest.php index 454a6064c6..2de8c0a045 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FooterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FooterTest.php @@ -199,7 +199,7 @@ public function test_reconstruct_rows_round_trips_unpartitioned_rows(): void $path = path('memory://footer-rows.floe'); $value = array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id'))); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $value->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $value->schema()); $writer->write($value); $writer->close(); @@ -212,7 +212,7 @@ public function test_reconstruct_rows_round_trips_empty_rows(): void $path = path('memory://footer-empty.floe'); $value = rows(schema()); - $writer = (new FloeFiles($filesystem, new AdaptiveBackend()))->create($path, $value->schema()); + $writer = new FloeFiles($filesystem, new AdaptiveBackend())->create($path, $value->schema()); $writer->write($value); $writer->close(); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FrameWriterTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FrameWriterTest.php index 234b523ab1..0a4aa8f628 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FrameWriterTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/FrameWriterTest.php @@ -63,7 +63,7 @@ public function test_footer_appends_trailer_and_flushes(): void { $sink = new StringDestinationStream(path('memory://frame.floe')); - (new FrameWriter($sink, 0x00))->footer('{"v":1}'); + new FrameWriter($sink, 0x00)->footer('{"v":1}'); static::assertSame( Format::frame(Format::FRAME_FOOTER, '{"v":1}' . Format::trailer(strlen('{"v":1}'))), @@ -161,7 +161,7 @@ public function test_close_closes_the_stream(): void { $filesystem = new RecordingFilesystem(memory_filesystem()); - (new FrameWriter($filesystem->writeTo(path('memory://frame.floe')), 0x00))->close(); + new FrameWriter($filesystem->writeTo(path('memory://frame.floe')), 0x00)->close(); static::assertSame(['writeTo', 'close'], $filesystem->calls); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/SplittingFrameEncoderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/SplittingFrameEncoderTest.php index 1f0e196f87..047e4b8449 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/SplittingFrameEncoderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Floe/SplittingFrameEncoderTest.php @@ -17,8 +17,8 @@ public function test_a_batch_that_fits_is_one_frame_holding_every_row(): void $rows = RowsMother::workedExample(); static::assertSame( - [[(new PhpBackend())->encodeFrame($rows, new NoopCodec()), $rows->count()]], - (new SplittingFrameEncoder(new PhpBackend()))->encode($rows), + [[new PhpBackend()->encodeFrame($rows, new NoopCodec()), $rows->count()]], + new SplittingFrameEncoder(new PhpBackend())->encode($rows), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Memory/ArrayMemoryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Memory/ArrayMemoryTest.php index d630d26f7d..1a442c554a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Memory/ArrayMemoryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/Memory/ArrayMemoryTest.php @@ -17,7 +17,7 @@ public function test_chunk_size_must_be_greater_than_0(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Chunk size must be greater than 0'); - (new ArrayMemory())->chunks(0); + new ArrayMemory()->chunks(0); } public function test_chunks(): void @@ -43,7 +43,7 @@ public function test_flat_values(): void { static::assertSame( [1, 2, 3, 4], - (new ArrayMemory([['id' => 1], ['id' => 2], ['id' => 3], ['id' => 4]]))->flatValues(), + new ArrayMemory([['id' => 1], ['id' => 2], ['id' => 3], ['id' => 4]])->flatValues(), ); } @@ -51,7 +51,7 @@ public function test_map(): void { static::assertSame( [1, 2], - (new ArrayMemory([['id' => 1], ['id' => 2]]))->map(static fn(?array $data): int => type_integer()->assert( + new ArrayMemory([['id' => 1], ['id' => 2]])->map(static fn(?array $data): int => type_integer()->assert( $data['id'] ?? null, )), ); @@ -63,7 +63,7 @@ public function test_save_memory_from_invalid_data_structure(): void $this->expectExceptionMessage('Memory expects nested array data structure: array>'); // @mago-ignore analysis:invalid-argument - (new ArrayMemory())->save([1, 2, 3]); + new ArrayMemory()->save([1, 2, 3]); } public function test_saving_multiple_entries_into_memory(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/MemoryRowsStorageTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/MemoryRowsStorageTest.php index a4629f1543..3249187149 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/MemoryRowsStorageTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/MemoryRowsStorageTest.php @@ -41,7 +41,7 @@ public function test_append_accumulates_rows_in_order(): void public function test_get_unknown_bucket_yields_nothing(): void { - static::assertSame([], RowsStorageContext::rows((new MemoryRowsStorage())->get('unknown'))); + static::assertSame([], RowsStorageContext::rows(new MemoryRowsStorage()->get('unknown'))); } public function test_is_resident_storage(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/PsrRowsStorageTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/PsrRowsStorageTest.php index d1c3276100..7bffd30b89 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/PsrRowsStorageTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/PsrRowsStorageTest.php @@ -32,11 +32,11 @@ public function test_append_then_get_returns_rows_in_order_across_chunks(): void public function test_custom_prefix_is_used_in_keys(): void { $cache = new ArrayCache(); - (new PsrRowsStorage( + new PsrRowsStorage( $cache, new FloeSerializer(new AdaptiveBackend()), prefix: 'custom.pfx', - ))->append('bucket', array_to_rows([[ + )->append('bucket', array_to_rows([[ 'id' => 1, ]], schema(int_schema('id')))); @@ -52,7 +52,7 @@ public function test_get_skips_non_string_chunk_payloads(): void static::assertSame( [], - RowsStorageContext::rows((new PsrRowsStorage($cache, new FloeSerializer(new AdaptiveBackend())))->get( + RowsStorageContext::rows(new PsrRowsStorage($cache, new FloeSerializer(new AdaptiveBackend()))->get( 'bucket', )), ); @@ -91,7 +91,7 @@ public function test_an_entry_with_one_malformed_field_counts_no_rows(string $en static::assertSame( 0, - (new PsrRowsStorage($cache, new FloeSerializer(new AdaptiveBackend()))) + new PsrRowsStorage($cache, new FloeSerializer(new AdaptiveBackend())) ->rows('bucket') ->exactly(), ); @@ -104,7 +104,7 @@ public function test_get_treats_a_malformed_entry_as_empty(): void static::assertSame( [], - RowsStorageContext::rows((new PsrRowsStorage($cache, new FloeSerializer(new AdaptiveBackend())))->get( + RowsStorageContext::rows(new PsrRowsStorage($cache, new FloeSerializer(new AdaptiveBackend()))->get( 'bucket', )), ); @@ -114,10 +114,10 @@ public function test_get_unknown_bucket_yields_nothing(): void { static::assertSame( [], - RowsStorageContext::rows((new PsrRowsStorage( + RowsStorageContext::rows(new PsrRowsStorage( new ArrayCache(), new FloeSerializer(new AdaptiveBackend()), - ))->get('unknown')), + )->get('unknown')), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/SpillingRowsStorageTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/SpillingRowsStorageTest.php index de28f2d476..824e4b87fa 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/SpillingRowsStorageTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Storage/SpillingRowsStorageTest.php @@ -210,11 +210,11 @@ public function test_an_unknown_bucket_reads_nothing(): void { static::assertSame( [], - IdRows::ids((new SpillingRowsStorage( + IdRows::ids(new SpillingRowsStorage( new MemoryRowsStorage(), new MemoryBudget(new PhpBackend(), Unit::fromGb(64), null), new PhpBackend(), - ))->get('missing')), + )->get('missing')), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/BatchSizeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/BatchSizeTest.php index 1569db4d40..2be9de31d7 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/BatchSizeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/BatchSizeTest.php @@ -13,12 +13,12 @@ final class BatchSizeTest extends FlowTestCase { public function test_the_default_size_is_2048(): void { - static::assertSame(2048, (new BatchSize())->size); + static::assertSame(2048, new BatchSize()->size); } public function test_one_row_is_the_smallest_batch(): void { - static::assertSame(1, (new BatchSize(1))->size); + static::assertSame(1, new BatchSize(1)->size); } #[TestWith([0])] diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/CardinalityTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/CardinalityTest.php index 45a480ac49..6af69fbc0a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/CardinalityTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/CardinalityTest.php @@ -173,7 +173,7 @@ public function test_normalize(): void { static::assertSame( ['at_most' => 10, 'estimate' => 5, 'relative_error' => 0.25], - (new Cardinality(10, 5, 0.25))->normalize(), + new Cardinality(10, 5, 0.25)->normalize(), ); static::assertSame( ['at_most' => null, 'estimate' => null, 'relative_error' => 0.5], @@ -183,7 +183,7 @@ public function test_normalize(): void public function test_normalize_gives_no_relative_error_when_it_is_not_finite(): void { - static::assertNull((new Cardinality(null, 5, INF))->normalize()['relative_error']); - static::assertNull((new Cardinality(null, 5, NAN))->normalize()['relative_error']); + static::assertNull(new Cardinality(null, 5, INF)->normalize()['relative_error']); + static::assertNull(new Cardinality(null, 5, NAN)->normalize()['relative_error']); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/AdaptiveBackendTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/AdaptiveBackendTest.php index 62c7facbdd..b454209d4a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/AdaptiveBackendTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/AdaptiveBackendTest.php @@ -46,10 +46,10 @@ public function test_adopt_is_what_the_php_backend_adopts(): void $column = ColumnMother::of(int_schema('a'), [1, 2]); $foreign = new ForeignColumnStub($column); - static::assertSame($column, (new AdaptiveBackend())->adopt(int_schema('a'), $column)); + static::assertSame($column, new AdaptiveBackend()->adopt(int_schema('a'), $column)); static::assertEquals( - (new PhpBackend())->adopt(int_schema('a'), $foreign), - (new AdaptiveBackend())->adopt(int_schema('a'), $foreign), + new PhpBackend()->adopt(int_schema('a'), $foreign), + new AdaptiveBackend()->adopt(int_schema('a'), $foreign), ); } @@ -58,19 +58,19 @@ public function test_adopt_refuses_an_untyped_column(): void $this->expectException(ColumnMismatchException::class); $this->expectExceptionMessage('column "a": mixed cannot be a batch column'); - (new AdaptiveBackend())->adopt(int_schema('a'), new ValueColumn([1])); + new AdaptiveBackend()->adopt(int_schema('a'), new ValueColumn([1])); } public function test_allocated_bytes_is_what_the_php_backend_allocates(): void { - static::assertSame((new PhpBackend())->allocatedBytes(), (new AdaptiveBackend())->allocatedBytes()); + static::assertSame(new PhpBackend()->allocatedBytes(), new AdaptiveBackend()->allocatedBytes()); } public function test_builder_builds_what_the_php_backend_builds(): void { - $default = (new AdaptiveBackend())->builder(str_schema('a')); + $default = new AdaptiveBackend()->builder(str_schema('a')); $default->append('x'); - $php = (new PhpBackend())->builder(str_schema('a')); + $php = new PhpBackend()->builder(str_schema('a')); $php->append('x'); static::assertEquals($php->finish(), $default->finish()); @@ -79,8 +79,8 @@ public function test_builder_builds_what_the_php_backend_builds(): void public function test_constant_is_what_the_php_backend_builds(): void { static::assertEquals( - (new PhpBackend())->constant(int_schema('a'), 7, 3), - (new AdaptiveBackend())->constant(int_schema('a'), 7, 3), + new PhpBackend()->constant(int_schema('a'), 7, 3), + new AdaptiveBackend()->constant(int_schema('a'), 7, 3), ); } @@ -89,8 +89,8 @@ public function test_decode_is_what_the_php_backend_decodes(): void $buffers = ColumnMother::of(int_schema('a', nullable: true), [1, null])->encode(); static::assertEquals( - (new PhpBackend())->decode(int_schema('a', nullable: true), $buffers, 2, 1), - (new AdaptiveBackend())->decode(int_schema('a', nullable: true), $buffers, 2, 1), + new PhpBackend()->decode(int_schema('a', nullable: true), $buffers, 2, 1), + new AdaptiveBackend()->decode(int_schema('a', nullable: true), $buffers, 2, 1), ); } @@ -99,13 +99,13 @@ public function test_decode_frame_is_what_the_php_backend_decodes(): void $rows = RowsMother::workedExample(); static::assertEquals( - (new PhpBackend())->decodeFrame( - (new PhpBackend())->encodeFrame($rows, new NoopCodec()), + new PhpBackend()->decodeFrame( + new PhpBackend()->encodeFrame($rows, new NoopCodec()), $rows->schema(), new NoopCodec(), ), - (new AdaptiveBackend())->decodeFrame( - (new PhpBackend())->encodeFrame($rows, new NoopCodec()), + new AdaptiveBackend()->decodeFrame( + new PhpBackend()->encodeFrame($rows, new NoopCodec()), $rows->schema(), new NoopCodec(), ), @@ -117,8 +117,8 @@ public function test_encode_frame_delegates(): void $rows = RowsMother::workedExample(); static::assertSame( - (new PhpBackend())->encodeFrame($rows, new TrailingZerosCodecStub()), - (new AdaptiveBackend())->encodeFrame($rows, new TrailingZerosCodecStub()), + new PhpBackend()->encodeFrame($rows, new TrailingZerosCodecStub()), + new AdaptiveBackend()->encodeFrame($rows, new TrailingZerosCodecStub()), ); } @@ -127,8 +127,8 @@ public function test_compare_is_what_the_php_backend_compares(): void $rows = array_to_rows([['a' => 1, 'b' => 2], ['a' => 2, 'b' => 2]], schema(int_schema('a'), int_schema('b'))); static::assertEquals( - (new PhpBackend())->compare($rows->column('a'), Operator::EQUAL, $rows->column('b'), 'a', 'b'), - (new AdaptiveBackend())->compare($rows->column('a'), Operator::EQUAL, $rows->column('b'), 'a', 'b'), + new PhpBackend()->compare($rows->column('a'), Operator::EQUAL, $rows->column('b'), 'a', 'b'), + new AdaptiveBackend()->compare($rows->column('a'), Operator::EQUAL, $rows->column('b'), 'a', 'b'), ); } @@ -136,14 +136,14 @@ public function test_is_null_is_what_the_php_backend_answers(): void { $column = array_to_rows([['a' => 1], ['a' => null]], schema(int_schema('a', nullable: true)))->column('a'); - static::assertEquals((new PhpBackend())->isNull($column), (new AdaptiveBackend())->isNull($column)); + static::assertEquals(new PhpBackend()->isNull($column), new AdaptiveBackend()->isNull($column)); } public function test_is_not_null_is_what_the_php_backend_answers(): void { $column = array_to_rows([['a' => 1], ['a' => null]], schema(int_schema('a', nullable: true)))->column('a'); - static::assertEquals((new PhpBackend())->isNotNull($column), (new AdaptiveBackend())->isNotNull($column)); + static::assertEquals(new PhpBackend()->isNotNull($column), new AdaptiveBackend()->isNotNull($column)); } public function test_add_is_what_the_php_backend_adds(): void @@ -151,8 +151,8 @@ public function test_add_is_what_the_php_backend_adds(): void $rows = array_to_rows([['a' => 7, 'b' => 2]], schema(int_schema('a'), int_schema('b'))); static::assertEquals( - (new PhpBackend())->add($rows->column('a'), $rows->column('b')), - (new AdaptiveBackend())->add($rows->column('a'), $rows->column('b')), + new PhpBackend()->add($rows->column('a'), $rows->column('b')), + new AdaptiveBackend()->add($rows->column('a'), $rows->column('b')), ); } @@ -161,8 +161,8 @@ public function test_subtract_is_what_the_php_backend_subtracts(): void $rows = array_to_rows([['a' => 7, 'b' => 2]], schema(int_schema('a'), int_schema('b'))); static::assertEquals( - (new PhpBackend())->subtract($rows->column('a'), $rows->column('b')), - (new AdaptiveBackend())->subtract($rows->column('a'), $rows->column('b')), + new PhpBackend()->subtract($rows->column('a'), $rows->column('b')), + new AdaptiveBackend()->subtract($rows->column('a'), $rows->column('b')), ); } @@ -171,8 +171,8 @@ public function test_multiply_is_what_the_php_backend_multiplies(): void $rows = array_to_rows([['a' => 7, 'b' => 2]], schema(int_schema('a'), int_schema('b'))); static::assertEquals( - (new PhpBackend())->multiply($rows->column('a'), $rows->column('b')), - (new AdaptiveBackend())->multiply($rows->column('a'), $rows->column('b')), + new PhpBackend()->multiply($rows->column('a'), $rows->column('b')), + new AdaptiveBackend()->multiply($rows->column('a'), $rows->column('b')), ); } @@ -181,8 +181,8 @@ public function test_modulo_is_what_the_php_backend_answers(): void $rows = array_to_rows([['a' => 7, 'b' => 2]], schema(int_schema('a'), int_schema('b'))); static::assertEquals( - (new PhpBackend())->modulo($rows->column('a'), $rows->column('b')), - (new AdaptiveBackend())->modulo($rows->column('a'), $rows->column('b')), + new PhpBackend()->modulo($rows->column('a'), $rows->column('b')), + new AdaptiveBackend()->modulo($rows->column('a'), $rows->column('b')), ); } @@ -191,7 +191,7 @@ public function test_release_freed_memory_is_what_the_backend_does(): void $backend = new AdaptiveBackend(); $backend->releaseFreedMemory(); - static::assertSame((new PhpBackend())->allocatedBytes(), $backend->allocatedBytes()); + static::assertSame(new PhpBackend()->allocatedBytes(), $backend->allocatedBytes()); } public function test_starts_with_is_what_the_php_backend_answers(): void @@ -202,8 +202,8 @@ public function test_starts_with_is_what_the_php_backend_answers(): void ); static::assertEquals( - (new PhpBackend())->startsWith($rows->column('h'), $rows->column('n')), - (new AdaptiveBackend())->startsWith($rows->column('h'), $rows->column('n')), + new PhpBackend()->startsWith($rows->column('h'), $rows->column('n')), + new AdaptiveBackend()->startsWith($rows->column('h'), $rows->column('n')), ); } @@ -212,8 +212,8 @@ public function test_hash_is_what_the_php_backend_answers(): void $rows = array_to_rows([['s' => 'test'], ['s' => null]], schema(str_schema('s', nullable: true))); static::assertEquals( - (new PhpBackend())->hash($rows->column('s'), HashAlgorithm::md5), - (new AdaptiveBackend())->hash($rows->column('s'), HashAlgorithm::md5), + new PhpBackend()->hash($rows->column('s'), HashAlgorithm::md5), + new AdaptiveBackend()->hash($rows->column('s'), HashAlgorithm::md5), ); } @@ -225,8 +225,8 @@ public function test_ends_with_is_what_the_php_backend_answers(): void ); static::assertEquals( - (new PhpBackend())->endsWith($rows->column('h'), $rows->column('n')), - (new AdaptiveBackend())->endsWith($rows->column('h'), $rows->column('n')), + new PhpBackend()->endsWith($rows->column('h'), $rows->column('n')), + new AdaptiveBackend()->endsWith($rows->column('h'), $rows->column('n')), ); } @@ -238,8 +238,8 @@ public function test_contains_is_what_the_php_backend_answers(): void ); static::assertEquals( - (new PhpBackend())->contains($rows->column('h'), $rows->column('n')), - (new AdaptiveBackend())->contains($rows->column('h'), $rows->column('n')), + new PhpBackend()->contains($rows->column('h'), $rows->column('n')), + new AdaptiveBackend()->contains($rows->column('h'), $rows->column('n')), ); } @@ -248,10 +248,10 @@ public function test_sort_is_what_the_php_backend_sorts(): void $rows = array_to_rows([['a' => 2], ['a' => 1]], schema(int_schema('a'))); static::assertSame( - (new PhpBackend()) + new PhpBackend() ->sort($rows, [new SortColumn('a')]) ->toArray(), - (new AdaptiveBackend()) + new AdaptiveBackend() ->sort($rows, [new SortColumn('a')]) ->toArray(), ); @@ -262,16 +262,16 @@ public function test_sort_working_bytes_are_what_the_php_backend_needs(): void $rows = array_to_rows([['a' => 2], ['a' => 1]], schema(int_schema('a'))); static::assertSame( - (new PhpBackend())->sortWorkingBytes($rows, [new SortColumn('a')]), - (new AdaptiveBackend())->sortWorkingBytes($rows, [new SortColumn('a')]), + new PhpBackend()->sortWorkingBytes($rows, [new SortColumn('a')]), + new AdaptiveBackend()->sortWorkingBytes($rows, [new SortColumn('a')]), ); } public function test_grouped_totals_counts_and_table_are_the_php_backends(): void { - static::assertInstanceOf(PhpGroupedTotals::class, (new AdaptiveBackend())->groupedTotals()); - static::assertInstanceOf(PhpGroupedCounts::class, (new AdaptiveBackend())->groupedCounts()); - static::assertInstanceOf(PhpGroupTable::class, (new AdaptiveBackend())->groupTable( + static::assertInstanceOf(PhpGroupedTotals::class, new AdaptiveBackend()->groupedTotals()); + static::assertInstanceOf(PhpGroupedCounts::class, new AdaptiveBackend()->groupedCounts()); + static::assertInstanceOf(PhpGroupTable::class, new AdaptiveBackend()->groupTable( ['a'], schema(int_schema('a')), )); @@ -284,11 +284,11 @@ public function test_partition_is_what_the_php_backend_partitions(): void static::assertSame( array_map( static fn(Rows $part): array => $part->toArray(), - (new PhpBackend())->partition($rows, [$rows->column('a')], 4, 0), + new PhpBackend()->partition($rows, [$rows->column('a')], 4, 0), ), array_map( static fn(Rows $part): array => $part->toArray(), - (new AdaptiveBackend())->partition($rows, [$rows->column('a')], 4, 0), + new AdaptiveBackend()->partition($rows, [$rows->column('a')], 4, 0), ), ); } @@ -306,16 +306,16 @@ public function test_row_hashes_and_multiset_hashes_are_the_php_backends(): void $rows = array_to_rows([['a' => 1], ['a' => 2]], schema(int_schema('a'))); static::assertSame( - (new PhpBackend()) + new PhpBackend() ->rowHashes($rows->columns(), 2) ->physicals(), - (new AdaptiveBackend()) + new AdaptiveBackend() ->rowHashes($rows->columns(), 2) ->physicals(), ); static::assertInstanceOf( PhpGroupedMultisetHashes::class, - (new AdaptiveBackend())->groupedMultisetHashes(HashAlgorithm::xxh128), + new AdaptiveBackend()->groupedMultisetHashes(HashAlgorithm::xxh128), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/CanonicalEncodingTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/CanonicalEncodingTest.php index fbd233e451..8b06c32788 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/CanonicalEncodingTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/CanonicalEncodingTest.php @@ -18,7 +18,6 @@ use Flow\ETL\Values\Schema\Definition; use Generator; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function array_map; @@ -52,6 +51,7 @@ use function Flow\Types\DSL\type_date; use function Flow\Types\DSL\type_enum; use function Flow\Types\DSL\type_float; +use function Flow\Types\DSL\type_html; use function Flow\Types\DSL\type_html_element; use function Flow\Types\DSL\type_integer; use function Flow\Types\DSL\type_json; @@ -142,6 +142,13 @@ enum_schema('v', BackedStringEnum::class), [['']], ['0e0100000000000000071b000000000000003c3f786d6c2076657273696f6e3d22312e30223f3e0a3c612f3e0a'], ]; + yield 'list of html' => [ + list_schema('v', type_list(type_html())), + [['

a

']], + [ + '0e0100000000000000083e000000000000003c21444f43545950452068746d6c3e3c68746d6c3e3c686561643e3c2f686561643e3c626f64793e3c703e613c2f703e3c2f626f64793e3c2f68746d6c3e', + ], + ]; yield 'list of time zones' => [ list_schema('v', type_list(type_time_zone())), [[new DateTimeZone('UTC')]], @@ -214,7 +221,7 @@ public function test_ordered_appends_every_column_to_its_row(): void static::assertSame( ['02010000000000000003000000000000f83f0e020000000000000002010000000000000000'], - array_map(bin2hex(...), (new CanonicalEncoding())->ordered([ + array_map(bin2hex(...), new CanonicalEncoding()->ordered([ $rows->column('a'), $rows->column('b'), $rows->column('c'), @@ -237,12 +244,11 @@ public function test_ordered_writes_the_tag_and_payload_of_each_type( 'v' => $value, ], $values), schema($definition)); - static::assertSame($expected, array_map(bin2hex(...), (new CanonicalEncoding())->ordered([$rows->column( + static::assertSame($expected, array_map(bin2hex(...), new CanonicalEncoding()->ordered([$rows->column( 'v', )], $rows->count()))); } - #[RequiresPhp('>= 8.4.0')] public function test_html_takes_tag_08(): void { $rows = array_to_rows([[ @@ -253,7 +259,7 @@ public function test_html_takes_tag_08(): void [ '083e000000000000003c21444f43545950452068746d6c3e3c68746d6c3e3c686561643e3c2f686561643e3c626f64793e3c703e613c2f703e3c2f626f64793e3c2f68746d6c3e', ], - array_map(bin2hex(...), (new CanonicalEncoding())->ordered([$rows->column('v')], 1)), + array_map(bin2hex(...), new CanonicalEncoding()->ordered([$rows->column('v')], 1)), ); } @@ -263,7 +269,7 @@ public function test_xml_element_is_encoded_by_its_markup_wherever_it_lives(): v ['v' => type_xml_element()->cast('
')->firstElementChild], ['v' => type_xml_element()->cast('
')->lastElementChild], ['v' => type_xml_element()->cast('
')->firstElementChild], - ['v' => (new DOMDocument())->createElement('a')], + ['v' => new DOMDocument()->createElement('a')], ], schema(xml_element_schema('v'))); static::assertSame( @@ -273,7 +279,7 @@ public function test_xml_element_is_encoded_by_its_markup_wherever_it_lives(): v '1107000000000000003c613e3c2f613e', '1107000000000000003c613e3c2f613e', ], - array_map(bin2hex(...), (new CanonicalEncoding())->ordered([$rows->column('v')], 4)), + array_map(bin2hex(...), new CanonicalEncoding()->ordered([$rows->column('v')], 4)), ); } @@ -285,12 +291,11 @@ public function test_xml_element_differs_from_xml_document_with_the_same_markup( ); static::assertNotSame( - (new CanonicalEncoding())->ordered([$rows->column('d')], 1), - (new CanonicalEncoding())->ordered([$rows->column('e')], 1), + new CanonicalEncoding()->ordered([$rows->column('d')], 1), + new CanonicalEncoding()->ordered([$rows->column('e')], 1), ); } - #[RequiresPhp('>= 8.4.0')] public function test_html_element_is_encoded_by_its_markup_wherever_it_lives(): void { $rows = array_to_rows([ @@ -300,7 +305,7 @@ public function test_html_element_is_encoded_by_its_markup_wherever_it_lives(): static::assertSame( ['1208000000000000003c703e613c2f703e', '1208000000000000003c703e613c2f703e'], - array_map(bin2hex(...), (new CanonicalEncoding())->ordered([$rows->column('v')], 2)), + array_map(bin2hex(...), new CanonicalEncoding()->ordered([$rows->column('v')], 2)), ); } @@ -308,11 +313,11 @@ public function test_ordered_concatenates_the_columns_in_list_order(): void { $rows = array_to_rows([['a' => 1, 'b' => true]], schema(int_schema('a'), bool_schema('b'))); - static::assertSame(['0201000000000000000101'], array_map(bin2hex(...), (new CanonicalEncoding())->ordered([ + static::assertSame(['0201000000000000000101'], array_map(bin2hex(...), new CanonicalEncoding()->ordered([ $rows->column('a'), $rows->column('b'), ], 1))); - static::assertSame(['0101020100000000000000'], array_map(bin2hex(...), (new CanonicalEncoding())->ordered([ + static::assertSame(['0101020100000000000000'], array_map(bin2hex(...), new CanonicalEncoding()->ordered([ $rows->column('b'), $rows->column('a'), ], 1))); @@ -334,7 +339,7 @@ enum_schema('e', BackedStringEnum::class), static::assertCount( 5, array_unique(array_map( - static fn($column): string => (new CanonicalEncoding())->ordered([$column], 1)[0], + static fn($column): string => new CanonicalEncoding()->ordered([$column], 1)[0], array_values($rows->columns()), )), ); @@ -344,7 +349,7 @@ public function test_null_differs_from_empty_string(): void { $rows = array_to_rows([['v' => null], ['v' => '']], schema(str_schema('v', true))); - static::assertSame(['00', '040000000000000000'], array_map(bin2hex(...), (new CanonicalEncoding())->ordered( + static::assertSame(['00', '040000000000000000'], array_map(bin2hex(...), new CanonicalEncoding()->ordered( [$rows->column('v')], 2, ))); @@ -356,7 +361,7 @@ public function test_negative_zero_equals_zero_and_every_nan_is_one_value(): voi static::assertSame( ['030000000000000000', '030000000000000000', '03000000000000f87f', '03000000000000f87f'], - array_map(bin2hex(...), (new CanonicalEncoding())->ordered([$rows->column('v')], 4)), + array_map(bin2hex(...), new CanonicalEncoding()->ordered([$rows->column('v')], 4)), ); } @@ -366,7 +371,7 @@ public function test_nan_with_a_payload_is_the_one_nan_value(): void 'v' => unpack('e', (string) hex2bin('010000000000f87f'))[1], ]], schema(float_schema('v'))); - static::assertSame(['03000000000000f87f'], array_map(bin2hex(...), (new CanonicalEncoding())->ordered( + static::assertSame(['03000000000000f87f'], array_map(bin2hex(...), new CanonicalEncoding()->ordered( [$rows->column('v')], 1, ))); @@ -374,8 +379,8 @@ public function test_nan_with_a_payload_is_the_one_nan_value(): void public function test_negative_count_encodes_to_no_values(): void { - static::assertSame([], (new CanonicalEncoding())->ordered([], -1)); - static::assertSame([], (new CanonicalEncoding())->named([], -1)); + static::assertSame([], new CanonicalEncoding()->ordered([], -1)); + static::assertSame([], new CanonicalEncoding()->named([], -1)); } public function test_float_nan_differs_from_string_nan(): void @@ -383,8 +388,8 @@ public function test_float_nan_differs_from_string_nan(): void $rows = array_to_rows([['f' => NAN, 's' => 'NaN']], schema(float_schema('f'), str_schema('s'))); static::assertNotSame( - (new CanonicalEncoding())->ordered([$rows->column('f')], 1), - (new CanonicalEncoding())->ordered([$rows->column('s')], 1), + new CanonicalEncoding()->ordered([$rows->column('f')], 1), + new CanonicalEncoding()->ordered([$rows->column('s')], 1), ); } @@ -397,7 +402,7 @@ public function test_same_instant_in_two_zones_is_equal(): void static::assertSame( ['0c0040204648470600', '0c0040204648470600'], - array_map(bin2hex(...), (new CanonicalEncoding())->ordered([$rows->column('v')], 2)), + array_map(bin2hex(...), new CanonicalEncoding()->ordered([$rows->column('v')], 2)), ); } @@ -409,8 +414,8 @@ public function test_date_differs_from_datetime_at_midnight(): void ); static::assertSame(['0b01000000', '0c0060d71d14000000'], [ - bin2hex((new CanonicalEncoding())->ordered([$rows->column('d')], 1)[0]), - bin2hex((new CanonicalEncoding())->ordered([$rows->column('t')], 1)[0]), + bin2hex(new CanonicalEncoding()->ordered([$rows->column('d')], 1)[0]), + bin2hex(new CanonicalEncoding()->ordered([$rows->column('t')], 1)[0]), ]); } @@ -420,7 +425,7 @@ public function test_map_entry_order_does_not_count(): void ['v' => ['a' => 1, 'b' => 2]], ['v' => ['b' => 2, 'a' => 1]], ], schema(map_schema('v', type_map(type_string(), type_integer())))); - $encoded = (new CanonicalEncoding())->ordered([$rows->column('v')], 2); + $encoded = new CanonicalEncoding()->ordered([$rows->column('v')], 2); static::assertSame($encoded[0], $encoded[1]); } @@ -431,7 +436,7 @@ public function test_map_with_integer_keys_takes_tag_02_for_the_keys(): void static::assertSame( ['0f010000000000000002010000000000000004010000000000000061'], - array_map(bin2hex(...), (new CanonicalEncoding())->ordered([$rows->column('v')], 1)), + array_map(bin2hex(...), new CanonicalEncoding()->ordered([$rows->column('v')], 1)), ); } @@ -447,14 +452,14 @@ public function test_map_string_key_that_php_turned_into_an_integer_takes_tag_04 static::assertSame( ['0f010000000000000004010000000000000031020100000000000000'], - array_map(bin2hex(...), (new CanonicalEncoding())->ordered([$column], 1)), + array_map(bin2hex(...), new CanonicalEncoding()->ordered([$column], 1)), ); } public function test_list_order_counts(): void { $rows = array_to_rows([['v' => [1, 2]], ['v' => [2, 1]]], schema(list_schema('v', type_list(type_integer())))); - $encoded = (new CanonicalEncoding())->ordered([$rows->column('v')], 2); + $encoded = new CanonicalEncoding()->ordered([$rows->column('v')], 2); static::assertNotSame($encoded[0], $encoded[1]); } @@ -470,8 +475,8 @@ public function test_structure_element_order_does_not_count(): void ); static::assertSame( - (new CanonicalEncoding())->ordered([$rows->column('l')], 1), - (new CanonicalEncoding())->ordered([$rows->column('r')], 1), + new CanonicalEncoding()->ordered([$rows->column('l')], 1), + new CanonicalEncoding()->ordered([$rows->column('r')], 1), ); } @@ -486,8 +491,8 @@ public function test_renamed_nested_element_differs(): void ); static::assertNotSame( - (new CanonicalEncoding())->ordered([$rows->column('l')], 1), - (new CanonicalEncoding())->ordered([$rows->column('r')], 1), + new CanonicalEncoding()->ordered([$rows->column('l')], 1), + new CanonicalEncoding()->ordered([$rows->column('r')], 1), ); } @@ -506,14 +511,14 @@ public function test_null_structure_element_equals_missing_optional_element(): v '100100000000000000010000000000000061020100000000000000', '100100000000000000010000000000000061020100000000000000', ], - array_map(bin2hex(...), (new CanonicalEncoding())->ordered([$rows->column('v')], 2)), + array_map(bin2hex(...), new CanonicalEncoding()->ordered([$rows->column('v')], 2)), ); } public function test_json_whitespace_counts(): void { $rows = array_to_rows([['v' => '{"a":1}'], ['v' => '{"a": 1}']], schema(json_schema('v'))); - $encoded = (new CanonicalEncoding())->ordered([$rows->column('v')], 2); + $encoded = new CanonicalEncoding()->ordered([$rows->column('v')], 2); static::assertNotSame($encoded[0], $encoded[1]); } @@ -524,7 +529,7 @@ public function test_named_writes_name_parts_sorted_by_name(): void static::assertSame( ['0100000000000000610201000000000000000100000000000000620101'], - array_map(bin2hex(...), (new CanonicalEncoding())->named($rows->columns(), 1)), + array_map(bin2hex(...), new CanonicalEncoding()->named($rows->columns(), 1)), ); } @@ -533,8 +538,8 @@ public function test_named_ignores_the_column_order(): void $rows = array_to_rows([['a' => 1, 'b' => 'x']], schema(int_schema('a'), str_schema('b'))); static::assertSame( - (new CanonicalEncoding())->named(['a' => $rows->column('a'), 'b' => $rows->column('b')], 1), - (new CanonicalEncoding())->named(['b' => $rows->column('b'), 'a' => $rows->column('a')], 1), + new CanonicalEncoding()->named(['a' => $rows->column('a'), 'b' => $rows->column('b')], 1), + new CanonicalEncoding()->named(['b' => $rows->column('b'), 'a' => $rows->column('a')], 1), ); } @@ -543,8 +548,8 @@ public function test_named_renamed_column_differs(): void $rows = array_to_rows([['a' => 1]], schema(int_schema('a'))); static::assertNotSame( - (new CanonicalEncoding())->named(['a' => $rows->column('a')], 1), - (new CanonicalEncoding())->named(['c' => $rows->column('a')], 1), + new CanonicalEncoding()->named(['a' => $rows->column('a')], 1), + new CanonicalEncoding()->named(['c' => $rows->column('a')], 1), ); } @@ -554,8 +559,8 @@ public function test_named_null_column_equals_missing_column(): void $without = array_to_rows([['a' => 1]], schema(int_schema('a'))); static::assertSame( - (new CanonicalEncoding())->named($with->columns(), 1), - (new CanonicalEncoding())->named($without->columns(), 1), + new CanonicalEncoding()->named($with->columns(), 1), + new CanonicalEncoding()->named($without->columns(), 1), ); } @@ -563,7 +568,7 @@ public function test_named_of_only_nulls_is_empty(): void { $rows = array_to_rows([['a' => null, 'b' => null]], schema(int_schema('a', true), null_schema('b'))); - static::assertSame([''], (new CanonicalEncoding())->named($rows->columns(), 1)); + static::assertSame([''], new CanonicalEncoding()->named($rows->columns(), 1)); } public function test_type_outside_the_table_is_refused(): void @@ -571,7 +576,7 @@ public function test_type_outside_the_table_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('type mixed has no canonical encoding, declare the type of the column'); - (new CanonicalEncoding())->ordered([new MistypedColumnStub( + new CanonicalEncoding()->ordered([new MistypedColumnStub( ColumnMother::of(int_schema('a'), [1]), type_mixed(), )], 1); @@ -581,7 +586,7 @@ public function test_no_rows_encode_to_no_values(): void { $rows = array_to_rows([], schema(int_schema('a'))); - static::assertSame([], (new CanonicalEncoding())->named($rows->columns(), 0)); - static::assertSame([], (new CanonicalEncoding())->ordered([$rows->column('a')], 0)); + static::assertSame([], new CanonicalEncoding()->named($rows->columns(), 0)); + static::assertSame([], new CanonicalEncoding()->ordered([$rows->column('a')], 0)); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ColumnConcatTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ColumnConcatTest.php index 91af9437ab..d80a7d7b89 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ColumnConcatTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ColumnConcatTest.php @@ -91,12 +91,12 @@ public function test_a_mixed_class_concat_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('cannot concat'); - ColumnMother::of(int_schema('a'), [1])->concat((new PhpBackend())->constant(int_schema('a'), 7, 2)); + ColumnMother::of(int_schema('a'), [1])->concat(new PhpBackend()->constant(int_schema('a'), 7, 2)); } public function test_container_columns_refuse_another_column_class(): void { - $constant = (new PhpBackend())->constant(int_schema('a'), 1, 1); + $constant = new PhpBackend()->constant(int_schema('a'), 1, 1); $containers = [ ColumnMother::of(list_schema('a', type_list(type_integer())), [[1]]), ColumnMother::of(map_schema('a', type_map(type_string(), type_integer())), [['x' => 1]]), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ColumnEncodeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ColumnEncodeTest.php index c403d9024b..d231ada255 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ColumnEncodeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ColumnEncodeTest.php @@ -91,7 +91,7 @@ public static function columns(): Generator ['', '', '0100000000000000'], ]; yield 'a constant is expanded' => [ - (new PhpBackend())->constant(int_schema('a'), 7, 2), + new PhpBackend()->constant(int_schema('a'), 7, 2), ['', '07000000000000000700000000000000'], ]; yield 'a slice re-bases offsets and re-packs validity from bit 0' => [ diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ComparableValuesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ComparableValuesTest.php index 3a00cd5481..47b3e950b1 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ComparableValuesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ComparableValuesTest.php @@ -11,7 +11,6 @@ use Flow\ETL\Values\Schema\Definition; use Generator; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\ETL\DSL\bool_schema; @@ -76,7 +75,6 @@ public static function by_value(): Generator yield 'list' => [list_schema('a', type_list(type_integer())), [[1, 2]]]; } - #[RequiresPhp('>= 8.4.0')] public function test_html_compares_by_physical(): void { $document = ColumnMother::of( @@ -88,8 +86,8 @@ public function test_html_compares_by_physical(): void type_html_element()->cast('

a

')->firstElementChild, ]); - static::assertSame($document->physicals(), (new ComparableValues())->equality($document)); - static::assertSame(['

a

', '

a

'], (new ComparableValues())->equality($element)); + static::assertSame($document->physicals(), new ComparableValues()->equality($document)); + static::assertSame(['

a

', '

a

'], new ComparableValues()->equality($element)); } public function test_xml_elements_of_different_documents_compare_by_their_markup(): void @@ -99,12 +97,12 @@ public function test_xml_elements_of_different_documents_compare_by_their_markup $elements = ColumnMother::of(xml_element_schema('a', nullable: true), [$first, $second, null]); $lists = ColumnMother::of(list_schema('a', type_list(type_xml_element())), [[$first], [$second]]); - static::assertTrue((new ComparableValues())->equalByPhysical($elements->type())); - static::assertSame(['

a

', '

a

', null], (new ComparableValues())->ordering($elements)); - static::assertSame(['

a

', '

a

', null], (new ComparableValues())->equality($elements)); + static::assertTrue(new ComparableValues()->equalByPhysical($elements->type())); + static::assertSame(['

a

', '

a

', null], new ComparableValues()->ordering($elements)); + static::assertSame(['

a

', '

a

', null], new ComparableValues()->equality($elements)); static::assertSame( [['

a

'], ['

a

']], - (new ComparableValues())->equalities($lists->type(), $lists->physicals()), + new ComparableValues()->equalities($lists->type(), $lists->physicals()), ); } @@ -117,9 +115,9 @@ public function test_other_types_compare_their_values(Definition $definition, ar { $column = ColumnMother::of($definition, $values); - static::assertFalse((new ComparableValues())->equalByPhysical($column->type())); - static::assertEquals($column->values(), (new ComparableValues())->ordering($column)); - static::assertEquals($column->values(), (new ComparableValues())->equality($column)); + static::assertFalse(new ComparableValues()->equalByPhysical($column->type())); + static::assertEquals($column->values(), new ComparableValues()->ordering($column)); + static::assertEquals($column->values(), new ComparableValues()->equality($column)); } /** @@ -133,8 +131,8 @@ public function test_uuid_json_enum_xml_and_html_order_by_their_physicals( ): void { $column = ColumnMother::of($definition, $values); - static::assertSame($column->physicals(), (new ComparableValues())->ordering($column)); - static::assertSame($column->physicals(), (new ComparableValues())->equality($column)); + static::assertSame($column->physicals(), new ComparableValues()->ordering($column)); + static::assertSame($column->physicals(), new ComparableValues()->equality($column)); } /** @@ -146,22 +144,22 @@ public function test_ordered_types_read_physicals(Definition $definition, array { $column = ColumnMother::of($definition, $values); - static::assertTrue((new ComparableValues())->equalByPhysical($column->type())); - static::assertSame($column->physicals(), (new ComparableValues())->ordering($column)); - static::assertSame($column->physicals(), (new ComparableValues())->equality($column)); + static::assertTrue(new ComparableValues()->equalByPhysical($column->type())); + static::assertSame($column->physicals(), new ComparableValues()->ordering($column)); + static::assertSame($column->physicals(), new ComparableValues()->equality($column)); } public function test_a_date_compares_on_the_datetime_microsecond_scale(): void { $column = ColumnMother::of(date_schema('a', nullable: true), [new DateTimeImmutable('2024-01-02'), null]); - static::assertSame([1_704_153_600_000_000, null], (new ComparableValues())->ordering($column)); - static::assertSame([1_704_153_600_000_000, null], (new ComparableValues())->equality($column)); + static::assertSame([1_704_153_600_000_000, null], new ComparableValues()->ordering($column)); + static::assertSame([1_704_153_600_000_000, null], new ComparableValues()->equality($column)); static::assertSame( - (new ComparableValues())->equality(ColumnMother::of(datetime_schema('a'), [new DateTimeImmutable( + new ComparableValues()->equality(ColumnMother::of(datetime_schema('a'), [new DateTimeImmutable( '2024-01-02 00:00:00 UTC', )])), - [(new ComparableValues())->equality($column)[0]], + [new ComparableValues()->equality($column)[0]], ); } @@ -169,15 +167,15 @@ public function test_nan_equals_nan_and_orders_as_a_float(): void { $column = ColumnMother::of(float_schema('a', nullable: true), [NAN, 1.0, NAN, null]); - static::assertSame(['NaN', 1.0, 'NaN', null], (new ComparableValues())->equality($column)); - static::assertNan((new ComparableValues())->ordering($column)[0]); + static::assertSame(['NaN', 1.0, 'NaN', null], new ComparableValues()->equality($column)); + static::assertNan(new ComparableValues()->ordering($column)[0]); } public function test_a_float_column_without_nan_keeps_its_physicals(): void { static::assertSame( [1.5, 2.0], - (new ComparableValues())->equality(ColumnMother::of(float_schema('a'), [1.5, 2.0])), + new ComparableValues()->equality(ColumnMother::of(float_schema('a'), [1.5, 2.0])), ); } @@ -188,7 +186,7 @@ public function test_orderings_of_two_columns_of_one_type_read_their_physicals() static::assertSame( [$first->physicals(), $second->physicals()], - (new ComparableValues())->orderings($first, $second), + new ComparableValues()->orderings($first, $second), ); } @@ -197,17 +195,14 @@ public function test_orderings_of_two_columns_of_different_types_read_their_valu $first = ColumnMother::of(json_schema('a'), ['{"a":1}']); $second = ColumnMother::of(uuid_schema('b'), ['00000000-0000-4000-8000-000000000001']); - static::assertEquals( - [$first->values(), $second->values()], - (new ComparableValues())->orderings($first, $second), - ); + static::assertEquals([$first->values(), $second->values()], new ComparableValues()->orderings($first, $second)); } public function test_infinities_summing_to_nan_stay_infinities(): void { static::assertSame( [INF, -INF, 1.0], - (new ComparableValues())->equality(ColumnMother::of(float_schema('a'), [INF, -INF, 1.0])), + new ComparableValues()->equality(ColumnMother::of(float_schema('a'), [INF, -INF, 1.0])), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/DateFormatPatternTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/DateFormatPatternTest.php index d037868ebe..87fc324d48 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/DateFormatPatternTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/DateFormatPatternTest.php @@ -21,7 +21,7 @@ final class DateFormatPatternTest extends TestCase #[TestWith(['Y\\', ['Y']])] public function test_letters(string $format, array $letters): void { - static::assertSame($letters, (new DateFormatPattern($format))->letters()); + static::assertSame($letters, new DateFormatPattern($format)->letters()); } /** @@ -43,6 +43,6 @@ public function test_letters(string $format, array $letters): void #[TestWith(['Y\\', [['Y\\', '']]])] public function test_segments(string $format, array $segments): void { - static::assertSame($segments, (new DateFormatPattern($format))->segments()); + static::assertSame($segments, new DateFormatPattern($format)->segments()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ElementsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ElementsTest.php index 11e949cfc9..3839dd2a41 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ElementsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ElementsTest.php @@ -13,16 +13,16 @@ public function test_flatten_takes_every_element_of_every_non_null_container_in_ { static::assertSame( [1, null, 2, 3, [4]], - (new Elements())->flatten([[1, null], null, [], ['a' => 2, 5 => 3], [[4]]]), + new Elements()->flatten([[1, null], null, [], ['a' => 2, 5 => 3], [[4]]]), ); - static::assertSame([], (new Elements())->flatten([])); + static::assertSame([], new Elements()->flatten([])); } public function test_shape_cuts_a_flat_list_back_into_the_containers(): void { static::assertSame( [['a', 'b'], null, [], ['a' => 'c', 5 => 'd']], - (new Elements())->shape(['a', 'b', 'c', 'd'], [[1, null], null, [], ['a' => 2, 5 => 3]]), + new Elements()->shape(['a', 'b', 'c', 'd'], [[1, null], null, [], ['a' => 2, 5 => 3]]), ); } @@ -30,16 +30,16 @@ public function test_field_takes_the_element_of_every_structure_that_has_it(): v { static::assertSame( [1, null], - (new Elements())->field([['a' => 1, 'b' => 2], ['b' => 3], null, ['a' => null]], 'a'), + new Elements()->field([['a' => 1, 'b' => 2], ['b' => 3], null, ['a' => null]], 'a'), ); - static::assertSame(['x'], (new Elements())->field([[0 => 'x']], 0)); + static::assertSame(['x'], new Elements()->field([[0 => 'x']], 0)); } public function test_with_field_puts_rendered_values_back_where_the_field_was(): void { static::assertSame( [['a' => 'one', 'b' => 2], ['b' => 3], null, ['a' => 'two']], - (new Elements())->withField([['a' => 1, 'b' => 2], ['b' => 3], null, ['a' => null]], 'a', ['one', 'two']), + new Elements()->withField([['a' => 1, 'b' => 2], ['b' => 3], null, ['a' => null]], 'a', ['one', 'two']), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Frame/NoopCodecTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Frame/NoopCodecTest.php index 9013ac4088..d379c0836b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Frame/NoopCodecTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Frame/NoopCodecTest.php @@ -11,16 +11,16 @@ final class NoopCodecTest extends TestCase { public function test_decode_is_passthrough(): void { - static::assertSame("raw\x00bytes", (new NoopCodec())->decode("raw\x00bytes")); + static::assertSame("raw\x00bytes", new NoopCodec()->decode("raw\x00bytes")); } public function test_encode_is_passthrough(): void { - static::assertSame("raw\x00bytes", (new NoopCodec())->encode("raw\x00bytes")); + static::assertSame("raw\x00bytes", new NoopCodec()->encode("raw\x00bytes")); } public function test_id_is_zero(): void { - static::assertSame(0x00, (new NoopCodec())->id()); + static::assertSame(0x00, new NoopCodec()->id()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/BooleanLayoutTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/BooleanLayoutTest.php index 436d42d299..9fc9a390aa 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/BooleanLayoutTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/BooleanLayoutTest.php @@ -17,9 +17,9 @@ final class BooleanLayoutTest extends TestCase { public function test_packs_bits_lsb_first_with_nulls_as_zero(): void { - static::assertSame(['05'], array_map(bin2hex(...), (new BooleanLayout())->encode([true, null, true, false]))); - static::assertSame(['ff01'], array_map(bin2hex(...), (new BooleanLayout())->encode(array_fill(0, 9, true)))); - static::assertSame(['ff'], array_map(bin2hex(...), (new BooleanLayout())->encode(array_fill(0, 8, true)))); + static::assertSame(['05'], array_map(bin2hex(...), new BooleanLayout()->encode([true, null, true, false]))); + static::assertSame(['ff01'], array_map(bin2hex(...), new BooleanLayout()->encode(array_fill(0, 9, true)))); + static::assertSame(['ff'], array_map(bin2hex(...), new BooleanLayout()->encode(array_fill(0, 8, true)))); } public function test_round_trips(): void @@ -44,7 +44,7 @@ public function test_eight_rows_fit_in_one_byte(): void { static::assertSame( array_fill(0, 8, true), - (new BooleanLayout())->decode(new Buffers(["\xFF"]), 8, array_fill(0, 8, true)), + new BooleanLayout()->decode(new Buffers(["\xFF"]), 8, array_fill(0, 8, true)), ); } @@ -53,7 +53,7 @@ public function test_refuses_an_empty_buffer_for_eight_rows(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Boolean values buffer of 0 bytes, expected 1 for 8 rows'); - (new BooleanLayout())->decode(new Buffers(['']), 8, array_fill(0, 8, true)); + new BooleanLayout()->decode(new Buffers(['']), 8, array_fill(0, 8, true)); } public function test_refuses_a_short_buffer(): void @@ -61,6 +61,6 @@ public function test_refuses_a_short_buffer(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Boolean values buffer of 1 bytes, expected 2 for 9 rows'); - (new BooleanLayout())->decode(new Buffers(["\xFF"]), 9, array_fill(0, 9, true)); + new BooleanLayout()->decode(new Buffers(["\xFF"]), 9, array_fill(0, 9, true)); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/BufferLayoutTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/BufferLayoutTest.php index 1c81a7c4e4..da180c7577 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/BufferLayoutTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/BufferLayoutTest.php @@ -54,14 +54,14 @@ public static function counts(): Generator #[DataProvider('counts')] public function test_counts_nodes_and_buffers(Type $type, int $nodes, int $buffers): void { - static::assertSame($nodes, (new BufferLayout())->nodeCount($type)); - static::assertSame($buffers, (new BufferLayout())->bufferCount($type)); + static::assertSame($nodes, new BufferLayout()->nodeCount($type)); + static::assertSame($buffers, new BufferLayout()->bufferCount($type)); } public function test_the_first_node_is_given(): void { - static::assertSame([[3, 3]], (new BufferLayout())->nodes(type_null(), 3, 3, [])); - static::assertSame([[2, 1]], (new BufferLayout())->nodes(type_integer(), 2, 1, ['', ''])); + static::assertSame([[3, 3]], new BufferLayout()->nodes(type_null(), 3, 3, [])); + static::assertSame([[2, 1]], new BufferLayout()->nodes(type_integer(), 2, 1, ['', ''])); } public function test_a_list_child_spans_the_last_offset(): void @@ -72,7 +72,7 @@ public function test_a_list_child_spans_the_last_offset(): void [2, 3, null], ]); - static::assertSame([[3, 1], [5, 2]], (new BufferLayout())->nodes($column->type(), 3, 1, $column->encode())); + static::assertSame([[3, 1], [5, 2]], new BufferLayout()->nodes($column->type(), 3, 1, $column->encode())); } public function test_a_map_entries_node_holds_no_nulls(): void @@ -81,7 +81,7 @@ public function test_a_map_entries_node_holds_no_nulls(): void static::assertSame( [[2, 0], [3, 0], [3, 0], [3, 2]], - (new BufferLayout())->nodes($type, 2, 0, ColumnMother::of(map_schema('a', $type), [ + new BufferLayout()->nodes($type, 2, 0, ColumnMother::of(map_schema('a', $type), [ ['a' => 1, 'b' => null], ['c' => null], ])->encode()), @@ -101,7 +101,7 @@ public function test_structure_children_span_their_parent(): void static::assertSame( [[2, 1], [2, 1], [2, 2]], - (new BufferLayout())->nodes($column->type(), 2, 1, $column->encode()), + new BufferLayout()->nodes($column->type(), 2, 1, $column->encode()), ); } @@ -110,7 +110,7 @@ public function test_refuses_a_buffer_count_other_than_the_layout(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Column of type integer holds 1 buffers, its layout needs 2'); - (new BufferLayout())->nodes(type_integer(), 1, 0, ['']); + new BufferLayout()->nodes(type_integer(), 1, 0, ['']); } public function test_refuses_an_offsets_buffer_of_another_length(): void @@ -118,7 +118,7 @@ public function test_refuses_an_offsets_buffer_of_another_length(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('List offsets buffer of 4 bytes, expected 8 for 1 rows'); - (new BufferLayout())->nodes(type_list(type_integer()), 1, 0, ['', pack('V', 0), '', '']); + new BufferLayout()->nodes(type_list(type_integer()), 1, 0, ['', pack('V', 0), '', '']); } public function test_refuses_a_map_entries_validity(): void @@ -126,7 +126,7 @@ public function test_refuses_a_map_entries_validity(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Map entries validity must be omitted, got 1 bytes'); - (new BufferLayout())->nodes(type_map(type_string(), type_integer()), 1, 0, [ + new BufferLayout()->nodes(type_map(type_string(), type_integer()), 1, 0, [ '', pack('V2', 0, 0), "\x01", @@ -143,6 +143,6 @@ public function test_refuses_a_short_child_validity(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Validity bitmap of 1 bytes is too short for 9 rows'); - (new BufferLayout())->nodes(type_list(type_optional(type_integer())), 1, 0, ['', pack('V2', 0, 9), "\x01", '']); + new BufferLayout()->nodes(type_list(type_optional(type_integer())), 1, 0, ['', pack('V2', 0, 9), "\x01", '']); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/FixedBinary16LayoutTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/FixedBinary16LayoutTest.php index 6b1dda8240..b9db2eb5ee 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/FixedBinary16LayoutTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/FixedBinary16LayoutTest.php @@ -17,7 +17,7 @@ public function test_a_null_slot_is_sixteen_zero_bytes(): void { static::assertSame( [str_repeat('a', 16) . str_repeat("\0", 16)], - (new FixedBinary16Layout())->encode([str_repeat('a', 16), null]), + new FixedBinary16Layout()->encode([str_repeat('a', 16), null]), ); } @@ -35,7 +35,7 @@ public function test_refuses_a_wrong_length(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('FixedBinary16 values buffer of 15 bytes, expected 16 for 1 rows'); - (new FixedBinary16Layout())->decode(new Buffers([str_repeat('a', 15)]), 1, [true]); + new FixedBinary16Layout()->decode(new Buffers([str_repeat('a', 15)]), 1, [true]); } public function test_refuses_a_wrong_length_for_two_rows(): void @@ -43,6 +43,6 @@ public function test_refuses_a_wrong_length_for_two_rows(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('FixedBinary16 values buffer of 15 bytes, expected 32 for 2 rows'); - (new FixedBinary16Layout())->decode(new Buffers([str_repeat('a', 15)]), 2, [true, true]); + new FixedBinary16Layout()->decode(new Buffers([str_repeat('a', 15)]), 2, [true, true]); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Float64LayoutTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Float64LayoutTest.php index 76a647a491..bc1a0a312e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Float64LayoutTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Float64LayoutTest.php @@ -18,7 +18,7 @@ public function test_encodes_nulls_as_zero(): void { static::assertSame( ['000000000000f83f0000000000000000'], - array_map(bin2hex(...), (new Float64Layout())->encode([1.5, null])), + array_map(bin2hex(...), new Float64Layout()->encode([1.5, null])), ); } @@ -38,7 +38,7 @@ public function test_refuses_a_wrong_length(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Float64 values buffer of 9 bytes, expected 8 for 1 rows'); - (new Float64Layout())->decode(new Buffers([str_repeat("\0", 9)]), 1, [true]); + new Float64Layout()->decode(new Buffers([str_repeat("\0", 9)]), 1, [true]); } public function test_refuses_a_wrong_length_for_two_rows(): void @@ -46,6 +46,6 @@ public function test_refuses_a_wrong_length_for_two_rows(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Float64 values buffer of 9 bytes, expected 16 for 2 rows'); - (new Float64Layout())->decode(new Buffers([str_repeat("\0", 9)]), 2, [true, true]); + new Float64Layout()->decode(new Buffers([str_repeat("\0", 9)]), 2, [true, true]); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Int32LayoutTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Int32LayoutTest.php index 119e19c477..2fc641debb 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Int32LayoutTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Int32LayoutTest.php @@ -18,7 +18,7 @@ public function test_encodes_nulls_as_zero(): void { static::assertSame( ['fdffffff0000000001000000'], - array_map(bin2hex(...), (new Int32Layout())->encode([-3, null, 1])), + array_map(bin2hex(...), new Int32Layout()->encode([-3, null, 1])), ); } @@ -42,7 +42,7 @@ public function test_refuses_a_wrong_length(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Int32 values buffer of 3 bytes, expected 4 for 1 rows'); - (new Int32Layout())->decode(new Buffers(["\0\0\0"]), 1, [true]); + new Int32Layout()->decode(new Buffers(["\0\0\0"]), 1, [true]); } public function test_refuses_a_wrong_length_for_two_rows(): void @@ -50,6 +50,6 @@ public function test_refuses_a_wrong_length_for_two_rows(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Int32 values buffer of 3 bytes, expected 8 for 2 rows'); - (new Int32Layout())->decode(new Buffers(["\0\0\0"]), 2, [true, true]); + new Int32Layout()->decode(new Buffers(["\0\0\0"]), 2, [true, true]); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Int64LayoutTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Int64LayoutTest.php index 528ee98eea..2a9dcd9c98 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Int64LayoutTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Int64LayoutTest.php @@ -18,7 +18,7 @@ public function test_encodes_nulls_as_zero(): void { static::assertSame( ['01000000000000000000000000000000ffffffffffffffff'], - array_map(bin2hex(...), (new Int64Layout())->encode([1, null, -1])), + array_map(bin2hex(...), new Int64Layout()->encode([1, null, -1])), ); } @@ -34,7 +34,7 @@ public function test_round_trips_the_extremes(): void public function test_decodes_zero_rows(): void { - static::assertSame([], (new Int64Layout())->decode(new Buffers(['']), 0, [])); + static::assertSame([], new Int64Layout()->decode(new Buffers(['']), 0, [])); } public function test_refuses_a_wrong_length(): void @@ -42,6 +42,6 @@ public function test_refuses_a_wrong_length(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Int64 values buffer of 7 bytes, expected 8 for 1 rows'); - (new Int64Layout())->decode(new Buffers(["\0\0\0\0\0\0\0"]), 1, [true]); + new Int64Layout()->decode(new Buffers(["\0\0\0\0\0\0\0"]), 1, [true]); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/NullCountTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/NullCountTest.php index 28e5f553b4..f1790e6ecd 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/NullCountTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/NullCountTest.php @@ -11,7 +11,7 @@ final class NullCountTest extends TestCase { public function test_counts_nulls(): void { - static::assertSame(2, (new NullCount())->of([null, 0, '', null, false])); - static::assertSame(0, (new NullCount())->of([])); + static::assertSame(2, new NullCount()->of([null, 0, '', null, false])); + static::assertSame(0, new NullCount()->of([])); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/OffsetsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/OffsetsTest.php index 77266c9903..a2e9c70a85 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/OffsetsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/OffsetsTest.php @@ -16,12 +16,12 @@ final class OffsetsTest extends TestCase { public function test_packs_little_endian_i32(): void { - static::assertSame('000000000200000002000000', bin2hex((new Offsets())->pack([0, 2, 2]))); + static::assertSame('000000000200000002000000', bin2hex(new Offsets()->pack([0, 2, 2]))); } public function test_packs_the_last_i32_offset(): void { - static::assertSame('00000000ffffff7f', bin2hex((new Offsets())->pack([0, 2_147_483_647]))); + static::assertSame('00000000ffffff7f', bin2hex(new Offsets()->pack([0, 2_147_483_647]))); } public function test_refuses_an_offset_past_the_i32_range(): void @@ -29,12 +29,12 @@ public function test_refuses_an_offset_past_the_i32_range(): void $this->expectException(OffsetOverflow::class); $this->expectExceptionMessage('Offsets exceed the i32 range of a batch buffer: the last offset is 2147483648'); - (new Offsets())->pack([0, 2_147_483_648]); + new Offsets()->pack([0, 2_147_483_648]); } public function test_unpacks(): void { - static::assertSame([0, 2, 2], (new Offsets())->unpack((string) hex2bin('000000000200000002000000'), 2, 'List')); + static::assertSame([0, 2, 2], new Offsets()->unpack((string) hex2bin('000000000200000002000000'), 2, 'List')); } public function test_unpack_refuses_a_wrong_length(): void @@ -42,7 +42,7 @@ public function test_unpack_refuses_a_wrong_length(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('List offsets buffer of 8 bytes, expected 12 for 2 rows'); - (new Offsets())->unpack((string) hex2bin('0000000002000000'), 2, 'List'); + new Offsets()->unpack((string) hex2bin('0000000002000000'), 2, 'List'); } public function test_unpack_refuses_offsets_that_do_not_start_at_0(): void @@ -50,7 +50,7 @@ public function test_unpack_refuses_offsets_that_do_not_start_at_0(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('List offsets start at 1, not 0'); - (new Offsets())->unpack((string) hex2bin('0100000002000000'), 1, 'List'); + new Offsets()->unpack((string) hex2bin('0100000002000000'), 1, 'List'); } public function test_unpack_refuses_offsets_that_decrease(): void @@ -58,6 +58,6 @@ public function test_unpack_refuses_offsets_that_decrease(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('List offsets are not monotonic: offset 1 is 3, offset 2 is 2'); - (new Offsets())->unpack((string) hex2bin('000000000300000002000000'), 2, 'List'); + new Offsets()->unpack((string) hex2bin('000000000300000002000000'), 2, 'List'); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Utf8LayoutTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Utf8LayoutTest.php index 6a49d68d7f..a86e590a55 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Utf8LayoutTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/Utf8LayoutTest.php @@ -18,7 +18,7 @@ public function test_a_null_slot_is_an_empty_range(): void { static::assertSame( ['00000000020000000200000003000000', '616263'], - array_map(bin2hex(...), (new Utf8Layout())->encode(['ab', null, 'c'])), + array_map(bin2hex(...), new Utf8Layout()->encode(['ab', null, 'c'])), ); } @@ -37,6 +37,6 @@ public function test_refuses_a_last_offset_other_than_the_data_length(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Utf8 data buffer of 3 bytes, the last offset is 2'); - (new Utf8Layout())->decode(new Buffers(["\0\0\0\0\x02\0\0\0", 'abc']), 1, [true]); + new Utf8Layout()->decode(new Buffers(["\0\0\0\0\x02\0\0\0", 'abc']), 1, [true]); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/ValidityTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/ValidityTest.php index 31e531baee..3ce88bfde7 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/ValidityTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Layout/ValidityTest.php @@ -21,9 +21,9 @@ final class ValidityTest extends TestCase { public function test_no_null_is_an_omitted_bitmap(): void { - static::assertSame('', (new Validity())->fromValues([1, 2, 3])); - static::assertSame('', (new Validity())->fromValues([])); - static::assertSame('', (new Validity())->fromNulls([], 3)); + static::assertSame('', new Validity()->fromValues([1, 2, 3])); + static::assertSame('', new Validity()->fromValues([])); + static::assertSame('', new Validity()->fromNulls([], 3)); } /** @@ -37,7 +37,7 @@ public function test_no_null_is_an_omitted_bitmap(): void #[TestWith([1003])] public function test_values_without_a_null_have_no_bitmap_for_every_length(int $length): void { - static::assertSame('', (new Validity())->fromValues(array_fill(0, $length, 1))); + static::assertSame('', new Validity()->fromValues(array_fill(0, $length, 1))); } public function test_values_with_nulls_match_the_bitmap_from_null_positions(): void @@ -49,8 +49,8 @@ public function test_values_with_nulls_match_the_bitmap_from_null_positions(): v } static::assertSame( - (new Validity())->fromNulls(array_fill_keys(array_keys($values, null, true), true), count($values)), - (new Validity())->fromValues($values), + new Validity()->fromNulls(array_fill_keys(array_keys($values, null, true), true), count($values)), + new Validity()->fromValues($values), ); } @@ -64,8 +64,8 @@ public function test_values_with_nulls_match_the_bitmap_from_null_positions(): v public function test_values_that_are_all_null_match_the_bitmap_from_null_positions(int $length): void { static::assertSame( - (new Validity())->fromNulls(array_fill_keys(range(0, $length - 1), true), $length), - (new Validity())->fromValues(array_fill(0, $length, null)), + new Validity()->fromNulls(array_fill_keys(range(0, $length - 1), true), $length), + new Validity()->fromValues(array_fill(0, $length, null)), ); } @@ -78,36 +78,36 @@ public function test_the_last_row_null_packs_lsb_first(int $count, string $hex): $values = array_slice($values, 0, $count); $values[$count - 1] = null; - static::assertSame($hex, bin2hex((new Validity())->fromValues($values))); - static::assertSame($hex, bin2hex((new Validity())->fromNulls([$count - 1 => true], $count))); + static::assertSame($hex, bin2hex(new Validity()->fromValues($values))); + static::assertSame($hex, bin2hex(new Validity()->fromNulls([$count - 1 => true], $count))); } public function test_the_first_row_null(): void { - static::assertSame('fe01', bin2hex((new Validity())->fromValues([null, 1, 1, 1, 1, 1, 1, 1, 1]))); - static::assertSame('fe01', bin2hex((new Validity())->fromNulls([0 => true], 9))); + static::assertSame('fe01', bin2hex(new Validity()->fromValues([null, 1, 1, 1, 1, 1, 1, 1, 1]))); + static::assertSame('fe01', bin2hex(new Validity()->fromNulls([0 => true], 9))); } public function test_reads_the_valid_flags(): void { static::assertSame( [false, true, true, true, true, true, true, true, true], - (new Validity())->valid("\xFE\x01", 9), + new Validity()->valid("\xFE\x01", 9), ); - static::assertSame([true, true], (new Validity())->valid('', 2)); - static::assertSame([], (new Validity())->valid('', 0)); + static::assertSame([true, true], new Validity()->valid('', 2)); + static::assertSame([], new Validity()->valid('', 0)); } public function test_counts_nulls_ignoring_padding_bits(): void { - static::assertSame(1, (new Validity())->nullCount("\xFE\x01", 9)); - static::assertSame(0, (new Validity())->nullCount('', 9)); - static::assertSame(7, (new Validity())->nullCount("\x01", 8)); + static::assertSame(1, new Validity()->nullCount("\xFE\x01", 9)); + static::assertSame(0, new Validity()->nullCount('', 9)); + static::assertSame(7, new Validity()->nullCount("\x01", 8)); } public function test_the_nulls_of_the_flags(): void { - static::assertSame([0 => true, 2 => true], (new Validity())->nulls([false, true, false])); + static::assertSame([0 => true, 2 => true], new Validity()->nulls([false, true, false])); } public function test_refuses_a_short_bitmap(): void @@ -115,6 +115,6 @@ public function test_refuses_a_short_bitmap(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Validity bitmap of 1 bytes is too short for 9 rows'); - (new Validity())->valid("\xFF", 9); + new Validity()->valid("\xFF", 9); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/MultisetDigestTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/MultisetDigestTest.php index b17532930a..be77b05ca1 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/MultisetDigestTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/MultisetDigestTest.php @@ -23,7 +23,7 @@ public function test_a_lane_carries_into_its_upper_half_and_wraps(): void { static::assertEquals( new MultisetDigest(0x1FFFFFFFE, PHP_INT_MIN), - (new MultisetDigest(0xFFFFFFFF, PHP_INT_MAX))->plus(new MultisetDigest(0xFFFFFFFF, 1)), + new MultisetDigest(0xFFFFFFFF, PHP_INT_MAX)->plus(new MultisetDigest(0xFFFFFFFF, 1)), ); } @@ -39,11 +39,11 @@ public function test_from_hex_reads_back_both_lanes_at_the_limits(): void { static::assertEquals( new MultisetDigest(PHP_INT_MIN, PHP_INT_MAX), - MultisetDigest::fromHex((new MultisetDigest(PHP_INT_MIN, PHP_INT_MAX))->hex()), + MultisetDigest::fromHex(new MultisetDigest(PHP_INT_MIN, PHP_INT_MAX)->hex()), ); static::assertEquals( new MultisetDigest(PHP_INT_MAX, PHP_INT_MIN), - MultisetDigest::fromHex((new MultisetDigest(PHP_INT_MAX, PHP_INT_MIN))->hex()), + MultisetDigest::fromHex(new MultisetDigest(PHP_INT_MAX, PHP_INT_MIN)->hex()), ); } @@ -82,13 +82,13 @@ public function test_both_lanes_wrap_past_minus_one(): void { static::assertEquals( new MultisetDigest(-2, 0), - (new MultisetDigest(-1, PHP_INT_MIN))->plus(new MultisetDigest(-1, PHP_INT_MIN)), + new MultisetDigest(-1, PHP_INT_MIN)->plus(new MultisetDigest(-1, PHP_INT_MIN)), ); } public function test_hex_is_the_high_lane_then_the_low_lane_in_two_complement(): void { - static::assertSame('800000000000000000000001fffffffe', (new MultisetDigest(0x1FFFFFFFE, PHP_INT_MIN))->hex()); - static::assertSame('0000000000000002ffffffffffffffff', (new MultisetDigest(-1, 2))->hex()); + static::assertSame('800000000000000000000001fffffffe', new MultisetDigest(0x1FFFFFFFE, PHP_INT_MIN)->hex()); + static::assertSame('0000000000000002ffffffffffffffff', new MultisetDigest(-1, 2)->hex()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/CastingColumnBuilderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/CastingColumnBuilderTest.php index c6554cd643..194b0a098c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/CastingColumnBuilderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/CastingColumnBuilderTest.php @@ -26,7 +26,7 @@ final class CastingColumnBuilderTest extends TestCase { public function test_casts_every_value(): void { - $builder = (new PhpBackend())->builder(int_schema('a', nullable: true)); + $builder = new PhpBackend()->builder(int_schema('a', nullable: true)); $builder->append('1'); $builder->appendMany(['2', null]); @@ -36,7 +36,7 @@ public function test_casts_every_value(): void public function test_append_many_is_atomic_on_a_refusal(): void { - $builder = (new PhpBackend())->builder(int_schema('a')); + $builder = new PhpBackend()->builder(int_schema('a')); try { $builder->appendMany(['1', 'x']); @@ -51,7 +51,7 @@ public function test_append_refuses_a_value_it_cannot_cast_as_append_many_does() $this->expectException(ColumnMismatchException::class); $this->expectExceptionMessage("column \"a\": could not convert 'abc' (string) to integer"); - (new PhpBackend()) + new PhpBackend() ->builder(int_schema('a')) ->append('abc'); } @@ -61,14 +61,14 @@ public function test_append_many_refuses_null_under_not_null(): void $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('column "a" (row 1): could not convert null to integer, column is not nullable'); - (new PhpBackend()) + new PhpBackend() ->builder(int_schema('a')) ->appendMany([1, null]); } public function test_the_null_definition_accepts_null(): void { - $builder = (new PhpBackend())->builder(null_schema('a')); + $builder = new PhpBackend()->builder(null_schema('a')); $builder->append(null); $builder->appendMany([null]); @@ -78,7 +78,7 @@ public function test_the_null_definition_accepts_null(): void public function test_append_from_copies_a_physical_cell(): void { $source = ColumnMother::of(int_schema('a', nullable: true), [1, null, 3]); - $builder = (new PhpBackend())->builder(int_schema('a', nullable: true)); + $builder = new PhpBackend()->builder(int_schema('a', nullable: true)); $builder->appendFrom($source, 2); $builder->appendFrom($source, 1); $builder->appendTake($source, [0, 1, 2]); @@ -91,7 +91,7 @@ public function test_append_from_refuses_null_under_not_null(): void $this->expectException(ColumnMismatchException::class); $this->expectExceptionMessage('could not convert null to integer, column is not nullable'); - (new PhpBackend()) + new PhpBackend() ->builder(int_schema('a')) ->appendFrom(ColumnMother::of(int_schema('a', nullable: true), [null]), 0); } @@ -101,7 +101,7 @@ public function test_append_take_refuses_null_under_not_null(): void $this->expectException(ColumnMismatchException::class); $this->expectExceptionMessage('could not convert null to integer, column is not nullable'); - (new PhpBackend()) + new PhpBackend() ->builder(int_schema('a')) ->appendTake(ColumnMother::of(int_schema('a', nullable: true), [1, null]), [0, 1]); } @@ -110,7 +110,7 @@ public function test_append_take_refuses_null_under_not_null(): void #[TestWith([null])] public function test_append_physicals_takes_physicals_with_nulls(?int $nullCount): void { - $builder = (new PhpBackend())->builder(int_schema('id', nullable: true)); + $builder = new PhpBackend()->builder(int_schema('id', nullable: true)); $builder->appendPhysicals([1, null, 3, null], $nullCount); $column = $builder->finish(); @@ -120,7 +120,7 @@ public function test_append_physicals_takes_physicals_with_nulls(?int $nullCount public function test_append_physicals_refuses_null_under_not_null_at_its_position(): void { - $builder = (new PhpBackend())->builder(int_schema('id')); + $builder = new PhpBackend()->builder(int_schema('id')); try { $builder->appendPhysicals([1, 2, null]); @@ -134,7 +134,7 @@ public function test_append_physicals_refuses_null_under_not_null_at_its_positio public function test_append_physicals_of_nothing_appends_nothing(): void { - $builder = (new PhpBackend())->builder(int_schema('id')); + $builder = new PhpBackend()->builder(int_schema('id')); $builder->appendPhysicals([], 0); static::assertSame(0, $builder->finish()->count()); @@ -150,7 +150,7 @@ public function test_append_physicals_refuses_a_physical_of_another_kind_and_app string $definition, mixed $physical, ): void { - $builder = (new PhpBackend())->builder(match ($definition) { + $builder = new PhpBackend()->builder(match ($definition) { 'integer' => int_schema('c'), 'float' => float_schema('c'), 'datetime' => datetime_schema('c'), @@ -171,7 +171,7 @@ public function test_append_physicals_refuses_a_physical_of_another_kind_and_app public function test_append_physicals_names_the_first_refused_physical_after_accepted_ones(): void { - $builder = (new PhpBackend())->builder(int_schema('id', nullable: true)); + $builder = new PhpBackend()->builder(int_schema('id', nullable: true)); try { $builder->appendPhysicals([1, null, 2.5, '3']); @@ -185,7 +185,7 @@ public function test_append_physicals_names_the_first_refused_physical_after_acc public function test_append_physicals_stores_any_physical_of_a_null_column_as_null(): void { - $builder = (new PhpBackend())->builder(null_schema('c')); + $builder = new PhpBackend()->builder(null_schema('c')); $builder->appendPhysicals([null]); static::assertSame([null], $builder->finish()->physicals()); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/ColumnDecoderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/ColumnDecoderTest.php index 8db2ed939a..34d6768703 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/ColumnDecoderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/ColumnDecoderTest.php @@ -31,7 +31,7 @@ public function test_derives_child_null_counts(): void static::assertSame( [[1, null], [null]], - (new ColumnDecoder()) + new ColumnDecoder() ->decode($type, new Buffers(ColumnMother::of(list_schema('a', $type), [ [1, null], [null], @@ -44,7 +44,7 @@ public function test_a_null_kind_consumes_no_buffer(): void { $type = type_structure(['n' => type_optional(type_null()), 'a' => type_integer()]); $buffers = new Buffers(ColumnMother::of(structure_schema('s', $type), [['n' => null, 'a' => 1]])->encode()); - $decoded = (new ColumnDecoder())->decode($type, $buffers, 1, 0); + $decoded = new ColumnDecoder()->decode($type, $buffers, 1, 0); static::assertSame(0, $buffers->remaining()); static::assertSame([['n' => null, 'a' => 1]], $decoded->values()); @@ -52,7 +52,7 @@ public function test_a_null_kind_consumes_no_buffer(): void public function test_a_top_level_null_column(): void { - static::assertInstanceOf(ConstantColumn::class, (new ColumnDecoder())->decode( + static::assertInstanceOf(ConstantColumn::class, new ColumnDecoder()->decode( type_null(), new Buffers([]), 3, @@ -65,7 +65,7 @@ public function test_refuses_a_null_count_other_than_the_bitmap(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Column null count 1 disagrees with its validity bitmap (0 nulls in 1 rows)'); - (new ColumnDecoder())->decode(type_integer(), new Buffers(['', "\0\0\0\0\0\0\0\0"]), 1, 1); + new ColumnDecoder()->decode(type_integer(), new Buffers(['', "\0\0\0\0\0\0\0\0"]), 1, 1); } public function test_refuses_nulls_in_a_non_optional_list_element(): void @@ -73,7 +73,7 @@ public function test_refuses_nulls_in_a_non_optional_list_element(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('List child holds 1 nulls in a non-nullable integer'); - (new ColumnDecoder())->decode( + new ColumnDecoder()->decode( type_list(type_integer()), new Buffers(['', pack('V2', 0, 1), "\x00", "\0\0\0\0\0\0\0\0"]), 1, @@ -86,7 +86,7 @@ public function test_refuses_nulls_in_a_map_key(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Map key child holds 1 nulls in a non-nullable string'); - (new ColumnDecoder())->decode( + new ColumnDecoder()->decode( type_map(type_string(), type_integer()), new Buffers(['', pack('V2', 0, 1), '', "\x00", pack('V2', 0, 0), '', '', "\0\0\0\0\0\0\0\0"]), 1, @@ -99,7 +99,7 @@ public function test_refuses_nulls_in_a_non_optional_map_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Map value child holds 1 nulls in a non-nullable integer'); - (new ColumnDecoder())->decode( + new ColumnDecoder()->decode( type_map(type_string(), type_integer()), new Buffers(['', pack('V2', 0, 1), '', '', pack('V2', 0, 1), 'k', "\x00", "\0\0\0\0\0\0\0\0"]), 1, @@ -114,13 +114,13 @@ public function test_null_kind_children_hold_nulls(): void static::assertSame( [[null, null]], - (new ColumnDecoder()) + new ColumnDecoder() ->decode($list, new Buffers(ColumnMother::of(list_schema('a', $list), [[null, null]])->encode()), 1, 0) ->values(), ); static::assertSame( [['k' => null]], - (new ColumnDecoder()) + new ColumnDecoder() ->decode($map, new Buffers(ColumnMother::of(map_schema('a', $map), [['k' => null]])->encode()), 1, 0) ->values(), ); @@ -135,7 +135,7 @@ public function test_a_structure_child_under_a_null_parent_holds_nulls(): void static::assertSame( [['a' => 1], null], - (new ColumnDecoder()) + new ColumnDecoder() ->decode($column->type(), new Buffers($column->encode()), 2, 1) ->values(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/ConstantColumnTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/ConstantColumnTest.php index 4f67cddd65..2bfeeccbdf 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/ConstantColumnTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/ConstantColumnTest.php @@ -71,7 +71,7 @@ public function test_null(): void public function test_expands_to_the_column_kind(): void { - $expanded = (new ConstantColumn(type_list(type_integer()), new IdentityPhysical(), [1, 2], 2))->expand(); + $expanded = new ConstantColumn(type_list(type_integer()), new IdentityPhysical(), [1, 2], 2)->expand(); static::assertInstanceOf(ListColumn::class, $expanded); static::assertSame([[1, 2], [1, 2]], $expanded->physicals()); @@ -105,7 +105,7 @@ public function test_with_type_restamps_the_value(): void '2024-01-02 04:04:05 Europe/Warsaw', type_instance_of(DateTimeImmutable::class) ->assert( - (new PhpBackend()) + new PhpBackend() ->constant(datetime_schema('a'), new DateTimeImmutable('2024-01-02 03:04:05 UTC'), 2) ->withType(type_datetime('Europe/Warsaw')) ->value(1), @@ -119,7 +119,7 @@ public function test_with_type_refuses_another_column_kind(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('integer and string are different column kinds'); - (new PhpBackend()) + new PhpBackend() ->constant(int_schema('a'), 1, 2) ->withType(type_string()); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/ListColumnTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/ListColumnTest.php index dc58ea99e4..d1fa4f2d55 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/ListColumnTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/ListColumnTest.php @@ -51,7 +51,7 @@ public function test_reads_cells_over_a_constant_element(): void $column = new ListColumn( type_list(type_time_zone()), [0, 2, 2, 3], - (new PhpBackend())->constant(definition_from_type('element', type_time_zone()), 'UTC', 3), + new PhpBackend()->constant(definition_from_type('element', type_time_zone()), 'UTC', 3), [1 => true], ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/PhpGroupedCountsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/PhpGroupedCountsTest.php index 796d60a252..6d5e631530 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/PhpGroupedCountsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/PhpGroupedCountsTest.php @@ -59,6 +59,6 @@ public function test_absorbing_an_earlier_group_it_never_counted_fails(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Earlier group 3 has no count'); - (new PhpGroupedCounts())->absorbEarlier(new PhpGroupedCounts(), [3 => 0]); + new PhpGroupedCounts()->absorbEarlier(new PhpGroupedCounts(), [3 => 0]); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/PhpGroupedMultisetHashesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/PhpGroupedMultisetHashesTest.php index 5d6f7c945a..1aea8cde19 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/PhpGroupedMultisetHashesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/PhpGroupedMultisetHashesTest.php @@ -141,7 +141,7 @@ public function test_one_row_in_one_group_equals_its_row_hash(): void static::assertSame(['8e18789eac90baf2a1f6bc7cceafa11a'], $hashes->hashes()->physicals()); static::assertSame( - (new PhpBackend()) + new PhpBackend() ->rowHashes($rows->columns(), 1) ->physicals(), $hashes->hashes()->physicals(), @@ -185,7 +185,7 @@ public function test_an_earlier_group_it_lacks_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Earlier group 3 has no hash'); - (new PhpGroupedMultisetHashes(HashAlgorithm::xxh128))->absorbEarlier( + new PhpGroupedMultisetHashes(HashAlgorithm::xxh128)->absorbEarlier( new PhpGroupedMultisetHashes(HashAlgorithm::xxh128), [3 => 0], ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/PhpGroupedTotalsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/PhpGroupedTotalsTest.php index d5a9dfd304..36c9041f7c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/PhpGroupedTotalsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Php/PhpGroupedTotalsTest.php @@ -93,7 +93,7 @@ public function test_totals_by_group_equal_a_numeric_total_per_group(Definition public function test_a_group_id_without_rows_has_no_count_and_no_sum(): void { - $grouped = (new GroupedTotalsContext(new PhpBackend(), int_schema('v')))->grouped([[[7], [2]]]); + $grouped = new GroupedTotalsContext(new PhpBackend(), int_schema('v'))->grouped([[[7], [2]]]); static::assertSame([0, 0, 1], array_column($grouped->partials(), 'count')); static::assertSame([null, null, 7.0], $grouped->sums()->values()); @@ -103,7 +103,7 @@ public function test_groups_without_rows_count_as_null_sums(): void { static::assertSame( 2, - (new GroupedTotalsContext(new PhpBackend(), int_schema('v'))) + new GroupedTotalsContext(new PhpBackend(), int_schema('v')) ->grouped([[[7], [2]]]) ->sums() ->nullCount(), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/PhpBackendTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/PhpBackendTest.php index 8198ba2572..717138b193 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/PhpBackendTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/PhpBackendTest.php @@ -49,7 +49,6 @@ use Flow\Types\Value\Uuid; use Generator; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\Attributes\TestWith; use PHPUnit\Framework\TestCase; use stdClass; @@ -330,7 +329,7 @@ public function test_refuses_null_under_a_not_null_definition(Definition $defini $this->expectException(ColumnMismatchException::class); $this->expectExceptionMessage('could not convert null to'); - (new PhpBackend()) + new PhpBackend() ->builder($definition) ->append(null); } @@ -349,13 +348,12 @@ public function test_hash_gives_the_full_hex_digest_and_keeps_nulls( ): void { static::assertSame( [$test, null, $empty], - (new PhpBackend()) + new PhpBackend() ->hash(ColumnMother::of(str_schema('value', nullable: true), ['test', null, '']), $algorithm) ->physicals(), ); } - #[RequiresPhp('>= 8.4.0')] public function test_html_round_trips(): void { $document = type_instance_of(HTMLDocument::class)->assert(ColumnMother::of( @@ -368,13 +366,11 @@ public function test_html_round_trips(): void static::assertStringContainsString( '

a

', - type_string()->assert((new HtmlDocumentPhysical())->toPhysical($document)), + type_string()->assert(new HtmlDocumentPhysical()->toPhysical($document)), ); static::assertSame( '

a

', - (new HtmlElementPhysical())->markup(type_string()->assert((new HtmlElementPhysical())->toPhysical( - $element, - ))), + new HtmlElementPhysical()->markup(type_string()->assert(new HtmlElementPhysical()->toPhysical($element))), ); } @@ -396,7 +392,7 @@ public function test_refuses(Definition $definition, string $message): void $this->expectException(ColumnMismatchException::class); $this->expectExceptionMessage($message); - (new PhpBackend())->builder($definition); + new PhpBackend()->builder($definition); } public function test_time_refuses_months(): void @@ -404,7 +400,7 @@ public function test_time_refuses_months(): void $this->expectException(ColumnMismatchException::class); $this->expectExceptionMessage("Relative DateInterval (with months/years) can't be stored in a time column"); - (new PhpBackend()) + new PhpBackend() ->builder(time_schema('a')) ->append('P1M'); } @@ -461,7 +457,7 @@ public function test_time_reads_back_with_days_folded_and_no_days_count(): void public function test_constant_holds_one_value(): void { - $column = (new PhpBackend())->constant(int_schema('a'), '7', 3); + $column = new PhpBackend()->constant(int_schema('a'), '7', 3); static::assertSame(3, $column->count()); static::assertSame(0, $column->nullCount()); @@ -472,7 +468,7 @@ public function test_constant_holds_one_value(): void public function test_constant_null(): void { - $column = (new PhpBackend())->constant(int_schema('a', nullable: true), null, 2); + $column = new PhpBackend()->constant(int_schema('a', nullable: true), null, 2); static::assertSame(2, $column->nullCount()); static::assertSame([null, null], $column->values()); @@ -484,14 +480,14 @@ public function test_constant_refuses_null_under_a_not_null_definition(): void $this->expectException(ColumnMismatchException::class); $this->expectExceptionMessage('column "a": could not convert null to integer, column is not nullable'); - (new PhpBackend())->constant(int_schema('a'), null, 2); + new PhpBackend()->constant(int_schema('a'), null, 2); } public function test_constant_null_under_the_null_definition(): void { static::assertSame( 2, - (new PhpBackend()) + new PhpBackend() ->constant(null_schema('a'), null, 2) ->nullCount(), ); @@ -530,7 +526,7 @@ public function test_decode_round_trips_a_null_column(): void { static::assertSame( [null, null], - (new PhpBackend()) + new PhpBackend() ->decode(null_schema('a'), ColumnMother::of(null_schema('a'), [null, null])->encode(), 2, 2) ->values(), ); @@ -622,14 +618,14 @@ public function test_decode_refuses( $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage($message); - (new PhpBackend())->decode($definition, $buffers, $count, $nullCount); + new PhpBackend()->decode($definition, $buffers, $count, $nullCount); } public function test_adopt_returns_its_own_column(): void { $column = ColumnMother::of(int_schema('a'), [1, 2]); - static::assertSame($column, (new PhpBackend())->adopt(int_schema('a'), $column)); + static::assertSame($column, new PhpBackend()->adopt(int_schema('a'), $column)); } /** @@ -637,7 +633,7 @@ public function test_adopt_returns_its_own_column(): void */ public static function own_nested_and_constant_columns(): Generator { - yield 'constant' => [int_schema('v'), (new PhpBackend())->constant(int_schema('v'), 1, 2)]; + yield 'constant' => [int_schema('v'), new PhpBackend()->constant(int_schema('v'), 1, 2)]; yield 'list' => [ list_schema('v', type_list(type_integer())), array_to_rows( @@ -674,14 +670,14 @@ public static function own_nested_and_constant_columns(): Generator #[DataProvider('own_nested_and_constant_columns')] public function test_adopt_returns_its_own_nested_or_constant_column(Definition $definition, Column $column): void { - static::assertSame($column, (new PhpBackend())->adopt($definition, $column)); + static::assertSame($column, new PhpBackend()->adopt($definition, $column)); } public function test_adopt_copies_a_foreign_column(): void { $foreign = new ForeignColumnStub(ColumnMother::of(str_schema('a', nullable: true), ['x', null, 'z'])); - $adopted = (new PhpBackend())->adopt(str_schema('a', nullable: true), $foreign); + $adopted = new PhpBackend()->adopt(str_schema('a', nullable: true), $foreign); static::assertNotSame($foreign, $adopted); static::assertSame(['x', null, 'z'], $adopted->values()); @@ -692,7 +688,7 @@ public function test_adopt_copies_an_empty_foreign_column(): void { $foreign = new ForeignColumnStub(ColumnMother::of(int_schema('a'), [])); - $adopted = (new PhpBackend())->adopt(int_schema('a'), $foreign); + $adopted = new PhpBackend()->adopt(int_schema('a'), $foreign); static::assertNotSame($foreign, $adopted); static::assertSame(0, $adopted->count()); @@ -705,7 +701,7 @@ public function test_adopt_refuses_a_null_under_not_null(): void $this->expectException(ColumnMismatchException::class); $this->expectExceptionMessage(ColumnMismatchException::valueDoesNotMatch('a', 'integer', null)->getMessage()); - (new PhpBackend())->adopt(int_schema('a'), $foreign); + new PhpBackend()->adopt(int_schema('a'), $foreign); } public function test_adopt_refuses_an_untyped_column(): void @@ -715,17 +711,17 @@ public function test_adopt_refuses_an_untyped_column(): void 'column "a": mixed cannot be a batch column, an untyped function result exists only inside function evaluation', ); - (new PhpBackend())->adopt(int_schema('a'), new ValueColumn([1, 2])); + new PhpBackend()->adopt(int_schema('a'), new ValueColumn([1, 2])); } public function test_allocated_bytes_is_zero(): void { - static::assertSame(0, (new PhpBackend())->allocatedBytes()); + static::assertSame(0, new PhpBackend()->allocatedBytes()); } public function test_allocated_peak_bytes_is_zero(): void { - static::assertSame(0, (new PhpBackend())->allocatedPeakBytes()); + static::assertSame(0, new PhpBackend()->allocatedPeakBytes()); } public function test_modulo_and_row_hashes_have_no_nulls(): void @@ -743,7 +739,7 @@ public function test_add_of_an_integer_and_a_float_is_no_overflow(): void { static::assertSame( [2.5], - (new PhpBackend())->add( + new PhpBackend()->add( ColumnMother::of(int_schema('a'), [1]), ColumnMother::of(float_schema('b'), [1.5]), )->values(), @@ -752,7 +748,7 @@ public function test_add_of_an_integer_and_a_float_is_no_overflow(): void public function test_sort_working_bytes_add_up_every_column(): void { - static::assertSame(88, (new PhpBackend())->sortWorkingBytes( + static::assertSame(88, new PhpBackend()->sortWorkingBytes( array_to_rows([['a' => 1, 'b' => null]], schema(int_schema('a'), int_schema('b', true))), [], )); @@ -943,16 +939,13 @@ public function test_gathered_and_ordered_bytes_follow_the_per_slot_estimate( ): void { $column = array_to_rows($data, $schema, new PhpBackend())->column('v'); - static::assertSame($gathered, (new PhpBackend())->gatheredBytes($column)); - static::assertSame($ordered, (new PhpBackend())->orderedBytes($column)); + static::assertSame($gathered, new PhpBackend()->gatheredBytes($column)); + static::assertSame($ordered, new PhpBackend()->orderedBytes($column)); } public function test_gathered_bytes_of_a_constant_column_are_none(): void { - static::assertSame( - 0, - (new PhpBackend())->gatheredBytes((new PhpBackend())->constant(int_schema('id'), 1, 4097)), - ); + static::assertSame(0, new PhpBackend()->gatheredBytes(new PhpBackend()->constant(int_schema('id'), 1, 4097))); } /** @@ -1021,11 +1014,7 @@ public static function frame_round_trips(): Generator #[DataProvider('frame_round_trips')] public function test_decode_frame_round_trips(Rows $rows, Codec $codec): void { - $decoded = (new PhpBackend())->decodeFrame( - (new PhpBackend())->encodeFrame($rows, $codec), - $rows->schema(), - $codec, - ); + $decoded = new PhpBackend()->decodeFrame(new PhpBackend()->encodeFrame($rows, $codec), $rows->schema(), $codec); static::assertSame($rows->count(), $decoded->count()); static::assertEquals($rows->toArray(), $decoded->toArray()); @@ -1037,8 +1026,8 @@ public function test_decode_frame_of_a_numeric_column_name_round_trips(): void static::assertSame( $rows->toArray(), - (new PhpBackend()) - ->decodeFrame((new PhpBackend())->encodeFrame($rows, new NoopCodec()), $rows->schema(), new NoopCodec()) + new PhpBackend() + ->decodeFrame(new PhpBackend()->encodeFrame($rows, new NoopCodec()), $rows->schema(), new NoopCodec()) ->toArray(), ); } @@ -1052,8 +1041,8 @@ public function test_decode_frame_accepts_a_null_struct_child_under_a_null_paren static::assertSame( $rows->toArray(), - (new PhpBackend()) - ->decodeFrame((new PhpBackend())->encodeFrame($rows, new NoopCodec()), $rows->schema(), new NoopCodec()) + new PhpBackend() + ->decodeFrame(new PhpBackend()->encodeFrame($rows, new NoopCodec()), $rows->schema(), new NoopCodec()) ->toArray(), ); } @@ -1063,7 +1052,7 @@ public function test_decode_frame_accepts_a_null_struct_child_under_a_null_paren */ public static function frame_refusals(): Generator { - $body = (new PhpBackend())->encodeFrame(RowsMother::workedExample(), new NoopCodec()); + $body = new PhpBackend()->encodeFrame(RowsMother::workedExample(), new NoopCodec()); yield 'a body shorter than the directory counts' => [ substr($body, 0, 11), @@ -1109,17 +1098,17 @@ public function test_decode_frame_refuses(string $body, string $message): void $this->expectException(FloeException::class); $this->expectExceptionMessage($message); - (new PhpBackend())->decodeFrame($body, RowsMother::workedExample()->schema(), new NoopCodec()); + new PhpBackend()->decodeFrame($body, RowsMother::workedExample()->schema(), new NoopCodec()); } public function test_decode_frame_refuses_a_buffer_that_decodes_to_another_length_than_its_prefix(): void { - $body = (new PhpBackend())->encodeFrame(RowsMother::workedExample(), new TrailingZerosCodecStub()); + $body = new PhpBackend()->encodeFrame(RowsMother::workedExample(), new TrailingZerosCodecStub()); $this->expectException(FloeException::class); $this->expectExceptionMessage('Floe BATCH frame buffer 1 decodes to 16 bytes, its prefix declares 15'); - (new PhpBackend())->decodeFrame( + new PhpBackend()->decodeFrame( substr_replace($body, pack('P', 15), 72, 8), RowsMother::workedExample()->schema(), new TrailingZerosCodecStub(), @@ -1136,19 +1125,19 @@ public function test_decode_frame_refuses_child_nodes_that_disagree_with_the_buf $this->expectException(FloeException::class); $this->expectExceptionMessage('Floe BATCH frame column "l" declares nodes that disagree with its buffers'); - (new PhpBackend())->decodeFrame(FrameContext::patch((new PhpBackend())->encodeFrame($rows, new NoopCodec()), [ + new PhpBackend()->decodeFrame(FrameContext::patch(new PhpBackend()->encodeFrame($rows, new NoopCodec()), [ 5 => 3, ]), $rows->schema(), new NoopCodec()); } public function test_decode_frame_refuses_a_column_refusal_as_malformed(): void { - $body = FrameContext::patch((new PhpBackend())->encodeFrame(RowsMother::workedExample(), new NoopCodec()), [ + $body = FrameContext::patch(new PhpBackend()->encodeFrame(RowsMother::workedExample(), new NoopCodec()), [ 10 => 10, ]); try { - (new PhpBackend())->decodeFrame($body, RowsMother::workedExample()->schema(), new NoopCodec()); + new PhpBackend()->decodeFrame($body, RowsMother::workedExample()->schema(), new NoopCodec()); static::fail('A cut values buffer must be refused'); } catch (FloeException $e) { static::assertSame( @@ -1161,7 +1150,7 @@ public function test_decode_frame_refuses_a_column_refusal_as_malformed(): void public function test_decode_frame_refuses_a_not_null_column_with_a_null_node(): void { - $body = (new PhpBackend())->encodeFrame(array_to_rows([ + $body = new PhpBackend()->encodeFrame(array_to_rows([ ['id' => 1], ['id' => null], ], schema(int_schema('id', nullable: true))), new NoopCodec()); @@ -1171,22 +1160,18 @@ public function test_decode_frame_refuses_a_not_null_column_with_a_null_node(): 'Floe BATCH frame is malformed: Rows do not match their schema: column "id" (row 1): could not convert null to integer, column is not nullable', ); - (new PhpBackend())->decodeFrame($body, schema(int_schema('id')), new NoopCodec()); + new PhpBackend()->decodeFrame($body, schema(int_schema('id')), new NoopCodec()); } public function test_decode_frame_refuses_a_null_in_a_non_optional_list_element(): void { - $body = (new PhpBackend())->encodeFrame(array_to_rows([['l' => [ + $body = new PhpBackend()->encodeFrame(array_to_rows([['l' => [ 1, null, ]]], schema(list_schema('l', type_list(type_optional(type_integer()))))), new NoopCodec()); try { - (new PhpBackend())->decodeFrame( - $body, - schema(list_schema('l', type_list(type_integer()))), - new NoopCodec(), - ); + new PhpBackend()->decodeFrame($body, schema(list_schema('l', type_list(type_integer()))), new NoopCodec()); static::fail('A null list element must be refused'); } catch (FloeException $e) { static::assertSame( @@ -1202,8 +1187,8 @@ public function test_decode_frame_refuses_a_null_map_key(): void $rows = array_to_rows([['m' => [ 1 => null, ]]], schema(map_schema('m', type_map(type_integer(), type_optional(type_integer()))))); - $words = FrameContext::directory((new PhpBackend())->encodeFrame($rows, new NoopCodec())); - $body = FrameContext::patch((new PhpBackend())->encodeFrame($rows, new NoopCodec()), [ + $words = FrameContext::directory(new PhpBackend()->encodeFrame($rows, new NoopCodec())); + $body = FrameContext::patch(new PhpBackend()->encodeFrame($rows, new NoopCodec()), [ 8 => 1, 10 => 0, 17 => $words[21], @@ -1213,7 +1198,7 @@ public function test_decode_frame_refuses_a_null_map_key(): void ]); try { - (new PhpBackend())->decodeFrame($body, $rows->schema(), new NoopCodec()); + new PhpBackend()->decodeFrame($body, $rows->schema(), new NoopCodec()); static::fail('A null map key must be refused'); } catch (FloeException $e) { static::assertSame( @@ -1228,7 +1213,7 @@ public function test_encode_frame_of_the_worked_example(): void { static::assertSame( '020000000200000005000000020000000000000002000000010000000000000000000000000000001800000018000000090000002800000014000000400000000a00000000000000ffffffffffffffff01000000000000000200000000000000ffffffffffffffff0100000000000000ffffffffffffffff00000000020000000200000000000000ffffffffffffffff6162000000000000', - bin2hex((new PhpBackend())->encodeFrame(RowsMother::workedExample(), new NoopCodec())), + bin2hex(new PhpBackend()->encodeFrame(RowsMother::workedExample(), new NoopCodec())), ); } @@ -1236,15 +1221,15 @@ public function test_encode_frame_wraps_each_buffer_behind_its_length_with_a_cod { static::assertSame( '020000000200000005000000020000000000000002000000010000000000000000000000000000001200000018000000090000002800000012000000400000000a00000000000000100000000000000001000000000000000207000000000000ffffffffffffffff01000000000000000c0000000000000000000000020000000203000000000000ffffffffffffffff6162000000000000', - bin2hex((new PhpBackend())->encodeFrame(RowsMother::workedExample(), new TrailingZerosCodecStub())), + bin2hex(new PhpBackend()->encodeFrame(RowsMother::workedExample(), new TrailingZerosCodecStub())), ); } public function test_encode_frame_stores_raw_when_the_codec_output_is_not_smaller(): void { static::assertSame( - (new PhpBackend())->encodeFrame(RowsMother::workedExample(), new NoopCodec()), - (new PhpBackend())->encodeFrame(RowsMother::workedExample(), new PrefixingCodecStub()), + new PhpBackend()->encodeFrame(RowsMother::workedExample(), new NoopCodec()), + new PhpBackend()->encodeFrame(RowsMother::workedExample(), new PrefixingCodecStub()), ); } @@ -1252,7 +1237,7 @@ public function test_encode_frame_of_a_list_with_a_null_slot(): void { static::assertSame( [2, 2, 4, 2, 1, 2, 0, 0, 9, 16, 20, 0, 0, 40, 24], - FrameContext::directory((new PhpBackend())->encodeFrame(array_to_rows([ + FrameContext::directory(new PhpBackend()->encodeFrame(array_to_rows([ ['l' => [1, 2]], ['l' => null], ], schema(list_schema('l', type_list(type_integer()), nullable: true))), new NoopCodec())), @@ -1263,7 +1248,7 @@ public function test_encode_frame_of_a_map_entries_node_and_extent(): void { static::assertSame( [2, 4, 8, 2, 0, 3, 0, 3, 0, 3, 0, 0, 0, 0, 20, 0, 0, 0, 0, 24, 24, 48, 11, 0, 0, 64, 32], - FrameContext::directory((new PhpBackend())->encodeFrame(array_to_rows([ + FrameContext::directory(new PhpBackend()->encodeFrame(array_to_rows([ ['m' => ['a' => 1]], ['m' => ['b' => 2, 'c' => 3]], ], schema(map_schema('m', type_map(type_string(), type_integer())))), new NoopCodec())), @@ -1274,7 +1259,7 @@ public function test_encode_frame_of_a_structure_with_a_null_parent(): void { static::assertSame( [2, 2, 3, 2, 1, 2, 1, 0, 9, 16, 9, 32, 24], - FrameContext::directory((new PhpBackend())->encodeFrame(array_to_rows([ + FrameContext::directory(new PhpBackend()->encodeFrame(array_to_rows([ ['s' => ['a' => 1]], ['s' => null], ], schema(structure_schema('s', type_structure(['a' => type_integer()]), nullable: true))), new NoopCodec())), @@ -1285,7 +1270,7 @@ public function test_encode_frame_of_a_null_column_has_a_full_null_node_and_no_e { static::assertSame( '020000000100000000000000020000000200000000000000', - bin2hex((new PhpBackend())->encodeFrame(array_to_rows([ + bin2hex(new PhpBackend()->encodeFrame(array_to_rows([ ['n' => null], ['n' => null], ], schema(null_schema('n'))), new NoopCodec())), @@ -1296,13 +1281,13 @@ public function test_encode_frame_of_a_batch_without_columns_keeps_its_row_count { static::assertSame( '03000000000000000000000000000000', - bin2hex((new PhpBackend())->encodeFrame(array_to_rows([[], [], []], schema()), new NoopCodec())), + bin2hex(new PhpBackend()->encodeFrame(array_to_rows([[], [], []], schema()), new NoopCodec())), ); } public function test_is_null_of_a_column_without_nulls_is_a_constant_column(): void { - $column = (new PhpBackend())->isNull(ColumnMother::of(int_schema('a', nullable: true), [1, 2])); + $column = new PhpBackend()->isNull(ColumnMother::of(int_schema('a', nullable: true), [1, 2])); static::assertInstanceOf(ConstantColumn::class, $column); static::assertSame([false, false], $column->values()); @@ -1310,7 +1295,7 @@ public function test_is_null_of_a_column_without_nulls_is_a_constant_column(): v public function test_is_not_null_of_a_column_without_nulls_is_a_constant_column(): void { - $column = (new PhpBackend())->isNotNull(ColumnMother::of(int_schema('a', nullable: true), [1, 2])); + $column = new PhpBackend()->isNotNull(ColumnMother::of(int_schema('a', nullable: true), [1, 2])); static::assertInstanceOf(ConstantColumn::class, $column); static::assertSame([true, true], $column->values()); @@ -1318,7 +1303,7 @@ public function test_is_not_null_of_a_column_without_nulls_is_a_constant_column( public function test_is_null_answers_per_row_and_never_null(): void { - $column = (new PhpBackend())->isNull(ColumnMother::of(int_schema('a', nullable: true), [1, null])); + $column = new PhpBackend()->isNull(ColumnMother::of(int_schema('a', nullable: true), [1, null])); static::assertSame([false, true], $column->values()); static::assertSame(0, $column->nullCount()); @@ -1326,7 +1311,7 @@ public function test_is_null_answers_per_row_and_never_null(): void public function test_is_not_null_answers_per_row_and_never_null(): void { - $column = (new PhpBackend())->isNotNull(ColumnMother::of(int_schema('a', nullable: true), [1, null])); + $column = new PhpBackend()->isNotNull(ColumnMother::of(int_schema('a', nullable: true), [1, null])); static::assertSame([true, false], $column->values()); static::assertSame(0, $column->nullCount()); @@ -1334,7 +1319,7 @@ public function test_is_not_null_answers_per_row_and_never_null(): void public function test_compare_negates_equality_and_keeps_null_unknown(): void { - $column = (new PhpBackend())->compare( + $column = new PhpBackend()->compare( ColumnMother::of(int_schema('a', nullable: true), [1, null, 3]), Operator::NOT_EQUAL, ColumnMother::of(int_schema('b'), [1, 2, 4]), @@ -1350,7 +1335,7 @@ public function test_compare_orders_greater_than_as_the_swapped_less_than(): voi { static::assertSame( [false, true, false], - (new PhpBackend()) + new PhpBackend() ->compare( ColumnMother::of(int_schema('a'), [1, 2, 3]), Operator::GREATER_THAN, @@ -1367,7 +1352,7 @@ public function test_compare_refuses_the_different_operator(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Comparison was built with an unsupported operator'); - (new PhpBackend())->compare( + new PhpBackend()->compare( ColumnMother::of(int_schema('a'), [1]), Operator::DIFFERENT, ColumnMother::of(int_schema('b'), [1]), @@ -1381,7 +1366,7 @@ public function test_compare_refuses_an_operator_a_comparison_does_not_support() $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Comparison was built with an unsupported operator'); - (new PhpBackend())->compare( + new PhpBackend()->compare( ColumnMother::of(int_schema('a'), [1]), Operator::SPACE_SHIP, ColumnMother::of(int_schema('b'), [1]), @@ -1392,7 +1377,7 @@ public function test_compare_refuses_an_operator_a_comparison_does_not_support() public function test_add_of_two_integer_columns_is_an_integer_column(): void { - $column = (new PhpBackend())->add( + $column = new PhpBackend()->add( ColumnMother::of(int_schema('a'), [1, -2]), ColumnMother::of(int_schema('b'), [2, 2]), ); @@ -1403,7 +1388,7 @@ public function test_add_of_two_integer_columns_is_an_integer_column(): void public function test_subtract_with_a_float_side_is_a_float_column(): void { - $column = (new PhpBackend())->subtract( + $column = new PhpBackend()->subtract( ColumnMother::of(int_schema('a'), [1, 3]), ColumnMother::of(float_schema('b'), [0.5, 3.0]), ); @@ -1417,7 +1402,7 @@ public function test_multiply_refuses_an_integer_overflow_at_its_row(): void $this->expectException(EvaluationException::class); $this->expectExceptionMessage('Multiply function integer overflow (row 1)'); - (new PhpBackend())->multiply( + new PhpBackend()->multiply( ColumnMother::of(int_schema('a'), [2, PHP_INT_MAX]), ColumnMother::of(int_schema('b'), [2, 2]), ); @@ -1427,7 +1412,7 @@ public function test_modulo_folds_a_negative_remainder_under_a_positive_modulus( { static::assertSame( [2, 1], - (new PhpBackend()) + new PhpBackend() ->modulo(ColumnMother::of(int_schema('a'), [-7, 7]), ColumnMother::of(int_schema('b'), [3, 3])) ->values(), ); @@ -1439,17 +1424,17 @@ public function test_modulo_folds_a_negative_remainder_under_a_positive_modulus( public static function text_matches(): Generator { yield 'starts with' => [ - (new PhpBackend())->startsWith(...), + new PhpBackend()->startsWith(...), ['ab', 'a', null, '', 'xx', 'żó', 'bc'], [true, null, null, true, false, true, false], ]; yield 'ends with' => [ - (new PhpBackend())->endsWith(...), + new PhpBackend()->endsWith(...), ['bc', 'a', null, '', 'xx', 'łw', 'ab'], [true, null, null, true, false, true, false], ]; yield 'contains' => [ - (new PhpBackend())->contains(...), + new PhpBackend()->contains(...), ['b', 'a', null, '', 'xx', 'ół', 'ca'], [true, null, null, true, false, true, false], ]; @@ -1488,9 +1473,9 @@ public function test_a_text_match_is_null_where_either_side_is_null( */ public static function constant_needle_matches(): Generator { - yield 'starts with' => [(new PhpBackend())->startsWith(...), [true, false, null]]; - yield 'ends with' => [(new PhpBackend())->endsWith(...), [false, true, null]]; - yield 'contains' => [(new PhpBackend())->contains(...), [true, true, null]]; + yield 'starts with' => [new PhpBackend()->startsWith(...), [true, false, null]]; + yield 'ends with' => [new PhpBackend()->endsWith(...), [false, true, null]]; + yield 'contains' => [new PhpBackend()->contains(...), [true, true, null]]; } /** @@ -1504,7 +1489,7 @@ public function test_a_text_match_takes_a_constant_needle(Closure $match, array $expected, $match( ColumnMother::of(str_schema('h', nullable: true), ['abc', 'cab', null]), - (new PhpBackend())->constant(str_schema('n'), 'ab', 3), + new PhpBackend()->constant(str_schema('n'), 'ab', 3), )->values(), ); } @@ -1514,9 +1499,9 @@ public function test_a_text_match_takes_a_constant_needle(Closure $match, array */ public static function text_match_kernels(): Generator { - yield 'starts with' => [(new PhpBackend())->startsWith(...)]; - yield 'ends with' => [(new PhpBackend())->endsWith(...)]; - yield 'contains' => [(new PhpBackend())->contains(...)]; + yield 'starts with' => [new PhpBackend()->startsWith(...)]; + yield 'ends with' => [new PhpBackend()->endsWith(...)]; + yield 'contains' => [new PhpBackend()->contains(...)]; } /** @@ -1534,7 +1519,7 @@ public function test_sort_keeps_rows_with_equal_keys_in_input_order(): void { static::assertSame( ['b', 'd', 'a', 'c'], - (new PhpBackend()) + new PhpBackend() ->sort( array_to_rows( [ @@ -1556,7 +1541,7 @@ public function test_sort_puts_nulls_where_the_column_asks(): void { static::assertSame( [3, 1, null], - (new PhpBackend()) + new PhpBackend() ->sort( array_to_rows( [['k' => 1], ['k' => null], ['k' => 3]], @@ -1652,7 +1637,7 @@ public function test_partition_puts_each_row_in_the_bucket_of_its_key_in_row_ord static::assertSame($expected, array_map( static fn(Rows $part): array => $part->reduceToArray('v'), - (new PhpBackend())->partition( + new PhpBackend()->partition( $rows, array_map(static fn(string $name) => $rows->column($name), $keyColumns), $buckets, @@ -1665,21 +1650,21 @@ public function test_partition_into_one_bucket_is_the_batch_itself(): void { $rows = array_to_rows([['k' => 1], ['k' => 2]], schema(int_schema('k')), new PhpBackend()); - static::assertSame([0 => $rows], (new PhpBackend())->partition($rows, [$rows->column('k')], 1, 0)); + static::assertSame([0 => $rows], new PhpBackend()->partition($rows, [$rows->column('k')], 1, 0)); } public function test_partition_of_an_empty_batch_has_no_bucket(): void { $rows = Rows::empty(schema(int_schema('k')), new PhpBackend()); - static::assertSame([], (new PhpBackend())->partition($rows, [$rows->column('k')], 4, 0)); + static::assertSame([], new PhpBackend()->partition($rows, [$rows->column('k')], 4, 0)); } public function test_partition_of_an_empty_batch_into_one_bucket_has_no_bucket(): void { $rows = Rows::empty(schema(int_schema('k')), new PhpBackend()); - static::assertSame([], (new PhpBackend())->partition($rows, [$rows->column('k')], 1, 0)); + static::assertSame([], new PhpBackend()->partition($rows, [$rows->column('k')], 1, 0)); } public function test_partition_refuses_a_bucket_count_below_one_even_for_an_empty_batch(): void @@ -1690,7 +1675,7 @@ public function test_partition_refuses_a_bucket_count_below_one_even_for_an_empt $this->expectExceptionMessage('Buckets count must be greater than 0, given: 0'); // @mago-ignore analysis:invalid-argument - (new PhpBackend())->partition($rows, [$rows->column('k')], 0, 0); + new PhpBackend()->partition($rows, [$rows->column('k')], 0, 0); } public function test_partition_refuses_a_hash_offset_outside_zero_to_twenty_four_even_for_an_empty_batch(): void @@ -1701,7 +1686,7 @@ public function test_partition_refuses_a_hash_offset_outside_zero_to_twenty_four $this->expectExceptionMessage('Hash offset must be between 0 and 24, given: 25'); // @mago-ignore analysis:invalid-argument - (new PhpBackend())->partition($rows, [$rows->column('k')], 4, 25); + new PhpBackend()->partition($rows, [$rows->column('k')], 4, 25); } public function test_row_hashes_are_the_xxh128_of_the_row_form(): void @@ -1713,13 +1698,13 @@ public function test_row_hashes_are_the_xxh128_of_the_row_form(): void static::assertSame( ['8e18789eac90baf2a1f6bc7cceafa11a', 'e406cdb168be00960a58088d91a960c5'], - (new PhpBackend()) + new PhpBackend() ->rowHashes($rows->columns(), 2) ->physicals(), ); static::assertSame( ['99aa06d3014798d86001c324468d497f'], - (new PhpBackend()) + new PhpBackend() ->rowHashes([], 1) ->physicals(), ); @@ -1730,10 +1715,10 @@ public function test_row_hashes_ignore_the_column_order(): void $rows = array_to_rows([['a' => 1, 'b' => 'x']], schema(int_schema('a'), str_schema('b'))); static::assertSame( - (new PhpBackend()) + new PhpBackend() ->rowHashes(['a' => $rows->column('a'), 'b' => $rows->column('b')], 1) ->physicals(), - (new PhpBackend()) + new PhpBackend() ->rowHashes(['b' => $rows->column('b'), 'a' => $rows->column('a')], 1) ->physicals(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/DatePhysicalTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/DatePhysicalTest.php index 6af7c565d3..31dddb4556 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/DatePhysicalTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/DatePhysicalTest.php @@ -18,11 +18,11 @@ public function test_the_calendar_day_in_the_value_zone(): void { static::assertSame( 19_787, - (new DatePhysical())->toPhysical( + new DatePhysical()->toPhysical( new DateTimeImmutable('2024-03-05 00:30:00', new DateTimeZone('Asia/Tokyo')), ), ); - static::assertSame(-1, (new DatePhysical())->toPhysical(new DateTimeImmutable('1969-12-31 23:59:59 UTC'))); + static::assertSame(-1, new DatePhysical()->toPhysical(new DateTimeImmutable('1969-12-31 23:59:59 UTC'))); } public function test_reads_back_midnight_utc(): void @@ -41,6 +41,6 @@ public function test_refuses_a_day_outside_the_i32_range(): void $this->expectException(CastingException::class); $this->expectExceptionMessage('outside the day range of a date column'); - (new DatePhysical())->toPhysical(new DateTimeImmutable('@' . ((2 ** 31) * 86_400))); + new DatePhysical()->toPhysical(new DateTimeImmutable('@' . ((2 ** 31) * 86_400))); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/DateTimePhysicalTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/DateTimePhysicalTest.php index 8b5675e537..734a1cfc13 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/DateTimePhysicalTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/DateTimePhysicalTest.php @@ -34,7 +34,7 @@ public function test_reads_every_physical_after_a_null(): void { static::assertEquals( [null, new DateTimeImmutable('@0')], - (new DateTimePhysical(new DateTimeZone('UTC')))->fromPhysicalAll([null, 0]), + new DateTimePhysical(new DateTimeZone('UTC'))->fromPhysicalAll([null, 0]), ); } @@ -53,6 +53,6 @@ public function test_refuses_a_value_outside_the_microsecond_range(): void $this->expectException(CastingException::class); $this->expectExceptionMessage('outside the microsecond range of a datetime column'); - (new DateTimePhysical(new DateTimeZone('UTC')))->toPhysical(new DateTimeImmutable('@9223372036855')); + new DateTimePhysical(new DateTimeZone('UTC'))->toPhysical(new DateTimeImmutable('@9223372036855')); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/DaysFromCivilTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/DaysFromCivilTest.php index 53432b8dfc..2569981402 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/DaysFromCivilTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/DaysFromCivilTest.php @@ -22,6 +22,6 @@ final class DaysFromCivilTest extends TestCase #[TestWith([-400, 3, 1, -865_565])] public function test_counts_days_from_the_epoch(int $year, int $month, int $day, int $days): void { - static::assertSame($days, (new DaysFromCivil())->of($year, $month, $day)); + static::assertSame($days, new DaysFromCivil()->of($year, $month, $day)); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/ElementPositionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/ElementPositionTest.php index 8d0fa8df48..f55e63b43b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/ElementPositionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/ElementPositionTest.php @@ -37,7 +37,7 @@ public function test_the_path_runs_from_the_document_element_down(): void static::assertSame( '0/1', - (new ElementPosition())->path(type_instance_of( + new ElementPosition()->path(type_instance_of( DOMElement::class, )->assert($root->firstElementChild?->lastElementChild)), ); @@ -48,7 +48,7 @@ public function test_an_element_outside_the_document_tree_has_no_path(): void $document = new DOMDocument(); $document->loadXML(''); - static::assertNull((new ElementPosition())->path(type_instance_of( + static::assertNull(new ElementPosition()->path(type_instance_of( DOMElement::class, )->assert($document->createElement('detached')))); } @@ -66,7 +66,7 @@ public function test_the_physical_splits_into_the_path_the_markup_and_the_docume public function test_bare_markup_has_no_position(): void { - static::assertNull((new ElementPosition())->pathOf('')); - static::assertNull((new ElementPosition())->markupOf('')); + static::assertNull(new ElementPosition()->pathOf('')); + static::assertNull(new ElementPosition()->markupOf('')); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/HtmlDocumentPhysicalTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/HtmlDocumentPhysicalTest.php index 8905e0931a..aded49bf2a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/HtmlDocumentPhysicalTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/HtmlDocumentPhysicalTest.php @@ -4,9 +4,7 @@ namespace Flow\ETL\Tests\Unit\Values\Column\Physical; -use Flow\ETL\Foundation\Exception\InvalidArgumentException; use Flow\ETL\Values\Column\Physical\HtmlDocumentPhysical; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\Types\DSL\type_html; @@ -14,7 +12,6 @@ final class HtmlDocumentPhysicalTest extends TestCase { - #[RequiresPhp('>= 8.4.0')] public function test_the_markup(): void { $document = type_html()->cast('

a

'); @@ -26,13 +23,4 @@ public function test_the_markup(): void static::assertEquals($markup, $physical->toPhysical($physical->fromPhysical($markup))); static::assertNull($physical->fromPhysicalAll([$markup, null])[1]); } - - #[RequiresPhp('< 8.4.0')] - public function test_restoring_below_php84_throws(): void - { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('requires PHP 8.4+'); - - (new HtmlDocumentPhysical())->fromPhysical('

x

'); - } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/HtmlElementPhysicalTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/HtmlElementPhysicalTest.php index 11c27bca70..bb9073d32e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/HtmlElementPhysicalTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/HtmlElementPhysicalTest.php @@ -6,7 +6,6 @@ use Flow\ETL\Foundation\Exception\InvalidArgumentException; use Flow\ETL\Values\Column\Physical\HtmlElementPhysical; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\Types\DSL\type_html_element; @@ -14,7 +13,6 @@ final class HtmlElementPhysicalTest extends TestCase { - #[RequiresPhp('>= 8.4.0')] public function test_the_markup(): void { $physical = new HtmlElementPhysical(); @@ -28,10 +26,9 @@ public function test_the_markup(): void public function test_the_markup_of_a_positioned_physical_is_the_element_alone(): void { - static::assertSame('

a

', (new HtmlElementPhysical())->markup("\x01\x008\x00

a

a

")); + static::assertSame('

a

', new HtmlElementPhysical()->markup("\x01\x008\x00

a

a

")); } - #[RequiresPhp('>= 8.4.0')] public function test_a_round_trip_keeps_the_parent_and_the_siblings(): void { $physical = new HtmlElementPhysical(); @@ -52,10 +49,9 @@ public function test_a_round_trip_keeps_the_parent_and_the_siblings(): void static::assertSame('01', $element->nextElementSibling?->textContent); } - #[RequiresPhp('>= 8.4.0')] public function test_bare_element_markup_of_earlier_builds_still_loads(): void { - $element = type_html_element()->assert((new HtmlElementPhysical())->fromPhysical( + $element = type_html_element()->assert(new HtmlElementPhysical()->fromPhysical( '

Name

', )); @@ -63,39 +59,27 @@ public function test_bare_element_markup_of_earlier_builds_still_loads(): void static::assertSame('BODY', $element->parentElement?->tagName); } - #[RequiresPhp('>= 8.4.0')] public function test_a_detached_element_is_stored_as_its_markup(): void { $element = type_html_element()->cast('

a

'); $element->remove(); - static::assertSame('

a

', (new HtmlElementPhysical())->toPhysical($element)); + static::assertSame('

a

', new HtmlElementPhysical()->toPhysical($element)); } - #[RequiresPhp('>= 8.4.0')] public function test_a_path_outside_the_document_is_refused(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Floe failed to restore HTMLElement'); - (new HtmlElementPhysical())->fromPhysical("\x015\x000\x00"); + new HtmlElementPhysical()->fromPhysical("\x015\x000\x00"); } - #[RequiresPhp('>= 8.4.0')] public function test_markup_without_an_element_is_refused(): void { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Floe failed to restore HTMLElement from "text"'); - (new HtmlElementPhysical())->fromPhysical('text'); - } - - #[RequiresPhp('< 8.4.0')] - public function test_restoring_below_php84_throws(): void - { - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('requires PHP 8.4+'); - - (new HtmlElementPhysical())->fromPhysical('

x

'); + new HtmlElementPhysical()->fromPhysical('text'); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/JsonFactoryTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/JsonFactoryTest.php index dff7d965c1..80c54c8a2c 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/JsonFactoryTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/JsonFactoryTest.php @@ -12,15 +12,15 @@ final class JsonFactoryTest extends TestCase { public function test_builds_json_equal_to_the_validating_constructor(): void { - static::assertEquals(Json::fromString('{"a":1}'), (new JsonFactory())->create('{"a":1}')); - static::assertEquals(Json::fromString('[1,2]'), (new JsonFactory())->create('[1,2]')); + static::assertEquals(Json::fromString('{"a":1}'), new JsonFactory()->create('{"a":1}')); + static::assertEquals(Json::fromString('[1,2]'), new JsonFactory()->create('[1,2]')); static::assertTrue( - (new JsonFactory()) + new JsonFactory() ->create('{}') ->isObject(), ); static::assertFalse( - (new JsonFactory()) + new JsonFactory() ->create('[]') ->isObject(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/PhysicalForTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/PhysicalForTest.php index 8c9b316206..eac2321e65 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/PhysicalForTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/PhysicalForTest.php @@ -184,13 +184,13 @@ public static function supported(): Generator public function test_supports_agrees_with_definition_from_type_and_definition(Type $type, bool $supported): void { try { - (new PhysicalFor())->definition(definition_from_type('value', $type)); + new PhysicalFor()->definition(definition_from_type('value', $type)); $defined = true; } catch (InvalidArgumentException|RuntimeException) { $defined = false; } - static::assertSame($supported, (new PhysicalFor())->supports($type)); + static::assertSame($supported, new PhysicalFor()->supports($type)); static::assertSame($supported, $defined); } @@ -201,7 +201,7 @@ public function test_supports_agrees_with_definition_from_type_and_definition(Ty #[DataProvider('types')] public function test_maps_the_type_to_its_physical(Type $type, string $class): void { - static::assertInstanceOf($class, (new PhysicalFor())->physical($type)); + static::assertInstanceOf($class, new PhysicalFor()->physical($type)); } /** @@ -213,14 +213,14 @@ public function test_refuses(Type $type, string $message): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage($message); - (new PhysicalFor())->physical($type); + new PhysicalFor()->physical($type); } public function test_structure_elements_are_keyed_by_name(): void { static::assertSame( ['a', 'b'], - array_keys((new PhysicalFor())->elements(type_structure(['a' => type_integer(), 'b' => type_string()]))), + array_keys(new PhysicalFor()->elements(type_structure(['a' => type_integer(), 'b' => type_string()]))), ); } @@ -258,7 +258,7 @@ public static function layouts(): Generator #[DataProvider('layouts')] public function test_maps_the_type_to_its_layout(Type $type, string $class): void { - static::assertInstanceOf($class, (new PhysicalFor())->layout($type)); + static::assertInstanceOf($class, new PhysicalFor()->layout($type)); } public function test_a_container_has_no_scalar_layout(): void @@ -266,7 +266,7 @@ public function test_a_container_has_no_scalar_layout(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('type list has no scalar layout'); - (new PhysicalFor())->layout(type_list(type_integer())); + new PhysicalFor()->layout(type_list(type_integer())); } public function test_picks_the_builder_of_the_column_kind(): void @@ -288,7 +288,7 @@ public function test_picks_the_builder_of_the_column_kind(): void public function test_an_optional_container_keeps_its_optional_type(): void { - $builder = (new PhysicalFor())->builder(type_optional(type_list(type_integer()))); + $builder = new PhysicalFor()->builder(type_optional(type_list(type_integer()))); $builder->appendPhysical(null); static::assertEquals(type_optional(type_list(type_integer())), $builder->finish()->type()); @@ -299,7 +299,7 @@ public function test_refuses_a_mixed_element(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('a mixed element has no column kind'); - (new PhysicalFor())->builder(type_list(type_mixed())); + new PhysicalFor()->builder(type_list(type_mixed())); } /** @@ -386,7 +386,7 @@ public function test_accepts_all_only_when_every_physical_is_of_the_kind( array $physicals, bool $accepts, ): void { - static::assertSame($accepts, (new PhysicalFor())->acceptsAll($type, $physicals)); + static::assertSame($accepts, new PhysicalFor()->acceptsAll($type, $physicals)); } /** @@ -395,6 +395,6 @@ public function test_accepts_all_only_when_every_physical_is_of_the_kind( #[DataProvider('physicals')] public function test_accepts_the_kind_flow_php_stores(Type $type, mixed $physical, bool $accepts): void { - static::assertSame($accepts, (new PhysicalFor())->accepts($type, $physical)); + static::assertSame($accepts, new PhysicalFor()->accepts($type, $physical)); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/StructPhysicalTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/StructPhysicalTest.php index aa81abf8cd..861fa8af49 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/StructPhysicalTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/StructPhysicalTest.php @@ -16,7 +16,7 @@ public function test_reads_every_physical_after_a_null(): void { static::assertEquals( [null, ['zone' => new DateTimeZone('UTC')]], - (new StructPhysical(['zone' => new TimeZonePhysical()]))->fromPhysicalAll([null, ['zone' => 'UTC']]), + new StructPhysical(['zone' => new TimeZonePhysical()])->fromPhysicalAll([null, ['zone' => 'UTC']]), ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/TimePhysicalTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/TimePhysicalTest.php index db299d8120..65ddc4a107 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/TimePhysicalTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/TimePhysicalTest.php @@ -20,11 +20,11 @@ public function test_microseconds_of_the_duration(): void $interval = new DateInterval('P1DT2H3M4S'); $interval->f = 0.5; - static::assertSame(93_784_500_000, (new TimePhysical())->toPhysical($interval)); + static::assertSame(93_784_500_000, new TimePhysical()->toPhysical($interval)); $interval->invert = 1; - static::assertSame(-93_784_500_000, (new TimePhysical())->toPhysical($interval)); + static::assertSame(-93_784_500_000, new TimePhysical()->toPhysical($interval)); } public function test_a_fraction_rounds_to_the_nearest_microsecond(): void @@ -32,7 +32,7 @@ public function test_a_fraction_rounds_to_the_nearest_microsecond(): void $interval = new DateInterval('PT0S'); $interval->f = 0.000_123; - static::assertSame(123, (new TimePhysical())->toPhysical($interval)); + static::assertSame(123, new TimePhysical()->toPhysical($interval)); } public function test_reads_back_hours_minutes_seconds_and_fraction(): void @@ -92,7 +92,7 @@ public function test_refuses_months(): void $this->expectException(CastingException::class); $this->expectExceptionMessage("Relative DateInterval (with months/years) can't be stored in a time column"); - (new TimePhysical())->toPhysical(new DateInterval('P1Y')); + new TimePhysical()->toPhysical(new DateInterval('P1Y')); } public function test_refuses_a_duration_outside_the_microsecond_range(): void @@ -103,6 +103,6 @@ public function test_refuses_a_duration_outside_the_microsecond_range(): void $interval = new DateInterval('PT0S'); $interval->s = 9_223_372_036_855; - (new TimePhysical())->toPhysical($interval); + new TimePhysical()->toPhysical($interval); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/XmlCharacterReferencesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/XmlCharacterReferencesTest.php index b211496134..c98f9749c0 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/XmlCharacterReferencesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/XmlCharacterReferencesTest.php @@ -20,6 +20,6 @@ final class XmlCharacterReferencesTest extends FlowTestCase #[TestWith(['&', '&'])] public function test_decodes_non_ascii_references_outside_cdata_and_comments(string $xml, string $decoded): void { - static::assertSame($decoded, (new XmlCharacterReferences())->decoded($xml)); + static::assertSame($decoded, new XmlCharacterReferences()->decoded($xml)); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/XmlDocumentPhysicalTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/XmlDocumentPhysicalTest.php index 2bcb591991..946127b9cb 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/XmlDocumentPhysicalTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/XmlDocumentPhysicalTest.php @@ -36,7 +36,7 @@ public function test_a_declared_encoding_is_kept(): void { static::assertSame( 'ISO-8859-1', - type_instance_of(DOMDocument::class)->assert((new XmlDocumentPhysical())->fromPhysical( + type_instance_of(DOMDocument::class)->assert(new XmlDocumentPhysical()->fromPhysical( '', ))->encoding, ); @@ -47,7 +47,7 @@ public function test_malformed_markup_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Floe failed to restore DOMDocument from ""'); - (new XmlDocumentPhysical())->fromPhysical(''); + new XmlDocumentPhysical()->fromPhysical(''); } public static function nodes(): Generator @@ -77,7 +77,7 @@ public function test_text_is_the_inverse_of_physical(string $node): void #[TestWith(['
'])] public function test_bytes_physical_did_not_produce_have_no_text(string $physical): void { - static::assertNull((new XmlDocumentPhysical())->text($physical)); + static::assertNull(new XmlDocumentPhysical()->text($physical)); } public function test_the_physical_of_a_node_is_the_markup_of_its_utf8_document(): void @@ -89,8 +89,8 @@ public function test_the_physical_of_a_node_is_the_markup_of_its_utf8_document() $row->appendChild(new DOMElement('b', 'ść')); static::assertSame( - (new XmlDocumentPhysical())->toPhysical($document), - (new XmlDocumentPhysical())->physical('ść'), + new XmlDocumentPhysical()->toPhysical($document), + new XmlDocumentPhysical()->physical('ść'), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/XmlElementPhysicalTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/XmlElementPhysicalTest.php index ddd76e84f2..362c35c565 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/XmlElementPhysicalTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/Physical/XmlElementPhysicalTest.php @@ -9,7 +9,6 @@ use DOMElement; use Flow\ETL\Foundation\Exception\InvalidArgumentException; use Flow\ETL\Values\Column\Physical\XmlElementPhysical; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\Types\DSL\type_instance_of; @@ -58,7 +57,7 @@ public function test_bare_element_markup_of_earlier_builds_still_loads(): void { static::assertSame( 'Name', - type_instance_of(DOMElement::class)->assert((new XmlElementPhysical())->fromPhysical( + type_instance_of(DOMElement::class)->assert(new XmlElementPhysical()->fromPhysical( 'Name', ))->textContent, ); @@ -66,10 +65,7 @@ public function test_bare_element_markup_of_earlier_builds_still_loads(): void public function test_bare_markup_is_its_own_markup(): void { - static::assertSame( - 'value', - (new XmlElementPhysical())->markup('value'), - ); + static::assertSame('value', new XmlElementPhysical()->markup('value')); } public function test_a_path_outside_the_document_is_refused(): void @@ -77,13 +73,11 @@ public function test_a_path_outside_the_document_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Floe failed to restore DOMElement'); - (new XmlElementPhysical())->fromPhysical("\x015\x000\x00"); + new XmlElementPhysical()->fromPhysical("\x015\x000\x00"); } - #[RequiresPhp('>= 8.4.0')] public function test_a_dom_element_of_the_new_api_reads_back_as_a_dom_element(): void { - // @mago-ignore analysis:unavailable-method $element = XMLDocument::createFromString('1')->documentElement?->firstElementChild; $physical = new XmlElementPhysical(); $bytes = type_string()->assert($physical->toPhysical($element)); @@ -102,7 +96,7 @@ public function test_restoring_xml_element_from_string(): void { static::assertSame( 'item', - type_instance_of(DOMElement::class)->assert((new XmlElementPhysical())->fromPhysical( + type_instance_of(DOMElement::class)->assert(new XmlElementPhysical()->fromPhysical( 'value', ))->tagName, ); @@ -110,7 +104,7 @@ public function test_restoring_xml_element_from_string(): void public function test_an_element_without_an_owner_document_is_stored_by_its_canonical_markup(): void { - static::assertSame('', (new XmlElementPhysical())->toPhysical(new DOMElement('detached'))); + static::assertSame('', new XmlElementPhysical()->toPhysical(new DOMElement('detached'))); } public function test_a_detached_element_is_stored_by_its_canonical_markup_and_returned_as_stored(): void @@ -130,19 +124,17 @@ public function test_a_detached_element_is_stored_by_its_canonical_markup_and_re ); } - #[RequiresPhp('>= 8.4.0')] public function test_a_detached_dom_element_of_the_new_api_is_stored_by_its_canonical_markup(): void { - // @mago-ignore analysis:unavailable-method $document = XMLDocument::createEmpty(); $element = $document->createElement('a'); $element->appendChild($document->createElement('b')); - static::assertSame('', (new XmlElementPhysical())->toPhysical($element)); + static::assertSame('', new XmlElementPhysical()->toPhysical($element)); } public function test_a_raw_markup_of_earlier_builds_is_returned_as_stored(): void { - static::assertSame('', (new XmlElementPhysical())->markup('')); + static::assertSame('', new XmlElementPhysical()->markup('')); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/RetypeTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/RetypeTest.php index 88bac1aa36..14153a1e72 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/RetypeTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/RetypeTest.php @@ -86,7 +86,7 @@ public static function refused(): Generator #[DataProvider('accepted')] public function test_accepts(Type $from, Type $to, int $nullCount): void { - (new Retype())->assert($from, $to, $nullCount); + new Retype()->assert($from, $to, $nullCount); $this->addToAssertionCount(1); } @@ -101,7 +101,7 @@ public function test_refuses(Type $from, Type $to, int $nullCount, string $messa $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage($message); - (new Retype())->assert($from, $to, $nullCount); + new Retype()->assert($from, $to, $nullCount); } /** @@ -157,6 +157,6 @@ public static function proofs(): Generator #[DataProvider('proofs')] public function test_proves(Type $from, Type $to, bool $proven): void { - static::assertSame($proven, (new Retype())->proves($from, $to)); + static::assertSame($proven, new Retype()->proves($from, $to)); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/TextValuesTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/TextValuesTest.php index daf45bbdfc..0e2c3e9e2d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/TextValuesTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/TextValuesTest.php @@ -311,7 +311,7 @@ public static function kept_physicals(): Generator #[DataProvider('scalar_texts')] public function test_texts(Type $type, array $physicals, array $expected): void { - static::assertSame($expected, (new TextValues())->texts($type, $physicals)); + static::assertSame($expected, new TextValues()->texts($type, $physicals)); } public function test_texts_use_the_configured_formats_at_every_depth(): void @@ -334,7 +334,7 @@ public function test_texts_refuse_a_float_that_is_not_finite_inside_a_nested_val $this->expectException(JsonException::class); $this->expectExceptionMessage('Inf and NaN cannot be JSON encoded'); - (new TextValues())->texts(type_list(type_float()), [[1.5, NAN]]); + new TextValues()->texts(type_list(type_float()), [[1.5, NAN]]); } public function test_a_refused_nested_float_restores_the_serialize_precision(): void @@ -343,7 +343,7 @@ public function test_a_refused_nested_float_restores_the_serialize_precision(): ini_set('serialize_precision', '17'); try { - (new TextValues())->texts(type_list(type_float()), [[NAN]]); + new TextValues()->texts(type_list(type_float()), [[NAN]]); static::fail('a NaN inside a nested value is refused'); } catch (JsonException) { static::assertSame('17', ini_get('serialize_precision')); @@ -360,7 +360,7 @@ public function test_nested_float_texts_never_depend_on_an_ini(string $ini, stri ini_set($ini, $value); try { - static::assertSame(['[0.1,1.0e+25]'], (new TextValues())->texts(type_list(type_float()), [[0.1, 1.0e25]])); + static::assertSame(['[0.1,1.0e+25]'], new TextValues()->texts(type_list(type_float()), [[0.1, 1.0e25]])); static::assertSame($value, ini_get($ini)); } finally { ini_set($ini, $previous); @@ -373,17 +373,17 @@ public function test_nested_float_texts_never_depend_on_an_ini(string $ini, stri #[DataProvider('kept_physicals')] public function test_keeps_physical(Type $type, bool $kept): void { - static::assertSame($kept, (new TextValues())->keepsPhysical($type)); + static::assertSame($kept, new TextValues()->keepsPhysical($type)); } public function test_of_returns_the_physicals_of_a_list_whose_elements_are_kept(): void { $physicals = [[1, null, 3], null, [], [[4]]]; - static::assertSame($physicals, (new TextValues())->of(type_list(type_optional(type_integer())), $physicals)); + static::assertSame($physicals, new TextValues()->of(type_list(type_optional(type_integer())), $physicals)); static::assertSame( [[['a', null], []], null], - (new TextValues())->of(type_list(type_list(type_optional(type_string()))), [[['a', null], []], null]), + new TextValues()->of(type_list(type_list(type_optional(type_string()))), [[['a', null], []], null]), ); } @@ -395,7 +395,7 @@ public function test_of_renders_only_the_structure_elements_that_differ_from_the (object) ['id' => 2, 'tags' => [], 'on' => '1970-01-01'], null, ], - (new TextValues())->of( + new TextValues()->of( type_structure([ 'id' => type_integer(), 'tags' => type_list(type_string()), @@ -415,11 +415,11 @@ public function test_of_makes_a_map_and_a_structure_of_kept_values_an_object(): { static::assertEquals( [(object) ['a' => 1, 'b' => 2], (object) [], null], - (new TextValues())->of(type_map(type_string(), type_integer()), [['a' => 1, 'b' => 2], [], null]), + new TextValues()->of(type_map(type_string(), type_integer()), [['a' => 1, 'b' => 2], [], null]), ); static::assertEquals( [(object) ['a' => 1, 'b' => 'x']], - (new TextValues())->of(type_structure(['a' => type_integer(), 'b' => type_string()]), [[ + new TextValues()->of(type_structure(['a' => type_integer(), 'b' => type_string()]), [[ 'a' => 1, 'b' => 'x', ]]), @@ -434,7 +434,7 @@ public function test_of_makes_a_map_and_a_structure_of_kept_values_an_object(): #[DataProvider('plain_values')] public function test_of(Type $type, array $physicals, array $expected): void { - static::assertEquals($expected, (new TextValues())->of($type, $physicals)); + static::assertEquals($expected, new TextValues()->of($type, $physicals)); } /** @@ -444,14 +444,14 @@ public function test_of(Type $type, array $physicals, array $expected): void #[DataProvider('shapes')] public function test_a_plain_value_carries_the_shape_of_its_type(Type $type, array $physicals, string $json): void { - static::assertSame($json, json_encode((new TextValues())->of($type, $physicals), JSON_THROW_ON_ERROR)); + static::assertSame($json, json_encode(new TextValues()->of($type, $physicals), JSON_THROW_ON_ERROR)); } public function test_of_uses_the_configured_formats_at_every_depth(): void { static::assertEquals( [(object) ['at' => ['02/01/2026 03:04'], 'on' => '2026/01/02']], - (new TextValues('d/m/Y H:i', 'Y/m/d'))->of( + new TextValues('d/m/Y H:i', 'Y/m/d')->of( type_structure(['at' => type_list(type_datetime()), 'on' => type_date()]), [['at' => [1_767_323_045_000_000], 'on' => 20_455]], ), @@ -462,7 +462,7 @@ public function test_of_refuses_malformed_json_text(): void { $this->expectException(JsonException::class); - (new TextValues())->of(type_json(), ['{oops']); + new TextValues()->of(type_json(), ['{oops']); } #[TestWith([0])] @@ -471,16 +471,16 @@ public function test_of_refuses_malformed_json_text(): void #[TestWith([253_402_300_799_999_999])] public function test_utc_date_times_format_every_letter_as_a_date_time_does(int $micros): void { - $instant = (new DateTimeImmutable( + $instant = new DateTimeImmutable( '@' . intdiv($micros - ((($micros % 1_000_000) + 1_000_000) % 1_000_000), 1_000_000), - )) + ) ->modify('+' . ((($micros % 1_000_000) + 1_000_000) % 1_000_000) . ' usec') ->setTimezone(new DateTimeZone('UTC')); foreach (str_split('dDjlNSwzWFmMntLoYyaABgGhHisuveIOPpZcrU') as $letter) { static::assertSame( [$instant->format($letter . ' | ' . $letter)], - (new TextValues())->dateTimes(type_datetime(), [$micros], $letter . ' | ' . $letter), + new TextValues()->dateTimes(type_datetime(), [$micros], $letter . ' | ' . $letter), $letter, ); } @@ -490,15 +490,15 @@ public function test_date_times_of_a_date_are_midnight_utc(): void { static::assertSame( ['2026-01-02 00:00:00.000000 000 +00:00 UTC', null, '1969-12-31 00:00:00.000000 000 +00:00 UTC'], - (new TextValues())->dateTimes(type_date(), [20_455, null, -1], 'Y-m-d H:i:s.u v P e'), + new TextValues()->dateTimes(type_date(), [20_455, null, -1], 'Y-m-d H:i:s.u v P e'), ); } public function test_date_times_with_the_zone_abbreviation_letter_name_utc(): void { static::assertSame(['UTC 1970', 'UTC 1970'], [ - ...(new TextValues())->dateTimes(type_datetime(), [0], 'T Y'), - ...(new TextValues())->dateTimes(type_date(), [0], 'T Y'), + ...new TextValues()->dateTimes(type_datetime(), [0], 'T Y'), + ...new TextValues()->dateTimes(type_date(), [0], 'T Y'), ]); } @@ -506,7 +506,7 @@ public function test_date_times_of_a_named_zone_cross_a_transition(): void { static::assertSame( ['2026-03-29T01:59:59.999999+01:00 CET', '2026-03-29T03:00:00.000000+02:00 CEST', null], - (new TextValues())->dateTimes( + new TextValues()->dateTimes( type_datetime('Europe/Warsaw'), [1_774_745_999_999_999, 1_774_746_000_000_000, null], 'Y-m-d\TH:i:s.uP T', @@ -518,7 +518,7 @@ public function test_date_times_keep_escaped_letters(): void { static::assertSame( ['u 123456 T v 123 \\'], - (new TextValues())->dateTimes(type_datetime(), [1_767_323_045_123_456], '\u u \T \v v \\\\'), + new TextValues()->dateTimes(type_datetime(), [1_767_323_045_123_456], '\u u \T \v v \\\\'), ); } @@ -536,13 +536,13 @@ public function test_uuids(): void Uuid::fromBytes($bytes[1])->toString(), Uuid::fromBytes($bytes[2])->toString(), ], - (new TextValues())->uuids($bytes), + new TextValues()->uuids($bytes), ); static::assertSame( [Uuid::fromBytes($bytes[0])->toString(), null, Uuid::fromBytes($bytes[2])->toString()], - (new TextValues())->uuids([$bytes[0], null, $bytes[2]]), + new TextValues()->uuids([$bytes[0], null, $bytes[2]]), ); - static::assertSame([], (new TextValues())->uuids([])); + static::assertSame([], new TextValues()->uuids([])); } #[TestWith(['serialize_precision', '-1'])] @@ -566,7 +566,7 @@ public function test_floats_never_depend_on_an_ini(string $ini, string $value): '0.30000000000000004', null, ], - (new TextValues())->floats([ + new TextValues()->floats([ 1.0, -0.0, 1.0e25, @@ -580,7 +580,7 @@ public function test_floats_never_depend_on_an_ini(string $ini, string $value): ); static::assertSame( ['NAN', 'INF', '-INF', '0.30000000000000004', '1.0e+25', null], - (new TextValues())->floats([NAN, INF, -INF, 0.1 + 0.2, 1.0e25, null]), + new TextValues()->floats([NAN, INF, -INF, 0.1 + 0.2, 1.0e25, null]), ); static::assertSame($value, ini_get($ini)); } finally { @@ -591,7 +591,7 @@ public function test_floats_never_depend_on_an_ini(string $ini, string $value): public function test_of_decodes_json_up_to_its_depth_limit(): void { static::assertIsArray( - (new TextValues())->of(type_json(), [ + new TextValues()->of(type_json(), [ str_repeat('[', 511) . '1' . str_repeat(']', 511), ])[0], ); @@ -601,7 +601,7 @@ public function test_of_reads_every_xml_physical_after_a_null(): void { static::assertSame( [null, ''], - (new TextValues())->of(type_xml(), [ + new TextValues()->of(type_xml(), [ null, ...ColumnMother::of(xml_schema('x'), [''])->physicals(), ]), @@ -612,12 +612,12 @@ public function test_of_refuses_json_past_its_depth_limit(): void { $this->expectException(JsonException::class); - (new TextValues())->of(type_json(), [str_repeat('[', 512) . '1' . str_repeat(']', 512)]); + new TextValues()->of(type_json(), [str_repeat('[', 512) . '1' . str_repeat(']', 512)]); } public function test_floats_beside_a_non_finite_one_keep_their_zero_fraction(): void { - static::assertSame(['1.0', 'NAN'], (new TextValues())->floats([1.0, NAN])); + static::assertSame(['1.0', 'NAN'], new TextValues()->floats([1.0, NAN])); } public function test_bindable_renders_xml_element_markup_from_its_physicals(): void @@ -626,19 +626,19 @@ public function test_bindable_renders_xml_element_markup_from_its_physicals(): v $document->loadXML(''); $element = ColumnMother::of(xml_element_schema('e'), [$document->documentElement]); - static::assertSame([''], (new TextValues())->bindable($element->type(), $element)); + static::assertSame([''], new TextValues()->bindable($element->type(), $element)); } public function test_floats_of_an_empty_list(): void { - static::assertSame([], (new TextValues())->floats([])); + static::assertSame([], new TextValues()->floats([])); } public function test_bindable_renders_markup_from_its_physicals(): void { $column = ColumnMother::of(xml_schema('x'), ['']); - static::assertSame([''], (new TextValues())->bindable($column->type(), $column)); + static::assertSame([''], new TextValues()->bindable($column->type(), $column)); } public function test_bindable_hands_over_every_other_type_as_logical_values(): void @@ -647,7 +647,7 @@ public function test_bindable_hands_over_every_other_type_as_logical_values(): v static::assertEquals( [new DateTimeImmutable('2026-01-02 03:04:05 UTC')], - (new TextValues())->bindable($column->type(), $column), + new TextValues()->bindable($column->type(), $column), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ValueColumnTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ValueColumnTest.php index 831e7fa14b..07ae1d09ca 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ValueColumnTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ValueColumnTest.php @@ -22,7 +22,7 @@ public function test_concat_is_refused(): void 'An untyped function result (mixed) cannot be concatenated; it exists only inside function evaluation', ); - (new ValueColumn([1]))->concat(new ValueColumn([2])); + new ValueColumn([1])->concat(new ValueColumn([2])); } public function test_encode_is_refused(): void @@ -32,7 +32,7 @@ public function test_encode_is_refused(): void 'An untyped function result (mixed) cannot be encoded; it exists only inside function evaluation', ); - (new ValueColumn([1]))->encode(); + new ValueColumn([1])->encode(); } public function test_reads_values_as_given(): void @@ -67,6 +67,6 @@ public function test_with_type_is_refused(): void 'An untyped function result (mixed) cannot be retyped to integer; it exists only inside function evaluation', ); - (new ValueColumn([1]))->withType(type_integer()); + new ValueColumn([1])->withType(type_integer()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ValueEqualityTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ValueEqualityTest.php index 5329f694a5..da157f3320 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ValueEqualityTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ValueEqualityTest.php @@ -30,20 +30,17 @@ public function test_a_null_on_either_side_is_unknown(): void schema(int_schema('l', nullable: true), int_schema('r', nullable: true)), ); - static::assertSame([null, null, true], (new ValueEquality())->equal($rows->column('l'), $rows->column('r'))); + static::assertSame([null, null, true], new ValueEquality()->equal($rows->column('l'), $rows->column('r'))); } public function test_form_feed_padded_integer_text_stays_exact_past_the_float_range(): void { - static::assertSame(9_007_199_254_740_993, (new ValueEquality())->number( - "\f9007199254740993\f", - type_integer(), - )); + static::assertSame(9_007_199_254_740_993, new ValueEquality()->number("\f9007199254740993\f", type_integer())); } public function test_a_decimal_string_rounds_to_the_nearest_integer(): void { - static::assertSame(2, (new ValueEquality())->number('2.4', type_integer())); + static::assertSame(2, new ValueEquality()->number('2.4', type_integer())); } public function test_cast_reads_a_string_as_a_datetime(): void @@ -52,7 +49,7 @@ public function test_cast_reads_a_string_as_a_datetime(): void static::assertEquals( [new DateTimeImmutable('2024-01-01 00:00:00')], - (new ValueEquality()) + new ValueEquality() ->cast($rows->column('a'), type_datetime(), 'a') ->values(), ); @@ -62,7 +59,7 @@ public function test_cast_to_the_type_the_column_already_has_returns_the_column( { $column = array_to_rows([['a' => 1]], schema(int_schema('a')))->column('a'); - static::assertSame($column, (new ValueEquality())->cast($column, type_integer(), 'a')); + static::assertSame($column, new ValueEquality()->cast($column, type_integer(), 'a')); } public function test_cast_names_the_row_of_a_string_that_is_not_a_datetime(): void @@ -72,14 +69,14 @@ public function test_cast_names_the_row_of_a_string_that_is_not_a_datetime(): vo $this->expectException(EvaluationException::class); $this->expectExceptionMessage('Column "a" value \'not a date\' cannot be cast to datetime to compare'); - (new ValueEquality())->cast($rows->column('a'), type_datetime(), 'a'); + new ValueEquality()->cast($rows->column('a'), type_datetime(), 'a'); } public function test_a_date_compares_as_a_datetime_and_only_a_date_widens(): void { static::assertEquals([type_datetime(), type_integer()], [ - (new ValueEquality())->type(type_date(), type_datetime()), - (new ValueEquality())->type(type_integer(), type_datetime()), + new ValueEquality()->type(type_date(), type_datetime()), + new ValueEquality()->type(type_integer(), type_datetime()), ]); } @@ -90,7 +87,7 @@ public function test_strings_are_equal_only_when_identical(): void schema(str_schema('l'), str_schema('r')), ); - static::assertSame([false, true], (new ValueEquality())->equal($rows->column('l'), $rows->column('r'))); + static::assertSame([false, true], new ValueEquality()->equal($rows->column('l'), $rows->column('r'))); } public function test_an_int_and_a_float_compare_by_value(): void @@ -100,7 +97,7 @@ public function test_an_int_and_a_float_compare_by_value(): void schema(int_schema('l'), float_schema('r')), ); - static::assertSame([true, false], (new ValueEquality())->equal($rows->column('l'), $rows->column('r'))); + static::assertSame([true, false], new ValueEquality()->equal($rows->column('l'), $rows->column('r'))); } public function test_datetimes_compare_by_instant(): void @@ -113,7 +110,7 @@ public function test_datetimes_compare_by_instant(): void schema(datetime_schema('l'), datetime_schema('r')), ); - static::assertSame([true], (new ValueEquality())->equal($rows->column('l'), $rows->column('r'))); + static::assertSame([true], new ValueEquality()->equal($rows->column('l'), $rows->column('r'))); } public function test_times_compare_by_their_length(): void @@ -126,14 +123,14 @@ public function test_times_compare_by_their_length(): void schema(time_schema('l'), time_schema('r')), ); - static::assertSame([true, false], (new ValueEquality())->equal($rows->column('l'), $rows->column('r'))); + static::assertSame([true, false], new ValueEquality()->equal($rows->column('l'), $rows->column('r'))); } public function test_in_casts_every_candidate_to_the_type_it_compares_in_with_its_needle(): void { static::assertSame( [true, false, true], - (new ValueEquality())->in( + new ValueEquality()->in( array_to_rows([['n' => 1], ['n' => 2], ['n' => 3]], schema(int_schema('n')))->column('n'), [['1'], [1.0, 5], [4, '3']], 'n', @@ -146,7 +143,7 @@ public function test_in_is_unknown_for_a_null_needle_a_null_haystack_and_no_matc { static::assertSame( [null, null, null, true], - (new ValueEquality())->in( + new ValueEquality()->in( array_to_rows([ ['n' => null], ['n' => 1], @@ -167,7 +164,7 @@ public function test_in_names_the_row_of_a_candidate_that_does_not_cast(): void "Column \"h\" value 'x' cannot be cast to integer to compare: \"x\" is not a number (row 1)", ); - (new ValueEquality())->in( + new ValueEquality()->in( array_to_rows([['n' => 1], ['n' => 2]], schema(int_schema('n')))->column('n'), [[1], ['x']], 'n', @@ -182,7 +179,7 @@ public function test_in_names_the_row_of_a_needle_that_does_not_cast(): void "Column \"n\" value 'a' cannot be cast to integer to compare: \"a\" is not a number (row 1)", ); - (new ValueEquality())->in( + new ValueEquality()->in( array_to_rows([['n' => '1'], ['n' => 'a']], schema(str_schema('n')))->column('n'), [[1], [2]], 'n', @@ -197,7 +194,7 @@ public function test_in_names_the_row_of_a_needle_that_does_not_cast_after_a_row "Column \"n\" value 'a' cannot be cast to integer to compare: \"a\" is not a number (row 1)", ); - (new ValueEquality())->in( + new ValueEquality()->in( array_to_rows([['n' => '1'], ['n' => 'a']], schema(str_schema('n')))->column('n'), [[1, 3], [2]], 'n', diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ValueOrderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ValueOrderTest.php index 2a172cd60c..66bc4063d8 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ValueOrderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Column/ValueOrderTest.php @@ -27,7 +27,7 @@ final class ValueOrderTest extends FlowTestCase #[TestWith(['B', 'a', -1])] public function test_two_strings_order_by_bytes(string $left, string $right, int $expected): void { - static::assertSame($expected, (new ValueOrder(type_string(), type_string()))->compare($left, $right)); + static::assertSame($expected, new ValueOrder(type_string(), type_string())->compare($left, $right)); } #[TestWith(['9', '10', -1])] @@ -38,7 +38,7 @@ public function test_a_numeric_string_operand_orders_strings_numerically( string $right, int $expected, ): void { - static::assertSame($expected, (new ValueOrder(type_optional(type_numeric_string()), type_string()))->compare( + static::assertSame($expected, new ValueOrder(type_optional(type_numeric_string()), type_string())->compare( $left, $right, )); @@ -46,7 +46,7 @@ public function test_a_numeric_string_operand_orders_strings_numerically( public function test_an_order_without_operand_types_orders_strings_by_bytes(): void { - static::assertSame(1, (new ValueOrder())->compare('9', '10')); + static::assertSame(1, new ValueOrder()->compare('9', '10')); } public function test_numbers_order_as_php_compares_them(): void @@ -80,7 +80,7 @@ public function test_float_operands_rank_nan_above_every_number(): void public function test_date_times_order_by_instant(): void { - static::assertSame(-1, (new ValueOrder())->compare( + static::assertSame(-1, new ValueOrder()->compare( new DateTimeImmutable('2024-01-01 10:00:00+00:00'), new DateTimeImmutable('2024-01-01 11:30:00+01:00'), )); @@ -109,7 +109,7 @@ public function test_less_than_or_equal_over_integer_columns_gives_null_for_one_ { static::assertSame( [null, null, true], - (new ValueOrder(type_integer(), type_integer()))->lessThanOrEqual([1, null, 1], [null, 1, 1]), + new ValueOrder(type_integer(), type_integer())->lessThanOrEqual([1, null, 1], [null, 1, 1]), ); } @@ -123,14 +123,14 @@ public function test_less_than_over_string_columns_orders_by_bytes(): void public function test_less_than_with_a_numeric_string_operand_orders_numerically(): void { - static::assertSame([true], (new ValueOrder(type_numeric_string(), type_string()))->lessThan(['9'], ['10'])); + static::assertSame([true], new ValueOrder(type_numeric_string(), type_string())->lessThan(['9'], ['10'])); } public function test_less_than_over_intervals_orders_by_length(): void { static::assertSame( [true, false], - (new ValueOrder())->lessThanOrEqual([new DateInterval('PT60M'), new DateInterval('PT61M')], [ + new ValueOrder()->lessThanOrEqual([new DateInterval('PT60M'), new DateInterval('PT61M')], [ new DateInterval('PT1H'), new DateInterval('PT1H'), ]), @@ -141,7 +141,7 @@ public function test_a_boolean_and_an_integer_operand_compare_as_scalars(): void { static::assertSame( [true, false], - (new ValueOrder(type_boolean(), type_integer()))->lessThan([false, true], [1, 1]), + new ValueOrder(type_boolean(), type_integer())->lessThan([false, true], [1, 1]), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Grouping/KeyEncoderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Grouping/KeyEncoderTest.php index 82041a0c46..3c86cd803b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Grouping/KeyEncoderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Grouping/KeyEncoderTest.php @@ -87,12 +87,12 @@ public function test_zero_and_negative_zero_are_one_key_but_two_partition_values public function test_an_empty_batch_has_no_keys(): void { - static::assertSame([], (new KeyEncoder(['k']))->of(rows(schema(int_schema('k'))))); + static::assertSame([], new KeyEncoder(['k'])->of(rows(schema(int_schema('k'))))); } public function test_equal_rows_share_a_key_and_others_do_not(): void { - $keys = (new KeyEncoder(['k', 'l']))->of(array_to_rows( + $keys = new KeyEncoder(['k', 'l'])->of(array_to_rows( [['k' => 'a', 'l' => [1, 2]], ['k' => 'a', 'l' => [1, 2]], ['k' => 'a', 'l' => [2, 1]]], schema(str_schema('k'), list_schema('l', type_list(type_integer()))), )); @@ -103,7 +103,7 @@ public function test_equal_rows_share_a_key_and_others_do_not(): void public function test_zero_and_negative_zero_are_one_key(): void { - $keys = (new KeyEncoder(['k']))->of(array_to_rows([ + $keys = new KeyEncoder(['k'])->of(array_to_rows([ ['k' => 0.0], ['k' => -0.0], ['k' => 1.5], @@ -115,7 +115,7 @@ public function test_zero_and_negative_zero_are_one_key(): void public function test_a_float_keeps_every_digit(): void { - $keys = (new KeyEncoder(['k']))->of(array_to_rows([ + $keys = new KeyEncoder(['k'])->of(array_to_rows([ ['k' => 0.1 + 0.2], ['k' => 0.3], ], schema(float_schema('k')))); @@ -128,23 +128,23 @@ public function test_values_of_different_types_never_share_a_key(): void static::assertCount( 10, array_unique(array_merge( - (new KeyEncoder(['k']))->of(array_to_rows([['k' => 1], ['k' => 0]], schema(int_schema('k')))), - (new KeyEncoder(['k']))->of(array_to_rows([['k' => 1.0]], schema(float_schema('k')))), - (new KeyEncoder(['k']))->of(array_to_rows([ + new KeyEncoder(['k'])->of(array_to_rows([['k' => 1], ['k' => 0]], schema(int_schema('k')))), + new KeyEncoder(['k'])->of(array_to_rows([['k' => 1.0]], schema(float_schema('k')))), + new KeyEncoder(['k'])->of(array_to_rows([ ['k' => '1'], ['k' => '1.0'], ['k' => ''], ['k' => '0'], ], schema(str_schema('k')))), - (new KeyEncoder(['k']))->of(array_to_rows([['k' => true], ['k' => false]], schema(bool_schema('k')))), - (new KeyEncoder(['k']))->of(array_to_rows([['k' => null]], schema(int_schema('k', nullable: true)))), + new KeyEncoder(['k'])->of(array_to_rows([['k' => true], ['k' => false]], schema(bool_schema('k')))), + new KeyEncoder(['k'])->of(array_to_rows([['k' => null]], schema(int_schema('k', nullable: true)))), )), ); } public function test_a_value_never_runs_into_the_next_one(): void { - $keys = (new KeyEncoder(['a', 'b']))->of(array_to_rows( + $keys = new KeyEncoder(['a', 'b'])->of(array_to_rows( [['a' => 'ab', 'b' => ''], ['a' => 'a', 'b' => 'b']], schema(str_schema('a'), str_schema('b')), )); @@ -157,8 +157,8 @@ public function test_a_column_the_batch_lacks_is_a_null_where_the_bound_schema_d $declared = schema(int_schema('k'), int_schema('missing', nullable: true)); static::assertSame( - (new KeyEncoder(['k', 'missing']))->of(array_to_rows([['k' => 1, 'missing' => null]], $declared)), - (new KeyEncoder(['k', 'missing'], declared: $declared))->of(array_to_rows([[ + new KeyEncoder(['k', 'missing'])->of(array_to_rows([['k' => 1, 'missing' => null]], $declared)), + new KeyEncoder(['k', 'missing'], declared: $declared)->of(array_to_rows([[ 'k' => 1, ]], schema(int_schema('k')))), ); @@ -169,17 +169,14 @@ public function test_a_column_the_batch_lacks_without_a_nullable_declaration_is_ $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Column "missing" does not exist.'); - (new KeyEncoder(['k', 'missing'], declared: schema(int_schema('k'), int_schema('missing'))))->of(array_to_rows( - [[ - 'k' => 1, - ]], - schema(int_schema('k')), - )); + new KeyEncoder(['k', 'missing'], declared: schema(int_schema('k'), int_schema('missing')))->of(array_to_rows([[ + 'k' => 1, + ]], schema(int_schema('k')))); } public function test_a_date_is_keyed_by_its_day(): void { - $keys = (new KeyEncoder(['d']))->of(array_to_rows([ + $keys = new KeyEncoder(['d'])->of(array_to_rows([ ['d' => new DateTimeImmutable('2026-01-01')], ['d' => new DateTimeImmutable('2026-01-01')], ['d' => new DateTimeImmutable('2026-01-02')], @@ -192,18 +189,18 @@ public function test_a_date_is_keyed_by_its_day(): void public function test_a_column_cast_to_a_type_keys_like_a_column_of_that_type(): void { static::assertSame( - (new KeyEncoder(['k']))->of(array_to_rows([['k' => 1.0]], schema(float_schema('k')))), - (new KeyEncoder(['k'], [type_float()]))->of(array_to_rows([['k' => 1]], schema(int_schema('k')))), + new KeyEncoder(['k'])->of(array_to_rows([['k' => 1.0]], schema(float_schema('k')))), + new KeyEncoder(['k'], [type_float()])->of(array_to_rows([['k' => 1]], schema(int_schema('k')))), ); static::assertSame( - (new KeyEncoder(['k']))->of(array_to_rows([['k' => 1]], schema(int_schema('k')))), - (new KeyEncoder(['k'], [type_integer()]))->of(array_to_rows([['k' => '1']], schema(str_schema('k')))), + new KeyEncoder(['k'])->of(array_to_rows([['k' => 1]], schema(int_schema('k')))), + new KeyEncoder(['k'], [type_integer()])->of(array_to_rows([['k' => '1']], schema(str_schema('k')))), ); } public function test_nans_share_a_key(): void { - $keys = (new KeyEncoder(['k']))->of(array_to_rows([['k' => NAN], ['k' => NAN]], schema(float_schema('k')))); + $keys = new KeyEncoder(['k'])->of(array_to_rows([['k' => NAN], ['k' => NAN]], schema(float_schema('k')))); static::assertSame($keys[0], $keys[1]); } @@ -238,11 +235,11 @@ public function test_an_int_and_a_float_of_one_value_are_one_key_under_a_float_k static::assertSame( ["\x03\x00\x00\x00\x00\x00\x00\xF0\x3F"], - (new KeyEncoder(['k'], declared: $declared))->of(array_to_rows([['k' => 1]], schema(int_schema('k')))), + new KeyEncoder(['k'], declared: $declared)->of(array_to_rows([['k' => 1]], schema(int_schema('k')))), ); static::assertSame( ["\x03\x00\x00\x00\x00\x00\x00\xF0\x3F"], - (new KeyEncoder(['k'], declared: $declared))->of(array_to_rows([['k' => 1.0]], $declared)), + new KeyEncoder(['k'], declared: $declared)->of(array_to_rows([['k' => 1.0]], $declared)), ); } @@ -250,10 +247,10 @@ public function test_a_column_the_batch_lacks_under_a_nullable_declaration_keys_ { static::assertSame( ["\x00\x02\x01\x00\x00\x00\x00\x00\x00\x00"], - (new KeyEncoder( + new KeyEncoder( ['k', 'id'], declared: schema(int_schema('k', nullable: true), int_schema('id')), - ))->of(array_to_rows([['id' => 1]], schema(int_schema('id')))), + )->of(array_to_rows([['id' => 1]], schema(int_schema('id')))), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Memory/BoundedReadTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Memory/BoundedReadTest.php index 60058ed6bb..26d1edf252 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Memory/BoundedReadTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Memory/BoundedReadTest.php @@ -16,9 +16,9 @@ final class BoundedReadTest extends FlowTestCase { public function test_a_stream_within_the_limit_is_read_whole(): void { - [$read, $fits] = (new BoundedRead( + [$read, $fits] = new BoundedRead( new MemoryBudget(new PhpBackend(), Unit::fromGb(64), null), - ))->read(IdRows::batches([1, 2], [3])); + )->read(IdRows::batches([1, 2], [3])); static::assertTrue($fits); static::assertSame([[1, 2], [3]], array_map(static fn($rows): array => $rows->reduceToArray('id'), $read)); @@ -30,7 +30,7 @@ public function test_past_the_limit_reading_stops_and_the_rest_continues_where_i $backend = new ReportedMemoryBackend(0); $budget = new MemoryBudget($backend, Unit::fromGb(1), null); $backend->reported = Unit::fromGb(2)->inBytes(); - [$read, $fits] = (new BoundedRead($budget))->read($rows); + [$read, $fits] = new BoundedRead($budget)->read($rows); static::assertFalse($fits); static::assertCount(1, $read); @@ -40,7 +40,7 @@ public function test_past_the_limit_reading_stops_and_the_rest_continues_where_i public function test_followed_by_a_finished_stream_yields_only_what_was_read(): void { $rows = IdRows::batches([1]); - [$read] = (new BoundedRead(new MemoryBudget(new PhpBackend(), Unit::fromGb(64), null)))->read($rows); + [$read] = new BoundedRead(new MemoryBudget(new PhpBackend(), Unit::fromGb(64), null))->read($rows); static::assertSame([1], IdRows::ids(BoundedRead::followedBy($read, $rows))); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Memory/MemoryBudgetTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Memory/MemoryBudgetTest.php index 2c6e28002f..ebda6a94b4 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Memory/MemoryBudgetTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Memory/MemoryBudgetTest.php @@ -21,7 +21,7 @@ final class MemoryBudgetTest extends FlowTestCase public function test_memory_held_before_the_budget_starts_does_not_count(): void { static::assertFalse( - (new MemoryBudget(new ReportedMemoryBackend(2_000_000_000), Unit::fromGb(1), null))->exceeded(), + new MemoryBudget(new ReportedMemoryBackend(2_000_000_000), Unit::fromGb(1), null)->exceeded(), ); } @@ -58,7 +58,7 @@ public function test_released_measures_growth_from_the_release(): void public function test_released_returns_freed_memory_through_the_backend(): void { $backend = new SpyBackend(); - (new MemoryBudget($backend, Unit::fromGb(1), null))->released(); + new MemoryBudget($backend, Unit::fromGb(1), null)->released(); static::assertSame(1, $backend->releases()); } @@ -156,11 +156,11 @@ public function test_an_allocation_up_to_exactly_the_cap_does_not_cross_it(): vo public function test_without_a_cap_no_allocation_crosses_it(): void { - static::assertFalse((new MemoryBudget( + static::assertFalse(new MemoryBudget( new ReportedMemoryBackend(0), Unit::fromGb(1), null, - ))->crossesCapWith(PHP_INT_MAX >> 1)); + )->crossesCapWith(PHP_INT_MAX >> 1)); } public function test_remaining_is_the_limit_minus_own_growth(): void @@ -187,7 +187,7 @@ public function test_floor_is_a_sixteenth_of_the_cap_up_to_128_mib(int $capGb, i { static::assertSame( Unit::fromMb($floorMb)->inBytes(), - (new MemoryBudget(new ReportedMemoryBackend(0), Unit::fromGb(1), Unit::fromGb($capGb)))->floor(), + new MemoryBudget(new ReportedMemoryBackend(0), Unit::fromGb(1), Unit::fromGb($capGb))->floor(), ); } @@ -195,7 +195,7 @@ public function test_floor_without_a_cap_is_the_limit(): void { static::assertSame( Unit::fromMb(300)->inBytes(), - (new MemoryBudget(new ReportedMemoryBackend(0), Unit::fromMb(300), null))->floor(), + new MemoryBudget(new ReportedMemoryBackend(0), Unit::fromMb(300), null)->floor(), ); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Rows/ColumnRetypingTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Rows/ColumnRetypingTest.php index bda1f03a4f..6c96b9dbbc 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Rows/ColumnRetypingTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Rows/ColumnRetypingTest.php @@ -23,7 +23,7 @@ public function test_an_absent_nullable_column_is_nulls(): void { static::assertSame( [null, null], - (new ColumnRetyping()) + new ColumnRetyping() ->absent(int_schema('id', nullable: true), 2, new PhpBackend()) ->values(), ); @@ -33,14 +33,14 @@ public function test_an_absent_not_null_column_is_refused_when_there_is_a_row(): { $this->expectException(SchemaMismatchException::class); - (new ColumnRetyping())->absent(int_schema('id'), 1, new PhpBackend()); + new ColumnRetyping()->absent(int_schema('id'), 1, new PhpBackend()); } public function test_an_absent_not_null_column_of_no_rows_is_empty(): void { static::assertSame( 0, - (new ColumnRetyping()) + new ColumnRetyping() ->absent(int_schema('id'), 0, new PhpBackend()) ->count(), ); @@ -50,12 +50,12 @@ public function test_the_same_definition_keeps_the_column(): void { $column = ColumnMother::of(int_schema('id'), [1, 2]); - static::assertSame($column, (new ColumnRetyping())->restamped($column, int_schema('id'), int_schema('id'))); + static::assertSame($column, new ColumnRetyping()->restamped($column, int_schema('id'), int_schema('id'))); } public function test_a_change_the_types_cannot_prove_is_not_restamped(): void { - static::assertNull((new ColumnRetyping())->restamped( + static::assertNull(new ColumnRetyping()->restamped( ColumnMother::of(str_schema('id'), ['1']), str_schema('id'), int_schema('id'), @@ -64,7 +64,7 @@ public function test_a_change_the_types_cannot_prove_is_not_restamped(): void public function test_a_proved_change_is_restamped(): void { - $retyped = (new ColumnRetyping())->restamped( + $retyped = new ColumnRetyping()->restamped( ColumnMother::of(int_schema('id'), [1, 2]), int_schema('id'), int_schema('id', nullable: true), @@ -76,7 +76,7 @@ public function test_a_proved_change_is_restamped(): void public function test_a_column_without_nulls_is_restamped_under_a_not_null_definition(): void { - $retyped = (new ColumnRetyping())->restamped( + $retyped = new ColumnRetyping()->restamped( ColumnMother::of(int_schema('id', nullable: true), [1, 2]), int_schema('id', nullable: true), int_schema('id'), @@ -88,7 +88,7 @@ public function test_a_column_without_nulls_is_restamped_under_a_not_null_defini public function test_a_column_with_nulls_is_restamped_under_a_nullable_definition(): void { - $retyped = (new ColumnRetyping())->restamped( + $retyped = new ColumnRetyping()->restamped( ColumnMother::of(int_schema('id', nullable: true), [1, null]), int_schema('id'), int_schema('id', nullable: true), @@ -101,7 +101,7 @@ public function test_a_column_with_nulls_is_restamped_under_a_nullable_definitio public function test_not_null_refuses_the_first_null_at_its_position(): void { try { - (new ColumnRetyping())->notNull( + new ColumnRetyping()->notNull( int_schema('id'), ColumnMother::of( int_schema('id', nullable: true), @@ -122,7 +122,7 @@ public function test_cast_casts_what_the_types_cannot_prove(): void { static::assertSame( [1, 2], - (new ColumnRetyping()) + new ColumnRetyping() ->cast( ColumnMother::of(str_schema('id'), ['1', '2']), str_schema('id'), @@ -136,7 +136,7 @@ public function test_cast_casts_what_the_types_cannot_prove(): void public function test_validate_refuses_the_lowest_bad_row_across_columns(): void { try { - (new ColumnRetyping())->validate([ + new ColumnRetyping()->validate([ 'a' => [ ColumnMother::of(list_schema('a', type_list(type_optional(type_integer()))), [[1], [2], [null]]), list_schema('a', type_list(type_integer())), @@ -155,7 +155,7 @@ public function test_validate_refuses_the_lowest_bad_row_across_columns(): void public function test_a_proved_change_with_a_null_under_not_null_is_left_to_validate(): void { - static::assertNull((new ColumnRetyping())->restamped( + static::assertNull(new ColumnRetyping()->restamped( ColumnMother::of(int_schema('id', nullable: true), [1, null]), int_schema('id', nullable: true), int_schema('id'), diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Rows/RecordBatchTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Rows/RecordBatchTest.php index 22dc3c57d5..7daac82151 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Rows/RecordBatchTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Rows/RecordBatchTest.php @@ -47,7 +47,7 @@ public function test_a_batch_is_handed_out_once_it_is_full_and_the_rest_on_flush public function test_nothing_added_flushes_nothing(): void { - static::assertSame([], (new RecordBatch(schema(int_schema('id')), new PhpBackend(), 1))->flush()); + static::assertSame([], new RecordBatch(schema(int_schema('id')), new PhpBackend(), 1)->flush()); } public function test_under_a_declared_schema_a_value_that_does_not_cast_is_a_corrupted_record(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Rows/RowsBuilderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Rows/RowsBuilderTest.php index 003cdd8ca0..5a1940d86b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Rows/RowsBuilderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Rows/RowsBuilderTest.php @@ -307,7 +307,7 @@ public function test_a_refused_value_wins_over_an_earlier_absence(): void $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('column "b" (row 1): could not convert null to integer, column is not nullable'); - (new RowsBuilder(schema(int_schema('a'), int_schema('b')), new PhpBackend()))->appendRows([ + new RowsBuilder(schema(int_schema('a'), int_schema('b')), new PhpBackend())->appendRows([ ['a' => 1], ['a' => 1, 'b' => null], ]); @@ -318,7 +318,7 @@ public function test_an_absence_names_the_first_row_that_lacks_the_column(): voi $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('column "b" (row 0) declared by the schema is missing from the row'); - (new RowsBuilder(schema(int_schema('a'), int_schema('b')), new PhpBackend()))->appendRows([ + new RowsBuilder(schema(int_schema('a'), int_schema('b')), new PhpBackend())->appendRows([ ['a' => 0], ['a' => 1, 'b' => 1], ['a' => 2], @@ -330,7 +330,7 @@ public function test_the_lowest_absence_across_columns_wins(): void $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('column "d" (row 1) declared by the schema is missing from the row'); - (new RowsBuilder(schema(int_schema('c'), int_schema('d')), new PhpBackend()))->appendRows([[ + new RowsBuilder(schema(int_schema('c'), int_schema('d')), new PhpBackend())->appendRows([[ 'c' => 0, 'd' => 0, ]])->appendRows([['c' => 1], ['c' => 2, 'd' => 2], ['d' => 3]]); @@ -341,7 +341,7 @@ public function test_an_earlier_absence_stays_over_a_later_one_in_another_column $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('column "c" (row 1) declared by the schema is missing from the row'); - (new RowsBuilder(schema(int_schema('c'), int_schema('d')), new PhpBackend()))->appendRows([[ + new RowsBuilder(schema(int_schema('c'), int_schema('d')), new PhpBackend())->appendRows([[ 'c' => 0, 'd' => 0, ]])->appendRows([['d' => 1], ['c' => 2, 'd' => 2], ['c' => 3]]); @@ -352,7 +352,7 @@ public function test_an_absence_at_the_same_row_names_the_first_column(): void $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('column "c" (row 0) declared by the schema is missing from the row'); - (new RowsBuilder(schema(int_schema('a'), int_schema('c'), int_schema('d')), new PhpBackend()))->appendRows([ + new RowsBuilder(schema(int_schema('a'), int_schema('c'), int_schema('d')), new PhpBackend())->appendRows([ ['a' => 0], ['a' => 1, 'c' => 1, 'd' => 1], ]); @@ -363,7 +363,7 @@ public function test_a_refusal_at_the_same_row_names_the_first_column(): void $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('column "a" (row 0)'); - (new RowsBuilder(schema(int_schema('a'), int_schema('b')), new PhpBackend()))->appendRows([ + new RowsBuilder(schema(int_schema('a'), int_schema('b')), new PhpBackend())->appendRows([ ['a' => 'x', 'b' => 'y'], ]); } @@ -373,20 +373,20 @@ public function test_an_absence_is_placed_after_the_rows_already_appended(): voi $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('column "c" (row 2) declared by the schema is missing from the row'); - (new RowsBuilder( + new RowsBuilder( schema(int_schema('a'), int_schema('b', nullable: true), int_schema('c')), new PhpBackend(), - ))->appendRows([['a' => 0, 'c' => 0]])->appendRows([['a' => 1, 'c' => 1], ['a' => 2]]); + )->appendRows([['a' => 0, 'c' => 0]])->appendRows([['a' => 1, 'c' => 1], ['a' => 2]]); } public function test_an_int_keyed_record_fills_the_columns_named_by_position(): void { static::assertSame( [['a' => null, 'e01' => 2]], - (new RowsBuilder( + new RowsBuilder( schema(int_schema('a', nullable: true), int_schema('e01', nullable: true)), new PhpBackend(), - )) + ) ->appendRows([[0 => 1, 1 => 2]]) ->finish() ->toArray(), @@ -398,7 +398,7 @@ public function test_the_first_refused_value_in_row_order_across_columns(): void $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('column "b" (row 1): could not convert \'x\' (string) to integer'); - (new RowsBuilder(schema(int_schema('a'), int_schema('b')), new PhpBackend()))->appendRows([[ + new RowsBuilder(schema(int_schema('a'), int_schema('b')), new PhpBackend())->appendRows([[ 'a' => 0, 'b' => 0, ]])->appendRows([['a' => 1, 'b' => 'x'], ['a' => 'y', 'b' => 2]]); @@ -408,7 +408,7 @@ public function test_a_view_of_another_definition_keeps_a_value_that_matches_the { static::assertSame( [['id' => 5, 'name' => null]], - (new RowsBuilder(schema(int_schema('id'), str_schema('name', nullable: true)), new PhpBackend())) + new RowsBuilder(schema(int_schema('id'), str_schema('name', nullable: true)), new PhpBackend()) ->appendFrom(array_to_rows([['id' => 5]], schema(int_schema('id', nullable: true))), 0) ->finish() ->toArray(), @@ -419,7 +419,7 @@ public function test_a_shared_column_before_a_view_keeps_the_value_of_the_view() { static::assertSame( [['a' => 1, 'b' => 2]], - (new RowsBuilder(schema(int_schema('a'), int_schema('b')), new PhpBackend())) + new RowsBuilder(schema(int_schema('a'), int_schema('b')), new PhpBackend()) ->appendFrom(array_to_rows([['a' => 1, 'b' => 2]], schema(int_schema('a'), int_schema('b', true))), 0) ->finish() ->toArray(), @@ -430,7 +430,7 @@ public function test_an_empty_key_does_not_fill_a_column_without_a_position(): v { static::assertSame( [['a' => null]], - (new RowsBuilder(schema(int_schema('a', true)), new PhpBackend())) + new RowsBuilder(schema(int_schema('a', true)), new PhpBackend()) ->appendRows([['' => 5]]) ->finish() ->toArray(), @@ -443,7 +443,7 @@ public function test_appending_taken_rows_adds_their_count(): void static::assertSame( 3, - (new RowsBuilder(schema(int_schema('id')), new PhpBackend())) + new RowsBuilder(schema(int_schema('id')), new PhpBackend()) ->appendTake($rows, [0, 1]) ->appendTake($rows, [1]) ->count(), @@ -456,7 +456,7 @@ public function test_appending_copied_rows_counts_each_row(): void static::assertSame( 2, - (new RowsBuilder(schema(int_schema('id')), new PhpBackend())) + new RowsBuilder(schema(int_schema('id')), new PhpBackend()) ->appendFrom($rows, 0) ->appendFrom($rows, 1) ->count(), @@ -469,7 +469,7 @@ public function test_appending_viewed_rows_counts_each_row(): void static::assertSame( 2, - (new RowsBuilder(schema(int_schema('id')), new PhpBackend())) + new RowsBuilder(schema(int_schema('id')), new PhpBackend()) ->appendFrom($rows, 0) ->appendFrom($rows, 1) ->count(), @@ -481,7 +481,7 @@ public function test_a_refused_view_is_placed_at_its_output_row(): void $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('column "id" (row 1): could not convert \'x\' (string) to integer'); - (new RowsBuilder(schema(int_schema('id')), new PhpBackend())) + new RowsBuilder(schema(int_schema('id')), new PhpBackend()) ->appendFrom(array_to_rows([['id' => 1]], schema(int_schema('id'))), 0) ->appendFrom(array_to_rows([['id' => 'x']], schema(str_schema('id'))), 0); } @@ -495,17 +495,17 @@ public function test_refuses_a_view_that_does_not_fit_the_target( $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage($message); - (new RowsBuilder($target, new PhpBackend()))->appendFrom($source, 0); + new RowsBuilder($target, new PhpBackend())->appendFrom($source, 0); } public function test_a_missing_nullable_column_is_padded_with_null(): void { static::assertEquals( array_to_rows([['id' => 1, 'name' => null]], schema(int_schema('id'), str_schema('name', nullable: true))), - (new RowsBuilder( + new RowsBuilder( schema(int_schema('id'), str_schema('name', nullable: true)), new PhpBackend(), - ))->appendRows([['id' => 1]])->finish(), + )->appendRows([['id' => 1]])->finish(), ); } @@ -516,7 +516,7 @@ public function test_a_missing_not_null_column_is_refused_with_its_row(): void 'Rows do not match their schema: column "name" (row 1) declared by the schema is missing from the row', ); - (new RowsBuilder(schema(int_schema('id'), str_schema('name')), new PhpBackend()))->appendRows([ + new RowsBuilder(schema(int_schema('id'), str_schema('name')), new PhpBackend())->appendRows([ ['id' => 1, 'name' => 'a'], ['id' => 2], ]); @@ -529,7 +529,7 @@ public function test_a_refused_value_in_the_first_row_reports_row_zero(): void 'Rows do not match their schema: column "i" (row 0): could not convert \'abc\' (string) to integer', ); - (new RowsBuilder(schema(int_schema('i')), new PhpBackend()))->appendRows([['i' => 'abc']]); + new RowsBuilder(schema(int_schema('i')), new PhpBackend())->appendRows([['i' => 'abc']]); } public function test_a_refused_value_is_reported_with_its_column_and_row(): void @@ -539,7 +539,7 @@ public function test_a_refused_value_is_reported_with_its_column_and_row(): void 'Rows do not match their schema: column "i" (row 1): could not convert \'n/a\' (string) to integer', ); - (new RowsBuilder(schema(int_schema('i')), new PhpBackend()))->appendRows([ + new RowsBuilder(schema(int_schema('i')), new PhpBackend())->appendRows([ ['i' => 1], ['i' => 'n/a'], ['i' => 3], @@ -564,7 +564,7 @@ public function test_a_null_on_a_not_null_column_is_reported_as_a_value_that_doe 'Rows do not match their schema: column "i" (row 0): could not convert null to integer, column is not nullable', ); - (new RowsBuilder(schema(int_schema('i')), new PhpBackend()))->appendRows([['i' => null]]); + new RowsBuilder(schema(int_schema('i')), new PhpBackend())->appendRows([['i' => null]]); } public function test_a_value_the_schema_does_not_declare_is_dropped(): void @@ -572,7 +572,7 @@ public function test_a_value_the_schema_does_not_declare_is_dropped(): void static::assertSame( ['id'], array_keys( - (new RowsBuilder(schema(int_schema('id')), new PhpBackend())) + new RowsBuilder(schema(int_schema('id')), new PhpBackend()) ->appendRows([['id' => 1, 'undeclared' => 'x']]) ->finish() ->values(0), @@ -584,7 +584,7 @@ public function test_rows_follow_the_schema_column_order(): void { static::assertSame( [['id' => 1, 'name' => 'a']], - (new RowsBuilder(schema(int_schema('id'), str_schema('name')), new PhpBackend())) + new RowsBuilder(schema(int_schema('id'), str_schema('name')), new PhpBackend()) ->appendRows([['name' => 'a', 'id' => 1]]) ->finish() ->toArray(), @@ -595,7 +595,7 @@ public function test_every_value_is_cast_against_its_own_column(): void { static::assertEquals( array_to_rows([['id' => 1, 'name' => '2']], schema(int_schema('id'), str_schema('name'))), - (new RowsBuilder(schema(int_schema('id'), str_schema('name')), new PhpBackend()))->appendRows([[ + new RowsBuilder(schema(int_schema('id'), str_schema('name')), new PhpBackend())->appendRows([[ 'id' => '1', 'name' => 2, ]])->finish(), @@ -617,7 +617,7 @@ public function test_append_from_fills_the_columns_after_a_missing_one(): void { static::assertSame( [['a' => null, 'b' => 5]], - (new RowsBuilder(schema(int_schema('a', nullable: true), int_schema('b')), new PhpBackend())) + new RowsBuilder(schema(int_schema('a', nullable: true), int_schema('b')), new PhpBackend()) ->appendFrom(array_to_rows([['b' => 5]], schema(int_schema('b'))), 0) ->finish() ->toArray(), @@ -628,7 +628,7 @@ public function test_append_from_keeps_a_shared_column_beside_a_retyped_one(): v { static::assertSame( [['a' => 1, 'b' => 2]], - (new RowsBuilder(schema(int_schema('a'), int_schema('b', nullable: true)), new PhpBackend())) + new RowsBuilder(schema(int_schema('a'), int_schema('b', nullable: true)), new PhpBackend()) ->appendFrom(array_to_rows([['a' => 1, 'b' => 2]], schema(int_schema('a'), int_schema('b'))), 0) ->finish() ->toArray(), @@ -642,7 +642,7 @@ public function test_append_from_names_the_first_column_the_schema_does_not_decl 'Rows do not match their schema: column "c" (row 0) is not declared by the schema', ); - (new RowsBuilder(schema(int_schema('a')), new PhpBackend()))->appendFrom( + new RowsBuilder(schema(int_schema('a')), new PhpBackend())->appendFrom( array_to_rows([['a' => 1, 'c' => 2, 'd' => 3]], schema(int_schema('a'), int_schema('c'), int_schema('d'))), 0, ); @@ -650,7 +650,7 @@ public function test_append_from_names_the_first_column_the_schema_does_not_decl public function test_appending_no_rows_changes_nothing(): void { - static::assertSame(0, (new RowsBuilder(schema(int_schema('id')), new PhpBackend()))->appendRows([])->count()); + static::assertSame(0, new RowsBuilder(schema(int_schema('id')), new PhpBackend())->appendRows([])->count()); } public function test_copies_physical_cells_from_another_batch(): void @@ -668,7 +668,7 @@ public function test_copies_physical_cells_from_another_batch(): void static::assertSame( [['id' => 2, 'name' => 'b'], ['id' => 2, 'name' => 'b'], ['id' => 1, 'name' => 'a']], - (new RowsBuilder(schema(int_schema('id'), str_schema('name')), new PhpBackend())) + new RowsBuilder(schema(int_schema('id'), str_schema('name')), new PhpBackend()) ->appendFrom($source, 1) ->appendTake($source, [1, 0]) ->finish() @@ -690,7 +690,7 @@ public function test_an_unknown_column_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('RowsBuilder has no column "nope"'); - (new RowsBuilder(schema(int_schema('id')), new PhpBackend()))->column('nope'); + new RowsBuilder(schema(int_schema('id')), new PhpBackend())->column('nope'); } public function test_ragged_columns_are_refused_at_finish(): void @@ -715,7 +715,7 @@ public function test_append_rows_refuses(Schema $schema, array $rows, string $ex $this->expectException($exception); $this->expectExceptionMessage($message); - (new RowsBuilder($schema, new PhpBackend())) + new RowsBuilder($schema, new PhpBackend()) ->appendRows($rows) ->finish(); } @@ -727,12 +727,12 @@ public function test_append_rows_refuses_a_definition_outside_the_nineteen(): vo 'Row does not match its schema: column "a": throwing cannot be a batch column, only the 19 Flow definitions have a column kind', ); - (new RowsBuilder( + new RowsBuilder( schema( new ForeignTypeDefinition('a', new ThrowingType(new LogicException('stub type refuses everything'))), ), new PhpBackend(), - ))->appendRows([['a' => [1, 2]]]); + )->appendRows([['a' => [1, 2]]]); } public function test_append_rows_refuses_a_structure_missing_a_required_element(): void @@ -740,18 +740,18 @@ public function test_append_rows_refuses_a_structure_missing_a_required_element( $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('Rows do not match their schema: column "data" (row 0)'); - (new RowsBuilder( + new RowsBuilder( schema(structure_schema('data', type_structure(['id' => type_integer(), 'name' => type_string()]))), new PhpBackend(), - ))->appendRows([['data' => ['id' => 1]]]); + )->appendRows([['data' => ['id' => 1]]]); } public function test_append_rows_casts_datetime_and_uuid_strings(): void { - $rows = (new RowsBuilder( + $rows = new RowsBuilder( schema(datetime_schema('created_at'), uuid_schema('uuid')), new PhpBackend(), - ))->appendRows([[ + )->appendRows([[ 'created_at' => '2024-01-01 12:00:00 UTC', 'uuid' => 'f47ac10b-58cc-4372-a567-0e02b2c3d479', ]])->finish(); @@ -768,10 +768,10 @@ public function test_append_rows_casts_raw_scalar_strings_to_schema_types(): voi { static::assertSame( [['id' => 1, 'price' => 9.99, 'active' => true, 'name' => 'Alice']], - (new RowsBuilder( + new RowsBuilder( schema(int_schema('id'), float_schema('price'), bool_schema('active'), str_schema('name')), new PhpBackend(), - )) + ) ->appendRows([['id' => '1', 'price' => '9.99', 'active' => 'true', 'name' => 'Alice']]) ->finish() ->toArray(), @@ -782,7 +782,7 @@ public function test_append_rows_keeps_native_typed_values(): void { static::assertSame( [['id' => 1, 'name' => 'Alice'], ['id' => 2, 'name' => 'Bob']], - (new RowsBuilder(schema(int_schema('id'), str_schema('name')), new PhpBackend())) + new RowsBuilder(schema(int_schema('id'), str_schema('name')), new PhpBackend()) ->appendRows([['id' => 1, 'name' => 'Alice'], ['id' => 2, 'name' => 'Bob']]) ->finish() ->toArray(), @@ -792,7 +792,7 @@ public function test_append_rows_keeps_native_typed_values(): void public function test_append_rows_keeps_native_uuid_value_objects(): void { // @mago-ignore analysis:mixed-assignment - $value = (new RowsBuilder(schema(uuid_schema('id')), new PhpBackend())) + $value = new RowsBuilder(schema(uuid_schema('id')), new PhpBackend()) ->appendRows([['id' => new Uuid('f47ac10b-58cc-4372-a567-0e02b2c3d479')]]) ->finish() ->column('id') @@ -804,10 +804,10 @@ public function test_append_rows_keeps_native_uuid_value_objects(): void public function test_append_rows_keeps_the_schema_definition_of_a_null_value(): void { - $rows = (new RowsBuilder( + $rows = new RowsBuilder( schema(int_schema('id'), str_schema('name', nullable: true)), new PhpBackend(), - ))->appendRows([['id' => 1, 'name' => null]])->finish(); + )->appendRows([['id' => 1, 'name' => null]])->finish(); static::assertNull($rows->column('name')->value(0)); static::assertTrue($rows->schema()->get('name')->isNullable()); @@ -819,7 +819,7 @@ public function test_append_rows_shares_the_declared_schema_instance(): void static::assertSame( $schema, - (new RowsBuilder($schema, new PhpBackend())) + new RowsBuilder($schema, new PhpBackend()) ->appendRows([['id' => 1], ['id' => 2]]) ->finish() ->schema(), @@ -830,10 +830,10 @@ public function test_append_rows_does_not_cast_native_values(): void { $createdAt = new DateTimeImmutable('2024-01-01 12:00:00 UTC'); - $rows = (new RowsBuilder( + $rows = new RowsBuilder( schema(int_schema('id'), datetime_schema('created_at')), new PhpBackend(), - ))->appendRows([['id' => 1, 'created_at' => $createdAt]])->finish(); + )->appendRows([['id' => 1, 'created_at' => $createdAt]])->finish(); static::assertSame(1, $rows->column('id')->value(0)); static::assertEquals($createdAt, $rows->column('created_at')->value(0)); @@ -841,14 +841,14 @@ public function test_append_rows_does_not_cast_native_values(): void public function test_append_rows_does_not_cast_nested_list_map_and_structure(): void { - $rows = (new RowsBuilder( + $rows = new RowsBuilder( schema( list_schema('tags', type_list(type_string())), map_schema('counts', type_map(type_string(), type_integer())), structure_schema('address', type_structure(['city' => type_string(), 'zip' => type_integer()])), ), new PhpBackend(), - ))->appendRows([[ + )->appendRows([[ 'tags' => ['a', 'b'], 'counts' => ['x' => 1, 'y' => 2], 'address' => ['city' => 'NYC', 'zip' => 10001], @@ -865,7 +865,7 @@ public function test_append_rows_does_not_cast_nested_list_map_and_structure(): public function test_append_rows_of_already_typed_values_is_idempotent(): void { $schema = schema(int_schema('id'), str_schema('name'), datetime_schema('created_at')); - $rows = (new RowsBuilder($schema, new PhpBackend()))->appendRows([[ + $rows = new RowsBuilder($schema, new PhpBackend())->appendRows([[ 'id' => 1, 'name' => 'Alice', 'created_at' => new DateTimeImmutable('2024-01-01 00:00:00 UTC'), @@ -873,7 +873,7 @@ public function test_append_rows_of_already_typed_values_is_idempotent(): void static::assertEquals( $rows, - (new RowsBuilder($schema, new PhpBackend()))->appendRows([$rows->values(0)])->finish(), + new RowsBuilder($schema, new PhpBackend())->appendRows([$rows->values(0)])->finish(), ); } @@ -881,7 +881,7 @@ public function test_a_present_null_and_an_absent_key_are_both_null(): void { static::assertSame( [['id' => 1, 'name' => null], ['id' => 2, 'name' => null], ['id' => 3, 'name' => 'c']], - (new RowsBuilder(schema(int_schema('id'), str_schema('name', nullable: true)), new PhpBackend())) + new RowsBuilder(schema(int_schema('id'), str_schema('name', nullable: true)), new PhpBackend()) ->appendRows([['id' => 1, 'name' => null], ['id' => 2], ['id' => 3, 'name' => 'c']]) ->finish() ->toArray(), @@ -893,7 +893,7 @@ public function test_a_refused_value_in_a_column_every_row_carries_is_placed_at_ $this->expectException(SchemaMismatchException::class); $this->expectExceptionMessage('column "id" (row 3): could not convert \'x\' (string) to integer'); - (new RowsBuilder(schema(int_schema('id')), new PhpBackend()))->appendRows([['id' => 1]])->appendRows([ + new RowsBuilder(schema(int_schema('id')), new PhpBackend())->appendRows([['id' => 1]])->appendRows([ ['id' => 2], ['id' => 3], ['id' => 'x'], @@ -904,7 +904,7 @@ public function test_append_records_takes_a_single_record(): void { static::assertSame( [['id' => 1]], - (new RowsBuilder(schema(int_schema('id')), new PhpBackend())) + new RowsBuilder(schema(int_schema('id')), new PhpBackend()) ->appendRecords(['id' => 1]) ->finish() ->toArray(), @@ -915,7 +915,7 @@ public function test_append_records_takes_a_list_of_records(): void { static::assertSame( [['id' => 1], ['id' => 2]], - (new RowsBuilder(schema(int_schema('id')), new PhpBackend())) + new RowsBuilder(schema(int_schema('id')), new PhpBackend()) ->appendRecords([['id' => 1], ['id' => 2]]) ->finish() ->toArray(), @@ -926,7 +926,7 @@ public function test_append_records_matches_a_numeric_string_key_to_its_declared { static::assertSame( [1], - (new RowsBuilder(schema(int_schema('2024')), new PhpBackend())) + new RowsBuilder(schema(int_schema('2024')), new PhpBackend()) ->appendRecords([['2024' => 1]]) ->finish() ->column('2024') @@ -941,14 +941,14 @@ public function test_append_records_of_keyed_records_refuses_an_undeclared_key() 'Rows do not match their schema: column "bad" (row 0) is not declared by the schema', ); - (new RowsBuilder(schema(int_schema('id')), new PhpBackend()))->appendRecords(['first' => ['bad' => 1]]); + new RowsBuilder(schema(int_schema('id')), new PhpBackend())->appendRecords(['first' => ['bad' => 1]]); } public function test_a_name_that_is_not_a_positional_name_takes_no_int_key(): void { static::assertSame( [['e5' => null]], - (new RowsBuilder(schema(int_schema('e5', true)), new PhpBackend())) + new RowsBuilder(schema(int_schema('e5', true)), new PhpBackend()) ->appendRows([[5 => 7]]) ->finish() ->toArray(), @@ -958,7 +958,7 @@ public function test_a_name_that_is_not_a_positional_name_takes_no_int_key(): vo public function test_append_records_refuses_an_undeclared_key_at_its_row(): void { try { - (new RowsBuilder(schema(int_schema('id')), new PhpBackend()))->appendRecords([ + new RowsBuilder(schema(int_schema('id')), new PhpBackend())->appendRecords([ ['id' => 1], ['id' => 2, 'nmae' => 'two'], ]); @@ -972,7 +972,7 @@ public function test_append_records_refuses_an_undeclared_key_at_its_row(): void public function test_append_records_refuses_an_undeclared_key_at_its_row_after_a_prior_append(): void { try { - (new RowsBuilder(schema(int_schema('id')), new PhpBackend()))->appendRecords([ + new RowsBuilder(schema(int_schema('id')), new PhpBackend())->appendRecords([ ['id' => 1], ['id' => 2], ])->appendRecords([['id' => 3, 'nmae' => 'three']]); @@ -986,7 +986,7 @@ public function test_an_int_key_fills_the_not_null_column_named_by_its_position( { static::assertSame( [['e00' => 'a']], - (new RowsBuilder(schema(str_schema('e00')), new PhpBackend())) + new RowsBuilder(schema(str_schema('e00')), new PhpBackend()) ->appendRows([['a', 'b']]) ->finish() ->toArray(), @@ -997,7 +997,7 @@ public function test_a_numeric_column_name_keeps_its_declared_name(): void { static::assertSame( [1], - (new RowsBuilder(schema(int_schema('2024')), new PhpBackend())) + new RowsBuilder(schema(int_schema('2024')), new PhpBackend()) ->appendRows([['2024' => 1, 'other' => 2]]) ->finish() ->column('2024') diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/RowsTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/RowsTest.php index 5f2653ca08..f4a5363cf3 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/RowsTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/RowsTest.php @@ -721,7 +721,7 @@ public function test_from_rows_reorders_and_hops_into_the_column_zone(): void public function test_of_takes_columns_verbatim(): void { $schema = schema(int_schema('number')); - $column = (new PhpBackend())->constant(int_schema('number'), 1, 2); + $column = new PhpBackend()->constant(int_schema('number'), 1, 2); $rows = Rows::fromColumns($schema, ['number' => $column], 2); static::assertSame($column, $rows->column('number')); @@ -733,7 +733,7 @@ public function test_of_checks_names_and_counts_only(): void // a column of another type passes the structural tier - values are checked where they enter a column $rows = Rows::fromColumns( schema(str_schema('id')), - ['id' => (new PhpBackend())->constant(int_schema('id'), 1, 1)], + ['id' => new PhpBackend()->constant(int_schema('id'), 1, 1)], 1, ); @@ -747,7 +747,7 @@ public function test_of_refuses_other_column_names(): void Rows::fromColumns( schema(int_schema('id')), - ['other' => (new PhpBackend())->constant(int_schema('other'), 1, 1)], + ['other' => new PhpBackend()->constant(int_schema('other'), 1, 1)], 1, ); } @@ -757,7 +757,7 @@ public function test_of_refuses_a_column_of_another_count(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Column "id" holds 2 rows, the batch 1'); - Rows::fromColumns(schema(int_schema('id')), ['id' => (new PhpBackend())->constant(int_schema('id'), 1, 2)], 1); + Rows::fromColumns(schema(int_schema('id')), ['id' => new PhpBackend()->constant(int_schema('id'), 1, 2)], 1); } public function test_of_refuses_a_null_in_a_not_null_column(): void @@ -791,7 +791,7 @@ public function test_project_shares_kept_columns(): void public function test_concat_of_mixed_column_classes_rebuilds_in_the_given_backend(): void { $schema = schema(int_schema('id')); - $constant = Rows::fromColumns($schema, ['id' => (new PhpBackend())->constant(int_schema('id'), 7, 2)], 2); + $constant = Rows::fromColumns($schema, ['id' => new PhpBackend()->constant(int_schema('id'), 7, 2)], 2); $concatenated = Rows::concat( $constant->schema(), new PhpBackend(), @@ -812,7 +812,7 @@ public function test_concat_of_three_mixed_parts_keeps_every_part(): void Rows::concat( $schema, new PhpBackend(), - Rows::fromColumns($schema, ['id' => (new PhpBackend())->constant(int_schema('id'), 7, 1)], 1), + Rows::fromColumns($schema, ['id' => new PhpBackend()->constant(int_schema('id'), 7, 1)], 1), array_to_rows([['id' => 1]], $schema, new PhpBackend()), array_to_rows([['id' => 2]], $schema, new PhpBackend()), )->toArray(), @@ -949,7 +949,7 @@ public function test_match_to_reports_the_first_null_under_not_null(): void public function test_match_to_restamps_a_provable_change_without_reading_values(): void { - $spy = new SpyColumn((new PhpBackend())->constant(int_schema('id'), 1, 2)); + $spy = new SpyColumn(new PhpBackend()->constant(int_schema('id'), 1, 2)); static::assertTrue( Rows::fromColumns(schema(int_schema('id')), ['id' => $spy], 2) @@ -999,14 +999,14 @@ public function test_with_columns_beside_a_constant_column(): void $rows = Rows::fromColumns( schema(int_schema('id'), str_schema('tag')), [ - 'id' => (new PhpBackend())->constant(int_schema('id'), 1, 2), - 'tag' => (new PhpBackend())->constant(str_schema('tag'), 'a', 2), + 'id' => new PhpBackend()->constant(int_schema('id'), 1, 2), + 'tag' => new PhpBackend()->constant(str_schema('tag'), 'a', 2), ], 2, ); - $builder = (new PhpBackend())->builder(str_schema('tag')); + $builder = new PhpBackend()->builder(str_schema('tag')); $builder->appendMany(['x', 'y']); - $n = (new PhpBackend())->builder(int_schema('n')); + $n = new PhpBackend()->builder(int_schema('n')); $n->appendMany([5, 6]); static::assertSame( @@ -1056,7 +1056,7 @@ public function test_with_columns_refuses_a_column_of_another_count(): void array_to_rows([['id' => 1], ['id' => 2]], schema(int_schema('id')))->withColumns( schema(int_schema('id'), int_schema('n')), - ['n' => (new PhpBackend())->constant(int_schema('n'), 1, 1)], + ['n' => new PhpBackend()->constant(int_schema('n'), 1, 1)], ); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/BooleanDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/BooleanDefinitionTest.php index a3da184c9b..6f15ce62f4 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/BooleanDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/BooleanDefinitionTest.php @@ -86,7 +86,7 @@ public function test_does_not_match_a_null_entry_when_not_nullable(): void public function test_is_not_nullable_by_default(): void { - static::assertFalse((new BooleanDefinition('col'))->isNullable()); + static::assertFalse(new BooleanDefinition('col')->isNullable()); } public function test_does_not_match_entry_with_different_type(): void diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/DateDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/DateDefinitionTest.php index 0fa1942bbd..f194439670 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/DateDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/DateDefinitionTest.php @@ -26,7 +26,7 @@ final class DateDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new DateDefinition('a'))->isNullable()); + static::assertFalse(new DateDefinition('a')->isNullable()); } public static function provideIsCompatibleCases(): Generator diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/DateTimeDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/DateTimeDefinitionTest.php index 99a21301aa..d24d2efbf6 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/DateTimeDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/DateTimeDefinitionTest.php @@ -25,7 +25,7 @@ final class DateTimeDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new DateTimeDefinition('a'))->isNullable()); + static::assertFalse(new DateTimeDefinition('a')->isNullable()); } public static function provideIsCompatibleCases(): Generator diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/ElementCompatibilityTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/ElementCompatibilityTest.php index f875cf8625..362ddd618d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/ElementCompatibilityTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/ElementCompatibilityTest.php @@ -98,6 +98,6 @@ public static function provideCases(): Generator #[DataProvider('provideCases')] public function test_element_compatibility(Type $declared, Type $given, bool $expected): void { - static::assertSame($expected, (new ElementCompatibility())->isCompatible('data.element', $declared, $given)); + static::assertSame($expected, new ElementCompatibility()->isCompatible('data.element', $declared, $given)); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/EnumDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/EnumDefinitionTest.php index e2f0c724e1..6794b6dcdd 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/EnumDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/EnumDefinitionTest.php @@ -27,7 +27,7 @@ final class EnumDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new EnumDefinition('a', BasicEnum::class))->isNullable()); + static::assertFalse(new EnumDefinition('a', BasicEnum::class)->isNullable()); } public static function provideIsCompatibleCases(): Generator diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/FloatDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/FloatDefinitionTest.php index f12449740b..3d9ee33600 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/FloatDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/FloatDefinitionTest.php @@ -23,7 +23,7 @@ final class FloatDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new FloatDefinition('a'))->isNullable()); + static::assertFalse(new FloatDefinition('a')->isNullable()); } public static function provideIsCompatibleCases(): Generator diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/HTMLDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/HTMLDefinitionTest.php index 3e649e3969..642ac43e8b 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/HTMLDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/HTMLDefinitionTest.php @@ -12,7 +12,6 @@ use Flow\ETL\Values\Schema\Metadata; use Generator; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RequiresPhp; use function Flow\ETL\DSL\bool_schema; use function Flow\ETL\DSL\html_schema; @@ -24,7 +23,7 @@ final class HTMLDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new HTMLDefinition('a'))->isNullable()); + static::assertFalse(new HTMLDefinition('a')->isNullable()); } public static function provideIsCompatibleCases(): Generator @@ -91,7 +90,6 @@ public function test_does_not_match_a_null_entry_when_not_nullable(): void static::assertFalse(html_schema('col')->matches(null)); } - #[RequiresPhp('>= 8.4.0')] public function test_does_not_match_entry_with_different_type(): void { static::assertFalse(html_schema('col')->matches(1)); @@ -143,7 +141,6 @@ public function test_make_nullable(): void static::assertFalse($def->isNullable()); } - #[RequiresPhp('>= 8.4.0')] public function test_matches_entry_with_same_name_and_type(): void { static::assertTrue(html_schema('content')->matches(type_html()->cast( @@ -213,7 +210,6 @@ public function test_nullable_matches_null(): void static::assertTrue(html_schema('col', true)->matches(null)); } - #[RequiresPhp('>= 8.4.0')] public function test_nullable_matches_an_entry_with_a_non_null_value_of_its_type(): void { static::assertTrue(html_schema('col', true)->matches(type_html()->cast( diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/HTMLElementDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/HTMLElementDefinitionTest.php index bb6eb70e73..c3a621e872 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/HTMLElementDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/HTMLElementDefinitionTest.php @@ -12,7 +12,6 @@ use Flow\ETL\Values\Schema\Metadata; use Generator; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RequiresPhp; use function Flow\ETL\DSL\bool_schema; use function Flow\ETL\DSL\html_element_schema; @@ -24,7 +23,7 @@ final class HTMLElementDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new HTMLElementDefinition('a'))->isNullable()); + static::assertFalse(new HTMLElementDefinition('a')->isNullable()); } public static function provideIsCompatibleCases(): Generator @@ -91,7 +90,6 @@ public function test_does_not_match_a_null_entry_when_not_nullable(): void static::assertFalse(html_element_schema('col')->matches(null)); } - #[RequiresPhp('>= 8.4.0')] public function test_does_not_match_entry_with_different_type(): void { static::assertFalse(html_element_schema('col')->matches(1)); @@ -143,7 +141,6 @@ public function test_make_nullable(): void static::assertFalse($def->isNullable()); } - #[RequiresPhp('>= 8.4.0')] public function test_matches_entry_with_same_name_and_type(): void { static::assertTrue(html_element_schema('element')->matches(type_html_element()->cast('
content
'))); @@ -214,7 +211,6 @@ public function test_nullable_matches_null(): void static::assertTrue(html_element_schema('col', true)->matches(null)); } - #[RequiresPhp('>= 8.4.0')] public function test_nullable_matches_an_entry_with_a_non_null_value_of_its_type(): void { static::assertTrue(html_element_schema('col', true)->matches(type_html_element()->cast('
content
'))); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/JsonDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/JsonDefinitionTest.php index 375cc03e76..dfb0414609 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/JsonDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/JsonDefinitionTest.php @@ -25,7 +25,7 @@ final class JsonDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new JsonDefinition('a'))->isNullable()); + static::assertFalse(new JsonDefinition('a')->isNullable()); } public static function provideIsCompatibleCases(): Generator diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/ListDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/ListDefinitionTest.php index 04dd3da3ec..8fda81d3bb 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/ListDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/ListDefinitionTest.php @@ -33,19 +33,19 @@ final class ListDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new ListDefinition('a', type_list(type_integer())))->isNullable()); + static::assertFalse(new ListDefinition('a', type_list(type_integer()))->isNullable()); } public function test_a_list_of_another_name_is_not_compatible(): void { - static::assertFalse((new ListDefinition('a', type_list(type_integer())))->isCompatible( + static::assertFalse(new ListDefinition('a', type_list(type_integer()))->isCompatible( new ListDefinition('b', type_list(type_integer())), )); } public function test_a_list_of_optional_elements_is_compatible_with_itself(): void { - static::assertTrue((new ListDefinition('a', type_list(type_optional(type_integer()))))->isCompatible( + static::assertTrue(new ListDefinition('a', type_list(type_optional(type_integer())))->isCompatible( new ListDefinition('a', type_list(type_optional(type_integer()))), )); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/MapDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/MapDefinitionTest.php index aa73ae0c47..72726ff23e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/MapDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/MapDefinitionTest.php @@ -32,22 +32,21 @@ final class MapDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new MapDefinition('a', type_map(type_string(), type_integer())))->isNullable()); + static::assertFalse(new MapDefinition('a', type_map(type_string(), type_integer()))->isNullable()); } public function test_a_map_of_another_name_is_not_compatible(): void { - static::assertFalse((new MapDefinition('a', type_map(type_string(), type_integer())))->isCompatible( + static::assertFalse(new MapDefinition('a', type_map(type_string(), type_integer()))->isCompatible( new MapDefinition('b', type_map(type_string(), type_integer())), )); } public function test_a_map_of_optional_values_is_compatible_with_itself(): void { - static::assertTrue((new MapDefinition('a', type_map( - type_string(), - type_optional(type_integer()), - )))->isCompatible(new MapDefinition('a', type_map(type_string(), type_optional(type_integer()))))); + static::assertTrue(new MapDefinition('a', type_map(type_string(), type_optional(type_integer())))->isCompatible( + new MapDefinition('a', type_map(type_string(), type_optional(type_integer()))), + )); } public static function provideIsCompatibleCases(): Generator diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/StructureDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/StructureDefinitionTest.php index 5c8db93b0c..9cb0f8b86f 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/StructureDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/StructureDefinitionTest.php @@ -34,15 +34,15 @@ final class StructureDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new StructureDefinition('a', type_structure(['id' => type_integer()])))->isNullable()); + static::assertFalse(new StructureDefinition('a', type_structure(['id' => type_integer()]))->isNullable()); } public function test_an_absent_optional_element_does_not_skip_the_elements_after_it(): void { - static::assertFalse((new StructureDefinition('s', type_structure([ + static::assertFalse(new StructureDefinition('s', type_structure([ 'a' => structure_element('a', type_integer(), optional: true), 'b' => type_integer(), - ])))->isCompatible(new StructureDefinition('s', type_structure(['b' => type_string()])))); + ]))->isCompatible(new StructureDefinition('s', type_structure(['b' => type_string()])))); } public static function provideIsCompatibleCases(): Generator diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/TimeDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/TimeDefinitionTest.php index af2716349e..e2ade20161 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/TimeDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/TimeDefinitionTest.php @@ -26,7 +26,7 @@ final class TimeDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new TimeDefinition('a'))->isNullable()); + static::assertFalse(new TimeDefinition('a')->isNullable()); } public static function provideIsCompatibleCases(): Generator diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/TimeZoneDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/TimeZoneDefinitionTest.php index af7cc1cf9e..632f32111a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/TimeZoneDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/TimeZoneDefinitionTest.php @@ -24,7 +24,7 @@ final class TimeZoneDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new TimeZoneDefinition('a'))->isNullable()); + static::assertFalse(new TimeZoneDefinition('a')->isNullable()); } public static function provide_is_compatible_cases(): Generator diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/TypeProjectionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/TypeProjectionTest.php index 705f6c3bb9..53fc852dd6 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/TypeProjectionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/TypeProjectionTest.php @@ -37,7 +37,7 @@ public function test_array_and_empty_array_are_both_projected(): void static::assertSame( 'structure{a: json, b: list, c: map}', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->structure($type) ->toString(), ); @@ -45,7 +45,7 @@ public function test_array_and_empty_array_are_both_projected(): void public function test_array_leaf_is_projected_to_json(): void { - static::assertEquals(type_json(), (new TypeProjection(ref('col')->name()))->project(type_array())); + static::assertEquals(type_json(), new TypeProjection(ref('col')->name())->project(type_array())); } public function test_deeply_nested_array_is_projected(): void @@ -58,7 +58,7 @@ public function test_deeply_nested_array_is_projected(): void static::assertSame( 'structure{a: list, b: map}', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->structure($type) ->toString(), ); @@ -74,7 +74,7 @@ public function test_deeply_nested_empty_array_is_projected(): void static::assertSame( 'structure{a: list, b: map}', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->structure($type) ->toString(), ); @@ -82,14 +82,14 @@ public function test_deeply_nested_empty_array_is_projected(): void public function test_empty_array_leaf_is_projected_to_json(): void { - static::assertEquals(type_json(), (new TypeProjection(ref('col')->name()))->project(type_empty_array())); + static::assertEquals(type_json(), new TypeProjection(ref('col')->name())->project(type_empty_array())); } public function test_list_array_element_is_projected(): void { static::assertSame( 'list', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->list(type_list(type_array())) ->toString(), ); @@ -99,7 +99,7 @@ public function test_list_element_is_projected(): void { static::assertSame( 'list', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->list(type_list(type_empty_array())) ->toString(), ); @@ -109,14 +109,14 @@ public function test_list_without_empty_array_is_returned_untouched(): void { $list = type_list(type_integer()); - static::assertSame($list, (new TypeProjection(ref('col')->name()))->list($list)); + static::assertSame($list, new TypeProjection(ref('col')->name())->list($list)); } public function test_map_array_value_is_projected(): void { static::assertSame( 'map', - (new TypeProjection(ref('col')->name()))->map(type_map(type_integer(), type_array()))->toString(), + new TypeProjection(ref('col')->name())->map(type_map(type_integer(), type_array()))->toString(), ); } @@ -124,7 +124,7 @@ public function test_map_value_is_projected(): void { static::assertSame( 'map', - (new TypeProjection(ref('col')->name()))->map(type_map(type_integer(), type_empty_array()))->toString(), + new TypeProjection(ref('col')->name())->map(type_map(type_integer(), type_empty_array()))->toString(), ); } @@ -132,14 +132,14 @@ public function test_map_without_empty_array_is_returned_untouched(): void { $map = type_map(type_integer(), type_string()); - static::assertSame($map, (new TypeProjection(ref('col')->name()))->map($map)); + static::assertSame($map, new TypeProjection(ref('col')->name())->map($map)); } public function test_optional_array_is_projected_to_optional_json(): void { static::assertSame( '?json', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->project(type_optional(type_array())) ->toString(), ); @@ -149,7 +149,7 @@ public function test_optional_empty_array_is_projected_to_optional_json(): void { static::assertSame( '?json', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->project(type_optional(type_empty_array())) ->toString(), ); @@ -159,14 +159,14 @@ public function test_optional_without_empty_array_is_returned_untouched(): void { $optional = type_optional(type_string()); - static::assertSame($optional, (new TypeProjection(ref('col')->name()))->project($optional)); + static::assertSame($optional, new TypeProjection(ref('col')->name())->project($optional)); } public function test_scalar_type_is_returned_untouched(): void { $string = type_string(); - static::assertSame($string, (new TypeProjection(ref('col')->name()))->project($string)); + static::assertSame($string, new TypeProjection(ref('col')->name())->project($string)); } public function test_structure_array_element_is_projected(): void @@ -176,7 +176,7 @@ public function test_structure_array_element_is_projected(): void static::assertSame( 'structure{data: json}', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->structure($type) ->toString(), ); @@ -189,7 +189,7 @@ public function test_structure_element_is_projected(): void static::assertSame( 'structure{data: json}', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->structure($type) ->toString(), ); @@ -205,7 +205,7 @@ public function test_structure_optional_array_element_is_projected(): void static::assertSame( 'structure{id: integer, data?: json}', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->structure($type) ->toString(), ); @@ -221,7 +221,7 @@ public function test_structure_optional_element_is_projected(): void static::assertSame( 'structure{id: integer, data?: json}', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->structure($type) ->toString(), ); @@ -231,7 +231,7 @@ public function test_interleaved_structure_keeps_every_position_and_flag(): void { static::assertSame( 'structure{z: integer, a?: json, b: string}', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->structure(new StructureType([ new StructureElement('z', type_integer()), new StructureElement('a', type_array(), optional: true), @@ -246,14 +246,14 @@ public function test_structure_without_empty_array_is_returned_untouched(): void /** @var StructureType> $structure */ $structure = type_structure(['id' => type_integer()]); - static::assertSame($structure, (new TypeProjection(ref('col')->name()))->structure($structure)); + static::assertSame($structure, new TypeProjection(ref('col')->name())->structure($structure)); } public function test_an_optional_union_list_element_becomes_optional(): void { static::assertSame( 'list', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->list(type_list(type_union(type_integer(), type_null()))) ->toString(), ); @@ -263,7 +263,7 @@ public function test_an_optional_union_map_value_becomes_optional(): void { static::assertSame( 'map', - (new TypeProjection(ref('col')->name()))->map(type_map(type_string(), type_union( + new TypeProjection(ref('col')->name())->map(type_map(type_string(), type_union( type_integer(), type_null(), )))->toString(), @@ -274,7 +274,7 @@ public function test_an_optional_union_structure_element_becomes_optional(): voi { static::assertSame( 'structure{x: ?integer}', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->structure(type_structure(['x' => type_union(type_integer(), type_null())])) ->toString(), ); @@ -284,7 +284,7 @@ public function test_an_optional_union_member_is_projected(): void { static::assertSame( 'list', - (new TypeProjection(ref('col')->name())) + new TypeProjection(ref('col')->name()) ->list(type_list(type_union(type_array(), type_null()))) ->toString(), ); @@ -306,7 +306,7 @@ public function test_a_multi_member_union_element_is_refused(): void . '* Declare json_schema(\'col\') when the shape is genuinely dynamic', ); - (new TypeProjection(ref('col')->name()))->list(type_list(type_union(type_integer(), type_string()))); + new TypeProjection(ref('col')->name())->list(type_list(type_union(type_integer(), type_string()))); } public function test_a_union_nested_deeper_is_refused(): void @@ -314,7 +314,7 @@ public function test_a_union_nested_deeper_is_refused(): void $this->expectException(UnsupportedUnionTypeException::class); $this->expectExceptionMessage('Column "col" cannot hold elements of type "integer|string"'); - (new TypeProjection(ref('col')->name()))->structure(type_structure([ + new TypeProjection(ref('col')->name())->structure(type_structure([ 'x' => type_list(type_union(type_integer(), type_string())), ])); } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/UuidDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/UuidDefinitionTest.php index bcfc38c512..449b57280e 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/UuidDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/UuidDefinitionTest.php @@ -23,7 +23,7 @@ final class UuidDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new UuidDefinition('a'))->isNullable()); + static::assertFalse(new UuidDefinition('a')->isNullable()); } public static function provideIsCompatibleCases(): Generator diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/XMLDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/XMLDefinitionTest.php index cf64429e4b..7fe50f39af 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/XMLDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/XMLDefinitionTest.php @@ -23,7 +23,7 @@ final class XMLDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new XMLDefinition('a'))->isNullable()); + static::assertFalse(new XMLDefinition('a')->isNullable()); } public static function provideIsCompatibleCases(): Generator diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/XMLElementDefinitionTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/XMLElementDefinitionTest.php index 7e44b619bb..f349e703af 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/XMLElementDefinitionTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Definition/XMLElementDefinitionTest.php @@ -23,7 +23,7 @@ final class XMLElementDefinitionTest extends FlowTestCase { public function test_is_not_nullable_by_default(): void { - static::assertFalse((new XMLElementDefinition('a'))->isNullable()); + static::assertFalse(new XMLElementDefinition('a')->isNullable()); } public static function provideIsCompatibleCases(): Generator diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/SortingStrategy/MetadataStrategyTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/SortingStrategy/MetadataStrategyTest.php index 9bba852e66..05f4db6b4a 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/SortingStrategy/MetadataStrategyTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/SortingStrategy/MetadataStrategyTest.php @@ -15,7 +15,7 @@ final class MetadataStrategyTest extends FlowTestCase { public function test_equal_metadata_values_order_by_name(): void { - static::assertSame(1, (new MetadataStrategy('k'))->compare( + static::assertSame(1, new MetadataStrategy('k')->compare( Definitions::of('b', type_integer(), metadata: Metadata::fromArray(['k' => 1])), Definitions::of('a', type_integer(), metadata: Metadata::fromArray(['k' => 1])), )); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/SortingStrategy/TypeStrategyTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/SortingStrategy/TypeStrategyTest.php index e0013a6c5c..a88b724c5d 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/SortingStrategy/TypeStrategyTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/SortingStrategy/TypeStrategyTest.php @@ -16,10 +16,10 @@ final class TypeStrategyTest extends FlowTestCase { public function test_descending_order_reverses_the_ascending_one(): void { - $ascending = (new TypeStrategy())->compare(int_schema('a'), str_schema('b')); + $ascending = new TypeStrategy()->compare(int_schema('a'), str_schema('b')); static::assertNotSame(0, $ascending); - static::assertSame(-$ascending, (new TypeStrategy(new TypePriorities(), SortOrder::DESC))->compare( + static::assertSame(-$ascending, new TypeStrategy(new TypePriorities(), SortOrder::DESC)->compare( int_schema('a'), str_schema('b'), )); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Validator/SelectiveValidatorTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Validator/SelectiveValidatorTest.php index 863fe9678d..43c42ab725 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Validator/SelectiveValidatorTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Validator/SelectiveValidatorTest.php @@ -135,13 +135,13 @@ public function test_schema_with_an_extra_entry(): void public function test_schema_with_null_definition(): void { static::assertTrue( - (new SelectiveValidator()) + new SelectiveValidator() ->validate(schema(integer_schema('id', nullable: true)), schema(null_schema('id'))) ->isValid(), ); static::assertFalse( - (new SelectiveValidator()) + new SelectiveValidator() ->validate(schema(integer_schema('id', nullable: true)), schema(string_schema('id', nullable: true))) ->isValid(), ); @@ -150,7 +150,7 @@ public function test_schema_with_null_definition(): void public function test_schema_with_multiple_columns_including_null_definition(): void { static::assertTrue( - (new SelectiveValidator()) + new SelectiveValidator() ->validate( expected: schema(integer_schema('id', nullable: true), string_schema('name')), given: schema(null_schema('id'), string_schema('name')), @@ -159,7 +159,7 @@ public function test_schema_with_multiple_columns_including_null_definition(): v ); static::assertFalse( - (new SelectiveValidator()) + new SelectiveValidator() ->validate( expected: schema(integer_schema('id', nullable: true), string_schema('name', nullable: true)), given: schema(string_schema('id', nullable: true), string_schema('name')), @@ -168,7 +168,7 @@ public function test_schema_with_multiple_columns_including_null_definition(): v ); static::assertFalse( - (new SelectiveValidator()) + new SelectiveValidator() ->validate( expected: schema(integer_schema('id', nullable: true), string_schema('name')), given: schema(string_schema('id', nullable: true), string_schema('name')), @@ -180,7 +180,7 @@ public function test_schema_with_multiple_columns_including_null_definition(): v public function test_schema_with_single_invalid_column(): void { static::assertFalse( - (new SelectiveValidator()) + new SelectiveValidator() ->validate( schema(integer_schema('id'), bool_schema('name'), bool_schema('active')), schema(integer_schema('id'), string_schema('name'), bool_schema('active', true)), @@ -192,7 +192,7 @@ public function test_schema_with_single_invalid_column(): void public function test_null_definition_against_non_nullable_expected(): void { static::assertFalse( - (new SelectiveValidator()) + new SelectiveValidator() ->validate(expected: schema(integer_schema('id')), given: schema(null_schema('id'))) ->isValid(), ); diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Validator/ValidationContextTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Validator/ValidationContextTest.php index fb6b46f56a..e466949448 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Validator/ValidationContextTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Schema/Validator/ValidationContextTest.php @@ -70,7 +70,7 @@ public function test_to_string_renders_full_nested_type_of_deeply_mismatched_def . ' |-- expected: inventory}>>' . ', given: inventory}>>' . "\n", - (new ValidationContext(mismatchedDefinitions: [ + new ValidationContext(mismatchedDefinitions: [ new MismatchedDefinition( map_schema('inventory', type_map(type_string(), type_structure([ 'sku' => type_string(), @@ -81,7 +81,7 @@ public function test_to_string_renders_full_nested_type_of_deeply_mismatched_def 'dimensions' => type_list(type_integer()), ]))), ), - ]))->toString(), + ])->toString(), ); } @@ -95,13 +95,13 @@ public function test_to_string_renders_all_sections_with_nullable_markers(): voi Unexpected Definitions: |-- active - DIFF, (new ValidationContext( + DIFF, new ValidationContext( missingDefinitions: [datetime_schema('deleted_at', nullable: true)], mismatchedDefinitions: [new MismatchedDefinition( string_schema('id', nullable: true), integer_schema('id'), )], unexpectedDefinitions: [bool_schema('active')], - ))->toString()); + )->toString()); } } diff --git a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Sort/RowOrderTest.php b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Sort/RowOrderTest.php index 0ad436304b..32fc1f00c7 100644 --- a/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Sort/RowOrderTest.php +++ b/src/core/etl/tests/Flow/ETL/Tests/Unit/Values/Sort/RowOrderTest.php @@ -53,7 +53,7 @@ final class RowOrderTest extends FlowTestCase { public function test_a_permutation_without_keys_keeps_every_row_in_place(): void { - static::assertSame([0, 1, 2], (new RowOrder([ref('v')->asc()]))->permutation([], 3)); + static::assertSame([0, 1, 2], new RowOrder([ref('v')->asc()])->permutation([], 3)); } public function test_maps_with_the_same_entries_in_another_key_order_tie(): void @@ -63,7 +63,7 @@ public function test_maps_with_the_same_entries_in_another_key_order_tie(): void ['m' => ['b' => 2, 'a' => 1]], ], schema(map_schema('m', type_map(type_string(), type_integer())))); - static::assertSame([false, true], (new RowOrder([ref('m')->asc()]))->ties($rows)); + static::assertSame([false, true], new RowOrder([ref('m')->asc()])->ties($rows)); } public function test_flag_orders_every_markup_json_and_enum_type_by_bytes(): void @@ -334,14 +334,14 @@ public function test_a_key_the_batch_lacks_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Column "c" does not exist'); - (new RowOrder([ref('c')->asc()]))->keys(array_to_rows([['a' => 1]], schema(int_schema('a')))); + new RowOrder([ref('c')->asc()])->keys(array_to_rows([['a' => 1]], schema(int_schema('a')))); } public function test_rows_tie_when_every_column_holds_an_equal_value(): void { static::assertSame( [false, true, false], - (new RowOrder([ref('at')->asc(), ref('n')->asc()]))->ties(array_to_rows( + new RowOrder([ref('at')->asc(), ref('n')->asc()])->ties(array_to_rows( [ ['at' => new DateTimeImmutable('2024-01-01 01:00:00', new DateTimeZone('+01:00')), 'n' => 1], ['at' => new DateTimeImmutable('2024-01-01 00:00:00', new DateTimeZone('UTC')), 'n' => 1], @@ -356,7 +356,7 @@ public function test_nan_ties_with_nan(): void { static::assertSame( [false, true, false], - (new RowOrder([ref('v')->asc()]))->ties(array_to_rows([ + new RowOrder([ref('v')->asc()])->ties(array_to_rows([ ['v' => NAN], ['v' => NAN], ['v' => 1.0], @@ -366,14 +366,14 @@ public function test_nan_ties_with_nan(): void public function test_an_empty_partition_has_no_ties(): void { - static::assertSame([], (new RowOrder([ref('v')->asc()]))->ties(array_to_rows([], schema(float_schema('v'))))); + static::assertSame([], new RowOrder([ref('v')->asc()])->ties(array_to_rows([], schema(float_schema('v'))))); } public function test_lists_tie_by_their_values(): void { static::assertSame( [false, true, false], - (new RowOrder([ref('l')->asc()]))->ties(array_to_rows([ + new RowOrder([ref('l')->asc()])->ties(array_to_rows([ ['l' => [1, 2]], ['l' => [1, 2]], ['l' => [2]], @@ -385,7 +385,7 @@ public function test_lists_of_one_element_type_tie_only_when_equal(): void { static::assertSame( [false, true, false], - (new RowOrder([ref('l')->asc()]))->ties(array_to_rows([ + new RowOrder([ref('l')->asc()])->ties(array_to_rows([ ['l' => [1]], ['l' => [1]], ['l' => [2]], @@ -397,7 +397,7 @@ public function test_xml_elements_of_different_documents_tie_by_their_markup(): { static::assertSame( [false, true, false], - (new RowOrder([ref('e')->asc()]))->ties(array_to_rows([ + new RowOrder([ref('e')->asc()])->ties(array_to_rows([ ['e' => type_xml_element()->cast('

a

')->firstElementChild], ['e' => type_xml_element()->cast('

a

')->firstElementChild], ['e' => type_xml_element()->cast('

b

')->firstElementChild], diff --git a/src/extension/arrow-ext/.github/workflows/release.yml b/src/extension/arrow-ext/.github/workflows/release.yml index b8f9af02d6..1a9330fba6 100644 --- a/src/extension/arrow-ext/.github/workflows/release.yml +++ b/src/extension/arrow-ext/.github/workflows/release.yml @@ -63,7 +63,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.3', '8.4', '8.5', '8.6'] + php: ['8.5', '8.6'] arch: ['x86_64', 'arm64'] ts: ['nts', 'zts'] @@ -169,7 +169,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.3', '8.4', '8.5', '8.6'] + php: ['8.5', '8.6'] ts: ['nts', 'zts'] steps: diff --git a/src/extension/arrow-ext/Cargo.lock b/src/extension/arrow-ext/Cargo.lock index a470a382d2..3c88d0f5f9 100644 --- a/src/extension/arrow-ext/Cargo.lock +++ b/src/extension/arrow-ext/Cargo.lock @@ -684,7 +684,6 @@ dependencies = [ "arrow-schema", "bytes", "ext-php-rs", - "ext-php-rs-build", "parquet", ] diff --git a/src/extension/arrow-ext/composer.json b/src/extension/arrow-ext/composer.json index da1f44d360..6d1b6055dc 100644 --- a/src/extension/arrow-ext/composer.json +++ b/src/extension/arrow-ext/composer.json @@ -5,7 +5,7 @@ "keywords": ["arrow", "parquet", "extension", "rust", "native"], "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "autoload": { "psr-4": { diff --git a/src/extension/flow-php-ext/.github/workflows/release.yml b/src/extension/flow-php-ext/.github/workflows/release.yml index 96815fe71a..9a430e714d 100644 --- a/src/extension/flow-php-ext/.github/workflows/release.yml +++ b/src/extension/flow-php-ext/.github/workflows/release.yml @@ -63,7 +63,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.3', '8.4', '8.5', '8.6'] + php: ['8.5', '8.6'] arch: ['x86_64', 'arm64'] ts: ['nts', 'zts'] @@ -169,7 +169,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.3', '8.4', '8.5', '8.6'] + php: ['8.5', '8.6'] arch: ['x86_64', 'arm64'] ts: ['nts', 'zts'] @@ -288,7 +288,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.3', '8.4', '8.5', '8.6'] + php: ['8.5', '8.6'] ts: ['nts', 'zts'] steps: diff --git a/src/extension/flow-php-ext/Cargo.lock b/src/extension/flow-php-ext/Cargo.lock index 3e2b8f4263..ab4311d36d 100644 --- a/src/extension/flow-php-ext/Cargo.lock +++ b/src/extension/flow-php-ext/Cargo.lock @@ -796,7 +796,6 @@ dependencies = [ "arrow-schema", "bytes", "ext-php-rs", - "ext-php-rs-build", "parquet", ] @@ -812,7 +811,6 @@ dependencies = [ "arrow-select", "bytes", "ext-php-rs", - "ext-php-rs-build", "flow-batch-frame", "flow-column-kernels", "flow-column-text", diff --git a/src/extension/flow-php-ext/Cargo.toml b/src/extension/flow-php-ext/Cargo.toml index 5e817076fd..47b14ba8a3 100644 --- a/src/extension/flow-php-ext/Cargo.toml +++ b/src/extension/flow-php-ext/Cargo.toml @@ -32,9 +32,6 @@ memchr.workspace = true serde.workspace = true serde_json.workspace = true -[build-dependencies] -ext-php-rs-build = "0.2" - [profile.release] strip = true diff --git a/src/extension/flow-php-ext/build.rs b/src/extension/flow-php-ext/build.rs index b813a5668c..f13ef4c289 100644 --- a/src/extension/flow-php-ext/build.rs +++ b/src/extension/flow-php-ext/build.rs @@ -5,29 +5,6 @@ fn main() { let version = extension_version("FLOW_PHP_EXT_VERSION"); println!("cargo:rustc-env=FLOW_PHP_EXT_VERSION={version}"); - - emit_php_version_cfg(); -} - -/// The `php84`/`php85` cfgs ext-php-rs sets for itself, for the same PHP (`PHP` first, then `PATH`): the extension -/// binary is bound to the PHP minor it is built against, so version gates are compile-time. -fn emit_php_version_cfg() { - use ext_php_rs_build::{ - emit_check_cfg, emit_php_cfg_flags, emit_rerun_if_env_changed, find_php, ApiVersion, PHPInfo, - }; - - emit_rerun_if_env_changed(); - emit_check_cfg(); - - let php = find_php().expect("cannot find the php executable"); - let info = PHPInfo::get(&php).expect("cannot read php -i"); - let version: ApiVersion = info - .zend_version() - .expect("cannot read the Zend API version") - .try_into() - .expect("unsupported Zend API version"); - - emit_php_cfg_flags(version); } fn extension_version(env_name: &str) -> String { diff --git a/src/extension/flow-php-ext/composer.json b/src/extension/flow-php-ext/composer.json index 36f7719c31..5635a846b8 100644 --- a/src/extension/flow-php-ext/composer.json +++ b/src/extension/flow-php-ext/composer.json @@ -5,7 +5,7 @@ "keywords": ["serializer", "binary", "extension", "rust", "native", "dataframe"], "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "autoload": { "psr-4": { diff --git a/src/extension/flow-php-ext/src/values.rs b/src/extension/flow-php-ext/src/values.rs index c95b4cf83d..26a7782c61 100644 --- a/src/extension/flow-php-ext/src/values.rs +++ b/src/extension/flow-php-ext/src/values.rs @@ -13,7 +13,6 @@ use crate::exception::ext_exception; extern "C" { fn php_date_instantiate(pce: *mut ext_php_rs::zend::ClassEntry, object: *mut Zval) -> *mut Zval; - #[cfg(php84)] fn php_date_initialize_from_ts_long(dateobj: *mut c_void, sec: i64, usec: c_int); fn php_date_initialize( @@ -159,32 +158,9 @@ pub fn datetime_from_micros(micros: i64, zone: &[u8]) -> Result(), - time_str.len() - 1, - c"U.u".as_ptr(), - std::ptr::null_mut(), - // PHP_DATE_INIT_FORMAT - the flags createFromFormat passes - 0x02, - ) - } - } + unsafe { php_date_initialize_from_ts_long(dateobj, seconds, fraction as c_int) }; + + true }, || { ext_exception(format!( diff --git a/src/extension/flow-php-ext/tests/phpt/120_group_table_lookup_parity.phpt b/src/extension/flow-php-ext/tests/phpt/120_group_table_lookup_parity.phpt index dd602b9c89..0458263901 100644 --- a/src/extension/flow-php-ext/tests/phpt/120_group_table_lookup_parity.phpt +++ b/src/extension/flow-php-ext/tests/phpt/120_group_table_lookup_parity.phpt @@ -48,12 +48,6 @@ $nested = [ ]; foreach ($nested as $label => [$definition, $known, $probed]) { - if ($label === 'html' && !class_exists('\Dom\HTMLDocument')) { - echo "html: same, php columns same\n"; - - continue; - } - $expected = $looked($php, $php, $definition, $known, $probed); echo $label, ': ', $looked($rust, $rust, $definition, $known, $probed) === $expected ? 'same' : 'MISMATCH', diff --git a/src/extension/flow-php-ext/tests/phpt/121_partition_parity.phpt b/src/extension/flow-php-ext/tests/phpt/121_partition_parity.phpt index fc9f063071..bc3f03d5e9 100644 --- a/src/extension/flow-php-ext/tests/phpt/121_partition_parity.phpt +++ b/src/extension/flow-php-ext/tests/phpt/121_partition_parity.phpt @@ -24,7 +24,7 @@ $cases = [ 'a composite key' => [[int_schema('k'), str_schema('s')], [[1, 'a'], [1, 'b'], [2, 'a'], [1, 'a']]], 'maps with nulls' => [[map_schema('k', type_map(type_string(), type_integer()), nullable: true)], [[['a' => 1]], [['b' => 2, 'a' => 1]], [null], [['a' => 1, 'b' => 2]]]], 'xml' => [[xml_schema('k')], [['
'], ['1'], ['']]], - ...(class_exists('\Dom\HTMLDocument') ? ['html' => [[html_schema('k')], [[$html('a')], [$html('b')], [$html('a')]]]] : []), + 'html' => [[html_schema('k')], [[$html('a')], [$html('b')], [$html('a')]]], ]; $partitioned = static function (Backend $partitioner, Backend $columns, array $definitions, array $values, int $buckets, int $offset): array { @@ -57,10 +57,6 @@ foreach ($cases as $label => [$definitions, $values]) { echo $label, ': ', implode(', ', array_unique($outcomes)), "\n"; } -if (!class_exists('\Dom\HTMLDocument')) { - echo "html: same\n"; -} - $empty = array_to_rows([], schema(int_schema('k')), $rust); echo 'empty batch: ', json_encode($rust->partition($empty, [$empty->column('k')], 4, 0)), "\n"; $one = array_to_rows([['k' => 1], ['k' => 2]], schema(int_schema('k')), $rust); diff --git a/src/extension/flow-php-ext/tests/phpt/bootstrap.php b/src/extension/flow-php-ext/tests/phpt/bootstrap.php index c7dbd46967..b6dda8f4c4 100644 --- a/src/extension/flow-php-ext/tests/phpt/bootstrap.php +++ b/src/extension/flow-php-ext/tests/phpt/bootstrap.php @@ -75,7 +75,7 @@ enum_schema('enum', BasicEnum::class), 'b' => structure_element('b', type_optional(type_string()), true), ])), null_schema('null'), - ...class_exists('\Dom\HTMLDocument') ? [html_schema('html')] : [], + html_schema('html'), ); } @@ -112,7 +112,7 @@ function all_types_values(): array 'bool' => false, 'datetime' => '2024-10-27T00:30:00Z', 'date' => '2024-02-29', - 'time' => (new DateTimeImmutable('2024-01-01 01:02:03'))->diff(new DateTimeImmutable('2024-01-01')), + 'time' => new DateTimeImmutable('2024-01-01 01:02:03')->diff(new DateTimeImmutable('2024-01-01')), 'uuid' => '00000000-0000-0000-0000-000000000000', 'json' => '[1,2]', 'enum' => BasicEnum::two, @@ -197,10 +197,8 @@ function all_types_values(): array ], ]; - if (class_exists('\\Dom\\HTMLDocument')) { - foreach ($rows as $index => $row) { - $rows[$index] = $row + ['html' => '

html

']; - } + foreach ($rows as $index => $row) { + $rows[$index] = $row + ['html' => '

html

']; } return $rows; @@ -211,7 +209,7 @@ function all_types_values(): array */ function php_rows(Schema $schema, array $values): Rows { - return (new RowsBuilder($schema, new PhpBackend())) + return new RowsBuilder($schema, new PhpBackend()) ->appendRows($values) ->finish(); } @@ -221,7 +219,7 @@ function php_rows(Schema $schema, array $values): Rows */ function native_rows(Schema $schema, array $values): Rows { - return (new RowsBuilder($schema, new RustBackend())) + return new RowsBuilder($schema, new RustBackend()) ->appendRows($values) ->finish(); } @@ -248,7 +246,7 @@ function comparable(mixed $value): string return $value; } - // @mago-expect analysis:unavailable-method,mixed-method-access,ambiguous-object-property-access + // @mago-expect analysis:mixed-method-access,ambiguous-object-property-access return [ $value::class, $value instanceof Dom\HTMLDocument ? $value->saveHtml() : $value->ownerDocument->saveHtml($value), @@ -273,7 +271,7 @@ function rust_parquet_batches( ): Iterator { $file = new FlowPhpParquetFileReader($stream); - return (new RustParquetOpenSource($file))->batches( + return new RustParquetOpenSource($file)->batches( $schema, $batchSize, ReadPlan::window( @@ -667,7 +665,7 @@ function rust_sniff_column(array $values, Flow\Types\Type\TypeNarrower $typer, b $csv .= '"' . str_replace('"', '""', $value ?? '') . '"' . "\n"; } - return (new RustCSVOpenSource( + return new RustCSVOpenSource( new Flow\Filesystem\Stream\MemorySourceStream($csv), ',', '"', @@ -675,7 +673,7 @@ function rust_sniff_column(array $values, Flow\Types\Type\TypeNarrower $typer, b true, $emptyToNull, false, - ))->sniff([], null, $typer, new Flow\ETL\Foundation\VoidProgress()); + )->sniff([], null, $typer, new Flow\ETL\Foundation\VoidProgress()); } /** @@ -889,9 +887,9 @@ function write_random_type(int $depth): array 4 => (static function () use ($zones): array { return [ Flow\Types\DSL\type_datetime($zones[mt_rand(0, count($zones) - 1)]), - static fn(): DateTimeImmutable => (new DateTimeImmutable( + static fn(): DateTimeImmutable => new DateTimeImmutable( '@' . mt_rand(-3_000_000_000, 5_000_000_000), - ))->modify('+' . mt_rand(0, 999_999) . ' usec'), + )->modify('+' . mt_rand(0, 999_999) . ' usec'), ]; })(), 5 => [ @@ -900,7 +898,7 @@ function write_random_type(int $depth): array ], 6 => [ Flow\Types\DSL\type_time(), - static fn(): DateInterval => (new DateTimeImmutable('@0'))->diff( + static fn(): DateInterval => new DateTimeImmutable('@0')->diff( new DateTimeImmutable('@' . mt_rand(-200_000, 200_000)), ), ], diff --git a/src/extension/parquet-engine/Cargo.toml b/src/extension/parquet-engine/Cargo.toml index 1c5c6a915f..38afa0cbe9 100644 --- a/src/extension/parquet-engine/Cargo.toml +++ b/src/extension/parquet-engine/Cargo.toml @@ -15,6 +15,3 @@ arrow-buffer = "60" arrow-schema = { version = "60", features = ["canonical_extension_types"] } bytes = "1" parquet = { version = "60", default-features = false, features = ["arrow", "arrow_canonical_extension_types", "snap", "flate2", "flate2-zlib-rs", "zstd", "lz4", "brotli", "simdutf8"] } - -[build-dependencies] -ext-php-rs-build = "0.2" diff --git a/src/extension/parquet-engine/build.rs b/src/extension/parquet-engine/build.rs deleted file mode 100644 index 9a0e2073fd..0000000000 --- a/src/extension/parquet-engine/build.rs +++ /dev/null @@ -1,24 +0,0 @@ -fn main() { - emit_php_version_cfg(); -} - -/// The `php84`/`php85` cfgs ext-php-rs sets for itself, for the same PHP (`PHP` first, then `PATH`): the extension -/// binary is bound to the PHP minor it is built against, so version gates are compile-time. -fn emit_php_version_cfg() { - use ext_php_rs_build::{ - emit_check_cfg, emit_php_cfg_flags, emit_rerun_if_env_changed, find_php, ApiVersion, PHPInfo, - }; - - emit_rerun_if_env_changed(); - emit_check_cfg(); - - let php = find_php().expect("cannot find the php executable"); - let info = PHPInfo::get(&php).expect("cannot read php -i"); - let version: ApiVersion = info - .zend_version() - .expect("cannot read the Zend API version") - .try_into() - .expect("unsupported Zend API version"); - - emit_php_cfg_flags(version); -} diff --git a/src/extension/parquet-engine/src/values.rs b/src/extension/parquet-engine/src/values.rs index df2e3c6fc0..29d2cbfdbb 100644 --- a/src/extension/parquet-engine/src/values.rs +++ b/src/extension/parquet-engine/src/values.rs @@ -13,7 +13,6 @@ use crate::php::{self, call_handle, ensure_no_pending_exception}; extern "C" { fn php_date_instantiate(pce: *mut ext_php_rs::zend::ClassEntry, object: *mut Zval) -> *mut Zval; - #[cfg(php84)] fn php_date_initialize_from_ts_long(dateobj: *mut c_void, sec: i64, usec: c_int); fn php_date_initialize( @@ -169,32 +168,9 @@ pub fn datetime_from_micros(micros: i64, zone: &[u8]) -> Result(), - time_str.len() - 1, - c"U.u".as_ptr(), - std::ptr::null_mut(), - // PHP_DATE_INIT_FORMAT - the flags createFromFormat passes - 0x02, - ) - } - } + unsafe { php_date_initialize_from_ts_long(dateobj, seconds, fraction as c_int) }; + + true }, || { ext_exception(format!( @@ -235,8 +211,8 @@ impl Instants { } } -/// Zend API numbers of PHP 8.3 to 8.6, whose timelib (2022.14-2022.17, 2026.03) lays `timelib_time` out as `TimelibTime`. -const VERIFIED_LAYOUT_APIS: [u32; 4] = [20_230_831, 20_240_924, 20_250_925, 20_261_112]; +/// Zend API numbers of PHP 8.5 and 8.6, whose timelib (2022.17, 2026.03) lays `timelib_time` out as `TimelibTime`. +const VERIFIED_LAYOUT_APIS: [u32; 2] = [20_250_925, 20_261_112]; fn layout_verified_for(api: u32) -> bool { VERIFIED_LAYOUT_APIS.contains(&api) @@ -389,8 +365,8 @@ mod tests { #[test] fn only_the_verified_php_minors_write_into_a_cloned_timelib_time() { - assert!(layout_verified_for(20_230_831)); - assert!(layout_verified_for(20_240_924)); + assert!(!layout_verified_for(20_230_831)); + assert!(!layout_verified_for(20_240_924)); assert!(layout_verified_for(20_250_925)); assert!(layout_verified_for(20_261_112)); assert!(!layout_verified_for(20_220_829)); diff --git a/src/extension/pg-query-ext/composer.json b/src/extension/pg-query-ext/composer.json index 480543eb73..83f524faaf 100644 --- a/src/extension/pg-query-ext/composer.json +++ b/src/extension/pg-query-ext/composer.json @@ -5,7 +5,7 @@ "keywords": ["postgresql", "parser", "sql", "ast", "extension", "libpg_query"], "license": "MIT", "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "scripts": { "build": "make build", diff --git a/src/lib/array-dot/composer.json b/src/lib/array-dot/composer.json index 591733e11f..9f1f7914f2 100644 --- a/src/lib/array-dot/composer.json +++ b/src/lib/array-dot/composer.json @@ -12,7 +12,7 @@ "dot" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/types": "self.version" }, "config": { diff --git a/src/lib/array-dot/src/Flow/ArrayDot/array_dot.php b/src/lib/array-dot/src/Flow/ArrayDot/array_dot.php index a80d68b0bf..6328a6df8c 100644 --- a/src/lib/array-dot/src/Flow/ArrayDot/array_dot.php +++ b/src/lib/array-dot/src/Flow/ArrayDot/array_dot.php @@ -17,8 +17,8 @@ use ReflectionNamedType; use function array_key_exists; -use function array_key_last; use function array_keys; +use function array_last; use function array_map; use function array_slice; use function array_values; @@ -108,7 +108,7 @@ function array_dot_set(array $array, Path|string $path, mixed $value): array { $path = $path instanceof Path ? $path : Path::fromString($path); - if ($path->steps[array_key_last($path->steps)] instanceof Multimatch) { + if (array_last($path->steps) instanceof Multimatch) { throw new InvalidPathException(sprintf( 'Path "%s" ends with a multimatch, array_dot_set() writes to a key or to every element under a wildcard.', $path->toString(), @@ -302,7 +302,7 @@ function array_dot_get(array $array, Path|string $path, ?Type $type = null): mix return $arraySlice; } - $pathTaken = (new Path($takenSteps))->toString(); + $pathTaken = new Path($takenSteps)->toString(); $validatedArrays = array_map(static function (mixed $v) use ($pathTaken): array { if (!is_array($v)) { throw new InvalidPathException( @@ -366,7 +366,7 @@ function array_dot_get(array $array, Path|string $path, ?Type $type = null): mix if (!is_array($arraySlice[$key->name])) { throw new InvalidPathException(sprintf( 'Expected array under path, "%s", but got: %s', - (new Path($takenSteps))->toString(), + new Path($takenSteps)->toString(), gettype($arraySlice[$key->name]), )); } @@ -388,7 +388,7 @@ function array_dot_rename(array $array, Path|string $path, string $newName): arr { $path = $path instanceof Path ? $path : Path::fromString($path); - $last = $path->steps[array_key_last($path->steps)]; + $last = array_last($path->steps); if (!$last instanceof Key) { throw new InvalidPathException(sprintf( diff --git a/src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit/Step/KeyTest.php b/src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit/Step/KeyTest.php index 0e7c3e9759..abfbc143f8 100644 --- a/src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit/Step/KeyTest.php +++ b/src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit/Step/KeyTest.php @@ -19,6 +19,6 @@ public function test_to_string_escapes_every_grammar_character( bool $nullsafe, string $expected, ): void { - static::assertSame($expected, (new Key($name, $nullsafe))->toString()); + static::assertSame($expected, new Key($name, $nullsafe)->toString()); } } diff --git a/src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit/Step/MultimatchTest.php b/src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit/Step/MultimatchTest.php index 3e14e81c38..46a77d7a19 100644 --- a/src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit/Step/MultimatchTest.php +++ b/src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit/Step/MultimatchTest.php @@ -24,17 +24,17 @@ public function test_keys_each_path_by_its_steps_joined_with_underscores(): void 'a.b' => new Path([new Key('a.b')]), ]; - static::assertSame($expected, (new Multimatch(array_values($expected)))->byResultKey()); + static::assertSame($expected, new Multimatch(array_values($expected))->byResultKey()); } public function test_to_string_joins_its_paths(): void { static::assertSame( '{a,?b.c}', - (new Multimatch([ + new Multimatch([ new Path([new Key('a')]), new Path([new Key('b', nullsafe: true), new Key('c')]), - ]))->toString(), + ])->toString(), ); } diff --git a/src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit/Step/WildcardTest.php b/src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit/Step/WildcardTest.php index bd81d05802..25d9bca573 100644 --- a/src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit/Step/WildcardTest.php +++ b/src/lib/array-dot/tests/Flow/ArrayDot/Tests/Unit/Step/WildcardTest.php @@ -14,6 +14,6 @@ final class WildcardTest extends TestCase #[TestWith([true, '?*'])] public function test_to_string(bool $nullsafe, string $expected): void { - static::assertSame($expected, (new Wildcard($nullsafe))->toString()); + static::assertSame($expected, new Wildcard($nullsafe)->toString()); } } diff --git a/src/lib/azure-sdk/composer.json b/src/lib/azure-sdk/composer.json index 297daded4d..1c30e1b6ce 100644 --- a/src/lib/azure-sdk/composer.json +++ b/src/lib/azure-sdk/composer.json @@ -14,7 +14,7 @@ "gcp" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/types": "self.version", "psr/log": "^2.0 || ^3.0", "psr/http-client": "^1.0", diff --git a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService.php b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService.php index 05175d3bdd..0245c7aac2 100644 --- a/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService.php +++ b/src/lib/azure-sdk/src/Flow/Azure/SDK/BlobService.php @@ -401,7 +401,7 @@ public function getBlockBlobBlockList( throw new AzureException(__METHOD__, $request, $response); } - $normalized = (new SimpleXMLNormalizer())->toArray($response->getBody()->getContents()); + $normalized = new SimpleXMLNormalizer()->toArray($response->getBody()->getContents()); $blocks = []; @@ -529,7 +529,7 @@ public function listBlobs(ListBlobOptions $options = new ListBlobOptions()): Gen throw new AzureException(__METHOD__, $request, $response); } - $normalized = (new SimpleXMLNormalizer())->toArray($response->getBody()->getContents()); + $normalized = new SimpleXMLNormalizer()->toArray($response->getBody()->getContents()); if (array_key_exists('Blobs', $normalized) && is_array($normalized['Blobs'])) { $blobsData = type_array()->assert($normalized['Blobs']); diff --git a/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/AuthorizationFactory/SharedKeyFactoryTest.php b/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/AuthorizationFactory/SharedKeyFactoryTest.php index db719b1252..c0c1bc4e4c 100644 --- a/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/AuthorizationFactory/SharedKeyFactoryTest.php +++ b/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/AuthorizationFactory/SharedKeyFactoryTest.php @@ -150,7 +150,7 @@ public function test_read_only_source_url_signs_a_service_sas_for_one_blob(): vo { static::assertSame( 'http://localhost:10000/flowphpaccount01/container/source/a.parquet?sv=2024-08-04&sr=b&sp=r&se=2026-11-13T12%3A00%3A00Z&sig=%2BSQtHD8x1t%2FiPtJZk5oiYlfbGWUnQsl7zXuCa8OqF3s%3D', - (new SharedKeyFactory('flowphpaccount01', 'flowphpkey01'))->readOnlySourceUrl( + new SharedKeyFactory('flowphpaccount01', 'flowphpkey01')->readOnlySourceUrl( 'http://localhost:10000/flowphpaccount01/container/source/a.parquet', 'container', 'source/a.parquet', @@ -163,7 +163,7 @@ public function test_read_only_source_url_signs_the_expiry_in_utc(): void { static::assertSame( 'http://localhost:10000/flowphpaccount01/container/source/a.parquet?sv=2024-08-04&sr=b&sp=r&se=2026-11-13T12%3A00%3A00Z&sig=%2BSQtHD8x1t%2FiPtJZk5oiYlfbGWUnQsl7zXuCa8OqF3s%3D', - (new SharedKeyFactory('flowphpaccount01', 'flowphpkey01'))->readOnlySourceUrl( + new SharedKeyFactory('flowphpaccount01', 'flowphpkey01')->readOnlySourceUrl( 'http://localhost:10000/flowphpaccount01/container/source/a.parquet', 'container', 'source/a.parquet', diff --git a/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/BlobService/ListBlobs/BlobTest.php b/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/BlobService/ListBlobs/BlobTest.php index 1eb56ea7dc..b034007025 100644 --- a/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/BlobService/ListBlobs/BlobTest.php +++ b/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/BlobService/ListBlobs/BlobTest.php @@ -12,7 +12,7 @@ final class BlobTest extends TestCase { public function test_name_returns_blob_name_from_data(): void { - static::assertSame('my-blob.txt', (new Blob(['Name' => 'my-blob.txt']))->name()); + static::assertSame('my-blob.txt', new Blob(['Name' => 'my-blob.txt'])->name()); } public function test_name_throws_when_blob_name_missing(): void @@ -20,7 +20,7 @@ public function test_name_throws_when_blob_name_missing(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Blob name must be a string'); - (new Blob([]))->name(); + new Blob([])->name(); } public function test_name_throws_when_blob_name_is_not_string(): void @@ -28,17 +28,17 @@ public function test_name_throws_when_blob_name_is_not_string(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Blob name must be a string'); - (new Blob(['Name' => 123]))->name(); + new Blob(['Name' => 123])->name(); } public function test_size_returns_integer_from_string_content_length(): void { - static::assertSame(4096, (new Blob(['Properties' => ['Content-Length' => '4096']]))->size()); + static::assertSame(4096, new Blob(['Properties' => ['Content-Length' => '4096']])->size()); } public function test_size_returns_integer_from_int_content_length(): void { - static::assertSame(4096, (new Blob(['Properties' => ['Content-Length' => 4096]]))->size()); + static::assertSame(4096, new Blob(['Properties' => ['Content-Length' => 4096]])->size()); } public function test_size_throws_when_properties_missing(): void @@ -46,7 +46,7 @@ public function test_size_throws_when_properties_missing(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Blob properties must be an array'); - (new Blob([]))->size(); + new Blob([])->size(); } public function test_size_throws_when_content_length_missing(): void @@ -54,7 +54,7 @@ public function test_size_throws_when_content_length_missing(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Content-Length must be a string or integer'); - (new Blob(['Properties' => []]))->size(); + new Blob(['Properties' => []])->size(); } public function test_size_throws_when_content_length_wrong_type(): void @@ -62,7 +62,7 @@ public function test_size_throws_when_content_length_wrong_type(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Content-Length must be a string or integer'); - (new Blob(['Properties' => ['Content-Length' => 1.5]]))->size(); + new Blob(['Properties' => ['Content-Length' => 1.5]])->size(); } public function test_last_modified_at_returns_datetime_for_valid_rfc7231_string(): void @@ -77,21 +77,21 @@ public function test_last_modified_at_returns_datetime_for_valid_rfc7231_string( public function test_last_modified_at_returns_null_when_properties_missing(): void { - static::assertNull((new Blob([]))->lastModifiedAt()); + static::assertNull(new Blob([])->lastModifiedAt()); } public function test_last_modified_at_returns_null_when_last_modified_missing(): void { - static::assertNull((new Blob(['Properties' => []]))->lastModifiedAt()); + static::assertNull(new Blob(['Properties' => []])->lastModifiedAt()); } public function test_last_modified_at_returns_null_for_empty_last_modified(): void { - static::assertNull((new Blob(['Properties' => ['Last-Modified' => '']]))->lastModifiedAt()); + static::assertNull(new Blob(['Properties' => ['Last-Modified' => '']])->lastModifiedAt()); } public function test_last_modified_at_returns_null_for_unparseable_last_modified(): void { - static::assertNull((new Blob(['Properties' => ['Last-Modified' => 'not-a-date']]))->lastModifiedAt()); + static::assertNull(new Blob(['Properties' => ['Last-Modified' => 'not-a-date']])->lastModifiedAt()); } } diff --git a/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/BlobService/PutBlockBlob/PutBlockBlobOptionsTest.php b/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/BlobService/PutBlockBlob/PutBlockBlobOptionsTest.php index 1b04673b3c..ccee56aae7 100644 --- a/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/BlobService/PutBlockBlob/PutBlockBlobOptionsTest.php +++ b/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/BlobService/PutBlockBlob/PutBlockBlobOptionsTest.php @@ -13,14 +13,14 @@ final class PutBlockBlobOptionsTest extends TestCase { public function test_if_none_match_header_is_absent_by_default(): void { - static::assertFalse(array_key_exists('If-None-Match', (new PutBlockBlobOptions())->toHeaders())); + static::assertFalse(array_key_exists('If-None-Match', new PutBlockBlobOptions()->toHeaders())); } public function test_if_none_match_header_is_sent_when_set(): void { static::assertSame( '*', - (new PutBlockBlobOptions()) + new PutBlockBlobOptions() ->withIfNoneMatch('*') ->toHeaders()['If-None-Match'], ); diff --git a/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/BlobService/PutBlockBlobBlockList/PutBlockBlobBlockListOptionsTest.php b/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/BlobService/PutBlockBlobBlockList/PutBlockBlobBlockListOptionsTest.php index 6b4b0baa88..707245d54b 100644 --- a/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/BlobService/PutBlockBlobBlockList/PutBlockBlobBlockListOptionsTest.php +++ b/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/BlobService/PutBlockBlobBlockList/PutBlockBlobBlockListOptionsTest.php @@ -13,14 +13,14 @@ final class PutBlockBlobBlockListOptionsTest extends TestCase { public function test_if_none_match_header_is_absent_by_default(): void { - static::assertFalse(array_key_exists('If-None-Match', (new PutBlockBlobBlockListOptions())->toHeaders())); + static::assertFalse(array_key_exists('If-None-Match', new PutBlockBlobBlockListOptions()->toHeaders())); } public function test_if_none_match_header_is_sent_when_set(): void { static::assertSame( '*', - (new PutBlockBlobBlockListOptions()) + new PutBlockBlobBlockListOptions() ->withIfNoneMatch('*') ->toHeaders()['If-None-Match'], ); @@ -28,7 +28,7 @@ public function test_if_none_match_header_is_sent_when_set(): void public function test_the_blob_properties_become_headers(): void { - $headers = (new PutBlockBlobBlockListOptions()) + $headers = new PutBlockBlobBlockListOptions() ->withContentType('text/csv') ->withContentEncoding('gzip') ->withContentLanguage('pl') @@ -47,7 +47,7 @@ public function test_the_blob_properties_become_headers(): void public function test_unset_blob_properties_send_no_headers(): void { - $headers = (new PutBlockBlobBlockListOptions())->toHeaders(); + $headers = new PutBlockBlobBlockListOptions()->toHeaders(); static::assertFalse(array_key_exists('x-ms-blob-content-type', $headers)); static::assertFalse(array_key_exists('x-ms-blob-content-encoding', $headers)); @@ -59,8 +59,8 @@ public function test_unset_blob_properties_send_no_headers(): void public function test_null_blob_properties_send_no_headers(): void { static::assertSame( - (new PutBlockBlobBlockListOptions())->toHeaders(), - (new PutBlockBlobBlockListOptions()) + new PutBlockBlobBlockListOptions()->toHeaders(), + new PutBlockBlobBlockListOptions() ->withContentType(null) ->withContentEncoding(null) ->withContentLanguage(null) diff --git a/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/Normalizer/SimpleXMLNormalizerTest.php b/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/Normalizer/SimpleXMLNormalizerTest.php index a6088b0899..eebff59d4a 100644 --- a/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/Normalizer/SimpleXMLNormalizerTest.php +++ b/src/lib/azure-sdk/tests/Flow/Azure/SDK/Tests/Unit/Normalizer/SimpleXMLNormalizerTest.php @@ -19,7 +19,7 @@ public function test_to_array_converts_flat_xml_to_associative_array(): void XML; - static::assertSame(['Name' => 'example', 'Size' => '1234'], (new SimpleXMLNormalizer())->toArray($xml)); + static::assertSame(['Name' => 'example', 'Size' => '1234'], new SimpleXMLNormalizer()->toArray($xml)); } public function test_to_array_normalizes_nested_elements_to_nested_arrays(): void @@ -41,7 +41,7 @@ public function test_to_array_normalizes_nested_elements_to_nested_arrays(): voi 'Content-Length' => '5678', ], ], - (new SimpleXMLNormalizer())->toArray($xml), + new SimpleXMLNormalizer()->toArray($xml), ); } @@ -54,7 +54,7 @@ public function test_to_array_normalizes_empty_elements_to_null(): void XML; - static::assertSame(['Empty' => null], (new SimpleXMLNormalizer())->toArray($xml)); + static::assertSame(['Empty' => null], new SimpleXMLNormalizer()->toArray($xml)); } public function test_to_array_normalizes_repeated_siblings_into_indexed_array(): void @@ -80,7 +80,7 @@ public function test_to_array_normalizes_repeated_siblings_into_indexed_array(): ['Name' => 'b', 'Size' => '2'], ], ], - (new SimpleXMLNormalizer())->toArray($xml), + new SimpleXMLNormalizer()->toArray($xml), ); } @@ -96,6 +96,6 @@ public function test_to_array_normalizes_single_repeated_element_as_associative_ XML; - static::assertSame(['Block' => ['Name' => 'only', 'Size' => '9']], (new SimpleXMLNormalizer())->toArray($xml)); + static::assertSame(['Block' => ['Name' => 'only', 'Size' => '9']], new SimpleXMLNormalizer()->toArray($xml)); } } diff --git a/src/lib/doctrine-dbal-bulk/composer.json b/src/lib/doctrine-dbal-bulk/composer.json index 78a92d6845..0f4871c977 100644 --- a/src/lib/doctrine-dbal-bulk/composer.json +++ b/src/lib/doctrine-dbal-bulk/composer.json @@ -11,8 +11,8 @@ "upsert" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", - "doctrine/dbal": "^4.5", + "php": "~8.5.0 || ~8.6.0", + "doctrine/dbal": "^4.6", "flow-php/types": "self.version" }, "autoload": { diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Bulk.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Bulk.php index d1d640f3fb..0e3d10b415 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Bulk.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Bulk.php @@ -38,7 +38,7 @@ public function delete(Connection $connection, string $table, BulkData $bulkData { $tableDefinition = $this->tableDefinitions->get($table, $connection); $chunks = $bulkData->chunk(max(1, intdiv( - (new DbalPlatform($connection->getDatabasePlatform()))->dialect()->maxBindParameters(), + new DbalPlatform($connection->getDatabasePlatform())->dialect()->maxBindParameters(), $bulkData->columns()->count(), ))); @@ -71,7 +71,7 @@ public function insert( ): void { $tableDefinition = $this->tableDefinitions->get($table, $connection); $chunks = $bulkData->chunk(max(1, intdiv( - (new DbalPlatform($connection->getDatabasePlatform()))->dialect()->maxBindParameters(), + new DbalPlatform($connection->getDatabasePlatform())->dialect()->maxBindParameters(), $bulkData->columns()->count(), ))); @@ -103,7 +103,7 @@ public function update( ): void { $tableDefinition = $this->tableDefinitions->get($table, $connection); $chunks = $bulkData->chunk(max(1, intdiv( - (new DbalPlatform($connection->getDatabasePlatform()))->dialect()->maxBindParameters(), + new DbalPlatform($connection->getDatabasePlatform())->dialect()->maxBindParameters(), $bulkData->columns()->count(), ))); diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/BulkData.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/BulkData.php index ace97642a2..9144dda9b3 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/BulkData.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/BulkData.php @@ -21,7 +21,6 @@ use Flow\Types\Exception\InvalidTypeException; use function array_chunk; -use function array_key_exists; use function array_keys; use function array_map; use function array_merge; @@ -48,7 +47,7 @@ /** * @param array $rows - * @param array $types + * @param array $types */ public function __construct( array $rows, @@ -191,11 +190,9 @@ function (int $index, array $row) use ($table): string { * @var mixed $_value */ foreach ($row as $columnName => $_value) { - if (array_key_exists($columnName, $this->types)) { - $type = $this->types[$columnName]; - } else { - $type = Type::getType($table->dbalColumn($columnName)->getTypeName()); - } + $type = $table->dbalType( + $this->types[$columnName] ?? $table->dbalColumn($columnName)->getTypeName(), + ); $keys[] = 'CAST(:' @@ -228,17 +225,13 @@ public function toSqlNamedParameters(TableDefinition $table): array { $rows = []; $platform = $table->platform(); - $types = []; foreach ($this->rows as $index => $row) { /** * @var mixed $entry */ foreach ($row as $column => $entry) { - $type = - $types[$column] ??= array_key_exists($column, $this->types) - ? $this->types[$column] - : Type::getType($table->dbalColumn($column)->getTypeName()); + $type = $table->dbalType($this->types[$column] ?? $table->dbalColumn($column)->getTypeName()); $rows[$index][$column . '_' . $index] = $type->convertToDatabaseValue( self::acceptedBy($type, $entry), $platform, @@ -295,12 +288,9 @@ function (array $row) use ($table): string { * @var mixed $_value */ foreach ($row as $columnName => $_value) { - if (array_key_exists($columnName, $this->types)) { - $type = $this->types[$columnName]; - } else { - $dbColumn = $table->dbalColumn($columnName); - $type = Type::getType($dbColumn->getTypeName()); - } + $type = $table->dbalType( + $this->types[$columnName] ?? $table->dbalColumn($columnName)->getTypeName(), + ); $keys[] = 'CAST(? as ' . $type->getSQLDeclaration([], $table->platform()) . ')'; } @@ -322,17 +312,13 @@ public function toSqlPositionalParameters(TableDefinition $table): array { $parameters = []; $platform = $table->platform(); - $types = []; foreach ($this->rows as $row) { /** * @var mixed $entry */ foreach ($row as $column => $entry) { - $type = - $types[$column] ??= array_key_exists($column, $this->types) - ? $this->types[$column] - : Type::getType($table->dbalColumn($column)->getTypeName()); + $type = $table->dbalType($this->types[$column] ?? $table->dbalColumn($column)->getTypeName()); $parameters[] = $type->convertToDatabaseValue(self::acceptedBy($type, $entry), $platform); } } @@ -355,7 +341,7 @@ public function toSqlPositionalPlaceholders(): string } /** - * @return array + * @return array */ public function types(): array { diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLDialect.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLDialect.php index a100029ec2..d9ddd16d2c 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLDialect.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/MySQLDialect.php @@ -42,9 +42,8 @@ public function prepareDelete(TableDefinition $table, BulkData $bulkData): strin return sprintf( 'DELETE FROM %s WHERE (%s) IN (%s)', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(', ', array_map(fn($column) => $this->platform->quoteIdentifier($column), $columns)), + $table->quotedName(), + implode(', ', array_map(fn($column) => $this->platform->quoteSingleIdentifier($column), $columns)), $bulkData->toSqlPlaceholders(), ); } @@ -69,9 +68,8 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser if ($options->skipConflicts === true) { return sprintf( 'INSERT INTO %s (%s) VALUES %s ON DUPLICATE KEY UPDATE %4$s=%4$s', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(',', array_map(fn(string $column): string => $this->platform->quoteIdentifier( + $table->quotedName(), + implode(',', array_map(fn(string $column): string => $this->platform->quoteSingleIdentifier( $column, ), $bulkData->columns()->all())), $bulkData->toSqlPlaceholders(), @@ -84,9 +82,8 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser 'INSERT INTO %s (%s) VALUES %s ON DUPLICATE KEY UPDATE %s', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(',', array_map(fn(string $column): string => $this->platform->quoteIdentifier( + $table->quotedName(), + implode(',', array_map(fn(string $column): string => $this->platform->quoteSingleIdentifier( $column, ), $bulkData->columns()->all())), $bulkData->toSqlPlaceholders(), @@ -94,7 +91,7 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser ? $this->updateSelectedColumns( $options->updateColumns, $bulkData->columns(), - $table->name(), + $table->quotedName(), $options->preserveExistingValues, ) : $this->updateAllColumns($bulkData->columns()), @@ -103,9 +100,8 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser return sprintf( 'INSERT INTO %s (%s) VALUES %s', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(',', array_map(fn(string $column): string => $this->platform->quoteIdentifier( + $table->quotedName(), + implode(',', array_map(fn(string $column): string => $this->platform->quoteSingleIdentifier( $column, ), $bulkData->columns()->all())), $bulkData->toSqlPlaceholders(), @@ -123,9 +119,8 @@ public function prepareUpdate(TableDefinition $table, BulkData $bulkData, ?Updat { return sprintf( 'REPLACE INTO %s (%s) VALUES %s', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(',', array_map(fn(string $column): string => $this->platform->quoteIdentifier( + $table->quotedName(), + implode(',', array_map(fn(string $column): string => $this->platform->quoteSingleIdentifier( $column, ), $bulkData->columns()->all())), $bulkData->toSqlPlaceholders(), @@ -142,11 +137,9 @@ private function updateAllColumns(Columns $columns): string return implode( ',', $columns->map( - // @mago-expect analysis:deprecated-method - // @mago-expect analysis:deprecated-method - fn(string $column): string => "{$this->platform->quoteIdentifier( + fn(string $column): string => "{$this->platform->quoteSingleIdentifier( $column, - )} = VALUES({$this->platform->quoteIdentifier($column)})", + )} = VALUES({$this->platform->quoteSingleIdentifier($column)})", ), ); } @@ -163,30 +156,22 @@ private function updateSelectedColumns( string $tableName, ?bool $preserveExistingValues = null, ): string { - return ( - count($updateColumns) - ? implode(',', array_map( - function (string $column) use ($tableName, $preserveExistingValues): string { - // @mago-expect analysis:deprecated-method - $clause = "{$this->platform->quoteIdentifier($column)} = "; - - if (true === $preserveExistingValues) { - return ( - $clause - // @mago-expect analysis:deprecated-method - // @mago-expect analysis:deprecated-method - . "COALESCE(VALUES({$this->platform->quoteIdentifier( - $column, - )}), {$tableName}.{$this->platform->quoteIdentifier($column)})" - ); - } - - // @mago-expect analysis:deprecated-method - return $clause . "VALUES({$this->platform->quoteIdentifier($column)})"; - }, - $updateColumns, - )) - : $this->updateAllColumns($columns) - ); + return count($updateColumns) ? implode(',', array_map(function (string $column) use ( + $tableName, + $preserveExistingValues, + ): string { + $clause = "{$this->platform->quoteSingleIdentifier($column)} = "; + + if (true === $preserveExistingValues) { + return ( + $clause + . "COALESCE(VALUES({$this->platform->quoteSingleIdentifier( + $column, + )}), {$tableName}.{$this->platform->quoteSingleIdentifier($column)})" + ); + } + + return $clause . "VALUES({$this->platform->quoteSingleIdentifier($column)})"; + }, $updateColumns)) : $this->updateAllColumns($columns); } } diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLDialect.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLDialect.php index a962338077..7917954e94 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLDialect.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/PostgreSQLDialect.php @@ -41,9 +41,8 @@ public function prepareDelete(TableDefinition $table, BulkData $bulkData): strin return sprintf( 'DELETE FROM %s WHERE (%s) IN (%s)', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(', ', array_map(fn($column) => $this->platform->quoteIdentifier($column), $columns)), + $table->quotedName(), + implode(', ', array_map(fn($column) => $this->platform->quoteSingleIdentifier($column), $columns)), $bulkData->toSqlCastedPlaceholders($table), ); } @@ -68,9 +67,8 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser if (count($options->conflictColumns)) { return sprintf( 'INSERT INTO %s (%s) VALUES %s ON CONFLICT (%s) DO UPDATE SET %s', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(',', array_map(fn(string $column): string => $this->platform->quoteIdentifier( + $table->quotedName(), + implode(',', array_map(fn(string $column): string => $this->platform->quoteSingleIdentifier( $column, ), $bulkData->columns()->all())), $bulkData->toSqlPlaceholders(), @@ -79,7 +77,7 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser ? $this->updatedSelectedColumns( $options->updateColumns, $bulkData->columns(), - $table->name(), + $table->quotedName(), $options->preserveExistingValues, ) : $this->updateAllColumns($bulkData->columns()), @@ -89,9 +87,8 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser if ($options->constraint) { return sprintf( 'INSERT INTO %s (%s) VALUES %s ON CONFLICT ON CONSTRAINT %s DO UPDATE SET %s', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(',', array_map(fn(string $column): string => $this->platform->quoteIdentifier( + $table->quotedName(), + implode(',', array_map(fn(string $column): string => $this->platform->quoteSingleIdentifier( $column, ), $bulkData->columns()->all())), $bulkData->toSqlPlaceholders(), @@ -100,7 +97,7 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser ? $this->updatedSelectedColumns( $options->updateColumns, $bulkData->columns(), - $table->name(), + $table->quotedName(), $options->preserveExistingValues, ) : $this->updateAllColumns($bulkData->columns()), @@ -110,9 +107,8 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser if ($options->skipConflicts === true) { return sprintf( 'INSERT INTO %s (%s) VALUES %s ON CONFLICT DO NOTHING', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(',', array_map(fn(string $column): string => $this->platform->quoteIdentifier( + $table->quotedName(), + implode(',', array_map(fn(string $column): string => $this->platform->quoteSingleIdentifier( $column, ), $bulkData->columns()->all())), $bulkData->toSqlPlaceholders(), @@ -121,9 +117,8 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser return sprintf( 'INSERT INTO %s (%s) VALUES %s', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(',', array_map(fn(string $column): string => $this->platform->quoteIdentifier( + $table->quotedName(), + implode(',', array_map(fn(string $column): string => $this->platform->quoteSingleIdentifier( $column, ), $bulkData->columns()->all())), $bulkData->toSqlPlaceholders(), @@ -159,18 +154,17 @@ public function prepareUpdate(TableDefinition $table, BulkData $bulkData, ?Updat return sprintf( 'UPDATE %s as existing_table SET %s FROM (VALUES %s) as excluded (%s) WHERE %s', - $table->name(), + $table->quotedName(), count($options->updateColumns) ? $this->updatedSelectedColumns( $options->updateColumns, $bulkData->columns()->without(...$options->primaryKeyColumns), - $table->name(), + $table->quotedName(), $options->preserveExistingValues, ) : $this->updateAllColumns($bulkData->columns()->without(...$options->primaryKeyColumns)), $bulkData->toSqlCastedPlaceholders($table), - // @mago-expect analysis:deprecated-method - implode(',', array_map(fn(string $column): string => $this->platform->quoteIdentifier( + implode(',', array_map(fn(string $column): string => $this->platform->quoteSingleIdentifier( $column, ), $bulkData->columns()->all())), $this->updatedIndexColumns($options->primaryKeyColumns), @@ -187,11 +181,11 @@ private function updateAllColumns(Columns $columns): string return implode( ',', $columns->map( - // @mago-expect analysis:deprecated-method - // @mago-expect analysis:deprecated-method - fn(string $column): string => "{$this->platform->quoteIdentifier( + fn(string $column): string => "{$this->platform->quoteSingleIdentifier( $column, - )} = {$this->platform->quoteIdentifier('excluded.' . $column)}", + )} = {$this->platform->quoteSingleIdentifier('excluded')}.{$this->platform->quoteSingleIdentifier( + $column, + )}", ), ); } @@ -202,10 +196,11 @@ private function updateAllColumns(Columns $columns): string private function updatedIndexColumns(array $updateColumns): string { return implode(' AND ', array_map( - // @mago-expect analysis:deprecated-method - // @mago-expect analysis:deprecated-method - fn(string $column): string => "{$this->platform->quoteIdentifier('existing_table.' - . $column)} = {$this->platform->quoteIdentifier('excluded.' . $column)}", + fn(string $column): string => "{$this->platform->quoteSingleIdentifier( + 'existing_table', + )}.{$this->platform->quoteSingleIdentifier($column)} = {$this->platform->quoteSingleIdentifier( + 'excluded', + )}.{$this->platform->quoteSingleIdentifier($column)}", $updateColumns, )); } @@ -224,29 +219,29 @@ private function updatedSelectedColumns( * The SET and WHERE clauses in ON CONFLICT DO UPDATE have access to the existing row using the * table's name (or an alias), and to rows proposed for insertion using the special EXCLUDED table. */ - return ( - count($updateColumns) - ? implode(',', array_map( - function (string $column) use ($tableName, $preserveExistingValues): string { - // @mago-expect analysis:deprecated-method - $clause = "{$this->platform->quoteIdentifier($column)} = "; - - if (true === $preserveExistingValues) { - return ( - $clause - // @mago-expect analysis:deprecated-method - // @mago-expect analysis:deprecated-method - . "COALESCE({$this->platform->quoteIdentifier('excluded.' - . $column)}, {$tableName}.{$this->platform->quoteIdentifier($column)})" - ); - } - - // @mago-expect analysis:deprecated-method - return $clause . "{$this->platform->quoteIdentifier('excluded.' . $column)}"; - }, - $updateColumns, - )) - : $this->updateAllColumns($columns) - ); + return count($updateColumns) ? implode(',', array_map(function (string $column) use ( + $tableName, + $preserveExistingValues, + ): string { + $clause = "{$this->platform->quoteSingleIdentifier($column)} = "; + + if (true === $preserveExistingValues) { + return ( + $clause + . "COALESCE({$this->platform->quoteSingleIdentifier( + 'excluded', + )}.{$this->platform->quoteSingleIdentifier( + $column, + )}, {$tableName}.{$this->platform->quoteSingleIdentifier($column)})" + ); + } + + return ( + $clause + . "{$this->platform->quoteSingleIdentifier('excluded')}.{$this->platform->quoteSingleIdentifier( + $column, + )}" + ); + }, $updateColumns)) : $this->updateAllColumns($columns); } } diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteDialect.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteDialect.php index 27c7628a6b..bd5de3b3ff 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteDialect.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/Dialect/SqliteDialect.php @@ -41,9 +41,8 @@ public function prepareDelete(TableDefinition $table, BulkData $bulkData): strin return sprintf( 'DELETE FROM %s WHERE (%s) IN (%s)', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(', ', array_map(fn($column) => $this->platform->quoteIdentifier($column), $columns)), + $table->quotedName(), + implode(', ', array_map(fn($column) => $this->platform->quoteSingleIdentifier($column), $columns)), $bulkData->toSqlPlaceholders(), ); } @@ -62,9 +61,8 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser if ($options->conflictColumns) { return sprintf( 'INSERT INTO %s (%s) VALUES %s ON CONFLICT (%s) DO UPDATE SET %s', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(',', array_map(fn(string $column): string => $this->platform->quoteIdentifier( + $table->quotedName(), + implode(',', array_map(fn(string $column): string => $this->platform->quoteSingleIdentifier( $column, ), $bulkData->columns()->all())), $bulkData->toSqlPlaceholders(), @@ -73,7 +71,7 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser ? $this->updateSelectedColumns( $options->updateColumns, $bulkData->columns(), - $table->name(), + $table->quotedName(), $options->preserveExistingValues, ) : $this->updateAllColumns($bulkData->columns()), @@ -83,9 +81,8 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser if ($options->skipConflicts) { return sprintf( 'INSERT INTO %s (%s) VALUES %s ON CONFLICT DO NOTHING', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(',', array_map(fn(string $column): string => $this->platform->quoteIdentifier( + $table->quotedName(), + implode(',', array_map(fn(string $column): string => $this->platform->quoteSingleIdentifier( $column, ), $bulkData->columns()->all())), $bulkData->toSqlPlaceholders(), @@ -94,9 +91,8 @@ public function prepareInsert(TableDefinition $table, BulkData $bulkData, ?Inser return sprintf( 'INSERT INTO %s (%s) VALUES %s', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(',', array_map(fn(string $column): string => $this->platform->quoteIdentifier( + $table->quotedName(), + implode(',', array_map(fn(string $column): string => $this->platform->quoteSingleIdentifier( $column, ), $bulkData->columns()->all())), $bulkData->toSqlPlaceholders(), @@ -107,9 +103,8 @@ public function prepareUpdate(TableDefinition $table, BulkData $bulkData, ?Updat { return sprintf( 'REPLACE INTO %s (%s) VALUES %s', - $table->name(), - // @mago-expect analysis:deprecated-method - implode(',', array_map(fn(string $column): string => $this->platform->quoteIdentifier( + $table->quotedName(), + implode(',', array_map(fn(string $column): string => $this->platform->quoteSingleIdentifier( $column, ), $bulkData->columns()->all())), $bulkData->toSqlPlaceholders(), @@ -121,11 +116,11 @@ private function updateAllColumns(Columns $columns): string return implode( ',', $columns->map( - // @mago-expect analysis:deprecated-method - // @mago-expect analysis:deprecated-method - fn(string $column): string => "{$this->platform->quoteIdentifier( + fn(string $column): string => "{$this->platform->quoteSingleIdentifier( $column, - )} = {$this->platform->quoteIdentifier('excluded.' . $column)}", + )} = {$this->platform->quoteSingleIdentifier('excluded')}.{$this->platform->quoteSingleIdentifier( + $column, + )}", ), ); } @@ -139,29 +134,29 @@ private function updateSelectedColumns( string $tableName, ?bool $preserveExistingValues = null, ): string { - return ( - [] !== $updateColumns - ? implode(',', array_map( - function (string $column) use ($tableName, $preserveExistingValues): string { - // @mago-expect analysis:deprecated-method - $clause = "{$this->platform->quoteIdentifier($column)} = "; - - if (true === $preserveExistingValues) { - return ( - $clause - // @mago-expect analysis:deprecated-method - // @mago-expect analysis:deprecated-method - . "COALESCE({$this->platform->quoteIdentifier('excluded.' - . $column)}, {$tableName}.{$this->platform->quoteIdentifier($column)})" - ); - } - - // @mago-expect analysis:deprecated-method - return $clause . "{$this->platform->quoteIdentifier('excluded.' . $column)}"; - }, - $updateColumns, - )) - : $this->updateAllColumns($columns) - ); + return [] !== $updateColumns ? implode(',', array_map(function (string $column) use ( + $tableName, + $preserveExistingValues, + ): string { + $clause = "{$this->platform->quoteSingleIdentifier($column)} = "; + + if (true === $preserveExistingValues) { + return ( + $clause + . "COALESCE({$this->platform->quoteSingleIdentifier( + 'excluded', + )}.{$this->platform->quoteSingleIdentifier( + $column, + )}, {$tableName}.{$this->platform->quoteSingleIdentifier($column)})" + ); + } + + return ( + $clause + . "{$this->platform->quoteSingleIdentifier('excluded')}.{$this->platform->quoteSingleIdentifier( + $column, + )}" + ); + }, $updateColumns)) : $this->updateAllColumns($columns); } } diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/QueryFactory/DbalQueryFactory.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/QueryFactory/DbalQueryFactory.php index 906e372345..b954829c5e 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/QueryFactory/DbalQueryFactory.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/QueryFactory/DbalQueryFactory.php @@ -26,7 +26,7 @@ final class DbalQueryFactory implements QueryFactory */ public function delete(AbstractPlatform $platform, TableDefinition $table, BulkData $bulkData): string { - return (new DbalPlatform($platform)) + return new DbalPlatform($platform) ->dialect() ->prepareDelete($table, $bulkData); } @@ -47,7 +47,7 @@ public function insert( BulkData $bulkData, ?InsertOptions $options = null, ): string { - return (new DbalPlatform($platform)) + return new DbalPlatform($platform) ->dialect() ->prepareInsert($table, $bulkData, $options); } @@ -68,7 +68,7 @@ public function update( BulkData $bulkData, ?UpdateOptions $options = null, ): string { - return (new DbalPlatform($platform)) + return new DbalPlatform($platform) ->dialect() ->prepareUpdate($table, $bulkData, $options); } diff --git a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/TableDefinition.php b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/TableDefinition.php index 9865514ebc..c2cc7f96bb 100644 --- a/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/TableDefinition.php +++ b/src/lib/doctrine-dbal-bulk/src/Flow/Doctrine/Bulk/TableDefinition.php @@ -7,19 +7,28 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Schema\Column; +use Doctrine\DBAL\Schema\Name\OptionallyQualifiedName; +use Doctrine\DBAL\Schema\Name\Parsers; +use Doctrine\DBAL\Types\Type; use Flow\Doctrine\Bulk\Exception\RuntimeException; -use function array_filter; -use function array_values; -use function count; +use function array_key_exists; +use function sprintf; final class TableDefinition { /** - * @var null|array + * @var null|array */ private ?array $columns = null; + private ?OptionallyQualifiedName $exactName = null; + + /** + * @var array + */ + private array $types = []; + public function __construct( private readonly string $name, private readonly Connection $connection, @@ -30,17 +39,18 @@ public function __construct( */ public function dbalColumn(string $columnName): Column { - $dbColumnNames = array_values(array_filter( - $this->getColumns(), - // @mago-expect analysis:deprecated-method - static fn(Column $dbColumn): bool => $dbColumn->getName() === $columnName, - )); + $columns = $this->getColumns(); - if (count($dbColumnNames) !== 1) { + if (!array_key_exists($columnName, $columns)) { throw new RuntimeException("Column with name {$columnName}, not found in table: {$this->name}"); } - return $dbColumnNames[0]; + return $columns[$columnName]; + } + + public function dbalType(string $typeName): Type + { + return $this->types[$typeName] ??= $this->connection->getConfiguration()->getTypeProvider()->get($typeName); } /** @@ -105,13 +115,21 @@ public function name(): string return $this->name; } + /** + * @throws RuntimeException + */ + public function quotedName(): string + { + return $this->exactName()->toSQL($this->platform()); + } + public function platform(): AbstractPlatform { return $this->connection->getDatabasePlatform(); } /** - * @return array + * @return array */ private function getColumns(): array { @@ -119,9 +137,47 @@ private function getColumns(): array return $this->columns; } - // @mago-expect analysis:deprecated-method - $this->columns = array_values($this->connection->createSchemaManager()->listTableColumns($this->name)); + $columns = []; + + foreach ($this->connection->createSchemaManager()->introspectTableColumns($this->exactName()) as $column) { + $columns[$column->getObjectName()->getIdentifier()->getValue()] = $column; + } + + if ($columns === []) { + throw new RuntimeException(sprintf( + 'Table "%s" not found, no table has the exact name %s.', + $this->name, + $this->quotedName(), + )); + } + + return $this->columns = $columns; + } + + /** + * @throws RuntimeException + */ + private function exactName(): OptionallyQualifiedName + { + if ($this->exactName !== null) { + return $this->exactName; + } + + $parsed = Parsers::getOptionallyQualifiedNameParser()->parse($this->name); + $qualifier = $parsed->getQualifier()?->getValue(); + + if ($qualifier !== null && !$this->platform()->supportsSchemas()) { + throw new RuntimeException(sprintf( + 'Table "%s" has the schema qualifier "%s", but this database platform does not support schemas. Pass the table name without "%s.".', + $this->name, + $qualifier, + $qualifier, + )); + } - return $this->columns; + return $this->exactName = OptionallyQualifiedName::quoted( + $parsed->getUnqualifiedName()->getValue(), + $qualifier, + ); } } diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Context/DatabaseContext.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Context/DatabaseContext.php index 38205fc696..f45d584f35 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Context/DatabaseContext.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Context/DatabaseContext.php @@ -24,10 +24,8 @@ public function createTable(Table $table): void { $schemaManager = $this->connection->createSchemaManager(); - // @mago-expect analysis:deprecated-method - if ($schemaManager->tablesExist([$table->getName()])) { - // @mago-expect analysis:deprecated-method - $schemaManager->dropTable($table->getName()); + if ($schemaManager->tablesExist([$table->getObjectName()->toString()])) { + $schemaManager->dropTable($table->getObjectName()->toString()); } $schemaManager->createTable($table); diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkDeleteTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkDeleteTest.php index be5b1567f9..72a521a27f 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkDeleteTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkDeleteTest.php @@ -5,8 +5,8 @@ namespace Flow\Doctrine\Bulk\Tests\Integration; use Doctrine\DBAL\Schema\Column; +use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\Doctrine\Bulk\Bulk; use Flow\Doctrine\Bulk\BulkData; @@ -16,11 +16,15 @@ final class MySqlBulkDeleteTest extends MysqlIntegrationTestCase { public function test_delete_nonexistent_rows(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); $this->databaseContext->connection()->executeStatement("INSERT INTO {$table} (id, name) VALUES (1, 'Name One'), @@ -52,12 +56,18 @@ public function test_delete_nonexistent_rows(): void public function test_delete_rows_with_composite_key_condition(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('group', Type::getType(Types::STRING), ['notnull' => true, 'length' => 1]), - new Column('value', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ]))->setPrimaryKey(['id', 'group'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('group', Types::STRING, ['notnull' => true, 'length' => 1]), + new Column('value', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) + ->edit() + ->addPrimaryKeyConstraint( + PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id', 'group')->create(), + ) + ->create(), + ); $this->databaseContext->connection()->executeStatement("INSERT INTO {$table} (id, `group`, value) VALUES (1, 'A', 'Value One A'), @@ -92,12 +102,16 @@ public function test_delete_rows_with_composite_key_condition(): void public function test_delete_rows_with_single_column_condition(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); $this->databaseContext->connection()->executeStatement("INSERT INTO {$table} (id, name, description) VALUES (1, 'Name One', 'Description One'), diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkInsertTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkInsertTest.php index 6f3dc1ac96..348aed2e5e 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkInsertTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkInsertTest.php @@ -6,31 +6,84 @@ use DateTime; use Doctrine\DBAL\Schema\Column; +use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\Doctrine\Bulk\Bulk; use Flow\Doctrine\Bulk\BulkData; use Flow\Doctrine\Bulk\Dialect\MySQLInsertOptions; +use Flow\Doctrine\Bulk\Exception\RuntimeException; use Flow\Doctrine\Bulk\Tests\MysqlIntegrationTestCase; +use PHPUnit\Framework\Attributes\TestWith; use function Flow\ETL\DSL\generate_random_string; use function json_encode; final class MySqlBulkInsertTest extends MysqlIntegrationTestCase { + public function test_inserts_into_a_table_with_a_mixed_case_unquoted_name(): void + { + $this->databaseContext->createTable(new Table('FlowBulkMixedCase', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ])); + + Bulk::create()->insert($this->databaseContext->connection(), 'FlowBulkMixedCase', new BulkData([[ + 'id' => 1, + 'name' => 'a', + ]])); + + static::assertSame([['id' => 1, 'name' => 'a']], $this->databaseContext->selectAll('FlowBulkMixedCase')); + } + + #[TestWith(['flow_bulk_orders', 'flow_bulk_orders', '`flow_bulk_orders`'])] + #[TestWith(['"FlowBulkOrders"', 'FlowBulkOrders', '`FlowBulkOrders`'])] + #[TestWith(['"FlowBulkOrders"', '"FlowBulkOrders"', '`FlowBulkOrders`'])] + #[TestWith(['"order"', 'order', '`order`'])] + #[TestWith(['"user"', 'user', '`user`'])] + public function test_inserts_into_the_table_with_the_exact_name(string $created, string $table, string $sql): void + { + $this->databaseContext->createTable(new Table($created, [ + new Column('id', Types::INTEGER, ['notnull' => true]), + ])); + + Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([['id' => 1]])); + + static::assertSame([['id' => 1]], $this->databaseContext->selectAll($sql)); + } + + public function test_insert_with_a_schema_qualified_table_name_is_refused(): void + { + $this->databaseContext->createTable(new Table('flow_bulk_orders', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + ])); + + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage( + 'Table "flow.flow_bulk_orders" has the schema qualifier "flow", but this database platform does not support schemas.', + ); + + Bulk::create()->insert($this->databaseContext->connection(), 'flow.flow_bulk_orders', new BulkData([[ + 'id' => 1, + ]])); + } + public function test_inserts_multiple_rows_at_once(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('age', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => false, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - new Column('updated_at', Type::getType(Types::DATETIME_MUTABLE), ['notnull' => true]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'platformOptions' => ['jsonb' => true]]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('age', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => false, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + new Column('updated_at', 'datetime', ['notnull' => true]), + new Column('tags', Types::JSON, ['notnull' => true, 'platformOptions' => ['jsonb' => true]]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ [ @@ -104,13 +157,17 @@ public function test_inserts_multiple_rows_at_once(): void public function test_inserts_new_rows_and_skip_already_existed(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => true], @@ -146,13 +203,17 @@ public function test_inserts_new_rows_and_skip_already_existed(): void public function test_inserts_new_rows_and_update_already_existed(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => true], @@ -188,13 +249,17 @@ public function test_inserts_new_rows_and_update_already_existed(): void public function test_inserts_new_rows_and_update_selected_columns_and_preserve_existing_values(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => false, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => false, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => false, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => false, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => true], @@ -230,13 +295,17 @@ public function test_inserts_new_rows_and_update_selected_columns_and_preserve_e public function test_inserts_new_rows_and_update_selected_columns_only_of_already_existed(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => true], diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkUpdateTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkUpdateTest.php index 99dc7c0abd..4f9abebef9 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkUpdateTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/MySqlBulkUpdateTest.php @@ -5,8 +5,8 @@ namespace Flow\Doctrine\Bulk\Tests\Integration; use Doctrine\DBAL\Schema\Column; +use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\Doctrine\Bulk\Bulk; use Flow\Doctrine\Bulk\BulkData; @@ -16,13 +16,17 @@ final class MySqlBulkUpdateTest extends MysqlIntegrationTestCase { public function test_update_multiple_rows_with_all_columns_at_once(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => false], diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkDeleteTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkDeleteTest.php index 52e4fed417..3fb131b74d 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkDeleteTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkDeleteTest.php @@ -8,8 +8,8 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\ForeignKeyConstraint; use Doctrine\DBAL\Schema\ForeignKeyConstraint\ReferentialAction; +use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\Doctrine\Bulk\Bulk; use Flow\Doctrine\Bulk\BulkData; @@ -26,7 +26,7 @@ public function test_a_failing_chunk_rolls_back_the_whole_delete(): void )); // named to sort before its parent, so the teardown drops the referencing table first $this->databaseContext->createTable( - new Table($child = 'flow_doctrine_bulk_child', [new Column('parent_c1', Type::getType(Types::INTEGER), [ + new Table($child = 'flow_doctrine_bulk_child', [new Column('parent_c1', Types::INTEGER, [ 'notnull' => true, ])], fkConstraints: [ ForeignKeyConstraint::editor() @@ -67,11 +67,15 @@ public function test_a_failing_chunk_rolls_back_the_whole_delete(): void public function test_delete_nonexistent_rows(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); $this->databaseContext->connection()->executeStatement("INSERT INTO {$table} (id, name) VALUES (1, 'Name One'), @@ -102,13 +106,19 @@ public function test_delete_nonexistent_rows(): void } public function test_delete_rows_with_composite_key_condition(): void - // @mago-expect analysis:deprecated-method { - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('group_name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 1]), - new Column('value', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ]))->setPrimaryKey(['id', 'group_name'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('group_name', Types::STRING, ['notnull' => true, 'length' => 1]), + new Column('value', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) + ->edit() + ->addPrimaryKeyConstraint( + PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id', 'group_name')->create(), + ) + ->create(), + ); $this->databaseContext->connection()->executeStatement("INSERT INTO {$table} (id, group_name, value) VALUES (1, 'A', 'Value One A'), @@ -142,13 +152,17 @@ public function test_delete_rows_with_composite_key_condition(): void } public function test_delete_rows_with_single_column_condition(): void - // @mago-expect analysis:deprecated-method { - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); $this->databaseContext->connection()->executeStatement("INSERT INTO {$table} (id, name, description) VALUES (1, 'Name One', 'Description One'), @@ -181,12 +195,18 @@ public function test_delete_rows_with_single_column_condition(): void public function test_delete_with_custom_types_using_casted_placeholders_works_with_postgresql(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('category', Type::getType(Types::STRING), ['notnull' => true, 'length' => 100]), - ]))->setPrimaryKey(['id', 'name', 'category'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('category', Types::STRING, ['notnull' => true, 'length' => 100]), + ]) + ->edit() + ->addPrimaryKeyConstraint( + PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id', 'name', 'category')->create(), + ) + ->create(), + ); $this->databaseContext->connection()->executeStatement("INSERT INTO {$table} (id, name, category) VALUES (1, 'Product One', 'Electronics'), @@ -197,9 +217,9 @@ public function test_delete_with_custom_types_using_casted_placeholders_works_wi static::assertEquals(4, $this->databaseContext->tableCount($table)); $customTypes = [ - 'id' => Type::getType(Types::INTEGER), - 'name' => Type::getType(Types::STRING), - 'category' => Type::getType(Types::STRING), + 'id' => Types::INTEGER, + 'name' => Types::STRING, + 'category' => Types::STRING, ]; $bulkData = new BulkData([ diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkInsertTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkInsertTest.php index c8de0bb7cf..b96bba45f4 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkInsertTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkInsertTest.php @@ -6,13 +6,15 @@ use DateTime; use Doctrine\DBAL\Schema\Column; +use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\Doctrine\Bulk\Bulk; use Flow\Doctrine\Bulk\BulkData; use Flow\Doctrine\Bulk\Dialect\PostgreSQLInsertOptions; +use Flow\Doctrine\Bulk\Exception\RuntimeException; use Flow\Doctrine\Bulk\Tests\PostgreSqlIntegrationTestCase; +use PHPUnit\Framework\Attributes\TestWith; use function Flow\ETL\DSL\generate_random_string; use function json_encode; @@ -21,11 +23,15 @@ final class PostgreSqlBulkInsertTest extends PostgreSqlIntegrationTestCase { public function test_consecutive_inserts_of_one_shape_prepare_the_statement_once(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); $bulk = Bulk::create(); $connection = $this->databaseContext->connection(); @@ -52,18 +58,58 @@ public function test_consecutive_inserts_of_one_shape_prepare_the_statement_once ); } + public function test_insert_into_a_table_created_with_an_unquoted_mixed_case_name_does_not_find_the_exact_name(): void + { + $this->databaseContext->createTable(new Table('FlowBulkMixedCase', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ])); + + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage( + 'Table "FlowBulkMixedCase" not found, no table has the exact name "FlowBulkMixedCase".', + ); + + Bulk::create()->insert($this->databaseContext->connection(), 'FlowBulkMixedCase', new BulkData([[ + 'id' => 1, + 'name' => 'a', + ]])); + } + + #[TestWith(['flow_bulk_orders', 'flow_bulk_orders', '"flow_bulk_orders"'])] + #[TestWith(['"FlowBulkOrders"', 'FlowBulkOrders', '"FlowBulkOrders"'])] + #[TestWith(['"FlowBulkOrders"', '"FlowBulkOrders"', '"FlowBulkOrders"'])] + #[TestWith(['public.flow_bulk_orders', 'public.flow_bulk_orders', '"public"."flow_bulk_orders"'])] + #[TestWith(['public."FlowBulkOrders"', 'public."FlowBulkOrders"', '"public"."FlowBulkOrders"'])] + #[TestWith(['"order"', 'order', '"order"'])] + #[TestWith(['"user"', 'user', '"user"'])] + public function test_inserts_into_the_table_with_the_exact_name(string $created, string $table, string $sql): void + { + $this->databaseContext->createTable(new Table($created, [ + new Column('id', Types::INTEGER, ['notnull' => true]), + ])); + + Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([['id' => 1]])); + + static::assertSame([['id' => 1]], $this->databaseContext->selectAll($sql)); + } + public function test_inserts_multiple_rows_at_once(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('age', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => false]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - new Column('updated_at', Type::getType(Types::DATETIME_MUTABLE), ['notnull' => true]), - new Column('tags', Type::getType(Types::JSON), ['notnull' => true, 'platformOptions' => ['jsonb' => true]]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('age', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => false]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + new Column('updated_at', 'datetime', ['notnull' => true]), + new Column('tags', Types::JSON, ['notnull' => true, 'platformOptions' => ['jsonb' => true]]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); $date1 = new DateTime(); @@ -139,13 +185,17 @@ public function test_inserts_multiple_rows_at_once(): void public function test_inserts_new_rows_and_skip_already_existed(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => true], @@ -181,13 +231,17 @@ public function test_inserts_new_rows_and_skip_already_existed(): void public function test_inserts_new_rows_or_updates_already_existed_based_on_columns(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => true], ['id' => 2, 'name' => 'Name Two', 'description' => 'Description Two', 'active' => false], @@ -222,13 +276,17 @@ public function test_inserts_new_rows_or_updates_already_existed_based_on_column public function test_inserts_new_rows_or_updates_already_existed_based_on_columns_with_update_only_specific_columns(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => true], ['id' => 2, 'name' => 'Name Two', 'description' => 'Description Two', 'active' => false], @@ -261,13 +319,17 @@ public function test_inserts_new_rows_or_updates_already_existed_based_on_column public function test_inserts_new_rows_or_updates_already_existed_based_on_columns_with_update_only_specific_columns_and_preserve_existing_values(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => false, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => false, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => false, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => false, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => true], ['id' => 2, 'name' => 'Name Two', 'description' => 'Description Two', 'active' => false], @@ -302,13 +364,17 @@ public function test_inserts_new_rows_or_updates_already_existed_based_on_column public function test_inserts_new_rows_or_updates_already_existed_based_on_primary_key(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => true], ['id' => 2, 'name' => 'Name Two', 'description' => 'Description Two', 'active' => false], diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkUpdateTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkUpdateTest.php index a3db435d3d..d7ead3dd5f 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkUpdateTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/PostgreSqlBulkUpdateTest.php @@ -7,8 +7,8 @@ use DateTime; use DateTimeImmutable; use Doctrine\DBAL\Schema\Column; +use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\Doctrine\Bulk\Bulk; use Flow\Doctrine\Bulk\BulkData; @@ -20,15 +20,21 @@ final class PostgreSqlBulkUpdateTest extends PostgreSqlIntegrationTestCase { public function test_update_multiple_rows_with_all_columns_and_multiple_primary_keys_at_once(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('account', Type::getType(Types::STRING), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - new Column('created_at', Type::getType(Types::DATETIME_MUTABLE), ['notnull' => true]), - ]))->setPrimaryKey(['id', 'account'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('account', Types::STRING, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + new Column('created_at', 'datetime', ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint( + PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id', 'account')->create(), + ) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ [ @@ -94,7 +100,7 @@ public function test_update_multiple_rows_with_all_columns_and_multiple_primary_ 'description' => 'Description One', 'active' => false, 'account' => 'Bob', - 'created_at' => (new DateTimeImmutable('2021-01-01 10:00:00'))->format('Y-m-d H:i:s'), + 'created_at' => new DateTimeImmutable('2021-01-01 10:00:00')->format('Y-m-d H:i:s'), ], [ 'id' => 2, @@ -102,7 +108,7 @@ public function test_update_multiple_rows_with_all_columns_and_multiple_primary_ 'description' => 'Changed description Two', 'active' => false, 'account' => 'Bob', - 'created_at' => (new DateTimeImmutable('2021-01-02 10:00:00'))->format('Y-m-d H:i:s'), + 'created_at' => new DateTimeImmutable('2021-01-02 10:00:00')->format('Y-m-d H:i:s'), ], [ 'id' => 3, @@ -110,7 +116,7 @@ public function test_update_multiple_rows_with_all_columns_and_multiple_primary_ 'description' => 'Changed description Three', 'active' => true, 'account' => 'Joe', - 'created_at' => (new DateTimeImmutable('2021-01-02 20:00:00'))->format('Y-m-d H:i:s'), + 'created_at' => new DateTimeImmutable('2021-01-02 20:00:00')->format('Y-m-d H:i:s'), ], ], $this->databaseContext->selectAll($table), @@ -119,13 +125,17 @@ public function test_update_multiple_rows_with_all_columns_and_multiple_primary_ public function test_update_multiple_rows_with_all_columns_at_once(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => false], @@ -179,13 +189,17 @@ public function test_update_multiple_rows_with_all_columns_at_once(): void public function test_update_multiple_rows_with_selected_columns_at_once(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => false], @@ -227,13 +241,17 @@ public function test_update_multiple_rows_with_selected_columns_at_once(): void public function test_update_when_bulk_data_has_not_all_columns_from_primary_key_columns(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => false], @@ -264,13 +282,19 @@ public function test_update_when_bulk_data_has_not_all_columns_from_primary_key_ public function test_update_with_custom_types_using_casted_placeholders_works_with_postgresql(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('category', Type::getType(Types::STRING), ['notnull' => true, 'length' => 100]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id', 'name'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('category', Types::STRING, ['notnull' => true, 'length' => 100]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint( + PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id', 'name')->create(), + ) + ->create(), + ); $this->databaseContext->connection()->executeStatement("INSERT INTO {$table} (id, name, category, active) VALUES (1, 'Product One', 'Electronics', true), @@ -281,10 +305,10 @@ public function test_update_with_custom_types_using_casted_placeholders_works_wi static::assertEquals(4, $this->databaseContext->tableCount($table)); $customTypes = [ - 'id' => Type::getType(Types::INTEGER), - 'name' => Type::getType(Types::STRING), - 'category' => Type::getType(Types::STRING), - 'active' => Type::getType(Types::BOOLEAN), + 'id' => Types::INTEGER, + 'name' => Types::STRING, + 'category' => Types::STRING, + 'active' => Types::BOOLEAN, ]; $bulkData = new BulkData([ @@ -319,13 +343,17 @@ public function test_update_with_custom_types_using_casted_placeholders_works_wi public function test_update_with_empty_primary_key_columns(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => false], diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkDeleteTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkDeleteTest.php index 5b367e99a2..74d2818e55 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkDeleteTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkDeleteTest.php @@ -5,8 +5,8 @@ namespace Flow\Doctrine\Bulk\Tests\Integration; use Doctrine\DBAL\Schema\Column; +use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\Doctrine\Bulk\Bulk; use Flow\Doctrine\Bulk\BulkData; @@ -19,11 +19,15 @@ final class SqliteBulkDeleteTest extends SqliteIntegrationTestCase { public function test_delete_nonexistent_rows(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); $this->databaseContext->connection()->executeStatement("INSERT INTO {$table} (id, name) VALUES (1, 'Name One'), @@ -76,13 +80,19 @@ public function test_delete_of_more_rows_than_the_bind_cap_succeeds(): void } public function test_delete_rows_with_composite_key_condition(): void - // @mago-expect analysis:deprecated-method { - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('group_name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 1]), - new Column('value', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ]))->setPrimaryKey(['id', 'group_name'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('group_name', Types::STRING, ['notnull' => true, 'length' => 1]), + new Column('value', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) + ->edit() + ->addPrimaryKeyConstraint( + PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id', 'group_name')->create(), + ) + ->create(), + ); $this->databaseContext->connection()->executeStatement("INSERT INTO {$table} (id, group_name, value) VALUES (1, 'A', 'Value One A'), @@ -117,12 +127,16 @@ public function test_delete_rows_with_composite_key_condition(): void public function test_delete_rows_with_single_column_condition(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); $this->databaseContext->connection()->executeStatement("INSERT INTO {$table} (id, name, description) VALUES (1, 'Name One', 'Description One'), diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkInsertTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkInsertTest.php index 347d8b39d0..882622c3c4 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkInsertTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkInsertTest.php @@ -7,30 +7,83 @@ use DateTime; use Doctrine\DBAL\Exception; use Doctrine\DBAL\Schema\Column; +use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\Doctrine\Bulk\Bulk; use Flow\Doctrine\Bulk\BulkData; use Flow\Doctrine\Bulk\Dialect\SqliteInsertOptions; +use Flow\Doctrine\Bulk\Exception\RuntimeException; use Flow\Doctrine\Bulk\Tests\Mother\WideTableMother; use Flow\Doctrine\Bulk\Tests\SqliteIntegrationTestCase; +use PHPUnit\Framework\Attributes\TestWith; use function Flow\ETL\DSL\generate_random_string; final class SqliteBulkInsertTest extends SqliteIntegrationTestCase { + public function test_inserts_into_a_table_with_a_mixed_case_unquoted_name(): void + { + $this->databaseContext->createTable(new Table('FlowBulkMixedCase', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + ])); + + Bulk::create()->insert($this->databaseContext->connection(), 'FlowBulkMixedCase', new BulkData([[ + 'id' => 1, + 'name' => 'a', + ]])); + + static::assertSame([['id' => 1, 'name' => 'a']], $this->databaseContext->selectAll('FlowBulkMixedCase')); + } + + #[TestWith(['flow_bulk_orders', 'flow_bulk_orders', '"flow_bulk_orders"'])] + #[TestWith(['"FlowBulkOrders"', 'FlowBulkOrders', '"FlowBulkOrders"'])] + #[TestWith(['"FlowBulkOrders"', '"FlowBulkOrders"', '"FlowBulkOrders"'])] + #[TestWith(['"order"', 'order', '"order"'])] + #[TestWith(['"user"', 'user', '"user"'])] + public function test_inserts_into_the_table_with_the_exact_name(string $created, string $table, string $sql): void + { + $this->databaseContext->createTable(new Table($created, [ + new Column('id', Types::INTEGER, ['notnull' => true]), + ])); + + Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([['id' => 1]])); + + static::assertSame([['id' => 1]], $this->databaseContext->selectAll($sql)); + } + + public function test_insert_with_a_schema_qualified_table_name_is_refused(): void + { + $this->databaseContext->createTable(new Table('flow_bulk_orders', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + ])); + + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage( + 'Table "main.flow_bulk_orders" has the schema qualifier "main", but this database platform does not support schemas.', + ); + + Bulk::create()->insert($this->databaseContext->connection(), 'main.flow_bulk_orders', new BulkData([[ + 'id' => 1, + ]])); + } + public function test_inserts_multiple_rows_at_once(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('age', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => false]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - new Column('updated_at', Type::getType(Types::DATETIME_MUTABLE), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('age', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => false]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + new Column('updated_at', 'datetime', ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ [ @@ -98,13 +151,17 @@ public function test_inserts_multiple_rows_at_once(): void public function test_inserts_new_rows_and_skip_already_existed(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => true], @@ -140,13 +197,17 @@ public function test_inserts_new_rows_and_skip_already_existed(): void public function test_inserts_new_rows_or_updates_already_existed_based_on_columns(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => true], ['id' => 2, 'name' => 'Name Two', 'description' => 'Description Two', 'active' => false], @@ -181,13 +242,17 @@ public function test_inserts_new_rows_or_updates_already_existed_based_on_column public function test_inserts_new_rows_or_updates_already_existed_based_on_columns_with_update_only_specific_columns(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => true], ['id' => 2, 'name' => 'Name Two', 'description' => 'Description Two', 'active' => false], @@ -220,13 +285,17 @@ public function test_inserts_new_rows_or_updates_already_existed_based_on_column public function test_inserts_new_rows_or_updates_already_existed_based_on_columns_with_update_only_specific_columns_and_preserve_existing_values(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => false, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => false, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => false, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => false, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => true], ['id' => 2, 'name' => 'Name Two', 'description' => 'Description Two', 'active' => false], diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkUpdateTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkUpdateTest.php index 8260069034..4036559a11 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkUpdateTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Integration/SqliteBulkUpdateTest.php @@ -6,8 +6,8 @@ use Doctrine\DBAL\Exception\NotNullConstraintViolationException; use Doctrine\DBAL\Schema\Column; +use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\Doctrine\Bulk\Bulk; use Flow\Doctrine\Bulk\BulkData; @@ -47,13 +47,17 @@ public function test_a_failing_chunk_rolls_back_the_whole_update(): void public function test_update_multiple_rows_with_all_columns_at_once(): void { - // @mago-expect analysis:deprecated-method - $this->databaseContext->createTable((new Table($table = 'flow_doctrine_bulk_test', [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('description', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - ]))->setPrimaryKey(['id'])); + $this->databaseContext->createTable( + new Table($table = 'flow_doctrine_bulk_test', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('description', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + ]) + ->edit() + ->addPrimaryKeyConstraint(PrimaryKeyConstraint::editor()->setUnquotedColumnNames('id')->create()) + ->create(), + ); Bulk::create()->insert($this->databaseContext->connection(), $table, new BulkData([ ['id' => 1, 'name' => 'Name One', 'description' => 'Description One', 'active' => false], diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Mother/WideTableMother.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Mother/WideTableMother.php index 5a49c56a04..3f60792b84 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Mother/WideTableMother.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Mother/WideTableMother.php @@ -7,7 +7,6 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\PrimaryKeyConstraint; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; final class WideTableMother @@ -57,7 +56,7 @@ public static function table(string $name, int $columns): Table $definitions = []; for ($column = 1; $column <= $columns; $column++) { - $definitions[] = new Column('c' . $column, Type::getType(Types::INTEGER), ['notnull' => true]); + $definitions[] = new Column('c' . $column, Types::INTEGER, ['notnull' => true]); } return new Table($name, $definitions); diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/MysqlIntegrationTestCase.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/MysqlIntegrationTestCase.php index c981201b09..80d645ea02 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/MysqlIntegrationTestCase.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/MysqlIntegrationTestCase.php @@ -19,8 +19,8 @@ protected function setUp(): void parent::setUp(); $this->databaseContext = new DatabaseContext(DriverManager::getConnection( - (new DsnParser(['mysql' => 'pdo_mysql']))->parse(getenv('MYSQL_DATABASE_URL') ?: ''), - (new Configuration())->setMiddlewares([new Middleware($this->logger), $this->spy]), + new DsnParser(['mysql' => 'pdo_mysql'])->parse(getenv('MYSQL_DATABASE_URL') ?: ''), + new Configuration()->setMiddlewares([new Middleware($this->logger), $this->spy]), )); $this->databaseContext->connection()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); } diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/PostgreSqlIntegrationTestCase.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/PostgreSqlIntegrationTestCase.php index a11916453e..48b4fe6dd4 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/PostgreSqlIntegrationTestCase.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/PostgreSqlIntegrationTestCase.php @@ -19,8 +19,8 @@ protected function setUp(): void parent::setUp(); $this->databaseContext = new DatabaseContext(DriverManager::getConnection( - (new DsnParser(['pgsql' => 'pdo_pgsql']))->parse(getenv('PGSQL_DATABASE_URL') ?: ''), - (new Configuration())->setMiddlewares([new Middleware($this->logger), $this->spy]), + new DsnParser(['pgsql' => 'pdo_pgsql'])->parse(getenv('PGSQL_DATABASE_URL') ?: ''), + new Configuration()->setMiddlewares([new Middleware($this->logger), $this->spy]), )); } } diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/SqliteIntegrationTestCase.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/SqliteIntegrationTestCase.php index 0d9402d705..329fd49666 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/SqliteIntegrationTestCase.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/SqliteIntegrationTestCase.php @@ -28,10 +28,10 @@ protected function setUp(): void } $this->databaseContext = new DatabaseContext(DriverManager::getConnection( - (new DsnParser(['sqlite' => 'sqlite3']))->parse( + new DsnParser(['sqlite' => 'sqlite3'])->parse( 'sqlite3://' . (str_starts_with($path, '/') ? '/' : '') . $path, ), - (new Configuration())->setMiddlewares([new Middleware($this->logger), $this->spy]), + new Configuration()->setMiddlewares([new Middleware($this->logger), $this->spy]), )); } } diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/BulkDataTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/BulkDataTest.php index 8fdff829cd..73379874b7 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/BulkDataTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/BulkDataTest.php @@ -10,7 +10,6 @@ use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\Doctrine\Bulk\BulkData; use Flow\Doctrine\Bulk\Columns; @@ -253,7 +252,7 @@ public function test_to_sql_casted_placeholders_falls_back_to_database_when_no_c // Provide custom type for only one column $customTypes = [ - 'id' => Type::getType(Types::INTEGER), + 'id' => Types::INTEGER, // 'name' not provided - should fall back to database lookup ]; @@ -277,8 +276,8 @@ public function test_to_sql_casted_placeholders_handles_special_characters_in_co $connection = $this->createSQLiteConnection(); $table = new Table('special_table', [ - new Column('user_id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('first_name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 100]), + new Column('user_id', Types::INTEGER, ['notnull' => true]), + new Column('first_name', Types::STRING, ['notnull' => true, 'length' => 100]), ]); $connection->createSchemaManager()->createTable($table); @@ -340,8 +339,8 @@ public function test_to_sql_casted_placeholders_with_custom_types(): void $tableDefinition = new TableDefinition('test_table', $connection); $customTypes = [ - 'id' => Type::getType(Types::INTEGER), - 'name' => Type::getType(Types::STRING), + 'id' => Types::INTEGER, + 'name' => Types::STRING, ]; $bulkData = new BulkData( @@ -563,7 +562,7 @@ public function test_to_sql_parameters_with_custom_types_conversion(): void // Custom type that converts values $customTypes = [ - 'id' => Type::getType(Types::INTEGER), + 'id' => Types::INTEGER, ]; $bulkData = new BulkData( @@ -586,11 +585,11 @@ public function test_to_sql_parameters_accepts_immutable_datetime_for_mutable_ty { static::assertSame( ['2026-01-02 03:04:05'], - array_values((new BulkData( + array_values(new BulkData( [['name' => new DateTimeImmutable('2026-01-02 03:04:05')]], - ['name' => Type::getType(Types::DATETIME_MUTABLE)], + ['name' => 'datetime'], $style, - ))->toSqlParameters(new TableDefinition('test_table', $this->createConnectionWithTable('test_table')))), + )->toSqlParameters(new TableDefinition('test_table', $this->createConnectionWithTable('test_table')))), ); } @@ -600,11 +599,11 @@ public function test_to_sql_parameters_accepts_mutable_datetime_for_immutable_ty { static::assertSame( ['2026-01-02 03:04:05'], - array_values((new BulkData( + array_values(new BulkData( [['name' => new DateTime('2026-01-02 03:04:05')]], - ['name' => Type::getType(Types::DATETIME_IMMUTABLE)], + ['name' => Types::DATETIME_IMMUTABLE], $style, - ))->toSqlParameters(new TableDefinition('test_table', $this->createConnectionWithTable('test_table')))), + )->toSqlParameters(new TableDefinition('test_table', $this->createConnectionWithTable('test_table')))), ); } @@ -767,10 +766,10 @@ public function test_uses_positional_parameters_when_explicitly_set(): void private function createComplexTestTable(Connection $connection, string $tableName): void { $table = new Table($tableName, [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('age', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('age', Types::INTEGER, ['notnull' => true]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), ]); $connection->createSchemaManager()->createTable($table); @@ -803,8 +802,8 @@ private function createSQLiteConnection(): Connection private function createTestTable(Connection $connection, string $tableName): void { $table = new Table($tableName, [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), ]); $connection->createSchemaManager()->createTable($table); @@ -819,8 +818,8 @@ public function test_chunk_returns_self_when_it_fits(): void public function test_chunk_splits_and_preserves_types_and_parameters_style(): void { - $types = ['id' => Type::getType(Types::INTEGER)]; - $chunks = (new BulkData([['id' => 1], ['id' => 2], ['id' => 3]], $types, SQLParametersStyle::NAMED))->chunk(2); + $types = ['id' => Types::INTEGER]; + $chunks = new BulkData([['id' => 1], ['id' => 2], ['id' => 3]], $types, SQLParametersStyle::NAMED)->chunk(2); static::assertCount(2, $chunks); static::assertSame([['id' => 1], ['id' => 2]], $chunks[0]->rows()); diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/ColumnsTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/ColumnsTest.php index 2b4cb5f4ac..89bdf4e260 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/ColumnsTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/ColumnsTest.php @@ -57,6 +57,6 @@ public function test_transforms_all_columns_to_placeholders(): void public function test_counts_its_columns(): void { - static::assertSame(3, (new Columns('id', 'name', 'age'))->count()); + static::assertSame(3, new Columns('id', 'name', 'age')->count()); } } diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/DbalPlatformTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/DbalPlatformTest.php index c911f03d9d..e96ed0956a 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/DbalPlatformTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/DbalPlatformTest.php @@ -5,7 +5,7 @@ namespace Flow\Doctrine\Bulk\Tests\Unit; use Doctrine\DBAL\Platforms\MariaDBPlatform; -use Doctrine\DBAL\Platforms\MySQL80Platform; +use Doctrine\DBAL\Platforms\MySQLPlatform; use Doctrine\DBAL\Platforms\OraclePlatform; use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Platforms\SQLitePlatform; @@ -16,14 +16,11 @@ use Flow\Doctrine\Bulk\Exception\RuntimeException; use PHPUnit\Framework\TestCase; -use function class_exists; - final class DbalPlatformTest extends TestCase { public function test_is_mysql(): void { - // @mago-expect analysis:deprecated-class - $platform = new DbalPlatform(new MySQL80Platform()); + $platform = new DbalPlatform(new MySQLPlatform()); static::assertInstanceOf(MySQLDialect::class, $platform->dialect()); } @@ -42,20 +39,7 @@ public function test_is_postgres_sql(): void static::assertInstanceOf(PostgreSQLDialect::class, $platform->dialect()); } - public function test_is_sqlite_sql_with_lowercase_l_class_name(): void - { - if (!class_exists(SQLitePlatform::class)) { - static::markTestSkipped( - 'Doctrine\\DBAL\\Platforms\\SqlitePlatform class is not available on this DBAL version.', - ); - } - - $platform = new DbalPlatform(new SQLitePlatform()); - - static::assertInstanceOf(SqliteDialect::class, $platform->dialect()); - } - - public function test_is_sqlite_sql_with_uppercase_l_class_name(): void + public function test_is_sqlite(): void { $platform = new DbalPlatform(new SQLitePlatform()); diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/Dialect/MySQLDialectTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/Dialect/MySQLDialectTest.php index e7e50cf37a..2eb3293e6c 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/Dialect/MySQLDialectTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/Dialect/MySQLDialectTest.php @@ -4,14 +4,186 @@ namespace Flow\Doctrine\Bulk\Tests\Unit\Dialect; +use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Platforms\MySQLPlatform; +use Doctrine\DBAL\Types\Types; +use Flow\Doctrine\Bulk\BulkData; use Flow\Doctrine\Bulk\Dialect\MySQLDialect; +use Flow\Doctrine\Bulk\Dialect\MySQLInsertOptions; +use Flow\Doctrine\Bulk\Dialect\MySQLUpdateOptions; +use Flow\Doctrine\Bulk\Exception\RuntimeException; +use Flow\Doctrine\Bulk\TableDefinition; +use Generator; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\TestWith; use PHPUnit\Framework\TestCase; final class MySQLDialectTest extends TestCase { + /** + * @return Generator + */ + public static function provide_insert_statements(): Generator + { + yield 'plain, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + null, + 'INSERT INTO `orders` (`id`,`order`) VALUES (?,?)', + ]; + yield 'plain, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + null, + 'INSERT INTO `orders` (`id`,`a.b`) VALUES (?,?)', + ]; + yield 'skip conflicts, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new MySQLInsertOptions(skipConflicts: true), + 'INSERT INTO `orders` (`id`,`order`) VALUES (?,?) ON DUPLICATE KEY UPDATE id=id', + ]; + yield 'skip conflicts, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + new MySQLInsertOptions(skipConflicts: true), + 'INSERT INTO `orders` (`id`,`a.b`) VALUES (?,?) ON DUPLICATE KEY UPDATE id=id', + ]; + yield 'upsert, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new MySQLInsertOptions(upsert: true), + 'INSERT INTO `orders` (`id`,`order`) + VALUES (?,?) + ON DUPLICATE KEY UPDATE `id` = VALUES(`id`),`order` = VALUES(`order`)', + ]; + yield 'upsert, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + new MySQLInsertOptions(upsert: true), + 'INSERT INTO `orders` (`id`,`a.b`) + VALUES (?,?) + ON DUPLICATE KEY UPDATE `id` = VALUES(`id`),`a.b` = VALUES(`a.b`)', + ]; + yield 'upsert with update columns preserving existing values, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new MySQLInsertOptions(upsert: true, updateColumns: ['order'], preserveExistingValues: true), + 'INSERT INTO `orders` (`id`,`order`) + VALUES (?,?) + ON DUPLICATE KEY UPDATE `order` = COALESCE(VALUES(`order`), `orders`.`order`)', + ]; + yield 'upsert with update columns preserving existing values, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + new MySQLInsertOptions(upsert: true, updateColumns: ['a.b'], preserveExistingValues: true), + 'INSERT INTO `orders` (`id`,`a.b`) + VALUES (?,?) + ON DUPLICATE KEY UPDATE `a.b` = COALESCE(VALUES(`a.b`), `orders`.`a.b`)', + ]; + } + + /** + * @return Generator + */ + public static function provide_update_statements(): Generator + { + yield 'replace, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + null, + 'REPLACE INTO `orders` (`id`,`order`) VALUES (?,?)', + ]; + yield 'replace, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + null, + 'REPLACE INTO `orders` (`id`,`a.b`) VALUES (?,?)', + ]; + } + + /** + * @return Generator + */ + public static function provide_delete_statements(): Generator + { + yield 'reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + 'DELETE FROM `orders` WHERE (`id`, `order`) IN ((?,?))', + ]; + yield 'dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + 'DELETE FROM `orders` WHERE (`id`, `a.b`) IN ((?,?))', + ]; + } + + #[DataProvider('provide_delete_statements')] + public function test_prepare_delete(string $table, BulkData $rows, string $sql): void + { + $connection = DriverManager::getConnection(['driver' => 'pdo_mysql', 'serverVersion' => '8.4.0']); + + static::assertSame($sql, new MySQLDialect($connection->getDatabasePlatform())->prepareDelete( + new TableDefinition($table, $connection), + $rows, + )); + } + + #[DataProvider('provide_insert_statements')] + public function test_prepare_insert(string $table, BulkData $rows, ?MySQLInsertOptions $options, string $sql): void + { + $connection = DriverManager::getConnection(['driver' => 'pdo_mysql', 'serverVersion' => '8.4.0']); + + static::assertSame($sql, new MySQLDialect($connection->getDatabasePlatform())->prepareInsert( + new TableDefinition($table, $connection), + $rows, + $options, + )); + } + + #[DataProvider('provide_update_statements')] + public function test_prepare_update(string $table, BulkData $rows, ?MySQLUpdateOptions $options, string $sql): void + { + $connection = DriverManager::getConnection(['driver' => 'pdo_mysql', 'serverVersion' => '8.4.0']); + + static::assertSame($sql, new MySQLDialect($connection->getDatabasePlatform())->prepareUpdate( + new TableDefinition($table, $connection), + $rows, + $options, + )); + } + + #[TestWith(['orders', '`orders`'])] + #[TestWith(['Orders', '`Orders`'])] + #[TestWith(['order', '`order`'])] + #[TestWith(['"my.table"', '`my.table`'])] + public function test_quoted_table_name_is_the_exact_name(string $table, string $quotedName): void + { + static::assertSame( + $quotedName, + new TableDefinition($table, DriverManager::getConnection([ + 'driver' => 'pdo_mysql', + 'serverVersion' => '8.4.0', + ]))->quotedName(), + ); + } + + public function test_schema_qualified_table_name_is_refused(): void + { + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage( + 'Table "flow.orders" has the schema qualifier "flow", but this database platform does not support schemas. Pass the table name without "flow.".', + ); + + new TableDefinition('flow.orders', DriverManager::getConnection([ + 'driver' => 'pdo_mysql', + 'serverVersion' => '8.4.0', + ]))->quotedName(); + } + public function test_max_bind_parameters(): void { - static::assertSame(65_535, (new MySQLDialect(new MySQLPlatform()))->maxBindParameters()); + static::assertSame(65_535, new MySQLDialect(new MySQLPlatform())->maxBindParameters()); } } diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/Dialect/PostgreSQLDialectTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/Dialect/PostgreSQLDialectTest.php index 417c140eb2..803243dcc1 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/Dialect/PostgreSQLDialectTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/Dialect/PostgreSQLDialectTest.php @@ -4,14 +4,265 @@ namespace Flow\Doctrine\Bulk\Tests\Unit\Dialect; +use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Platforms\PostgreSQLPlatform; +use Doctrine\DBAL\Types\Types; +use Flow\Doctrine\Bulk\BulkData; use Flow\Doctrine\Bulk\Dialect\PostgreSQLDialect; +use Flow\Doctrine\Bulk\Dialect\PostgreSQLInsertOptions; +use Flow\Doctrine\Bulk\Dialect\PostgreSQLUpdateOptions; +use Flow\Doctrine\Bulk\TableDefinition; +use Generator; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\TestWith; use PHPUnit\Framework\TestCase; final class PostgreSQLDialectTest extends TestCase { + /** + * @return Generator + */ + public static function provide_insert_statements(): Generator + { + yield 'plain, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + null, + 'INSERT INTO "orders" ("id","order") VALUES (?,?)', + ]; + yield 'plain, reserved word, schema qualified table' => [ + 'public.orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + null, + 'INSERT INTO "public"."orders" ("id","order") VALUES (?,?)', + ]; + yield 'plain, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + null, + 'INSERT INTO "orders" ("id","a.b") VALUES (?,?)', + ]; + yield 'conflict columns, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new PostgreSQLInsertOptions(conflictColumns: ['id']), + 'INSERT INTO "orders" ("id","order") VALUES (?,?) ON CONFLICT (id) DO UPDATE SET "id" = "excluded"."id","order" = "excluded"."order"', + ]; + yield 'conflict columns, reserved word, schema qualified table' => [ + 'public.orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new PostgreSQLInsertOptions(conflictColumns: ['id']), + 'INSERT INTO "public"."orders" ("id","order") VALUES (?,?) ON CONFLICT (id) DO UPDATE SET "id" = "excluded"."id","order" = "excluded"."order"', + ]; + yield 'conflict columns, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + new PostgreSQLInsertOptions(conflictColumns: ['id']), + 'INSERT INTO "orders" ("id","a.b") VALUES (?,?) ON CONFLICT (id) DO UPDATE SET "id" = "excluded"."id","a.b" = "excluded"."a.b"', + ]; + yield 'conflict columns with update columns preserving existing values, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new PostgreSQLInsertOptions( + conflictColumns: ['id'], + updateColumns: ['order'], + preserveExistingValues: true, + ), + 'INSERT INTO "orders" ("id","order") VALUES (?,?) ON CONFLICT (id) DO UPDATE SET "order" = COALESCE("excluded"."order", "orders"."order")', + ]; + yield 'conflict columns with update columns preserving existing values, reserved word, schema qualified table' => + [ + 'public.orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new PostgreSQLInsertOptions( + conflictColumns: ['id'], + updateColumns: ['order'], + preserveExistingValues: true, + ), + 'INSERT INTO "public"."orders" ("id","order") VALUES (?,?) ON CONFLICT (id) DO UPDATE SET "order" = COALESCE("excluded"."order", "public"."orders"."order")', + ]; + yield 'conflict columns with update columns preserving existing values, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + new PostgreSQLInsertOptions(conflictColumns: ['id'], updateColumns: ['a.b'], preserveExistingValues: true), + 'INSERT INTO "orders" ("id","a.b") VALUES (?,?) ON CONFLICT (id) DO UPDATE SET "a.b" = COALESCE("excluded"."a.b", "orders"."a.b")', + ]; + yield 'constraint with update columns, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new PostgreSQLInsertOptions(constraint: 'orders_pkey', updateColumns: ['order']), + 'INSERT INTO "orders" ("id","order") VALUES (?,?) ON CONFLICT ON CONSTRAINT orders_pkey DO UPDATE SET "order" = "excluded"."order"', + ]; + yield 'constraint with update columns, reserved word, schema qualified table' => [ + 'public.orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new PostgreSQLInsertOptions(constraint: 'orders_pkey', updateColumns: ['order']), + 'INSERT INTO "public"."orders" ("id","order") VALUES (?,?) ON CONFLICT ON CONSTRAINT orders_pkey DO UPDATE SET "order" = "excluded"."order"', + ]; + yield 'constraint with update columns, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + new PostgreSQLInsertOptions(constraint: 'orders_pkey', updateColumns: ['a.b']), + 'INSERT INTO "orders" ("id","a.b") VALUES (?,?) ON CONFLICT ON CONSTRAINT orders_pkey DO UPDATE SET "a.b" = "excluded"."a.b"', + ]; + yield 'skip conflicts, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new PostgreSQLInsertOptions(skipConflicts: true), + 'INSERT INTO "orders" ("id","order") VALUES (?,?) ON CONFLICT DO NOTHING', + ]; + yield 'skip conflicts, reserved word, schema qualified table' => [ + 'public.orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new PostgreSQLInsertOptions(skipConflicts: true), + 'INSERT INTO "public"."orders" ("id","order") VALUES (?,?) ON CONFLICT DO NOTHING', + ]; + yield 'skip conflicts, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + new PostgreSQLInsertOptions(skipConflicts: true), + 'INSERT INTO "orders" ("id","a.b") VALUES (?,?) ON CONFLICT DO NOTHING', + ]; + } + + /** + * @return Generator + */ + public static function provide_update_statements(): Generator + { + yield 'all columns, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new PostgreSQLUpdateOptions(primaryKeyColumns: ['id']), + 'UPDATE "orders" as existing_table SET "order" = "excluded"."order" FROM (VALUES (CAST(? as INT),CAST(? as VARCHAR))) as excluded ("id","order") WHERE "existing_table"."id" = "excluded"."id"', + ]; + yield 'all columns, reserved word, schema qualified table' => [ + 'public.orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new PostgreSQLUpdateOptions(primaryKeyColumns: ['id']), + 'UPDATE "public"."orders" as existing_table SET "order" = "excluded"."order" FROM (VALUES (CAST(? as INT),CAST(? as VARCHAR))) as excluded ("id","order") WHERE "existing_table"."id" = "excluded"."id"', + ]; + yield 'all columns, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + new PostgreSQLUpdateOptions(primaryKeyColumns: ['id']), + 'UPDATE "orders" as existing_table SET "a.b" = "excluded"."a.b" FROM (VALUES (CAST(? as INT),CAST(? as VARCHAR))) as excluded ("id","a.b") WHERE "existing_table"."id" = "excluded"."id"', + ]; + yield 'update columns preserving existing values, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new PostgreSQLUpdateOptions( + primaryKeyColumns: ['id'], + updateColumns: ['order'], + preserveExistingValues: true, + ), + 'UPDATE "orders" as existing_table SET "order" = COALESCE("excluded"."order", "orders"."order") FROM (VALUES (CAST(? as INT),CAST(? as VARCHAR))) as excluded ("id","order") WHERE "existing_table"."id" = "excluded"."id"', + ]; + yield 'update columns preserving existing values, reserved word, schema qualified table' => [ + 'public.orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new PostgreSQLUpdateOptions( + primaryKeyColumns: ['id'], + updateColumns: ['order'], + preserveExistingValues: true, + ), + 'UPDATE "public"."orders" as existing_table SET "order" = COALESCE("excluded"."order", "public"."orders"."order") FROM (VALUES (CAST(? as INT),CAST(? as VARCHAR))) as excluded ("id","order") WHERE "existing_table"."id" = "excluded"."id"', + ]; + yield 'update columns preserving existing values, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + new PostgreSQLUpdateOptions( + primaryKeyColumns: ['id'], + updateColumns: ['a.b'], + preserveExistingValues: true, + ), + 'UPDATE "orders" as existing_table SET "a.b" = COALESCE("excluded"."a.b", "orders"."a.b") FROM (VALUES (CAST(? as INT),CAST(? as VARCHAR))) as excluded ("id","a.b") WHERE "existing_table"."id" = "excluded"."id"', + ]; + } + + /** + * @return Generator + */ + public static function provide_delete_statements(): Generator + { + yield 'reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + 'DELETE FROM "orders" WHERE ("id", "order") IN ((CAST(? as INT),CAST(? as VARCHAR)))', + ]; + yield 'reserved word, schema qualified table' => [ + 'public.orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + 'DELETE FROM "public"."orders" WHERE ("id", "order") IN ((CAST(? as INT),CAST(? as VARCHAR)))', + ]; + yield 'dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + 'DELETE FROM "orders" WHERE ("id", "a.b") IN ((CAST(? as INT),CAST(? as VARCHAR)))', + ]; + } + + #[DataProvider('provide_delete_statements')] + public function test_prepare_delete(string $table, BulkData $rows, string $sql): void + { + $connection = DriverManager::getConnection(['driver' => 'pdo_pgsql', 'serverVersion' => '16.0']); + + static::assertSame($sql, new PostgreSQLDialect($connection->getDatabasePlatform())->prepareDelete( + new TableDefinition($table, $connection), + $rows, + )); + } + + #[DataProvider('provide_insert_statements')] + public function test_prepare_insert( + string $table, + BulkData $rows, + ?PostgreSQLInsertOptions $options, + string $sql, + ): void { + $connection = DriverManager::getConnection(['driver' => 'pdo_pgsql', 'serverVersion' => '16.0']); + + static::assertSame($sql, new PostgreSQLDialect($connection->getDatabasePlatform())->prepareInsert( + new TableDefinition($table, $connection), + $rows, + $options, + )); + } + + #[DataProvider('provide_update_statements')] + public function test_prepare_update( + string $table, + BulkData $rows, + ?PostgreSQLUpdateOptions $options, + string $sql, + ): void { + $connection = DriverManager::getConnection(['driver' => 'pdo_pgsql', 'serverVersion' => '16.0']); + + static::assertSame($sql, new PostgreSQLDialect($connection->getDatabasePlatform())->prepareUpdate( + new TableDefinition($table, $connection), + $rows, + $options, + )); + } + + #[TestWith(['orders', '"orders"'])] + #[TestWith(['Orders', '"Orders"'])] + #[TestWith(['order', '"order"'])] + #[TestWith(['public.Orders', '"public"."Orders"'])] + #[TestWith(['"my.table"', '"my.table"'])] + public function test_quoted_table_name_is_the_exact_name(string $table, string $quotedName): void + { + static::assertSame( + $quotedName, + new TableDefinition($table, DriverManager::getConnection([ + 'driver' => 'pdo_pgsql', + 'serverVersion' => '16.0', + ]))->quotedName(), + ); + } + public function test_max_bind_parameters(): void { - static::assertSame(65_535, (new PostgreSQLDialect(new PostgreSQLPlatform()))->maxBindParameters()); + static::assertSame(65_535, new PostgreSQLDialect(new PostgreSQLPlatform())->maxBindParameters()); } } diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/Dialect/SqliteDialectTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/Dialect/SqliteDialectTest.php index 8320e56559..80e13ba988 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/Dialect/SqliteDialectTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/Dialect/SqliteDialectTest.php @@ -4,14 +4,178 @@ namespace Flow\Doctrine\Bulk\Tests\Unit\Dialect; +use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Platforms\SQLitePlatform; +use Doctrine\DBAL\Types\Types; +use Flow\Doctrine\Bulk\BulkData; use Flow\Doctrine\Bulk\Dialect\SqliteDialect; +use Flow\Doctrine\Bulk\Dialect\SqliteInsertOptions; +use Flow\Doctrine\Bulk\Dialect\SqliteUpdateOptions; +use Flow\Doctrine\Bulk\Exception\RuntimeException; +use Flow\Doctrine\Bulk\TableDefinition; +use Generator; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\TestWith; use PHPUnit\Framework\TestCase; final class SqliteDialectTest extends TestCase { + /** + * @return Generator + */ + public static function provide_insert_statements(): Generator + { + yield 'plain, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + null, + 'INSERT INTO "orders" ("id","order") VALUES (?,?)', + ]; + yield 'plain, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + null, + 'INSERT INTO "orders" ("id","a.b") VALUES (?,?)', + ]; + yield 'conflict columns, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new SqliteInsertOptions(conflictColumns: ['id']), + 'INSERT INTO "orders" ("id","order") VALUES (?,?) ON CONFLICT (id) DO UPDATE SET "id" = "excluded"."id","order" = "excluded"."order"', + ]; + yield 'conflict columns, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + new SqliteInsertOptions(conflictColumns: ['id']), + 'INSERT INTO "orders" ("id","a.b") VALUES (?,?) ON CONFLICT (id) DO UPDATE SET "id" = "excluded"."id","a.b" = "excluded"."a.b"', + ]; + yield 'conflict columns with update columns preserving existing values, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new SqliteInsertOptions(conflictColumns: ['id'], updateColumns: ['order'], preserveExistingValues: true), + 'INSERT INTO "orders" ("id","order") VALUES (?,?) ON CONFLICT (id) DO UPDATE SET "order" = COALESCE("excluded"."order", "orders"."order")', + ]; + yield 'conflict columns with update columns preserving existing values, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + new SqliteInsertOptions(conflictColumns: ['id'], updateColumns: ['a.b'], preserveExistingValues: true), + 'INSERT INTO "orders" ("id","a.b") VALUES (?,?) ON CONFLICT (id) DO UPDATE SET "a.b" = COALESCE("excluded"."a.b", "orders"."a.b")', + ]; + yield 'skip conflicts, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + new SqliteInsertOptions(skipConflicts: true), + 'INSERT INTO "orders" ("id","order") VALUES (?,?) ON CONFLICT DO NOTHING', + ]; + yield 'skip conflicts, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + new SqliteInsertOptions(skipConflicts: true), + 'INSERT INTO "orders" ("id","a.b") VALUES (?,?) ON CONFLICT DO NOTHING', + ]; + } + + /** + * @return Generator + */ + public static function provide_update_statements(): Generator + { + yield 'replace, reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + null, + 'REPLACE INTO "orders" ("id","order") VALUES (?,?)', + ]; + yield 'replace, dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + null, + 'REPLACE INTO "orders" ("id","a.b") VALUES (?,?)', + ]; + } + + /** + * @return Generator + */ + public static function provide_delete_statements(): Generator + { + yield 'reserved word' => [ + 'orders', + new BulkData([['id' => 1, 'order' => 'a']], ['id' => Types::INTEGER, 'order' => Types::STRING]), + 'DELETE FROM "orders" WHERE ("id", "order") IN ((?,?))', + ]; + yield 'dotted name' => [ + 'orders', + new BulkData([['id' => 1, 'a.b' => 'a']], ['id' => Types::INTEGER, 'a.b' => Types::STRING]), + 'DELETE FROM "orders" WHERE ("id", "a.b") IN ((?,?))', + ]; + } + + #[DataProvider('provide_delete_statements')] + public function test_prepare_delete(string $table, BulkData $rows, string $sql): void + { + $connection = DriverManager::getConnection(['driver' => 'sqlite3', 'memory' => true]); + + static::assertSame($sql, new SqliteDialect($connection->getDatabasePlatform())->prepareDelete( + new TableDefinition($table, $connection), + $rows, + )); + } + + #[DataProvider('provide_insert_statements')] + public function test_prepare_insert(string $table, BulkData $rows, ?SqliteInsertOptions $options, string $sql): void + { + $connection = DriverManager::getConnection(['driver' => 'sqlite3', 'memory' => true]); + + static::assertSame($sql, new SqliteDialect($connection->getDatabasePlatform())->prepareInsert( + new TableDefinition($table, $connection), + $rows, + $options, + )); + } + + #[DataProvider('provide_update_statements')] + public function test_prepare_update(string $table, BulkData $rows, ?SqliteUpdateOptions $options, string $sql): void + { + $connection = DriverManager::getConnection(['driver' => 'sqlite3', 'memory' => true]); + + static::assertSame($sql, new SqliteDialect($connection->getDatabasePlatform())->prepareUpdate( + new TableDefinition($table, $connection), + $rows, + $options, + )); + } + + #[TestWith(['orders', '"orders"'])] + #[TestWith(['Orders', '"Orders"'])] + #[TestWith(['order', '"order"'])] + #[TestWith(['"my.table"', '"my.table"'])] + public function test_quoted_table_name_is_the_exact_name(string $table, string $quotedName): void + { + static::assertSame( + $quotedName, + new TableDefinition($table, DriverManager::getConnection([ + 'driver' => 'sqlite3', + 'memory' => true, + ]))->quotedName(), + ); + } + + public function test_schema_qualified_table_name_is_refused(): void + { + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage( + 'Table "main.orders" has the schema qualifier "main", but this database platform does not support schemas. Pass the table name without "main.".', + ); + + new TableDefinition('main.orders', DriverManager::getConnection([ + 'driver' => 'sqlite3', + 'memory' => true, + ]))->quotedName(); + } + public function test_max_bind_parameters(): void { - static::assertSame(32_766, (new SqliteDialect(new SQLitePlatform()))->maxBindParameters()); + static::assertSame(32_766, new SqliteDialect(new SQLitePlatform())->maxBindParameters()); } } diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/TableDefinitionTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/TableDefinitionTest.php index 2b26993c36..dc9e17ceab 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/TableDefinitionTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/TableDefinitionTest.php @@ -4,13 +4,17 @@ namespace Flow\Doctrine\Bulk\Tests\Unit; +use Doctrine\DBAL\Configuration; use Doctrine\DBAL\Connection; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\SQLitePlatform; use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; +use Doctrine\DBAL\Types\DecimalType; +use Doctrine\DBAL\Types\Exception\UnknownColumnType; +use Doctrine\DBAL\Types\IntegerType; +use Doctrine\DBAL\Types\TypeRegistry; use Doctrine\DBAL\Types\Types; use Exception; use Flow\Doctrine\Bulk\BulkData; @@ -50,9 +54,7 @@ public function test_column_caching_works_correctly(): void $column1 = $tableDefinition->dbalColumn('id'); $column2 = $tableDefinition->dbalColumn('id'); - // @mago-expect analysis:deprecated-method - // @mago-expect analysis:deprecated-method - static::assertSame($column1->getName(), $column2->getName()); + static::assertSame($column1->getObjectName()->toString(), $column2->getObjectName()->toString()); static::assertSame($column1->getTypeName(), $column2->getTypeName()); } @@ -87,6 +89,75 @@ public function test_dbal_column_is_case_sensitive(): void $tableDefinition->dbalColumn('ID'); } + public function test_dbal_column_reads_columns_of_a_mixed_case_table(): void + { + $connection = $this->createSQLiteConnection(); + $connection->createSchemaManager()->createTable(new Table('MixedCase', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('Name', Types::STRING, ['notnull' => true, 'length' => 255]), + ])); + + static::assertSame( + 'Name', + new TableDefinition('MixedCase', $connection) + ->dbalColumn('Name') + ->getObjectName() + ->getIdentifier() + ->getValue(), + ); + } + + public function test_dbal_column_reads_columns_of_a_quoted_table(): void + { + $connection = $this->createSQLiteConnection(); + $connection->createSchemaManager()->createTable(new Table('"Quoted"', [ + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('Name', Types::STRING, ['notnull' => true, 'length' => 255]), + ])); + + static::assertSame( + 'Name', + new TableDefinition('"Quoted"', $connection) + ->dbalColumn('Name') + ->getObjectName() + ->getIdentifier() + ->getValue(), + ); + } + + public function test_dbal_type_resolves_a_type_registered_only_on_the_connection(): void + { + static::assertInstanceOf( + DecimalType::class, + new TableDefinition('test_table', DriverManager::getConnection( + ['driver' => 'sqlite3', 'memory' => true], + new Configuration()->setTypeProvider(new TypeRegistry(['money' => new DecimalType()])), + ))->dbalType('money'), + ); + } + + public function test_dbal_type_resolves_each_type_name_once(): void + { + $connection = $this->createConnectionWithTable('test_table'); + $tableDefinition = new TableDefinition('test_table', $connection); + $integerType = $tableDefinition->dbalType(Types::INTEGER); + + $connection->getConfiguration()->setTypeProvider(new TypeRegistry([])); + + static::assertInstanceOf(IntegerType::class, $integerType); + static::assertSame($integerType, $tableDefinition->dbalType(Types::INTEGER)); + } + + public function test_dbal_type_throws_doctrine_exception_for_unknown_type_name(): void + { + $tableDefinition = new TableDefinition('test_table', $this->createConnectionWithTable('test_table')); + + $this->expectException(UnknownColumnType::class); + $this->expectExceptionMessage('Unknown column type "unknown_type" requested.'); + + $tableDefinition->dbalType('unknown_type'); + } + public function test_dbal_column_returns_column_with_correct_type(): void { $connection = $this->createConnectionWithTable('test_table'); @@ -94,8 +165,7 @@ public function test_dbal_column_returns_column_with_correct_type(): void $nameColumn = $tableDefinition->dbalColumn('name'); - // @mago-expect analysis:deprecated-method - static::assertSame('name', $nameColumn->getName()); + static::assertSame('name', $nameColumn->getObjectName()->getIdentifier()->getValue()); static::assertSame(Types::STRING, $nameColumn->getTypeName()); } @@ -107,8 +177,7 @@ public function test_dbal_column_returns_existing_column(): void $column = $tableDefinition->dbalColumn('id'); static::assertInstanceOf(Column::class, $column); - // @mago-expect analysis:deprecated-method - static::assertSame('id', $column->getName()); + static::assertSame('id', $column->getObjectName()->getIdentifier()->getValue()); } public function test_dbal_column_throws_exception_for_empty_column_name(): void @@ -212,7 +281,7 @@ public function test_dbal_types_with_different_column_types(): void array_diff_key($types, ['created_at_0' => true]), ); // doctrine/dbal 4.6 reads datetime columns back as datetime_immutable - static::assertContains($types['created_at_0'], [Types::DATETIME_MUTABLE, Types::DATETIME_IMMUTABLE]); + static::assertContains($types['created_at_0'], ['datetime', Types::DATETIME_IMMUTABLE]); } public function test_dbal_types_with_empty_bulk_data_throws_exception(): void @@ -397,11 +466,11 @@ public function test_to_sql_casted_placeholders_with_multiple_rows(): void private function createComplexTestTable(Connection $connection, string $tableName): void { $table = new Table($tableName, [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('age', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('active', Type::getType(Types::BOOLEAN), ['notnull' => true]), - new Column('created_at', Type::getType(Types::DATETIME_MUTABLE), ['notnull' => true]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('age', Types::INTEGER, ['notnull' => true]), + new Column('active', Types::BOOLEAN, ['notnull' => true]), + new Column('created_at', 'datetime', ['notnull' => true]), ]); $connection->createSchemaManager()->createTable($table); @@ -434,8 +503,8 @@ private function createSQLiteConnection(): Connection private function createTestTable(Connection $connection, string $tableName): void { $table = new Table($tableName, [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), ]); $connection->createSchemaManager()->createTable($table); diff --git a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/TableDefinitionsTest.php b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/TableDefinitionsTest.php index 5348cfdf32..a88e7d9f04 100644 --- a/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/TableDefinitionsTest.php +++ b/src/lib/doctrine-dbal-bulk/tests/Flow/Doctrine/Bulk/Tests/Unit/TableDefinitionsTest.php @@ -8,7 +8,6 @@ use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Table; -use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Types; use Flow\Doctrine\Bulk\TableDefinition; use Flow\Doctrine\Bulk\TableDefinitions; @@ -43,7 +42,7 @@ public function test_the_same_table_name_on_another_connection_gets_that_connect $other = $this->createSQLiteConnection(); $other->createSchemaManager()->createTable(new Table('users', [ - new Column('email', Type::getType(Types::STRING), ['length' => 255]), + new Column('email', Types::STRING, ['length' => 255]), ])); static::assertInstanceOf(Column::class, $tableDefinitions->get('users', $other)->dbalColumn('email')); @@ -166,8 +165,7 @@ public function test_get_returns_working_table_definition(): void // Test that it can access database metadata $column = $tableDefinition->dbalColumn('id'); static::assertInstanceOf(Column::class, $column); - // @mago-expect analysis:deprecated-method - static::assertSame('id', $column->getName()); + static::assertSame('id', $column->getObjectName()->getIdentifier()->getValue()); } public function test_get_with_different_connections_for_same_name_keeps_separate_definitions(): void @@ -288,8 +286,8 @@ private function createSQLiteConnection(): Connection private function createTestTable(Connection $connection, string $tableName): void { $table = new Table($tableName, [ - new Column('id', Type::getType(Types::INTEGER), ['notnull' => true]), - new Column('name', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('id', Types::INTEGER, ['notnull' => true]), + new Column('name', Types::STRING, ['notnull' => true, 'length' => 255]), ]); $connection->createSchemaManager()->createTable($table); diff --git a/src/lib/dremel/composer.json b/src/lib/dremel/composer.json index 2351b4b4a8..4d31b77bdf 100644 --- a/src/lib/dremel/composer.json +++ b/src/lib/dremel/composer.json @@ -12,7 +12,7 @@ "algorithm" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "config": { "optimize-autoloader": true, diff --git a/src/lib/filesystem/composer.json b/src/lib/filesystem/composer.json index 1a6c2a515a..010a297383 100644 --- a/src/lib/filesystem/composer.json +++ b/src/lib/filesystem/composer.json @@ -13,7 +13,7 @@ "aws" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/telemetry": "self.version", "flow-php/types": "self.version", "symfony/polyfill-mbstring": "^1.33" diff --git a/src/lib/filesystem/src/Flow/Filesystem/Local/GlobWalker.php b/src/lib/filesystem/src/Flow/Filesystem/Local/GlobWalker.php index a04ca4ddca..6943ff4233 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Local/GlobWalker.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Local/GlobWalker.php @@ -97,7 +97,7 @@ public function walk(Path $pattern): array $paths = array_values(array_filter( array_keys($found), - (new GlobPattern(rtrim($base, '/') . '/' . implode('/', $collapsed)))->matches(...), + new GlobPattern(rtrim($base, '/') . '/' . implode('/', $collapsed))->matches(...), )); sort($paths, SORT_STRING); diff --git a/src/lib/filesystem/src/Flow/Filesystem/Local/NativeLocalFilesystem.php b/src/lib/filesystem/src/Flow/Filesystem/Local/NativeLocalFilesystem.php index a52799c69b..457f416970 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Local/NativeLocalFilesystem.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Local/NativeLocalFilesystem.php @@ -124,7 +124,7 @@ public function list(Path $path, Filter $pathFilter = new OnlyFiles()): Generato return; } - foreach ((new GlobWalker())->walk($path) as $filePath) { + foreach (new GlobWalker()->walk($path) as $filePath) { $status = self::statFor( path($this->mount->protocol . '://' . path_real($filePath)->path(), $path->options()), $filePath, @@ -199,7 +199,7 @@ public function rm(Path $path, bool $recursive = true): bool $deletedCount = 0; - foreach (array_reverse((new GlobWalker())->walk($path)) as $filePath) { + foreach (array_reverse(new GlobWalker()->walk($path)) as $filePath) { if (is_dir($filePath)) { $this->rmdir($filePath, $recursive); } else { @@ -226,7 +226,7 @@ public function status(Path $path): ?FileStatus return self::statFor($path, $path->path()); } - $filePath = (new GlobWalker())->walk($path)[0] ?? null; + $filePath = new GlobWalker()->walk($path)[0] ?? null; return $filePath === null ? null diff --git a/src/lib/filesystem/src/Flow/Filesystem/Partition.php b/src/lib/filesystem/src/Flow/Filesystem/Partition.php index c413d53998..46b81580c7 100644 --- a/src/lib/filesystem/src/Flow/Filesystem/Partition.php +++ b/src/lib/filesystem/src/Flow/Filesystem/Partition.php @@ -165,7 +165,7 @@ public static function fromValue(string $name, Type $type, mixed $value): string } } - return (new TypedValueFormatter())->format($type, $value); + return new TypedValueFormatter()->format($type, $value); } public function id(): string diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Double/FakeNativeLocalFilesystem.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Double/FakeNativeLocalFilesystem.php index a0c9b9c4b7..c4b962d43f 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Double/FakeNativeLocalFilesystem.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Double/FakeNativeLocalFilesystem.php @@ -108,7 +108,7 @@ public function list(Path $path, Filter $pathFilter = new OnlyFiles()): Generato return; } - foreach ((new GlobWalker())->walk($path) as $filePath) { + foreach (new GlobWalker()->walk($path) as $filePath) { $status = new FileStatus(path_real($filePath, $path->options()), is_file($filePath)); if ($pathFilter->accept($status)) { @@ -192,7 +192,7 @@ public function rm(Path $path, bool $recursive = true): bool $deletedCount = 0; - foreach (array_reverse((new GlobWalker())->walk($path)) as $filePath) { + foreach (array_reverse(new GlobWalker()->walk($path)) as $filePath) { if (is_dir($filePath)) { $this->rmdir($filePath); } else { @@ -215,7 +215,7 @@ public function status(Path $path): ?FileStatus return new FileStatus($path, is_file($path->path())); } - $filePath = (new GlobWalker())->walk($path)[0] ?? null; + $filePath = new GlobWalker()->walk($path)[0] ?? null; return $filePath === null ? null : new FileStatus(path($filePath, $path->options()), true); } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/FileListingTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/FileListingTest.php index ace291e122..53d2d0bf1d 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/FileListingTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/FileListingTest.php @@ -41,7 +41,7 @@ public function test_glob_without_placeholders_attaches_the_paths_own_partitions $stream->close(); $statuses = iterator_to_array( - (new FileListing($filesystem))->list(path('memory://hive/**/*.csv'), new KeepAll()), + new FileListing($filesystem)->list(path('memory://hive/**/*.csv'), new KeepAll()), false, ); @@ -60,7 +60,7 @@ public function test_listing_a_directory_yields_file_statuses(): void } $statuses = iterator_to_array( - (new FileListing($filesystem))->list(path('memory://listing/*.csv'), new KeepAll()), + new FileListing($filesystem)->list(path('memory://listing/*.csv'), new KeepAll()), false, ); @@ -100,7 +100,7 @@ public function test_placeholder_partitions_are_attached(): void } $statuses = iterator_to_array( - (new FileListing($filesystem))->list(path('memory://orders/{order-name}.csv'), new KeepAll()), + new FileListing($filesystem)->list(path('memory://orders/{order-name}.csv'), new KeepAll()), false, ); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/GlobWalkerTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/GlobWalkerTest.php index ea43fbb254..e6c5f8c311 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/GlobWalkerTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/GlobWalkerTest.php @@ -35,14 +35,14 @@ protected function tearDown(): void public function test_a_missing_base_directory_yields_nothing(): void { - static::assertSame([], (new GlobWalker())->walk(path(__DIR__ . '/var/glob_walker/missing/*.csv'))); + static::assertSame([], new GlobWalker()->walk(path(__DIR__ . '/var/glob_walker/missing/*.csv'))); } public function test_directories_matching_the_last_segment_are_returned(): void { static::assertSame( [__DIR__ . '/var/glob_walker/data/a.csv', __DIR__ . '/var/glob_walker/data/sub'], - (new GlobWalker())->walk(path(__DIR__ . '/var/glob_walker/data/*')), + new GlobWalker()->walk(path(__DIR__ . '/var/glob_walker/data/*')), ); } @@ -51,7 +51,7 @@ public function test_double_star_does_not_descend_into_a_symlinked_directory(): symlink(__DIR__ . '/var/glob_walker/real', __DIR__ . '/var/glob_walker/data/linked'); symlink(__DIR__ . '/var/glob_walker/data', __DIR__ . '/var/glob_walker/data/loop'); - static::assertSame([], (new GlobWalker())->walk(path(__DIR__ . '/var/glob_walker/data/**/x.csv'))); + static::assertSame([], new GlobWalker()->walk(path(__DIR__ . '/var/glob_walker/data/**/x.csv'))); } public function test_explicit_segments_follow_a_symlinked_directory(): void @@ -60,7 +60,7 @@ public function test_explicit_segments_follow_a_symlinked_directory(): void static::assertSame( [__DIR__ . '/var/glob_walker/data/linked/sub/x.csv'], - (new GlobWalker())->walk(path(__DIR__ . '/var/glob_walker/data/*/sub/x.csv')), + new GlobWalker()->walk(path(__DIR__ . '/var/glob_walker/data/*/sub/x.csv')), ); } @@ -85,7 +85,7 @@ public function test_paths_are_sorted(): void __DIR__ . '/var/glob_walker/sorted/a/1.csv', __DIR__ . '/var/glob_walker/sorted/b/1.csv', ], - (new GlobWalker())->walk(path(__DIR__ . '/var/glob_walker/sorted/**/*.csv')), + new GlobWalker()->walk(path(__DIR__ . '/var/glob_walker/sorted/**/*.csv')), ); } @@ -93,7 +93,7 @@ public function test_consecutive_double_stars_match_like_one(): void { static::assertSame( [__DIR__ . '/var/glob_walker/real/sub/x.csv'], - (new GlobWalker())->walk(path(__DIR__ . '/var/glob_walker/real/**/**/*.csv')), + new GlobWalker()->walk(path(__DIR__ . '/var/glob_walker/real/**/**/*.csv')), ); } @@ -101,7 +101,7 @@ public function test_redundant_slashes_are_collapsed(): void { static::assertSame( [__DIR__ . '/var/glob_walker/real/sub/x.csv'], - (new GlobWalker())->walk(path(__DIR__ . '/var/glob_walker/real/*//x.csv')), + new GlobWalker()->walk(path(__DIR__ . '/var/glob_walker/real/*//x.csv')), ); } } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/MemoryFilesystemTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/MemoryFilesystemTest.php index 1e60648e83..c39dffe6c9 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/MemoryFilesystemTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/MemoryFilesystemTest.php @@ -403,7 +403,7 @@ public function test_write_to_rejects_mismatched_scheme(): void public function test_a_memory_filesystem_has_no_configuration(): void { - static::assertNull((new MemoryFilesystem())->normalize()); + static::assertNull(new MemoryFilesystem()->normalize()); } public function test_a_memory_filesystem_cannot_be_rebuilt_from_a_configuration(): void diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/StdOutFilesystemTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/StdOutFilesystemTest.php index d60a65f2b6..e41e9d554b 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/StdOutFilesystemTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/Local/StdOutFilesystemTest.php @@ -19,7 +19,7 @@ public function test_append_to_rejects_mismatched_scheme(): void { $this->expectException(InvalidSchemeException::class); - (new StdOutFilesystem())->appendTo(path('file:///var/foo.txt')); + new StdOutFilesystem()->appendTo(path('file:///var/foo.txt')); } public function test_append_to_same_target_as_open_write_throws(): void @@ -48,7 +48,7 @@ public function test_create(): void { $this->expectExceptionMessage('Cannot create files exclusively in stdout'); - (new StdOutFilesystem())->create(path('stdout://a.stdout')); + new StdOutFilesystem()->create(path('stdout://a.stdout')); } public function test_get_system_tmp_dir(): void @@ -169,8 +169,8 @@ public function test_status(): void public function test_stdout_filesystem_supports_only_stdout_paths(): void { - static::assertTrue((new StdOutFilesystem())->supports(path('stdout://output.csv'))); - static::assertFalse((new StdOutFilesystem())->supports(path('/tmp/output.csv'))); + static::assertTrue(new StdOutFilesystem()->supports(path('stdout://output.csv'))); + static::assertFalse(new StdOutFilesystem()->supports(path('/tmp/output.csv'))); } public function test_write_to_different_targets_concurrently_succeeds(): void @@ -194,7 +194,7 @@ public function test_write_to_rejects_mismatched_scheme(): void 'Scheme "file://" is not supported by this protocol. Expected scheme is "stdout://"', ); - (new StdOutFilesystem())->writeTo(path('file:///var/foo.txt')); + new StdOutFilesystem()->writeTo(path('file:///var/foo.txt')); } public function test_write_to_same_target_twice_throws(): void @@ -209,7 +209,7 @@ public function test_write_to_same_target_twice_throws(): void public function test_a_stdout_filesystem_has_no_configuration(): void { - static::assertNull((new StdOutFilesystem())->normalize()); + static::assertNull(new StdOutFilesystem()->normalize()); } public function test_a_stdout_filesystem_cannot_be_rebuilt_from_a_configuration(): void diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalDestinationStreamTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalDestinationStreamTest.php index 8ba7eea6cf..db4d835f72 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalDestinationStreamTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalDestinationStreamTest.php @@ -44,7 +44,7 @@ public function test_exclusive_stream_links_the_temporary_file_at_close(): void public function test_exclusive_stream_refuses_an_existing_target_and_removes_the_temporary_file(): void { - (new NativeLocalFilesystem()) + new NativeLocalFilesystem() ->writeTo(path(__DIR__ . '/var/exclusive.txt')) ->append('first') ->close(); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalSourceStreamTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalSourceStreamTest.php index ca98178610..7fc575d7e3 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalSourceStreamTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Integration/NativeLocalSourceStreamTest.php @@ -95,7 +95,7 @@ public function test_iterating_through_blob(): void TEXT; $this->givenFileExists(__DIR__ . '/var/file.txt', $content); - $stream = (new NativeLocalFilesystem())->readFrom(path(__DIR__ . '/var/file.txt')); + $stream = new NativeLocalFilesystem()->readFrom(path(__DIR__ . '/var/file.txt')); static::assertSame($content, implode('', iterator_to_array($stream->iterate()))); @@ -111,7 +111,7 @@ public function test_reading_from_blob_by_limit_and_offset(): void TEXT; $this->givenFileExists(__DIR__ . '/var/file.txt', $content); - $stream = (new NativeLocalFilesystem())->readFrom(path(__DIR__ . '/var/file.txt')); + $stream = new NativeLocalFilesystem()->readFrom(path(__DIR__ . '/var/file.txt')); static::assertSame($content, $stream->content()); @@ -138,7 +138,7 @@ public function test_reading_lines_from_file(int $lineLength): void TEXT; $this->givenFileExists(__DIR__ . '/var/file.txt', $content); - $stream = (new NativeLocalFilesystem())->readFrom(path(__DIR__ . '/var/file.txt')); + $stream = new NativeLocalFilesystem()->readFrom(path(__DIR__ . '/var/file.txt')); static::assertSame($content, $stream->content()); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/MountTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/MountTest.php index 1b1f16f418..946401c20a 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/MountTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/MountTest.php @@ -13,17 +13,17 @@ final class MountTest extends TestCase { public function test_does_not_support_mismatching_path(): void { - static::assertFalse((new Mount('warehouse'))->supports(Path::from('archive://data/file.csv'))); + static::assertFalse(new Mount('warehouse')->supports(Path::from('archive://data/file.csv'))); } public function test_does_not_support_mismatching_string(): void { - static::assertFalse((new Mount('warehouse'))->supports('archive')); + static::assertFalse(new Mount('warehouse')->supports('archive')); } public function test_exposes_protocol(): void { - static::assertSame('warehouse', (new Mount('warehouse'))->protocol); + static::assertSame('warehouse', new Mount('warehouse')->protocol); } public function test_rejects_empty_protocol(): void @@ -42,11 +42,11 @@ public function test_rejects_invalid_characters(): void public function test_supports_matching_path(): void { - static::assertTrue((new Mount('warehouse'))->supports(Path::from('warehouse://data/file.csv'))); + static::assertTrue(new Mount('warehouse')->supports(Path::from('warehouse://data/file.csv'))); } public function test_supports_matching_string(): void { - static::assertTrue((new Mount('warehouse'))->supports('warehouse')); + static::assertTrue(new Mount('warehouse')->supports('warehouse')); } } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Operations/CopyTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Operations/CopyTest.php index 52d57a93ff..a9118bb5b1 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Operations/CopyTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Operations/CopyTest.php @@ -31,7 +31,7 @@ public function test_copies_across_mounts_and_leaves_source_in_place(): void $destPath = sys_get_temp_dir() . '/flow_copy_test_' . bin2hex(random_bytes(4)); $dest = path('file://' . $destPath); - static::assertTrue((new Copy($fstab))->execute($src, $dest)); + static::assertTrue(new Copy($fstab)->execute($src, $dest)); static::assertNotNull($fstab->for($src)->status($src)); static::assertSame('copy-payload', file_get_contents($destPath)); @@ -49,7 +49,7 @@ public function test_copies_within_a_single_mount(): void $dest = path('memory://b.txt'); - static::assertTrue((new Copy($fstab))->execute($src, $dest)); + static::assertTrue(new Copy($fstab)->execute($src, $dest)); static::assertNotNull($fstab->for($src)->status($src)); static::assertNotNull($fstab->for($dest)->status($dest)); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Operations/MoveTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Operations/MoveTest.php index d38368ad9b..b95d3a4444 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Operations/MoveTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Operations/MoveTest.php @@ -39,7 +39,7 @@ public function test_cross_mount_move_propagates_iteration_error_and_closes_stre $fstab = new FilesystemTable($throwing, memory_filesystem('dest')); try { - (new Copy($fstab))->execute($src, $dest); + new Copy($fstab)->execute($src, $dest); static::fail('Expected RuntimeException to be thrown from throwing iterate()'); } catch (RuntimeException $e) { static::assertSame('Throwing source stream failed mid-iterate', $e->getMessage()); @@ -60,7 +60,7 @@ public function test_cross_mount_move_returns_false_when_source_rm_fails(): void $srcStream->append('move-payload'); $srcStream->close(); - static::assertFalse((new Move($fstab))->execute($src, $dest)); + static::assertFalse(new Move($fstab)->execute($src, $dest)); static::assertNotNull($fstab->for($dest)->status($dest)); static::assertSame('move-payload', $fstab->for($dest)->readFrom($dest)->content()); @@ -78,7 +78,7 @@ public function test_cross_mount_move_streams_copy_then_removes_source(): void $destPath = sys_get_temp_dir() . '/flow_move_test_' . bin2hex(random_bytes(4)); $dest = path('file://' . $destPath); - static::assertTrue((new Move($fstab))->execute($src, $dest)); + static::assertTrue(new Move($fstab)->execute($src, $dest)); static::assertNull($fstab->for($src)->status($src)); static::assertSame('move-payload', file_get_contents($destPath)); @@ -93,7 +93,7 @@ public function test_same_mount_move_delegates_to_filesystem_mv(): void file_put_contents($tmp, 'local-bytes'); $destPath = $tmp . '.moved'; - static::assertTrue((new Move($fstab))->execute(path('file://' . $tmp), path('file://' . $destPath))); + static::assertTrue(new Move($fstab)->execute(path('file://' . $tmp), path('file://' . $destPath))); static::assertFileDoesNotExist($tmp); static::assertSame('local-bytes', file_get_contents($destPath)); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/PartitionTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/PartitionTest.php index 043c2f2573..514a385607 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/PartitionTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/PartitionTest.php @@ -10,7 +10,6 @@ use Flow\Types\Type; use Generator; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\Types\DSL\type_date; @@ -122,7 +121,7 @@ public static function round_trips(): Generator #[DataProvider('round_trips')] public function test_a_partition_value_casts_back_to_the_written_value(Type $type, mixed $value): void { - $segment = (new Partition('c', Partition::fromValue('c', $type, $value)))->segment(); + $segment = new Partition('c', Partition::fromValue('c', $type, $value))->segment(); static::assertEquals($value, $type->cast(Partition::fromSegment($segment)?->value)); } @@ -182,7 +181,6 @@ public function test_creating_partition_value_from_float(float $value, string $e static::assertSame($expected, Partition::fromValue('x', type_float(), $value)); } - #[RequiresPhp('>= 8.4.0')] public function test_creating_partition_value_from_html(): void { $this->expectExceptionMessage('Column "html" of type html can\'t be used as a partition'); @@ -207,7 +205,7 @@ public function test_creating_partitions_from_uri_decodes_an_encoded_value(): vo public function test_a_null_value_is_written_and_read_back_as_the_hive_sentinel(): void { - static::assertSame('region=__HIVE_DEFAULT_PARTITION__', (new Partition('region', null))->segment()); + static::assertSame('region=__HIVE_DEFAULT_PARTITION__', new Partition('region', null)->segment()); static::assertEquals( new Partition('region', null), Partition::fromSegment('region=__HIVE_DEFAULT_PARTITION__'), @@ -216,7 +214,7 @@ public function test_a_null_value_is_written_and_read_back_as_the_hive_sentinel( public function test_an_empty_value_is_written_and_read_back_apart_from_null(): void { - static::assertSame('region=', (new Partition('region', ''))->segment()); + static::assertSame('region=', new Partition('region', '')->segment()); static::assertSame('region', Partition::fromSegment('region=')?->name); static::assertSame('', Partition::fromSegment('region=')?->value); } @@ -280,7 +278,7 @@ public function test_a_reserved_character_in_the_name_survives_the_path(string $ { static::assertEquals( new Partition($value, 'value'), - Partition::fromSegment((new Partition($value, 'value'))->segment()), + Partition::fromSegment(new Partition($value, 'value')->segment()), ); } @@ -289,7 +287,7 @@ public function test_a_reserved_character_in_the_value_survives_the_path(string { static::assertEquals( new Partition('name', $value), - Partition::fromSegment((new Partition('name', $value))->segment()), + Partition::fromSegment(new Partition('name', $value)->segment()), ); } } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/Filter/FiltersTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/Filter/FiltersTest.php index 09efed2fe6..b235636864 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/Filter/FiltersTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/Filter/FiltersTest.php @@ -16,6 +16,6 @@ public function test_filters_are_the_members_in_the_order_they_were_given(): voi $onlyFiles = new OnlyFiles(); $keepAll = new KeepAll(); - static::assertSame([$onlyFiles, $keepAll], (new Filters($onlyFiles))->add($keepAll)->filters()); + static::assertSame([$onlyFiles, $keepAll], new Filters($onlyFiles)->add($keepAll)->filters()); } } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/Filter/PlaceholderPartitionsTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/Filter/PlaceholderPartitionsTest.php index 96524acc66..4aa117a455 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/Filter/PlaceholderPartitionsTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/Filter/PlaceholderPartitionsTest.php @@ -49,7 +49,7 @@ public function accept(FileStatus $status): bool static::assertFalse($filter->accept(new FileStatus(path('/output/123456-PL.csv'), isFile: true))); - static::assertTrue((new PlaceholderPartitions(path('/output/{order-name}.csv'), new KeepAll()))->accept( + static::assertTrue(new PlaceholderPartitions(path('/output/{order-name}.csv'), new KeepAll())->accept( new FileStatus(path('/output/123456-PL.csv'), isFile: true), )); } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/GlobPatternTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/GlobPatternTest.php index 55dd1932cf..94a1514b92 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/GlobPatternTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/GlobPatternTest.php @@ -77,6 +77,6 @@ public static function patterns(): Generator #[DataProvider('patterns')] public function test_matching(string $pattern, string $path, bool $expected): void { - static::assertSame($expected, (new GlobPattern($pattern))->matches($path)); + static::assertSame($expected, new GlobPattern($pattern)->matches($path)); } } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/UnixPathTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/UnixPathTest.php index 51f60ead11..90b6cd9550 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/UnixPathTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/UnixPathTest.php @@ -287,9 +287,9 @@ public function test_fnmatch_with_hidden_files(): void public function test_glob(): void { - static::assertEquals('/output/*.csv', (new UnixPath('/output/{order-name}.csv'))->glob()); - static::assertEquals('/output/*_*/file.csv', (new UnixPath('/output/{year}_{month}/file.csv'))->glob()); - static::assertEquals('/output/file.csv', (new UnixPath('/output/file.csv'))->glob()); + static::assertEquals('/output/*.csv', new UnixPath('/output/{order-name}.csv')->glob()); + static::assertEquals('/output/*_*/file.csv', new UnixPath('/output/{year}_{month}/file.csv')->glob()); + static::assertEquals('/output/file.csv', new UnixPath('/output/file.csv')->glob()); } public function test_is_equal(): void @@ -304,12 +304,12 @@ public function test_is_equal(): void public function test_is_pattern_detection(): void { - static::assertTrue((new UnixPath('/path/*/file.txt'))->isPattern()); - static::assertTrue((new UnixPath('/path/**/file.txt'))->isPattern()); - static::assertTrue((new UnixPath('/path/file?.txt'))->isPattern()); - static::assertTrue((new UnixPath('/path/file[abc].txt'))->isPattern()); - static::assertTrue((new UnixPath('/path/file{a,b}.txt'))->isPattern()); - static::assertFalse((new UnixPath('/path/file.txt'))->isPattern()); + static::assertTrue(new UnixPath('/path/*/file.txt')->isPattern()); + static::assertTrue(new UnixPath('/path/**/file.txt')->isPattern()); + static::assertTrue(new UnixPath('/path/file?.txt')->isPattern()); + static::assertTrue(new UnixPath('/path/file[abc].txt')->isPattern()); + static::assertTrue(new UnixPath('/path/file{a,b}.txt')->isPattern()); + static::assertFalse(new UnixPath('/path/file.txt')->isPattern()); } public function test_matches_non_pattern_exact_match(): void @@ -374,14 +374,11 @@ public function test_parent_directory_edge_cases(): void public function test_partition_placeholders(): void { - static::assertEquals([], (new UnixPath('/path/to/file.csv'))->partitionPlaceholders()); - static::assertEquals(['order-name'], (new UnixPath('/path/to/{order-name}.csv'))->partitionPlaceholders()); - static::assertEquals( - ['year', 'month'], - (new UnixPath('/path/{year}_{month}/file.csv'))->partitionPlaceholders(), - ); - static::assertEquals(['name'], (new UnixPath('/path/{name}/{name}.csv'))->partitionPlaceholders()); - static::assertEquals([], (new UnixPath('/path/*/file.csv'))->partitionPlaceholders()); + static::assertEquals([], new UnixPath('/path/to/file.csv')->partitionPlaceholders()); + static::assertEquals(['order-name'], new UnixPath('/path/to/{order-name}.csv')->partitionPlaceholders()); + static::assertEquals(['year', 'month'], new UnixPath('/path/{year}_{month}/file.csv')->partitionPlaceholders()); + static::assertEquals(['name'], new UnixPath('/path/{name}/{name}.csv')->partitionPlaceholders()); + static::assertEquals([], new UnixPath('/path/*/file.csv')->partitionPlaceholders()); } public function test_partitions_extraction(): void @@ -728,18 +725,18 @@ public function test_uri_of_a_file_path_reads_back_as_the_same_path(): void { $path = new UnixPath('/path/file.txt'); - static::assertSame('/path/file.txt', (new UnixPath($path->uri()))->path()); - static::assertSame('file:///path/file.txt', (new UnixPath($path->uri()))->uri()); + static::assertSame('/path/file.txt', new UnixPath($path->uri())->path()); + static::assertSame('file:///path/file.txt', new UnixPath($path->uri())->uri()); } public function test_uri_of_the_root_directory(): void { - static::assertSame('file:///', (new UnixPath('/'))->uri()); + static::assertSame('file:///', new UnixPath('/')->uri()); } public function test_uri_of_a_non_file_protocol_has_no_leading_slash(): void { - static::assertSame('memory://path/file.txt', (new UnixPath('memory://path/file.txt'))->uri()); - static::assertSame('s3://bucket/key.txt', (new UnixPath('s3://bucket/key.txt'))->uri()); + static::assertSame('memory://path/file.txt', new UnixPath('memory://path/file.txt')->uri()); + static::assertSame('s3://bucket/key.txt', new UnixPath('s3://bucket/key.txt')->uri()); } } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/WindowsPathTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/WindowsPathTest.php index 144c1be8d1..3ca03dd748 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/WindowsPathTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Path/WindowsPathTest.php @@ -258,8 +258,8 @@ public function test_fnmatch_with_hidden_files(): void public function test_glob(): void { - static::assertEquals('C:/output/*.csv', (new WindowsPath('C:/output/{order-name}.csv'))->glob()); - static::assertEquals('C:/output/file.csv', (new WindowsPath('C:/output/file.csv'))->glob()); + static::assertEquals('C:/output/*.csv', new WindowsPath('C:/output/{order-name}.csv')->glob()); + static::assertEquals('C:/output/file.csv', new WindowsPath('C:/output/file.csv')->glob()); } public function test_is_equal(): void @@ -274,12 +274,12 @@ public function test_is_equal(): void public function test_is_pattern_detection(): void { - static::assertTrue((new WindowsPath('/path/*/file.txt'))->isPattern()); - static::assertTrue((new WindowsPath('/path/**/file.txt'))->isPattern()); - static::assertTrue((new WindowsPath('/path/file?.txt'))->isPattern()); - static::assertTrue((new WindowsPath('/path/file[abc].txt'))->isPattern()); - static::assertTrue((new WindowsPath('/path/file{a,b}.txt'))->isPattern()); - static::assertFalse((new WindowsPath('/path/file.txt'))->isPattern()); + static::assertTrue(new WindowsPath('/path/*/file.txt')->isPattern()); + static::assertTrue(new WindowsPath('/path/**/file.txt')->isPattern()); + static::assertTrue(new WindowsPath('/path/file?.txt')->isPattern()); + static::assertTrue(new WindowsPath('/path/file[abc].txt')->isPattern()); + static::assertTrue(new WindowsPath('/path/file{a,b}.txt')->isPattern()); + static::assertFalse(new WindowsPath('/path/file.txt')->isPattern()); } public function test_matches_non_pattern_exact_match(): void @@ -350,11 +350,11 @@ public function test_partition_logic(string $input, array $partitionData, string public function test_partition_placeholders(): void { - static::assertEquals([], (new WindowsPath('C:/path/to/file.csv'))->partitionPlaceholders()); - static::assertEquals(['order-name'], (new WindowsPath('C:/path/to/{order-name}.csv'))->partitionPlaceholders()); + static::assertEquals([], new WindowsPath('C:/path/to/file.csv')->partitionPlaceholders()); + static::assertEquals(['order-name'], new WindowsPath('C:/path/to/{order-name}.csv')->partitionPlaceholders()); static::assertEquals( ['year', 'month'], - (new WindowsPath('C:/path/{year}_{month}/file.csv'))->partitionPlaceholders(), + new WindowsPath('C:/path/{year}_{month}/file.csv')->partitionPlaceholders(), ); } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/Block/NativeLocalFileBlocksFactoryTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/Block/NativeLocalFileBlocksFactoryTest.php index 414bb1da72..a2bcacd11e 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/Block/NativeLocalFileBlocksFactoryTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/Block/NativeLocalFileBlocksFactoryTest.php @@ -20,14 +20,14 @@ final class NativeLocalFileBlocksFactoryTest extends TestCase { public function test_the_default_block_location_is_the_system_temp_dir(): void { - static::assertSame(sys_get_temp_dir(), (new NativeLocalFileBlocksFactory())->blockLocation()); + static::assertSame(sys_get_temp_dir(), new NativeLocalFileBlocksFactory()->blockLocation()); } public function test_an_explicit_block_location_is_created_and_reported(): void { $location = sys_get_temp_dir() . '/flow-blocks-' . bin2hex(random_bytes(4)); - static::assertSame($location, (new NativeLocalFileBlocksFactory($location))->blockLocation()); + static::assertSame($location, new NativeLocalFileBlocksFactory($location)->blockLocation()); static::assertTrue(is_dir($location)); rmdir($location); @@ -37,7 +37,7 @@ public function test_permissions_apply_to_created_location_and_block_file(): voi { $location = sys_get_temp_dir() . '/flow-blocks-' . bin2hex(random_bytes(4)); - $block = (new NativeLocalFileBlocksFactory($location, new Permissions(0o660, 0o770)))->create(16); + $block = new NativeLocalFileBlocksFactory($location, new Permissions(0o660, 0o770))->create(16); static::assertSame(0o770, fileperms($location) & 0o777); static::assertSame(0o660, fileperms($block->path()->path()) & 0o777); @@ -50,7 +50,7 @@ public function test_permissions_leave_an_existing_location_untouched(): void { $existingMode = fileperms(sys_get_temp_dir()) & 0o777; - $block = (new NativeLocalFileBlocksFactory(sys_get_temp_dir(), new Permissions(0o660, 0o770)))->create(16); + $block = new NativeLocalFileBlocksFactory(sys_get_temp_dir(), new Permissions(0o660, 0o770))->create(16); static::assertSame($existingMode, fileperms(sys_get_temp_dir()) & 0o777); @@ -59,7 +59,7 @@ public function test_permissions_leave_an_existing_location_untouched(): void public function test_a_block_is_created_under_the_block_location(): void { - $block = (new NativeLocalFileBlocksFactory())->create(16); + $block = new NativeLocalFileBlocksFactory()->create(16); static::assertStringStartsWith(sys_get_temp_dir(), $block->path()->path()); static::assertSame(16, $block->spaceLeft()); diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/BlockCachedSourceStreamTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/BlockCachedSourceStreamTest.php index b13b949469..2c700345a3 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/BlockCachedSourceStreamTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/BlockCachedSourceStreamTest.php @@ -28,7 +28,7 @@ public function test_a_negative_offset_bypasses_the_cache(): void { $inner = new ReadRecordingSourceStream(new StringSourceStream(path('memory://cache.bin'), 'abcdefgh')); - static::assertSame('gh', (new BlockCachedSourceStream($inner, 4))->read(2, -2)); + static::assertSame('gh', new BlockCachedSourceStream($inner, 4)->read(2, -2)); static::assertSame([[2, -2]], $inner->reads); } @@ -65,10 +65,10 @@ public function test_only_the_last_two_blocks_are_kept(): void #[TestWith([20, 3, ''])] public function test_a_read_stops_at_the_end_of_the_stream(int $offset, int $length, string $expected): void { - static::assertSame($expected, (new BlockCachedSourceStream( + static::assertSame($expected, new BlockCachedSourceStream( new StringSourceStream(path('memory://cache.bin'), 'abcdefgh'), 3, - ))->read($length, $offset)); + )->read($length, $offset)); } public function test_everything_but_read_is_the_inner_stream(): void diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/MemorySourceStreamTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/MemorySourceStreamTest.php index 0b4304274d..80fe75091f 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/MemorySourceStreamTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/MemorySourceStreamTest.php @@ -28,7 +28,7 @@ public function test_read_lines_conforms_to_the_source_stream_contract( ): void { static::assertSame( $expected, - iterator_to_array((new MemorySourceStream($content))->readLines($separator, $length)), + iterator_to_array(new MemorySourceStream($content)->readLines($separator, $length)), ); } } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/RangeSourceStreamTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/RangeSourceStreamTest.php index 45ca273c25..1ad458e3db 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/RangeSourceStreamTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/RangeSourceStreamTest.php @@ -49,7 +49,7 @@ public function test_content_is_the_window(): void { static::assertSame( 'cde', - (new RangeSourceStream(new StringSourceStream(path('memory://range.bin'), 'abcdefg'), 2, 5))->content(), + new RangeSourceStream(new StringSourceStream(path('memory://range.bin'), 'abcdefg'), 2, 5)->content(), ); } @@ -62,7 +62,7 @@ public function test_exposes_its_window_and_inner_stream(): void static::assertSame(2, $range->start()); static::assertSame(5, $range->end()); static::assertSame($range->start() + $range->size(), $range->end()); - static::assertSame(3, (new RangeSourceStream($inner, 3, 3))->end()); + static::assertSame(3, new RangeSourceStream($inner, 3, 3)->end()); } public function test_it_delegates_path_and_open_state(): void @@ -78,11 +78,9 @@ public function test_iterate_stops_at_the_window_end(): void static::assertSame( ['cd', 'ef', 'g'], iterator_to_array( - (new RangeSourceStream( - new StringSourceStream(path('memory://range.bin'), 'abcdefghij'), + new RangeSourceStream(new StringSourceStream(path('memory://range.bin'), 'abcdefghij'), 2, 7)->iterate( 2, - 7, - ))->iterate(2), + ), false, ), ); @@ -93,7 +91,7 @@ public function test_iterate_stops_when_the_inner_stream_ends_early(): void static::assertSame( ['cd'], iterator_to_array( - (new RangeSourceStream(new StringSourceStream(path('memory://range.bin'), 'abcd'), 2, 10))->iterate(4), + new RangeSourceStream(new StringSourceStream(path('memory://range.bin'), 'abcd'), 2, 10)->iterate(4), false, ), ); @@ -109,11 +107,11 @@ public function test_iterate_stops_when_the_inner_stream_ends_early(): void #[TestWith([-10, 2, 'cd'])] public function test_read_is_relative_to_the_window(int $offset, int $length, string $expected): void { - static::assertSame($expected, (new RangeSourceStream( + static::assertSame($expected, new RangeSourceStream( new StringSourceStream(path('memory://range.bin'), 'abcdefgh'), 2, 6, - ))->read($length, $offset)); + )->read($length, $offset)); } /** @@ -131,11 +129,11 @@ public function test_read_lines_conforms_to_the_source_stream_contract( $padded = '>>' . $content . '<<'; static::assertSame($expected, iterator_to_array( - (new RangeSourceStream( + new RangeSourceStream( new StringSourceStream(path('memory://range.bin'), $padded), 2, 2 + strlen($content), - ))->readLines($separator, $length), + )->readLines($separator, $length), false, )); } @@ -144,7 +142,7 @@ public function test_size_is_the_window_length(): void { static::assertSame( 3, - (new RangeSourceStream(new StringSourceStream(path('memory://range.bin'), 'abcdefg'), 2, 5))->size(), + new RangeSourceStream(new StringSourceStream(path('memory://range.bin'), 'abcdefg'), 2, 5)->size(), ); } } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/SourceStreamWrapperTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/SourceStreamWrapperTest.php index df4f012d3e..580f9405c5 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/SourceStreamWrapperTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/SourceStreamWrapperTest.php @@ -89,8 +89,8 @@ public function test_a_uri_opens_once(): void $uri = SourceStreamWrapper::uri(new StringSourceStream(path('memory://a.txt'), 'foo')); $opened = null; - static::assertTrue((new SourceStreamWrapper())->stream_open($uri, 'rb', 0, $opened)); - static::assertFalse((new SourceStreamWrapper())->stream_open($uri, 'rb', 0, $opened)); + static::assertTrue(new SourceStreamWrapper()->stream_open($uri, 'rb', 0, $opened)); + static::assertFalse(new SourceStreamWrapper()->stream_open($uri, 'rb', 0, $opened)); } #[TestWith(['w'])] @@ -100,7 +100,7 @@ public function test_a_writing_mode_does_not_open(string $mode): void { $opened = null; - static::assertFalse((new SourceStreamWrapper())->stream_open( + static::assertFalse(new SourceStreamWrapper()->stream_open( SourceStreamWrapper::uri(new StringSourceStream(path('memory://a.txt'), 'foo')), $mode, 0, @@ -112,7 +112,7 @@ public function test_an_unknown_uri_does_not_open(): void { $opened = null; - static::assertFalse((new SourceStreamWrapper())->stream_open( + static::assertFalse(new SourceStreamWrapper()->stream_open( SourceStreamWrapper::PROTOCOL . '://unknown', 'rb', 0, diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/StringDestinationStreamTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/StringDestinationStreamTest.php index f835439613..c416e6365f 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/StringDestinationStreamTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/StringDestinationStreamTest.php @@ -25,7 +25,7 @@ public function test_append_accumulates_bytes(): void public function test_content_of_empty_stream_is_empty_string(): void { - static::assertSame('', (new StringDestinationStream(path('memory://empty.bin')))->content()); + static::assertSame('', new StringDestinationStream(path('memory://empty.bin'))->content()); } public function test_from_resource_appends_resource_contents(): void @@ -42,7 +42,7 @@ public function test_from_resource_appends_resource_contents(): void public function test_is_open_is_always_true(): void { - static::assertTrue((new StringDestinationStream(path('memory://open.bin')))->isOpen()); + static::assertTrue(new StringDestinationStream(path('memory://open.bin'))->isOpen()); } public function test_close_is_a_noop_and_keeps_content_readable(): void @@ -58,7 +58,7 @@ public function test_path_returns_the_construction_path(): void { static::assertSame( 'memory://value.bin', - (new StringDestinationStream(path('memory://value.bin')))->path()->uri(), + new StringDestinationStream(path('memory://value.bin'))->path()->uri(), ); } } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/StringSourceStreamTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/StringSourceStreamTest.php index d4b471eca2..9b2c8286b5 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/StringSourceStreamTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Stream/StringSourceStreamTest.php @@ -16,7 +16,7 @@ final class StringSourceStreamTest extends TestCase { public function test_content_returns_the_whole_payload(): void { - static::assertSame('foobar', (new StringSourceStream(path('memory://value.bin'), 'foobar'))->content()); + static::assertSame('foobar', new StringSourceStream(path('memory://value.bin'), 'foobar')->content()); } public function test_empty_content_is_allowed(): void @@ -30,7 +30,7 @@ public function test_empty_content_is_allowed(): void public function test_size_is_the_byte_length(): void { - static::assertSame(6, (new StringSourceStream(path('memory://size.bin'), 'foobar'))->size()); + static::assertSame(6, new StringSourceStream(path('memory://size.bin'), 'foobar')->size()); } public function test_read_returns_a_byte_range(): void @@ -62,7 +62,7 @@ public function test_read_lines_conforms_to_the_source_stream_contract( ): void { static::assertSame( $expected, - iterator_to_array((new StringSourceStream(path('memory://lines.bin'), $content))->readLines( + iterator_to_array(new StringSourceStream(path('memory://lines.bin'), $content)->readLines( $separator, $length, )), @@ -71,7 +71,7 @@ public function test_read_lines_conforms_to_the_source_stream_contract( public function test_is_open_is_always_true(): void { - static::assertTrue((new StringSourceStream(path('memory://open.bin'), 'x'))->isOpen()); + static::assertTrue(new StringSourceStream(path('memory://open.bin'), 'x')->isOpen()); } public function test_close_is_a_noop_and_keeps_content_readable(): void @@ -86,7 +86,7 @@ public function test_path_returns_the_construction_path(): void { static::assertSame( 'memory://value.bin', - (new StringSourceStream(path('memory://value.bin'), 'x'))->path()->uri(), + new StringSourceStream(path('memory://value.bin'), 'x')->path()->uri(), ); } } diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Telemetry/FilesystemTelemetryAttributesTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Telemetry/FilesystemTelemetryAttributesTest.php index 6ce6bc40d3..52f4a37d5d 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Telemetry/FilesystemTelemetryAttributesTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Telemetry/FilesystemTelemetryAttributesTest.php @@ -13,7 +13,7 @@ final class FilesystemTelemetryAttributesTest extends TestCase public function test_all_custom_keys_use_the_flow_filesystem_prefix(): void { // @mago-expect analysis:mixed-assignment - foreach ((new ReflectionClass(FilesystemTelemetryAttributes::class))->getConstants() as $name => $value) { + foreach (new ReflectionClass(FilesystemTelemetryAttributes::class)->getConstants() as $name => $value) { static::assertIsString($value); static::assertStringStartsWith( 'flow.filesystem.', diff --git a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Telemetry/TraceableFilesystemTest.php b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Telemetry/TraceableFilesystemTest.php index 34476488dc..e03c7b2115 100644 --- a/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Telemetry/TraceableFilesystemTest.php +++ b/src/lib/filesystem/tests/Flow/Filesystem/Tests/Unit/Telemetry/TraceableFilesystemTest.php @@ -344,9 +344,9 @@ public function test_configuration_is_the_inner_filesystems(): void static::assertSame( ['protocol' => 'file', 'permissions' => null], - (new TraceableFilesystem(new NativeLocalFilesystem(), $config))->normalize(), + new TraceableFilesystem(new NativeLocalFilesystem(), $config)->normalize(), ); - static::assertNull((new TraceableFilesystem(memory_filesystem(), $config))->normalize()); + static::assertNull(new TraceableFilesystem(memory_filesystem(), $config)->normalize()); } public function test_a_traceable_filesystem_is_rebuilt_as_its_inner_filesystem(): void diff --git a/src/lib/parquet-viewer/composer.json b/src/lib/parquet-viewer/composer.json index 9dbad51702..605b43ce32 100644 --- a/src/lib/parquet-viewer/composer.json +++ b/src/lib/parquet-viewer/composer.json @@ -11,11 +11,11 @@ "parquet" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "coduo/php-humanizer": "^5.0", "flow-php/etl": "self.version", "flow-php/parquet": "self.version", - "symfony/console": "^6.4.34 || ^7.4.6 || ^8.0.6" + "symfony/console": "^7.4.6 || ^8.0.6" }, "config": { "optimize-autoloader": true, diff --git a/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDDLCommand.php b/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDDLCommand.php index 530c065332..b94f1c86d6 100644 --- a/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDDLCommand.php +++ b/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDDLCommand.php @@ -39,7 +39,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::FAILURE; } try { - $parquetFile = (new Reader())->read($filePath); + $parquetFile = new Reader()->read($filePath); $parquetFile->metadata(); } catch (InvalidArgumentException) { $style->error(sprintf('File "%s" is not a valid parquet file', $filePath)); diff --git a/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDataCommand.php b/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDataCommand.php index c48fd2caed..af06449cc7 100644 --- a/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDataCommand.php +++ b/src/lib/parquet-viewer/src/Flow/ParquetViewer/Command/ReadDataCommand.php @@ -57,7 +57,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::FAILURE; } try { - $parquetFile = (new Reader())->read($filePath); + $parquetFile = new Reader()->read($filePath); $parquetFile->metadata(); } catch (InvalidArgumentException) { $style->error(sprintf('File "%s" is not a valid parquet file', $filePath)); diff --git a/src/lib/parquet-viewer/tests/Flow/ParquetViewer/Tests/Integration/ReadMetadataTest.php b/src/lib/parquet-viewer/tests/Flow/ParquetViewer/Tests/Integration/ReadMetadataTest.php index 35d7c251df..005e5128a7 100644 --- a/src/lib/parquet-viewer/tests/Flow/ParquetViewer/Tests/Integration/ReadMetadataTest.php +++ b/src/lib/parquet-viewer/tests/Flow/ParquetViewer/Tests/Integration/ReadMetadataTest.php @@ -78,7 +78,7 @@ public function test_reading_metadata_from_parquet_file(): void public function test_decimal_statistics_are_shown_as_decimals(): void { $path = TestParquetFile::path($this); - (new Writer())->write($path, Schema::with(FlatColumn::decimal('amount', 10, 2)), [ + new Writer()->write($path, Schema::with(FlatColumn::decimal('amount', 10, 2)), [ ['amount' => -3.5], ['amount' => 1.25], ]); @@ -97,7 +97,7 @@ public function test_decimal_statistics_are_shown_as_decimals(): void public function test_uuid_statistics_are_shown_as_uuids(): void { $path = TestParquetFile::path($this); - (new Writer())->write($path, Schema::with(FlatColumn::uuid('id')), [ + new Writer()->write($path, Schema::with(FlatColumn::uuid('id')), [ ['id' => '0f8fad5b-d9cb-469f-a165-70867728950e'], ['id' => '7c9e6679-7425-40de-944b-e07fc1f90ae7'], ]); diff --git a/src/lib/parquet-viewer/tests/Flow/ParquetViewer/Tests/Unit/StatisticFormatterTest.php b/src/lib/parquet-viewer/tests/Flow/ParquetViewer/Tests/Unit/StatisticFormatterTest.php index ad0e416326..1dacc930a3 100644 --- a/src/lib/parquet-viewer/tests/Flow/ParquetViewer/Tests/Unit/StatisticFormatterTest.php +++ b/src/lib/parquet-viewer/tests/Flow/ParquetViewer/Tests/Unit/StatisticFormatterTest.php @@ -43,7 +43,7 @@ public static function statistics(): Generator #[DataProvider('statistics')] public function test_format(FlatColumn $column, bool|float|int|string|null $physical, string $expected): void { - static::assertSame($expected, (new StatisticFormatter(DataConverter::initialize(Options::default())))->format( + static::assertSame($expected, new StatisticFormatter(DataConverter::initialize(Options::default()))->format( $column, $physical, )); diff --git a/src/lib/parquet/composer.json b/src/lib/parquet/composer.json index 4edd551def..0bbb18a0de 100644 --- a/src/lib/parquet/composer.json +++ b/src/lib/parquet/composer.json @@ -11,7 +11,7 @@ "parquet" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "ext-bcmath": "*", "ext-zlib": "*", "composer-runtime-api": "^2.2", diff --git a/src/lib/parquet/composer.lock b/src/lib/parquet/composer.lock index a4e2c8bad8..ee77016066 100644 --- a/src/lib/parquet/composer.lock +++ b/src/lib/parquet/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "031972e7f01f84f591c28dc6f3c650e6", + "content-hash": "e20b7c57c30fb272f357cca0ee5a515c", "packages": [ { "name": "flow-php/filesystem", @@ -12,20 +12,19 @@ "source": { "type": "git", "url": "https://github.com/flow-php/filesystem.git", - "reference": "8bfe0b20ecb0ef5a293f0eca9552d5df8c148ec7" + "reference": "473d094e208d17927d638ffef918bece40ab5877" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/flow-php/filesystem/zipball/8bfe0b20ecb0ef5a293f0eca9552d5df8c148ec7", - "reference": "8bfe0b20ecb0ef5a293f0eca9552d5df8c148ec7", + "url": "https://api.github.com/repos/flow-php/filesystem/zipball/473d094e208d17927d638ffef918bece40ab5877", + "reference": "473d094e208d17927d638ffef918bece40ab5877", "shasum": "" }, "require": { "flow-php/telemetry": "self.version", "flow-php/types": "self.version", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0", - "symfony/polyfill-mbstring": "^1.33", - "webmozart/glob": "^3.0 || ^4.0" + "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "symfony/polyfill-mbstring": "^1.33" }, "default-branch": true, "type": "library", @@ -43,14 +42,13 @@ "license": [ "MIT" ], - "description": "PHP ETL - Filesystem abstraction", + "description": "One filesystem API for local disks, S3, Azure Blob Storage and SFTP.", "keywords": [ "aws", "azure", "etl", "extract", "filesystem", - "gcp", "load", "remote", "transform" @@ -63,13 +61,10 @@ { "url": "https://flow-php.com/sponsor", "type": "custom" - }, - { - "url": "https://github.com/norberttech", - "type": "github" } ], - "time": "2026-05-11T20:05:24+00:00" + "time": "2026-12-01T00:49:10+00:00", + "published-time": "2026-12-01T00:49:15+00:00" }, { "name": "flow-php/snappy", @@ -77,16 +72,16 @@ "source": { "type": "git", "url": "https://github.com/flow-php/snappy.git", - "reference": "9121489ce2cacef61cc21ed4a6a5a25d8466856b" + "reference": "7a0cba3218cb03d5e4b15b5466ecfe42933beb6c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/flow-php/snappy/zipball/9121489ce2cacef61cc21ed4a6a5a25d8466856b", - "reference": "9121489ce2cacef61cc21ed4a6a5a25d8466856b", + "url": "https://api.github.com/repos/flow-php/snappy/zipball/7a0cba3218cb03d5e4b15b5466ecfe42933beb6c", + "reference": "7a0cba3218cb03d5e4b15b5466ecfe42933beb6c", "shasum": "" }, "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0" + "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" }, "default-branch": true, "type": "library", @@ -104,7 +99,7 @@ "license": [ "MIT" ], - "description": "PHP ETL - Google Snappy compression algorithm implementation", + "description": "Pure PHP implementation of the Google Snappy compression algorithm.", "keywords": [ "Algorithm", "compression", @@ -123,13 +118,10 @@ { "url": "https://flow-php.com/sponsor", "type": "custom" - }, - { - "url": "https://github.com/norberttech", - "type": "github" } ], - "time": "2026-05-11T20:06:21+00:00" + "time": "2026-11-26T02:46:00+00:00", + "published-time": "2026-11-26T02:46:04+00:00" }, { "name": "flow-php/telemetry", @@ -137,17 +129,17 @@ "source": { "type": "git", "url": "https://github.com/flow-php/telemetry.git", - "reference": "0cbebd005d2d082ece89146209a7450a240471e7" + "reference": "89bbeb87d8b5c7365c1c52791cf0e9e97df6f3db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/flow-php/telemetry/zipball/0cbebd005d2d082ece89146209a7450a240471e7", - "reference": "0cbebd005d2d082ece89146209a7450a240471e7", + "url": "https://api.github.com/repos/flow-php/telemetry/zipball/89bbeb87d8b5c7365c1c52791cf0e9e97df6f3db", + "reference": "89bbeb87d8b5c7365c1c52791cf0e9e97df6f3db", "shasum": "" }, "require": { "composer-runtime-api": "^2.2", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0", + "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", "psr/clock": "^1.0", "symfony/polyfill-mbstring": "^1.33" }, @@ -167,7 +159,7 @@ "license": [ "MIT" ], - "description": "Flow PHP - Telemetry library for metrics and tracing", + "description": "OpenTelemetry-compatible traces, metrics and logs for PHP.", "keywords": [ "Metrics", "php", @@ -182,13 +174,10 @@ { "url": "https://flow-php.com/sponsor", "type": "custom" - }, - { - "url": "https://github.com/norberttech", - "type": "github" } ], - "time": "2026-05-11T20:07:00+00:00" + "time": "2026-12-02T19:22:15+00:00", + "published-time": "2026-12-02T19:22:20+00:00" }, { "name": "flow-php/types", @@ -196,16 +185,16 @@ "source": { "type": "git", "url": "https://github.com/flow-php/types.git", - "reference": "362594275360459d7447f94707cb055d8aead848" + "reference": "551d7b8fcea681559802b75f424c524dc3c2e226" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/flow-php/types/zipball/362594275360459d7447f94707cb055d8aead848", - "reference": "362594275360459d7447f94707cb055d8aead848", + "url": "https://api.github.com/repos/flow-php/types/zipball/551d7b8fcea681559802b75f424c524dc3c2e226", + "reference": "551d7b8fcea681559802b75f424c524dc3c2e226", "shasum": "" }, "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0", + "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", "symfony/polyfill-mbstring": "^1.33" }, "default-branch": true, @@ -224,7 +213,7 @@ "license": [ "MIT" ], - "description": "Extended types for PHP aligned with modern static analysis tools to provide better type safety.", + "description": "Runtime types for PHP that match what static analysis tools understand.", "keywords": [ "php", "types" @@ -237,13 +226,10 @@ { "url": "https://flow-php.com/sponsor", "type": "custom" - }, - { - "url": "https://github.com/norberttech", - "type": "github" } ], - "time": "2026-05-11T20:06:54+00:00" + "time": "2026-12-02T22:17:19+00:00", + "published-time": "2026-12-02T22:17:25+00:00" }, { "name": "packaged/thrift", @@ -282,7 +268,8 @@ "issues": "https://github.com/packaged/thrift/issues", "source": "https://github.com/packaged/thrift/tree/0.15.0" }, - "time": "2021-09-23T10:34:40+00:00" + "time": "2021-09-23T10:34:40+00:00", + "published-time": "2021-09-23T10:35:14+00:00" }, { "name": "psr/clock", @@ -330,20 +317,21 @@ "issues": "https://github.com/php-fig/clock/issues", "source": "https://github.com/php-fig/clock/tree/1.0.0" }, - "time": "2022-11-25T14:36:26+00:00" + "time": "2022-11-25T14:36:26+00:00", + "published-time": "2022-11-25T14:59:22+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.37.0", + "version": "v1.43.3", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315" + "reference": "122889ed24dc000165bcbfd77ec412f15cbdfc6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6a21eb99c6973357967f6ce3708cd55a6bec6315", - "reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/122889ed24dc000165bcbfd77ec412f15cbdfc6a", + "reference": "122889ed24dc000165bcbfd77ec412f15cbdfc6a", "shasum": "" }, "require": { @@ -395,7 +383,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.37.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.43.3" }, "funding": [ { @@ -415,56 +403,8 @@ "type": "tidelift" } ], - "time": "2026-04-10T17:25:58+00:00" - }, - { - "name": "webmozart/glob", - "version": "4.7.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/glob.git", - "reference": "8a2842112d6916e61e0e15e316465b611f3abc17" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/glob/zipball/8a2842112d6916e61e0e15e316465b611f3abc17", - "reference": "8a2842112d6916e61e0e15e316465b611f3abc17", - "shasum": "" - }, - "require": { - "php": "^7.3 || ^8.0.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.5", - "symfony/filesystem": "^5.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Glob\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "A PHP implementation of Ant's glob.", - "support": { - "issues": "https://github.com/webmozarts/glob/issues", - "source": "https://github.com/webmozarts/glob/tree/4.7.0" - }, - "time": "2024-03-07T20:33:40+00:00" + "time": "2026-10-28T09:35:49+00:00", + "published-time": "2026-10-28T10:07:45+00:00" } ], "packages-dev": [], @@ -477,11 +417,11 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "ext-bcmath": "*", "ext-zlib": "*", "composer-runtime-api": "^2.2" }, "platform-dev": {}, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.11.0" } diff --git a/src/lib/parquet/src/Flow/Parquet/BloomFilter/Sbbf.php b/src/lib/parquet/src/Flow/Parquet/BloomFilter/Sbbf.php index 18ef211ab4..d260523324 100644 --- a/src/lib/parquet/src/Flow/Parquet/BloomFilter/Sbbf.php +++ b/src/lib/parquet/src/Flow/Parquet/BloomFilter/Sbbf.php @@ -87,12 +87,12 @@ public static function bits(int $hash, int $blocks): array */ public function serialized(): string { - (new BloomFilterHeader([ + new BloomFilterHeader([ 'numBytes' => strlen($this->bitset), 'algorithm' => new BloomFilterAlgorithm(['BLOCK' => new SplitBlockAlgorithm()]), 'hash' => new BloomFilterHash(['XXHASH' => new XxHash()]), 'compression' => new BloomFilterCompression(['UNCOMPRESSED' => new Uncompressed()]), - ]))->write(new CompactProtocol($header = new MemoryBuffer())); + ])->write(new CompactProtocol($header = new MemoryBuffer())); return $header->data() . $this->bitset; } diff --git a/src/lib/parquet/src/Flow/Parquet/DataSize.php b/src/lib/parquet/src/Flow/Parquet/DataSize.php index 8ad8bb02e8..3cf7941716 100644 --- a/src/lib/parquet/src/Flow/Parquet/DataSize.php +++ b/src/lib/parquet/src/Flow/Parquet/DataSize.php @@ -4,6 +4,8 @@ namespace Flow\Parquet; +use RoundingMode; + use function round; final class DataSize @@ -23,13 +25,13 @@ public function add(int|self $bits): void { if ($bits instanceof self) { $this->bits += $bits->bits; - $this->bytes = (int) round($this->bits / 8, 0, PHP_ROUND_HALF_DOWN); + $this->bytes = (int) round($this->bits / 8, 0, RoundingMode::HalfTowardsZero); return; } $this->bits += $bits; - $this->bytes = (int) round($this->bits / 8, 0, PHP_ROUND_HALF_DOWN); + $this->bytes = (int) round($this->bits / 8, 0, RoundingMode::HalfTowardsZero); } public function addBytes(int $bytes): void @@ -45,7 +47,7 @@ public function bits(): int public function bytes(): int { if ($this->bytes === null) { - $this->bytes = (int) round($this->bits / 8, 0, PHP_ROUND_HALF_DOWN); + $this->bytes = (int) round($this->bits / 8, 0, RoundingMode::HalfTowardsZero); } return $this->bytes; @@ -55,13 +57,13 @@ public function sub(int|self $bits): void { if ($bits instanceof self) { $this->bits -= $bits->bits; - $this->bytes = (int) round($this->bits / 8, 0, PHP_ROUND_HALF_DOWN); + $this->bytes = (int) round($this->bits / 8, 0, RoundingMode::HalfTowardsZero); return; } $this->bits -= $bits; - $this->bytes = (int) round($this->bits / 8, 0, PHP_ROUND_HALF_DOWN); + $this->bytes = (int) round($this->bits / 8, 0, RoundingMode::HalfTowardsZero); } public function subBytes(int $bytes): void diff --git a/src/lib/parquet/src/Flow/Parquet/Engine/PhpParquetFileWriter.php b/src/lib/parquet/src/Flow/Parquet/Engine/PhpParquetFileWriter.php index 2d46b0155c..02252b705c 100644 --- a/src/lib/parquet/src/Flow/Parquet/Engine/PhpParquetFileWriter.php +++ b/src/lib/parquet/src/Flow/Parquet/Engine/PhpParquetFileWriter.php @@ -178,7 +178,7 @@ public function writeStoredColumns(array $columns): void private function writeSlices(array $columns, DremelShredder $shredder): void { $stream = $this->stream ?? throw new RuntimeException('Writer is not open'); - $count = (new ColumnLists())->length($columns); + $count = new ColumnLists()->length($columns); for ($offset = 0; $offset < $count; $offset += $length) { $length = min($this->rowGroupSizeCheckInterval, $this->rowGroupBuilder->rowsLeft(), $count - $offset); diff --git a/src/lib/parquet/src/Flow/Parquet/Reader/ColumnDataDecoder.php b/src/lib/parquet/src/Flow/Parquet/Reader/ColumnDataDecoder.php index 4bc3f063b4..4e651a197b 100644 --- a/src/lib/parquet/src/Flow/Parquet/Reader/ColumnDataDecoder.php +++ b/src/lib/parquet/src/Flow/Parquet/Reader/ColumnDataDecoder.php @@ -127,7 +127,7 @@ public function decodeDictionary(string $buffer, FlatColumn $column, DictionaryP { $reader = new BinaryBufferReader($buffer); - return new Dictionary(iterator_to_array((new PlainValueUnpacker($reader, $this->byteOrder))->unpack( + return new Dictionary(iterator_to_array(new PlainValueUnpacker($reader, $this->byteOrder)->unpack( $column, $pageHeader->valuesCount(), ))); diff --git a/src/lib/parquet/src/Flow/Parquet/Reader/PageValuesDecoder.php b/src/lib/parquet/src/Flow/Parquet/Reader/PageValuesDecoder.php index 55d41bcc50..0e6c2a1b35 100644 --- a/src/lib/parquet/src/Flow/Parquet/Reader/PageValuesDecoder.php +++ b/src/lib/parquet/src/Flow/Parquet/Reader/PageValuesDecoder.php @@ -44,7 +44,7 @@ public function decode( ?Dictionary $dictionary = null, ): Generator { yield from match ($encoding) { - Encodings::PLAIN => (new PlainValueUnpacker($reader, $this->byteOrder))->unpack($column, $valuesCount), + Encodings::PLAIN => new PlainValueUnpacker($reader, $this->byteOrder)->unpack($column, $valuesCount), Encodings::RLE => $this->rleBooleans($reader, $column, $valuesCount), Encodings::DELTA_BINARY_PACKED => $this->deltaBinaryPacked($reader, $column, $valuesCount), Encodings::DELTA_LENGTH_BYTE_ARRAY => $this->deltaLengthByteArray($reader, $column, $valuesCount), diff --git a/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilder.php b/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilder.php index e0ad0c0406..8a0145c365 100644 --- a/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilder.php +++ b/src/lib/parquet/src/Flow/Parquet/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilder.php @@ -373,7 +373,7 @@ private function buildDictionaryPage(Codec $codec, Compressions $compression): P $dictionary = $this->dictionary; $pageBuffer = ''; $pageWriter = new BinaryBufferWriter($pageBuffer); - (new PlainValuesPacker($pageWriter, $this->byteOrder))->packValues($this->column, $dictionary->dictionary); + new PlainValuesPacker($pageWriter, $this->byteOrder)->packValues($this->column, $dictionary->dictionary); $compressedBuffer = $codec->compress($pageBuffer, $compression); @@ -397,7 +397,7 @@ private function buildDictionaryPage(Codec $codec, Compressions $compression): P */ private function dictionaryIndices(): ?array { - $extended = (new DictionaryBuilder())->build( + $extended = new DictionaryBuilder()->build( $this->column, new WriteFlatColumnValues( $this->column, diff --git a/src/lib/parquet/src/Flow/Parquet/Writer/PageBuilder/DictionaryBuilder.php b/src/lib/parquet/src/Flow/Parquet/Writer/PageBuilder/DictionaryBuilder.php index fdbc7f32bb..74667ad3e5 100644 --- a/src/lib/parquet/src/Flow/Parquet/Writer/PageBuilder/DictionaryBuilder.php +++ b/src/lib/parquet/src/Flow/Parquet/Writer/PageBuilder/DictionaryBuilder.php @@ -25,20 +25,20 @@ public function build( ): Dictionary { return match ($column->type()) { PhysicalType::INT64, PhysicalType::INT32 => match ($column->logicalType()?->name()) { - LogicalType::DATE, LogicalType::TIME, LogicalType::TIMESTAMP => (new ObjectDictionaryBuilder())->build( + LogicalType::DATE, LogicalType::TIME, LogicalType::TIMESTAMP => new ObjectDictionaryBuilder()->build( $data, $dictionary, ), - default => (new ScalarDictionaryBuilder())->build($data, $dictionary), + default => new ScalarDictionaryBuilder()->build($data, $dictionary), }, - PhysicalType::BOOLEAN => (new ScalarDictionaryBuilder())->build($data, $dictionary), - PhysicalType::FLOAT, PhysicalType::DOUBLE => (new FloatDictionaryBuilder())->build($data, $dictionary), + PhysicalType::BOOLEAN => new ScalarDictionaryBuilder()->build($data, $dictionary), + PhysicalType::FLOAT, PhysicalType::DOUBLE => new FloatDictionaryBuilder()->build($data, $dictionary), PhysicalType::FIXED_LEN_BYTE_ARRAY, PhysicalType::BYTE_ARRAY => match ($column->logicalType()?->name()) { - LogicalType::DATE, LogicalType::TIME, LogicalType::TIMESTAMP => (new ObjectDictionaryBuilder())->build( + LogicalType::DATE, LogicalType::TIME, LogicalType::TIMESTAMP => new ObjectDictionaryBuilder()->build( $data, $dictionary, ), - default => (new ScalarDictionaryBuilder())->build($data, $dictionary), + default => new ScalarDictionaryBuilder()->build($data, $dictionary), }, default => throw new RuntimeException( 'Building dictionary for "' . $column->type()->name . '" is not supported', diff --git a/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/BufferValueStorage.php b/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/BufferValueStorage.php index 04f00ac38f..adfa4b4112 100644 --- a/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/BufferValueStorage.php +++ b/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/BufferValueStorage.php @@ -28,7 +28,7 @@ public function __construct() public function addValues(FlatColumn $column, array $values): void { $localBuffer = ''; - (new PlainValuesPacker(new BinaryBufferWriter($localBuffer), $this->byteOrder))->packValues($column, $values); + new PlainValuesPacker(new BinaryBufferWriter($localBuffer), $this->byteOrder)->packValues($column, $values); $this->buffer .= $localBuffer; $this->size += strlen($localBuffer); } diff --git a/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/DeltaByteArrayValueStorage.php b/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/DeltaByteArrayValueStorage.php index 965c052a13..f77d2d25f9 100644 --- a/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/DeltaByteArrayValueStorage.php +++ b/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/DeltaByteArrayValueStorage.php @@ -11,6 +11,7 @@ use Flow\Parquet\ParquetFile\Schema\PhysicalType; use function array_filter; +use function array_first; use function array_push; use function array_values; use function count; @@ -48,12 +49,10 @@ public function addValues(FlatColumn $column, array $values): void if ((count($strings) + count(array_filter($values, is_null(...)))) !== count($values)) { throw new InvalidArgumentException(sprintf( 'DELTA_BYTE_ARRAY encoding requires string values, got %s', - gettype( - array_values(array_filter( - $values, - static fn(mixed $value): bool => $value !== null && !is_string($value), - ))[0], - ), + gettype(array_first(array_filter( + $values, + static fn(mixed $value): bool => $value !== null && !is_string($value), + ))), )); } diff --git a/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/DeltaLengthByteArrayValueStorage.php b/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/DeltaLengthByteArrayValueStorage.php index c6cb1d02be..1b239040dd 100644 --- a/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/DeltaLengthByteArrayValueStorage.php +++ b/src/lib/parquet/src/Flow/Parquet/Writer/ValueStorage/DeltaLengthByteArrayValueStorage.php @@ -11,6 +11,7 @@ use Flow\Parquet\ParquetFile\Schema\PhysicalType; use function array_filter; +use function array_first; use function array_push; use function array_values; use function count; @@ -47,12 +48,10 @@ public function addValues(FlatColumn $column, array $values): void if ((count($strings) + count(array_filter($values, is_null(...)))) !== count($values)) { throw new InvalidArgumentException(sprintf( 'DELTA_LENGTH_BYTE_ARRAY encoding requires string values, got %s', - gettype( - array_values(array_filter( - $values, - static fn(mixed $value): bool => $value !== null && !is_string($value), - ))[0], - ), + gettype(array_first(array_filter( + $values, + static fn(mixed $value): bool => $value !== null && !is_string($value), + ))), )); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/FilterExpectations.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/FilterExpectations.php index ab1a18edea..5a0468babe 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/FilterExpectations.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/FilterExpectations.php @@ -88,7 +88,7 @@ public static function matchingIds(iterable $rows, Filter $filter, Schema $schem $ids = []; - foreach ((new FilterEvaluator(BoundFilter::bind($filter, $schema, new Options())))->mask($batch) as $row) { + foreach (new FilterEvaluator(BoundFilter::bind($filter, $schema, new Options()))->mask($batch) as $row) { /** @var int $id */ $id = $batch['id'][$row]; $ids[] = $id; diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/FlatColumnPages.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/FlatColumnPages.php index 0eb8d501b1..beaead9027 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/FlatColumnPages.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/FlatColumnPages.php @@ -67,7 +67,7 @@ public static function paged(Schema $schema, array $rows, int $firstPageRows): a */ public static function shredded(Schema $schema, array $rows): array { - return (new DremelShredder(new ColumnDataValidator(), DataConverter::initialize(Options::default())))->shred( + return new DremelShredder(new ColumnDataValidator(), DataConverter::initialize(Options::default()))->shred( $schema, $rows, 0, diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/MemoryParquetFile.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/MemoryParquetFile.php index 18e8f11a82..9480a988d8 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/MemoryParquetFile.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/MemoryParquetFile.php @@ -47,7 +47,7 @@ public static function threeRowGroups(): string { return self::written( Writer::php( - options: (new Options()) + options: new Options() ->set(Option::ROW_GROUP_SIZE_BYTES, 1) ->set(Option::ROW_GROUP_SIZE_CHECK_INTERVAL, 2) ->set(Option::PAGE_SIZE_BYTES, 1) @@ -97,7 +97,7 @@ public static function dictionaryColumn(array $values, Options $options): string */ public static function pagedColumns(): string { - return self::written(Writer::php(options: (new Options()) + return self::written(Writer::php(options: new Options() ->set(Option::DICTIONARY_ENABLED, false) ->set(Option::PAGE_SIZE_BYTES, 16) ->set(Option::PAGE_SIZE_CHECK_INTERVAL, 2) diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/OneGroupPagePruning.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/OneGroupPagePruning.php index 3e8fed20c1..459ba75864 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/OneGroupPagePruning.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/OneGroupPagePruning.php @@ -24,7 +24,7 @@ public static function pruned(Filter $filter, InMemoryIndexes $indexes, ?PrunedR { $footer = FooterMother::oneGroup(10, FlatColumn::int64('a'), FlatColumn::int64('b')); - return (new PageIndexPruner(new MetadataRowGroupChunks($footer->metadata()), $indexes))->prune( + return new PageIndexPruner(new MetadataRowGroupChunks($footer->metadata()), $indexes)->prune( BoundFilter::bind($filter, $footer->schema(), new Options()), $rows ?? new PrunedRows(RowSelection::all(10), RowSelection::none(10)), ); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/PreImageDifferential.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/PreImageDifferential.php index d47e6b171e..c2bec2c6de 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/PreImageDifferential.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/PreImageDifferential.php @@ -49,11 +49,11 @@ public static function mismatches(FlatColumn $column, array $physicals, array $l $comparison = new Comparison(parquet_column($column->name()), $operator, $literal); foreach ($physicals as $physical) { - $matches = (new FilterEvaluator(BoundFilter::bind( + $matches = new FilterEvaluator(BoundFilter::bind( $comparison, Schema::with($column), new Options(), - )))->mask([ + ))->mask([ $column->name() => [$converter === null ? $physical : $converter->fromParquetType($physical)], ]) === [0]; diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/TestParquetFile.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/TestParquetFile.php index 941fb122ad..bc3df43f82 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/TestParquetFile.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/TestParquetFile.php @@ -31,7 +31,7 @@ public static function path(TestCase $test): string . (string) preg_replace( '/[^A-Za-z0-9_-]+/', '_', - (new ReflectionClass($test))->getShortName() . '-' . $test->nameWithDataSet(), + new ReflectionClass($test)->getShortName() . '-' . $test->nameWithDataSet(), ) . '-' . (string) getmypid() diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/ThreeRowGroupsPruning.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/ThreeRowGroupsPruning.php index d86b756801..7484b3df17 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/ThreeRowGroupsPruning.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/ThreeRowGroupsPruning.php @@ -34,7 +34,7 @@ public static function pruned( ): PrunedRows { $metadata = MemoryParquetFile::read(Reader::php(), MemoryParquetFile::threeRowGroups())->metadata(); - return (new RowGroupStatisticsPruner($chunks ?? new MetadataRowGroupChunks($metadata)))->prune( + return new RowGroupStatisticsPruner($chunks ?? new MetadataRowGroupChunks($metadata))->prune( BoundFilter::bind($filter, $metadata->schema(), new Options()), new PrunedRows($selected, $matched ?? RowSelection::none(6)), ); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/WriteAcceptance.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/WriteAcceptance.php index 975a3cf457..11716e7df9 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Context/WriteAcceptance.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Context/WriteAcceptance.php @@ -52,7 +52,7 @@ public static function input(string $name): mixed ), 'DateInterval PT25H' => new DateInterval('PT25H'), 'DateInterval P1M' => new DateInterval('P1M'), - 'DateInterval -PT1H' => (new DateTimeImmutable('@3600'))->diff(new DateTimeImmutable('@0')), + 'DateInterval -PT1H' => new DateTimeImmutable('@3600')->diff(new DateTimeImmutable('@0')), 'toString() uuid object' => new ToStringUuid('0190a6b0-6b1f-7c5e-9a3b-0123456789ab'), 'array [1]' => [1], 'array [a=>1]' => ['a' => 1], diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/BloomFilter/BloomFilterReaderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/BloomFilter/BloomFilterReaderTest.php index f3c089fad0..7ad7d7d3d5 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/BloomFilter/BloomFilterReaderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/BloomFilter/BloomFilterReaderTest.php @@ -33,7 +33,7 @@ public function test_every_value_an_external_writer_wrote_is_in_its_row_group_fi static::assertNotNull($bloomFilter); foreach (array_slice($rows, $first, $rowGroup->rowsCount()) as $row) { - if (!$bloomFilter->check((new BloomHash())->of($column, $row[$column->name()]))) { + if (!$bloomFilter->check(new BloomHash()->of($column, $row[$column->name()]))) { $missing[] = $row[$column->name()]; } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Data/RLEBitPackedHybridTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Data/RLEBitPackedHybridTest.php index d4729b6082..9c6c1049c0 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Data/RLEBitPackedHybridTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Data/RLEBitPackedHybridTest.php @@ -21,12 +21,8 @@ public function test_(): void { $values = [0, 1, 1, 1, 1, 1, 1, 1, 1, 1]; $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( - new BinaryBufferWriter($buffer), - BitWidth::fromArray($values), - $values, - ); - static::assertSame($values, (new RLEBitPackedHybrid())->decodeHybrid( + new RLEBitPackedHybrid()->encodeHybrid(new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values); + static::assertSame($values, new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), @@ -37,12 +33,8 @@ public function test_1(): void { $values = [5, 5, 5, 5, 5, 5, 4, 4, 4, 4]; $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( - new BinaryBufferWriter($buffer), - BitWidth::fromArray($values), - $values, - ); - static::assertSame($values, (new RLEBitPackedHybrid())->decodeHybrid( + new RLEBitPackedHybrid()->encodeHybrid(new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values); + static::assertSame($values, new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), @@ -53,13 +45,13 @@ public function test_bit_packing_reading_with_extra_bytes_in_the_buffer(): void { $values = [3, 3, 3, 3]; $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( + new RLEBitPackedHybrid()->encodeHybrid( $writer = new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values, ); $writer->writeBytes([1, 2, 3]); - static::assertSame($values, (new RLEBitPackedHybrid())->decodeHybrid( + static::assertSame($values, new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), @@ -71,13 +63,9 @@ public function test_bit_packing_with_not_a_full_sequence(): void $values = [1, 2, 3, 1234]; $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( - new BinaryBufferWriter($buffer), - BitWidth::fromArray($values), - $values, - ); + new RLEBitPackedHybrid()->encodeHybrid(new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values); - static::assertSame($values, (new RLEBitPackedHybrid())->decodeHybrid( + static::assertSame($values, new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), @@ -139,13 +127,9 @@ public function test_bit_packing_with_two_sequences(): void ]; $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( - new BinaryBufferWriter($buffer), - BitWidth::fromArray($values), - $values, - ); + new RLEBitPackedHybrid()->encodeHybrid(new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values); - static::assertSame($values, (new RLEBitPackedHybrid())->decodeHybrid( + static::assertSame($values, new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), @@ -157,13 +141,9 @@ public function test_bit_packing_zeroes(): void $values = [0, 0, 0, 0]; $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( - new BinaryBufferWriter($buffer), - BitWidth::fromArray($values), - $values, - ); + new RLEBitPackedHybrid()->encodeHybrid(new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values); - static::assertSame($values, (new RLEBitPackedHybrid())->decodeHybrid( + static::assertSame($values, new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), @@ -174,13 +154,13 @@ public function test_bit_rle_reading_with_extra_bytes_in_the_buffer(): void { $values = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3]; $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( + new RLEBitPackedHybrid()->encodeHybrid( $writer = new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values, ); $writer->writeBytes([1, 2, 3]); - static::assertSame($values, (new RLEBitPackedHybrid())->decodeHybrid( + static::assertSame($values, new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), @@ -192,13 +172,9 @@ public function test_both_rle_and_bit_packed(): void $values = [1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 412, 5]; $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( - new BinaryBufferWriter($buffer), - BitWidth::fromArray($values), - $values, - ); + new RLEBitPackedHybrid()->encodeHybrid(new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values); - static::assertSame($values, (new RLEBitPackedHybrid())->decodeHybrid( + static::assertSame($values, new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), @@ -285,13 +261,9 @@ public function test_encoding_bit_pack_before_encoding_rle(): void ]; $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( - new BinaryBufferWriter($buffer), - BitWidth::fromArray($values), - $values, - ); + new RLEBitPackedHybrid()->encodeHybrid(new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values); - static::assertSame($values, (new RLEBitPackedHybrid())->decodeHybrid( + static::assertSame($values, new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), @@ -383,13 +355,9 @@ public function test_flushing_buffers_when_they_are_dividable_by_8(): void 1, ]; $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( - new BinaryBufferWriter($buffer), - BitWidth::fromArray($values), - $values, - ); + new RLEBitPackedHybrid()->encodeHybrid(new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values); - static::assertSame($values, (new RLEBitPackedHybrid())->decodeHybrid( + static::assertSame($values, new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), @@ -400,12 +368,8 @@ public function test_only_zeroes(): void { $values = [0, 0, 0, 0, 0, 0, 0, 0, 0]; $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( - new BinaryBufferWriter($buffer), - BitWidth::fromArray($values), - $values, - ); - static::assertSame($values, (new RLEBitPackedHybrid())->decodeHybrid( + new RLEBitPackedHybrid()->encodeHybrid(new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values); + static::assertSame($values, new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), @@ -417,13 +381,9 @@ public function test_plain_long_rle(): void $values = array_fill(0, 100, 1); $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( - new BinaryBufferWriter($buffer), - BitWidth::fromArray($values), - $values, - ); + new RLEBitPackedHybrid()->encodeHybrid(new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values); - static::assertSame($values, (new RLEBitPackedHybrid())->decodeHybrid( + static::assertSame($values, new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), @@ -435,13 +395,9 @@ public function test_plain_rle_with_two_sequences(): void $values = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( - new BinaryBufferWriter($buffer), - BitWidth::fromArray($values), - $values, - ); + new RLEBitPackedHybrid()->encodeHybrid(new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values); - static::assertSame($values, (new RLEBitPackedHybrid())->decodeHybrid( + static::assertSame($values, new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), @@ -459,7 +415,7 @@ public function test_with_dynamically_generated_values(): void } $buffer = ''; - (new RLEBitPackedHybrid())->encodeHybrid( + new RLEBitPackedHybrid()->encodeHybrid( new BinaryBufferWriter($buffer), BitWidth::fromArray($values), $values, @@ -467,7 +423,7 @@ public function test_with_dynamically_generated_values(): void static::assertSame( $values, - (new RLEBitPackedHybrid())->decodeHybrid( + new RLEBitPackedHybrid()->decodeHybrid( new BinaryBufferReader($buffer), BitWidth::fromArray($values), count($values), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/CrossEngineTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/CrossEngineTest.php index 7d6b3d6290..73bb30b182 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/CrossEngineTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/CrossEngineTest.php @@ -95,7 +95,7 @@ public function test_arrow_write_php_read(): void $engine->writeRows($stream, $schema, Compressions::SNAPPY, new Options(), $inputData); $result = iterator_to_array( - (new Reader(engine: new PhpParquetEngine())) + new Reader(engine: new PhpParquetEngine()) ->read($path) ->values(), ); @@ -120,10 +120,10 @@ public function test_explicit_php_engine(): void $phpEngine = new PhpParquetEngine(); - (new Writer(engine: $phpEngine))->write($path, $schema, $inputData); + new Writer(engine: $phpEngine)->write($path, $schema, $inputData); $result = iterator_to_array( - (new Reader(engine: $phpEngine)) + new Reader(engine: $phpEngine) ->read($path) ->values(), ); @@ -149,7 +149,7 @@ public function test_php_write_arrow_read(): void ['id' => 3, 'name' => 'three', 'value' => 3.3], ]; - (new Writer(engine: new PhpParquetEngine()))->write($path, $schema, $inputData); + new Writer(engine: new PhpParquetEngine())->write($path, $schema, $inputData); $engine = new RustParquetEngine(); $chunks = iterator_to_array( diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/EngineParityTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/EngineParityTest.php index 6e26df80fe..fd897aa2d7 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/EngineParityTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/EngineParityTest.php @@ -39,7 +39,7 @@ public function test_both_engines_decode_the_same_float32_bytes_identically(): v { $path = TestParquetFile::path($this); - (new Writer())->write($path, Schema::with(FlatColumn::float('v')), [ + new Writer()->write($path, Schema::with(FlatColumn::float('v')), [ ['v' => 0.1], ['v' => 18.52], ['v' => 1 / 3], @@ -52,7 +52,7 @@ public function test_both_engines_decode_the_same_float32_bytes_identically(): v static::assertSame( iterator_to_array( - (new Reader(engine: new RustParquetEngine())) + new Reader(engine: new RustParquetEngine()) ->read($path) ->values(), ), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/FilterParityTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/FilterParityTest.php index c0eaeea6ab..4775fe6771 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/FilterParityTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/FilterParityTest.php @@ -259,7 +259,7 @@ public function test_both_engines_filter_nanosecond_timestamps_by_the_microsecon $rows = array_map( static fn(int $id): array => [ 'id' => $id, - 'ts' => (new DateTimeImmutable('2024-01-01 00:00:00.000001 UTC'))->modify('+' . $id . ' microseconds'), + 'ts' => new DateTimeImmutable('2024-01-01 00:00:00.000001 UTC')->modify('+' . $id . ' microseconds'), ], range(0, 9), ); @@ -399,7 +399,7 @@ public function test_both_engines_keep_every_row_group_of_a_file_without_column_ foreach ([parquet_column('id')->equals(1), parquet_column('name')->equals('name-1')] as $filter) { foreach ([PhpParquetEngine::class, RustParquetEngine::class] as $engine) { - $file = (new Reader(engine: ParquetEngineMother::create($engine)))->read($fixture); + $file = new Reader(engine: ParquetEngineMother::create($engine))->read($fixture); static::assertEquals(RowSelection::all(5000), FilePlan::of($file, $filter)->selection); static::assertSame([1], FilterExpectations::ids($file->values(new Query(['id'], $filter)))); } @@ -560,7 +560,7 @@ public function test_both_engines_page_prune_a_file_whose_columns_break_pages_at $rows = []; foreach ([PhpParquetEngine::class, RustParquetEngine::class] as $engine) { - $file = (new Reader(engine: ParquetEngineMother::create($engine)))->read($fixture); + $file = new Reader(engine: ParquetEngineMother::create($engine))->read($fixture); $plan = FilePlan::of($file, $filter); static::assertEquals($selection, $plan->selection); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/ReadColumnsTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/ReadColumnsTest.php index 8ad80217e3..002ee0a5e7 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/ReadColumnsTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/ReadColumnsTest.php @@ -83,7 +83,7 @@ public function test_an_offset_counts_the_rows_the_row_filter_keeps_and_is_annou 3, ); $schema = Schema::with(FlatColumn::int32('id', Repetition::REQUIRED)); - (new Writer(options: $options, engine: new PhpParquetEngine(options: $options)))->write( + new Writer(options: $options, engine: new PhpParquetEngine(options: $options))->write( $path, $schema, array_map(static fn(int $id): array => ['id' => $id], range(1, 9)), @@ -118,7 +118,7 @@ public function test_a_row_filter_reads_a_column_the_read_does_not_return(string FlatColumn::int32('id', Repetition::REQUIRED), FlatColumn::int32('amount', Repetition::REQUIRED), ); - (new Writer())->write( + new Writer()->write( $path, $schema, array_map(static fn(int $id): array => ['id' => $id, 'amount' => $id * 10], range(1, 5)), @@ -146,7 +146,7 @@ public function test_a_row_filter_reads_a_column_the_read_does_not_return(string public function test_reading_no_column_yields_at_most_one_chunk_without_a_column(string $engineClass): void { $path = TestParquetFile::path($this); - (new Writer())->write( + new Writer()->write( $path, Schema::with(FlatColumn::int32('id', Repetition::REQUIRED)), array_map(static fn(int $id): array => ['id' => $id], range(1, 5)), @@ -172,7 +172,7 @@ public function test_stored_columns_hold_temporal_and_uuid_values_as_they_are_st $path = TestParquetFile::path($this); $instant = new DateTimeImmutable('2009-02-13 23:31:30.123456', new DateTimeZone('UTC')); $beforeEpoch = new DateTimeImmutable('1969-12-31 23:59:59.999999', new DateTimeZone('UTC')); - (new Writer())->write( + new Writer()->write( $path, Schema::with( FlatColumn::date('d'), @@ -205,7 +205,7 @@ public function test_stored_columns_hold_temporal_and_uuid_values_as_they_are_st 'us' => $instant, 'ms' => $instant, 'ns' => $instant, - 't' => (new DateTimeImmutable('@0'))->diff(new DateTimeImmutable('@3723.000004')), + 't' => new DateTimeImmutable('@0')->diff(new DateTimeImmutable('@3723.000004')), 'instants' => [$instant, $beforeEpoch], 's' => ['day' => new DateTimeImmutable('1969-12-31', new DateTimeZone('UTC'))], 'u' => '00112233-4455-6677-8899-aabbccddeeff', @@ -305,7 +305,7 @@ public function test_chunks_follow_batch_size_limit_and_offset( $engine = ParquetEngineMother::create($engineClass); $path = TestParquetFile::path($this); - (new Writer())->write( + new Writer()->write( $path, Schema::with( FlatColumn::int32('id', Repetition::REQUIRED), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RowGroupChunksParityTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RowGroupChunksParityTest.php index e06813a24e..f3e011ce67 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RowGroupChunksParityTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RowGroupChunksParityTest.php @@ -42,7 +42,7 @@ public function test_the_arrow_footer_slices_give_the_zone_maps_of_the_php_foote $file = MemoryParquetFile::read(Reader::php(), $bytes); $columns = array_values($file->schema()->columnsFlat()); $php = $file->reader()->footer()->rowGroupChunks($columns); - $rust = (new RustParquetFileReader(new MemorySourceStream($bytes))) + $rust = new RustParquetFileReader(new MemorySourceStream($bytes)) ->footer() ->rowGroupChunks($columns); @@ -53,8 +53,8 @@ public function test_the_arrow_footer_slices_give_the_zone_maps_of_the_php_foote static::assertSame($php->columnOrder($column), $rust->columnOrder($column)); // var_export: a NaN bound never equals itself static::assertSame( - var_export((new RowGroupZoneMaps($php, $group))->zone($column), true), - var_export((new RowGroupZoneMaps($rust, $group))->zone($column), true), + var_export(new RowGroupZoneMaps($php, $group)->zone($column), true), + var_export(new RowGroupZoneMaps($rust, $group)->zone($column), true), ); } } @@ -64,14 +64,14 @@ public function test_deprecated_bounds_of_a_legacy_file_stay_untrusted_through_t { $fixture = __DIR__ . '/../IO/Fixtures/EdgeCases/datapage_v2.snappy.parquet'; $columns = array_values(Reader::php()->read($fixture)->schema()->columnsFlat()); - $chunks = (new RustParquetFileReader(NativeLocalSourceStream::open(path_real($fixture)))) + $chunks = new RustParquetFileReader(NativeLocalSourceStream::open(path_real($fixture))) ->footer() ->rowGroupChunks($columns); foreach ($columns as $column) { static::assertNotNull($chunks->chunk(0, $column)->statistics()?->min($column)); - static::assertNull((new RowGroupZoneMaps($chunks, 0))->zone($column)?->min); - static::assertNull((new RowGroupZoneMaps($chunks, 0))->zone($column)?->max); + static::assertNull(new RowGroupZoneMaps($chunks, 0)->zone($column)?->min); + static::assertNull(new RowGroupZoneMaps($chunks, 0)->zone($column)?->max); } } @@ -79,7 +79,7 @@ public function test_each_column_chunk_is_decoded_once_per_footer(): void { $bytes = FilterRows::bytes('row_groups_php'); $columns = array_values(MemoryParquetFile::read(Reader::php(), $bytes)->schema()->columnsFlat()); - $footer = (new RustParquetFileReader(new MemorySourceStream($bytes)))->footer(); + $footer = new RustParquetFileReader(new MemorySourceStream($bytes))->footer(); static::assertSame( $footer->rowGroupChunks($columns)->chunk(0, $columns[0]), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustLibParityTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustLibParityTest.php index ec0e1ffe75..a19118cd4c 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustLibParityTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustLibParityTest.php @@ -68,7 +68,7 @@ public function test_a_fixture_reads_the_values_of_the_php_engine( var_export(ParquetRows::read(Reader::php()->read($path), $batchSize, [], $limit, $offset), true), var_export( ParquetRows::read( - (new Reader(engine: new RustParquetEngine()))->read($path), + new Reader(engine: new RustParquetEngine())->read($path), $batchSize, [], $limit, @@ -98,7 +98,7 @@ public function test_an_interval_column_is_refused_naming_it_and_the_php_reader( static::assertSame( ParquetRows::read(Reader::php()->read($path), 100, ['id']), - ParquetRows::read((new Reader(engine: new RustParquetEngine()))->read($path), 100, ['id']), + ParquetRows::read(new Reader(engine: new RustParquetEngine())->read($path), 100, ['id']), ); $this->expectException(RuntimeException::class); @@ -107,7 +107,7 @@ public function test_an_interval_column_is_refused_naming_it_and_the_php_reader( . 'with \Flow\Parquet\Reader::php()', ); - ParquetRows::read((new Reader(engine: new RustParquetEngine()))->read($path), 100); + ParquetRows::read(new Reader(engine: new RustParquetEngine())->read($path), 100); } public function test_a_uint64_above_php_int_max_reads_as_the_same_decimal_string_on_both_engines(): void @@ -117,7 +117,7 @@ public function test_a_uint64_above_php_int_max_reads_as_the_same_decimal_string static::assertSame([['u64' => '18446744073709551615']], ParquetRows::read(Reader::php()->read($path), 100)); static::assertSame( ParquetRows::read(Reader::php()->read($path), 100), - ParquetRows::read((new Reader(engine: new RustParquetEngine()))->read($path), 100), + ParquetRows::read(new Reader(engine: new RustParquetEngine())->read($path), 100), ); } @@ -127,10 +127,7 @@ public function test_the_external_uint64_fixture_reads_as_decimal_strings_on_bot $expected = [['col0' => '0'], ['col0' => '9223372036854775808'], ['col0' => '18446744073709551615']]; static::assertSame($expected, ParquetRows::read(Reader::php()->read($path), 10)); - static::assertSame($expected, ParquetRows::read( - (new Reader(engine: new RustParquetEngine()))->read($path), - 10, - )); + static::assertSame($expected, ParquetRows::read(new Reader(engine: new RustParquetEngine())->read($path), 10)); } #[TestWith(['double_key', 'float'])] @@ -144,7 +141,7 @@ public function test_a_map_key_a_php_array_cannot_hold_is_refused_by_both_engine static::assertSame( ParquetRows::read(Reader::php()->read($path), 10, ['id']), - ParquetRows::read((new Reader(engine: new RustParquetEngine()))->read($path), 10, ['id']), + ParquetRows::read(new Reader(engine: new RustParquetEngine())->read($path), 10, ['id']), ); try { @@ -157,6 +154,6 @@ public function test_a_map_key_a_php_array_cannot_hold_is_refused_by_both_engine $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage("Map key of Parquet column \"{$column}\" must be int or string, got {$type}"); - ParquetRows::read((new Reader(engine: new RustParquetEngine()))->read($path), 10, [$column]); + ParquetRows::read(new Reader(engine: new RustParquetEngine())->read($path), 10, [$column]); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustLibRegressionTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustLibRegressionTest.php index 5dd0144e36..336c92937d 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustLibRegressionTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustLibRegressionTest.php @@ -53,7 +53,7 @@ public function test_an_offset_read_reads_only_the_footer_and_the_row_group_it_n } $stream = new ReadCountingSourceStream(NativeLocalSourceStream::open(path_real(self::PAGINATION))); - $file = (new Reader(engine: new RustParquetEngine()))->readStream($stream); + $file = new Reader(engine: new RustParquetEngine())->readStream($stream); $rows = iterator_to_array($file->values(new Query(offset: 4990, limit: 10)), false); static::assertCount(10, $rows); @@ -65,7 +65,7 @@ public function test_a_full_read_reads_the_file_about_once(): void $stream = new ReadCountingSourceStream(NativeLocalSourceStream::open(path_real(self::PAGINATION))); static::assertCount(5000, iterator_to_array( - (new Reader(engine: new RustParquetEngine())) + new Reader(engine: new RustParquetEngine()) ->readStream($stream) ->values(), false, @@ -90,7 +90,7 @@ public function test_invalid_utf8_is_refused_naming_column_and_row(): void public function test_a_time_of_a_day_and_an_hour_keeps_its_day(): void { - $interval = (new DateTimeImmutable('2024-01-01 00:00:00'))->diff(new DateTimeImmutable('2024-01-02 01:00:00')); + $interval = new DateTimeImmutable('2024-01-01 00:00:00')->diff(new DateTimeImmutable('2024-01-02 01:00:00')); $bytes = MemoryParquetFile::written( new Writer(engine: new RustParquetEngine()), Schema::with(FlatColumn::time('t')), @@ -112,8 +112,7 @@ public function test_int96_reads_exactly_outside_the_nanosecond_range(): void { $values = array_column( ParquetRows::read( - (new Reader(engine: new RustParquetEngine()))->read(__DIR__ - . '/../IO/Fixtures/EdgeCases/int96.parquet'), + new Reader(engine: new RustParquetEngine())->read(__DIR__ . '/../IO/Fixtures/EdgeCases/int96.parquet'), 10, ), 'ts', @@ -130,7 +129,7 @@ public function test_dates_are_utc_and_times_carry_their_day_count(): void Schema::with(FlatColumn::date('d'), FlatColumn::time('t')), [[ 'd' => new DateTimeImmutable('2024-02-29'), - 't' => (new DateTimeImmutable('@0'))->diff(new DateTimeImmutable('@90000')), + 't' => new DateTimeImmutable('@0')->diff(new DateTimeImmutable('@90000')), ]], ); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustParquetEngineReadTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustParquetEngineReadTest.php index ff648899db..3318de7a6e 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustParquetEngineReadTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustParquetEngineReadTest.php @@ -57,7 +57,7 @@ public function test_read_flat_columns(): void ['id' => 3, 'name' => 'Charlie', 'active' => true, 'score' => 92.1], ]; - (new Writer())->write($path, $schema, $inputData); + new Writer()->write($path, $schema, $inputData); $engine = new RustParquetEngine(); $chunks = iterator_to_array( @@ -92,7 +92,7 @@ public function test_read_nested_lists(): void ['id' => 2, 'tags' => ['python']], ]; - (new Writer())->write($path, $schema, $inputData); + new Writer()->write($path, $schema, $inputData); $engine = new RustParquetEngine(); $chunks = iterator_to_array( @@ -121,7 +121,7 @@ public function test_read_nested_maps(): void ['id' => 2, 'metadata' => ['score' => 200]], ]; - (new Writer())->write($path, $schema, $inputData); + new Writer()->write($path, $schema, $inputData); $engine = new RustParquetEngine(); $chunks = iterator_to_array( @@ -156,7 +156,7 @@ public function test_read_nested_structs(): void ['id' => 2, 'address' => ['city' => 'Warsaw', 'zip' => 00001]], ]; - (new Writer())->write($path, $schema, $inputData); + new Writer()->write($path, $schema, $inputData); $engine = new RustParquetEngine(); $chunks = iterator_to_array( @@ -185,7 +185,7 @@ public function test_read_nested_uuid_as_canonical_strings(): void NestedColumn::list('uuid_list', ListElement::uuid()), ); - (new Writer())->write($path, $schema, [[ + new Writer()->write($path, $schema, [[ 'top_uuid' => $uuid, 'body' => ['id' => $uuid, 'data' => '{"a":1}'], 'uuid_list' => [$uuid, $uuid], @@ -226,7 +226,7 @@ public function test_read_with_column_projection(): void ['id' => 2, 'name' => 'Bob', 'email' => 'bob@example.com'], ]; - (new Writer())->write($path, $schema, $inputData); + new Writer()->write($path, $schema, $inputData); $engine = new RustParquetEngine(); $chunks = iterator_to_array( @@ -249,7 +249,7 @@ public function test_read_with_limit(): void $inputData = array_map(static fn(int $i): array => ['id' => $i], range(1, 100)); - (new Writer())->write($path, $schema, $inputData); + new Writer()->write($path, $schema, $inputData); $engine = new RustParquetEngine(); $chunks = iterator_to_array( @@ -272,7 +272,7 @@ public function test_read_with_limit_and_offset(): void $inputData = array_map(static fn(int $i): array => ['id' => $i], range(1, 100)); - (new Writer())->write($path, $schema, $inputData); + new Writer()->write($path, $schema, $inputData); $engine = new RustParquetEngine(); $chunks = iterator_to_array( @@ -295,7 +295,7 @@ public function test_read_with_offset(): void $inputData = array_map(static fn(int $i): array => ['id' => $i], range(1, 100)); - (new Writer())->write($path, $schema, $inputData); + new Writer()->write($path, $schema, $inputData); $engine = new RustParquetEngine(); $chunks = iterator_to_array( diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustParquetEngineWriteTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustParquetEngineWriteTest.php index ab83e87154..538abea28c 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustParquetEngineWriteTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/RustParquetEngineWriteTest.php @@ -62,7 +62,7 @@ public function test_write_flat_columns_readable_by_php_engine(): void $engine->writeRows($stream, $schema, Compressions::SNAPPY, new Options(), $inputData); $result = iterator_to_array( - (new Reader()) + new Reader() ->read($path) ->values(), ); @@ -96,7 +96,7 @@ public function test_write_nested_types(): void $engine->writeRows($stream, $schema, Compressions::SNAPPY, new Options(), $inputData); $result = iterator_to_array( - (new Reader()) + new Reader() ->read($path) ->values(), ); @@ -118,7 +118,7 @@ public function test_write_with_gzip_compression(): void $engine->writeRows($stream, $schema, Compressions::GZIP, new Options(), $inputData); $result = iterator_to_array( - (new Reader()) + new Reader() ->read($path) ->values(), ); @@ -139,7 +139,7 @@ public function test_write_with_snappy_compression(): void $engine->writeRows($stream, $schema, Compressions::SNAPPY, new Options(), $inputData); $result = iterator_to_array( - (new Reader()) + new Reader() ->read($path) ->values(), ); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/WriteColumnsTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/WriteColumnsTest.php index 273dae6a20..d360407349 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/WriteColumnsTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Engine/WriteColumnsTest.php @@ -66,7 +66,7 @@ public function test_stored_columns_write_the_file_their_temporal_and_uuid_value 'us' => [$instant, null], 'ms' => [$instant, null], 'ns' => [$instant, null], - 't' => [(new DateTimeImmutable('@0'))->diff(new DateTimeImmutable('@3723.000004')), null], + 't' => [new DateTimeImmutable('@0')->diff(new DateTimeImmutable('@3723.000004')), null], 'instants' => [ [$instant, new DateTimeImmutable('1969-12-31 23:59:59.999999', new DateTimeZone('UTC'))], null, diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/CompressionTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/CompressionTest.php index 3e30b3b0be..9263c60e3a 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/CompressionTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/CompressionTest.php @@ -77,7 +77,7 @@ public function test_writing_and_reading_file_with_brotli_compression(string $en static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -130,7 +130,7 @@ public function test_writing_and_reading_file_with_gzip_compression(string $engi static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -188,7 +188,7 @@ public function test_writing_and_reading_file_with_lz4_compression(string $engin static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -246,7 +246,7 @@ public function test_writing_and_reading_file_with_lz4_raw_compression(string $e static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -304,7 +304,7 @@ public function test_writing_and_reading_file_with_snappy_compression(string $en static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -361,7 +361,7 @@ public function test_writing_and_reading_file_with_snappy_polyfill(string $engin static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -414,7 +414,7 @@ public function test_writing_and_reading_file_with_uncompressed_compression(stri static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -472,7 +472,7 @@ public function test_writing_and_reading_file_with_zstd_compression(string $engi static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/DeltaEncodingsTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/DeltaEncodingsTest.php index 9c999ba5c1..579d16c2b3 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/DeltaEncodingsTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/DeltaEncodingsTest.php @@ -41,16 +41,16 @@ public function test_a_dictionary_column_of_nulls_round_trips(string $writerEngi $path = TestParquetFile::path($this); $rows = [['s' => null], ['s' => null]]; - (new Writer(options: Options::default()->set(Option::COLUMNS_ENCODINGS, [ + new Writer(options: Options::default()->set(Option::COLUMNS_ENCODINGS, [ 's' => Encodings::RLE_DICTIONARY, - ]), engine: ParquetEngineMother::create($writerEngine)))->write( + ]), engine: ParquetEngineMother::create($writerEngine))->write( $path, Schema::with(FlatColumn::string('s')), $rows, ); static::assertSame($rows, iterator_to_array( - (new Reader(engine: ParquetEngineMother::create($readerEngine))) + new Reader(engine: ParquetEngineMother::create($readerEngine)) ->read($path) ->values(), false, @@ -70,7 +70,7 @@ public function test_explicit_delta_string_encodings_round_trip( ['dlba' => '', 'dba' => 'axle', 'dbp' => -5, 'required' => 7], ]; - (new Writer(options: Options::default()->set( + new Writer(options: Options::default()->set( Option::WRITER_VERSION, $writerVersion, )->set(Option::COLUMNS_ENCODINGS, [ @@ -78,7 +78,7 @@ public function test_explicit_delta_string_encodings_round_trip( 'dba' => Encodings::DELTA_BYTE_ARRAY, 'dbp' => Encodings::DELTA_BINARY_PACKED, 'required' => Encodings::DELTA_BINARY_PACKED, - ]), engine: ParquetEngineMother::create($writerEngine)))->write( + ]), engine: ParquetEngineMother::create($writerEngine))->write( $path, Schema::with( FlatColumn::string('dlba'), @@ -89,7 +89,7 @@ public function test_explicit_delta_string_encodings_round_trip( $rows, ); - $file = (new Reader(engine: ParquetEngineMother::create($readerEngine)))->read($path); + $file = new Reader(engine: ParquetEngineMother::create($readerEngine))->read($path); static::assertSame($rows, iterator_to_array($file->values(), false)); [$dlba, $dba, $dbp, $required] = $file->metadata()->columnChunks(); @@ -111,7 +111,7 @@ public function test_reading_delta_byte_array_written_by_arrow_rs(string $engine ['s' => null, 'f' => 'zzzz'], ], iterator_to_array( - (new Reader(engine: ParquetEngineMother::create($engineClass))) + new Reader(engine: ParquetEngineMother::create($engineClass)) ->read(__DIR__ . '/Fixtures/delta_byte_array_arrow_v2.parquet') ->values(), false, @@ -131,7 +131,7 @@ public function test_reading_delta_length_byte_array_written_by_an_external_writ ['s' => '', 'n' => null], ], iterator_to_array( - (new Reader(engine: ParquetEngineMother::create($engineClass))) + new Reader(engine: ParquetEngineMother::create($engineClass)) ->read(__DIR__ . '/Fixtures/delta_length_byte_array_external_v2.parquet') ->values(), false, @@ -153,20 +153,20 @@ public function test_writer_version_2_round_trips_strings_fixed_length_and_ints( ['s' => 'babble', 'f' => 'abcd', 'i' => 3], ]; - (new Writer( + new Writer( options: Options::default() ->set(Option::DICTIONARY_ENABLED, false) ->set(Option::WRITER_VERSION, 2) ->set(Option::PAGE_MAXIMUM_ROWS_COUNT, 2) ->set(Option::PAGE_SIZE_CHECK_INTERVAL, 2), engine: ParquetEngineMother::create($writerEngine), - ))->write( + )->write( $path, Schema::with(FlatColumn::string('s'), FlatColumn::fixedSizeByteArray('f', 4), FlatColumn::int64('i')), $rows, ); - $file = (new Reader(engine: ParquetEngineMother::create($readerEngine)))->read($path); + $file = new Reader(engine: ParquetEngineMother::create($readerEngine))->read($path); static::assertSame($rows, iterator_to_array($file->values(), false)); @@ -200,13 +200,13 @@ public function test_int64_values_with_deltas_near_large_powers_of_two_round_tri $path = TestParquetFile::path($this); $rows = array_map(static fn(int $i): array => ['i' => ($i % 2) === 0 ? 0 : (1 << 59) + $i], range(0, 129)); - (new Writer( + new Writer( options: Options::default()->set(Option::DICTIONARY_ENABLED, false)->set(Option::WRITER_VERSION, 2), engine: ParquetEngineMother::create($writerEngine), - ))->write($path, Schema::with(FlatColumn::int64('i')), $rows); + )->write($path, Schema::with(FlatColumn::int64('i')), $rows); static::assertSame($rows, iterator_to_array( - (new Reader(engine: ParquetEngineMother::create($readerEngine))) + new Reader(engine: ParquetEngineMother::create($readerEngine)) ->read($path) ->values(), false, @@ -224,14 +224,14 @@ public function test_negative_and_sequential_ints_round_trip_gzip_compressed( range(0, 199), ); - (new Writer( + new Writer( compression: Compressions::GZIP, options: Options::default()->set(Option::DICTIONARY_ENABLED, false)->set(Option::WRITER_VERSION, 2), engine: ParquetEngineMother::create($writerEngine), - ))->write($path, Schema::with(FlatColumn::int32('i32'), FlatColumn::int64('i64')), $rows); + )->write($path, Schema::with(FlatColumn::int32('i32'), FlatColumn::int64('i64')), $rows); static::assertSame($rows, iterator_to_array( - (new Reader(engine: ParquetEngineMother::create($readerEngine))) + new Reader(engine: ParquetEngineMother::create($readerEngine)) ->read($path) ->values(), false, diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/EdgeCasesReadingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/EdgeCasesReadingTest.php index 56f2087287..2e3210c1a1 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/EdgeCasesReadingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/EdgeCasesReadingTest.php @@ -18,7 +18,7 @@ public function test_nonullable_impala(string $engineClass): void $engine = ParquetEngineMother::create($engineClass); $path = __DIR__ . '/Fixtures/EdgeCases/nonnullable.impala.parquet'; - $reader = (new Reader(engine: $engine))->read($path); + $reader = new Reader(engine: $engine)->read($path); static::assertEquals( [ @@ -74,7 +74,7 @@ public function test_read_datapage_v2_snappy_list(string $engineClass): void ['a' => 'abc', 'b' => 5, 'c' => 2.0, 'd' => true, 'e' => [1, 2]], ], iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read(__DIR__ . '/Fixtures/EdgeCases/datapage_v2.snappy.parquet') ->values(), false, @@ -88,7 +88,7 @@ public function test_read_null_list(string $engineClass): void $engine = ParquetEngineMother::create($engineClass); $path = __DIR__ . '/Fixtures/EdgeCases/null_list.parquet'; - $reader = (new Reader(engine: $engine))->read($path); + $reader = new Reader(engine: $engine)->read($path); $rows = []; diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/ListsWritingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/ListsWritingTest.php index a6a54eda82..930608f9e3 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/ListsWritingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/ListsWritingTest.php @@ -48,7 +48,7 @@ public function test_writing_empty_lists_of_ints(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -71,7 +71,7 @@ public function test_writing_list_of_decimals(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -105,7 +105,7 @@ public function test_writing_list_of_ints(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -139,7 +139,7 @@ public function test_writing_list_of_strings(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -179,7 +179,7 @@ public function test_writing_list_of_structures(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -215,7 +215,7 @@ public function test_writing_list_with_nullable_elements(string $engineClass): v static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -251,7 +251,7 @@ public function test_writing_list_with_nullable_list_values(string $engineClass) static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -287,7 +287,7 @@ public function test_writing_nullable_list_of_ints(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -329,7 +329,7 @@ public function test_writing_nullable_list_of_structures(string $engineClass): v static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -367,7 +367,7 @@ public function test_writing_nullable_list_of_structures_with_required_fields(st static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -397,7 +397,7 @@ public function test_writing_nullable_lists_of_ints(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/LogicalTypesReadingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/LogicalTypesReadingTest.php index 6290e90367..e452959d57 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/LogicalTypesReadingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/LogicalTypesReadingTest.php @@ -28,7 +28,7 @@ public function test_reading_converted_type_only_columns(string $engineClass): v $engine = ParquetEngineMother::create($engineClass); $path = TestParquetFile::path($this); - (new Writer(engine: new PhpParquetEngine()))->write( + new Writer(engine: new PhpParquetEngine())->write( $path, Schema::with( new FlatColumn( @@ -58,7 +58,7 @@ public function test_reading_converted_type_only_columns(string $engineClass): v ]], ); - $file = (new Reader(engine: $engine))->read($path); + $file = new Reader(engine: $engine)->read($path); static::assertSame( [[ @@ -84,7 +84,7 @@ public function test_reading_dates(string $engineClass): void ['d' => null], ], TemporalValues::format( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read(__DIR__ . '/Fixtures/logical_types.parquet') ->values(new Query(['d'])), ), @@ -107,7 +107,7 @@ public function test_reading_fixed_len_decimals(string $engineClass): void ['dec9' => null, 'dec18' => null, 'dec38' => null, 'dec50' => null], ], iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read(__DIR__ . '/Fixtures/decimals_fixed_len.parquet') ->values(), ), @@ -125,7 +125,7 @@ public function test_reading_int_backed_decimals(string $engineClass): void ['dec9' => null, 'dec18' => null], ], iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read(__DIR__ . '/Fixtures/logical_types.parquet') ->values(new Query(['dec9', 'dec18'])), ), @@ -143,7 +143,7 @@ public function test_reading_times_in_every_unit(string $engineClass): void ['t_ms' => null, 't_us' => null, 't_ns' => null], ], TemporalValues::format( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read(__DIR__ . '/Fixtures/logical_types.parquet') ->values(new Query(['t_ms', 't_us', 't_ns'])), ), @@ -172,7 +172,7 @@ public function test_reading_timestamps_in_every_unit(string $engineClass): void ], ['ts_ms' => null, 'ts_us' => null, 'ts_ns' => null, 'ts_us_utc' => null, 'ts_us_far' => null], ], - TemporalValues::format((new Reader(engine: $engine)) + TemporalValues::format(new Reader(engine: $engine) ->read(__DIR__ . '/Fixtures/logical_types.parquet') ->values(new Query(['ts_ms', 'ts_us', 'ts_ns', 'ts_us_utc', 'ts_us_far']))), ); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/LogicalTypesWritingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/LogicalTypesWritingTest.php index 20d71d3257..ec0f41dbf2 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/LogicalTypesWritingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/LogicalTypesWritingTest.php @@ -33,7 +33,7 @@ public function test_dates_are_the_wall_clock_day(string $writerClass, string $r $reader = ParquetEngineMother::create($readerClass); $path = TestParquetFile::path($this); - (new Writer(engine: $writer))->write($path, Schema::with(FlatColumn::date('d')), [ + new Writer(engine: $writer)->write($path, Schema::with(FlatColumn::date('d')), [ ['d' => new DateTimeImmutable('2024-01-01 00:00:00', new DateTimeZone('Europe/Warsaw'))], ['d' => new DateTimeImmutable('1969-12-31 12:00:00', new DateTimeZone('UTC'))], ['d' => new DateTimeImmutable('1900-02-28 00:00:00', new DateTimeZone('UTC'))], @@ -46,7 +46,7 @@ public function test_dates_are_the_wall_clock_day(string $writerClass, string $r ['d' => '1900-02-28 00:00:00.000000 +00:00'], ], TemporalValues::format( - (new Reader(engine: $reader)) + new Reader(engine: $reader) ->read($path) ->values(), ), @@ -60,7 +60,7 @@ public function test_decimals_round_half_away_from_zero(string $writerClass, str $reader = ParquetEngineMother::create($readerClass); $path = TestParquetFile::path($this); - (new Writer(engine: $writer))->write($path, Schema::with(FlatColumn::decimal('d', 9, 2)), [ + new Writer(engine: $writer)->write($path, Schema::with(FlatColumn::decimal('d', 9, 2)), [ ['d' => 0.125], ['d' => 2.675], ['d' => -0.125], @@ -72,7 +72,7 @@ public function test_decimals_round_half_away_from_zero(string $writerClass, str static::assertSame( [['d' => 0.13], ['d' => 2.68], ['d' => -0.13], ['d' => 1.01], ['d' => 10.0], ['d' => -100.0]], iterator_to_array( - (new Reader(engine: $reader)) + new Reader(engine: $reader) ->read($path) ->values(), ), @@ -91,7 +91,7 @@ public function test_decimals_round_trip(string $writerClass, string $readerClas ['d9' => null, 'd38' => 1.2345678901234568E+18, 'i32' => null, 'i64' => null, 'ba' => null], ]; - (new Writer(engine: $writer))->write( + new Writer(engine: $writer)->write( $path, Schema::with( FlatColumn::decimal('d9', 9, 2), @@ -130,7 +130,7 @@ public function test_decimals_round_trip(string $writerClass, string $readerClas static::assertSame( $rows, iterator_to_array( - (new Reader(engine: $reader)) + new Reader(engine: $reader) ->read($path) ->values(), ), @@ -143,11 +143,11 @@ public function test_times_round_trip_in_every_unit(string $writerClass, string $writer = ParquetEngineMother::create($writerClass); $reader = ParquetEngineMother::create($readerClass); $path = TestParquetFile::path($this); - $time = (new DateTimeImmutable('2020-01-01 00:00:00 UTC'))->diff( + $time = new DateTimeImmutable('2020-01-01 00:00:00 UTC')->diff( new DateTimeImmutable('2020-01-01 03:04:05.678901 UTC'), ); - (new Writer(engine: $writer))->write( + new Writer(engine: $writer)->write( $path, Schema::with( FlatColumn::time('t'), @@ -168,7 +168,7 @@ public function test_times_round_trip_in_every_unit(string $writerClass, string static::assertSame( [['t' => '03:04:05.678901', 't_ms' => '03:04:05.678000', 't_ns' => '03:04:05.678901']], TemporalValues::format( - (new Reader(engine: $reader)) + new Reader(engine: $reader) ->read($path) ->values(), ), @@ -184,7 +184,7 @@ public function test_timestamps_round_trip_in_every_unit(string $writerClass, st $instant = new DateTimeImmutable('2020-01-02 04:04:05.678901 +01:00'); $preEpoch = new DateTimeImmutable('1969-12-31 23:59:58.5 UTC'); - (new Writer(engine: $writer))->write( + new Writer(engine: $writer)->write( $path, Schema::with( FlatColumn::dateTime('ts'), @@ -225,13 +225,13 @@ public function test_timestamps_round_trip_in_every_unit(string $writerClass, st ], ], TemporalValues::format( - (new Reader(engine: $reader)) + new Reader(engine: $reader) ->read($path) ->values(), ), ); - $schema = (new Reader()) + $schema = new Reader() ->read($path) ->metadata() ->schema(); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/MapsWritingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/MapsWritingTest.php index c15ce552ab..855ce52257 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/MapsWritingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/MapsWritingTest.php @@ -47,7 +47,7 @@ public function test_writing_empty_map_of_int_int(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -81,7 +81,7 @@ public function test_writing_map_of_int_int(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -111,7 +111,7 @@ public function test_writing_map_of_int_int_with_all_maps_null(string $engineCla static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -145,7 +145,7 @@ public function test_writing_map_of_int_string(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -168,7 +168,7 @@ public function test_writing_map_of_string_decimal(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -204,7 +204,7 @@ public function test_writing_nullable_map_of_int_int(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/PaginationTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/PaginationTest.php index cfbb8e6f9b..42960b49b1 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/PaginationTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/PaginationTest.php @@ -61,7 +61,7 @@ public function test_offset_past_first_page_of_multi_page_column(string $engineC array_map(static fn(int $i): array => ['id' => $i], range(0, 99)), ); - $file = (new Reader(engine: $engine))->read($path); + $file = new Reader(engine: $engine)->read($path); static::assertSame( array_map(static fn(int $i): array => ['id' => $i], range(30, 99)), @@ -75,12 +75,12 @@ public function test_reading_last_100_rows(string $engineClass): void $engine = ParquetEngineMother::create($engineClass); $path = __DIR__ . '/Fixtures/pagination_row_group_1kb_5k_rows.snappy.parquet'; - $totalRows = (new Reader(engine: $engine)) + $totalRows = new Reader(engine: $engine) ->read($path) ->metadata() ->rowsNumber(); - $file = (new Reader(engine: $engine))->read($path); + $file = new Reader(engine: $engine)->read($path); static::assertEquals( array_merge(...array_map( @@ -101,7 +101,7 @@ public function test_setting_offset_larger_than_file( $engine = ParquetEngineMother::create($engineClass); $path = __DIR__ . '/Fixtures/pagination_row_group_1kb_5k_rows.snappy.parquet'; - $file = (new Reader(engine: $engine))->read($path); + $file = new Reader(engine: $engine)->read($path); static::assertCount( $results, @@ -117,7 +117,7 @@ public function test_columns_refuses_a_batch_size_below_one(string $engineClass) $this->expectExceptionMessage('Batch size must be greater than 0'); iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read(__DIR__ . '/Fixtures/pagination_row_group_1kb_5k_rows.snappy.parquet') ->columns(new Query(['id']), 0), ); @@ -126,7 +126,7 @@ public function test_columns_refuses_a_batch_size_below_one(string $engineClass) #[DataProvider('engine_provider')] public function test_columns_with_a_limit_of_zero_read_no_row(string $engineClass): void { - $file = (new Reader(engine: ParquetEngineMother::create($engineClass)))->read(__DIR__ + $file = new Reader(engine: ParquetEngineMother::create($engineClass))->read(__DIR__ . '/Fixtures/pagination_row_group_1kb_5k_rows.snappy.parquet'); static::assertSame([], iterator_to_array($file->columns(new Query(['id'], limit: 0), 2))); @@ -140,7 +140,7 @@ public function test_columns_refuses_an_unknown_column(string $engineClass): voi $this->expectExceptionMessage('Column "nope" does not exist'); iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read(__DIR__ . '/Fixtures/pagination_row_group_1kb_5k_rows.snappy.parquet') ->columns(new Query(['nope']), 2), ); @@ -150,7 +150,7 @@ public function test_columns_refuses_an_unknown_column(string $engineClass): voi public function test_values_equal_the_zip_of_columns(string $engineClass): void { $engine = ParquetEngineMother::create($engineClass); - $file = (new Reader(engine: $engine))->read(__DIR__ + $file = new Reader(engine: $engine)->read(__DIR__ . '/Fixtures/pagination_row_group_1kb_5k_rows.snappy.parquet'); $zipped = []; @@ -177,7 +177,7 @@ public function test_simple_pagination_on_small_row_group_size(string $engineCla // Uncomment only to apply changes to the dataset // $this->generateDataset($path); - $file = (new Reader(engine: $engine))->read($path); + $file = new Reader(engine: $engine)->read($path); static::assertEquals( array_merge(...array_map(static fn(int $i): array => [['id' => $i]], range(1020, 1029))), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SchemaReadingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SchemaReadingTest.php index 2aa271ba42..3e28be986d 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SchemaReadingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SchemaReadingTest.php @@ -181,7 +181,7 @@ public function test_reading_primitives_schema_ddl(string $engineClass): void public function test_reading_statistics(string $engineClass): void { $engine = ParquetEngineMother::create($engineClass); - $metadata = (new Reader(engine: $engine)) + $metadata = new Reader(engine: $engine) ->read(__DIR__ . '/Fixtures/primitives.parquet') ->metadata(); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesReadingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesReadingTest.php index 17955eed43..3f5473ddaf 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesReadingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesReadingTest.php @@ -248,7 +248,7 @@ public function test_reading_every_delta_binary_packed_value(string $engineClass range(1, 1000), ), iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read(__DIR__ . '/Fixtures/delta_binary_acked_encoded_integers.parquet') ->values(), false, diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesWritingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesWritingTest.php index 4cf112a1ca..7e205e46b8 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesWritingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/SimpleTypesWritingTest.php @@ -110,7 +110,7 @@ public function test_writing_bool_column(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -142,7 +142,7 @@ public function test_writing_bool_nullable_column(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -176,7 +176,7 @@ public function test_writing_date_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -213,7 +213,7 @@ public function test_writing_date_column_before_1970(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -249,7 +249,7 @@ public function test_writing_date_nullable_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -283,7 +283,7 @@ public function test_writing_decimal_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -325,7 +325,7 @@ public function test_writing_decimal_column_with_different_precisions( static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -359,7 +359,7 @@ public function test_writing_decimal_nullable_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -393,7 +393,7 @@ public function test_writing_double_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -427,7 +427,7 @@ public function test_writing_double_nullable_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -461,7 +461,7 @@ public function test_writing_enum_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -486,7 +486,7 @@ public function test_writing_float_column(string $engineClass): void static::assertSame( $widened, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -513,7 +513,7 @@ public function test_writing_float_nullable_column(string $engineClass): void static::assertSame( $widened, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -547,7 +547,7 @@ public function test_writing_int32_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -581,7 +581,7 @@ public function test_writing_int32_nullable_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -615,7 +615,7 @@ public function test_writing_int64(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -648,7 +648,7 @@ public function test_writing_int64_nullable_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -686,7 +686,7 @@ public function test_writing_json_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -726,7 +726,7 @@ public function test_writing_json_nullable_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -759,7 +759,7 @@ public function test_writing_string_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -792,7 +792,7 @@ public function test_writing_string_nullable_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -812,7 +812,7 @@ public function test_writing_time_column(string $engineClass): void $inputData = array_merge(...array_map( static fn(int $i): array => [ [ - 'time' => (new DateTimeImmutable('2023-01-01 00:00:00 UTC'))->diff( + 'time' => new DateTimeImmutable('2023-01-01 00:00:00 UTC')->diff( new DateTimeImmutable('2023-01-01 15:45:00 UTC'), ), ], @@ -825,7 +825,7 @@ public function test_writing_time_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -846,7 +846,7 @@ public function test_writing_time_nullable_column(string $engineClass): void static fn(int $i): array => [ [ 'time' => ($i % 2) === 0 - ? (new DateTimeImmutable('2023-01-01 00:00:00 UTC'))->diff( + ? new DateTimeImmutable('2023-01-01 00:00:00 UTC')->diff( new DateTimeImmutable('2023-01-01 15:45:00 UTC'), ) : null, @@ -860,7 +860,7 @@ public function test_writing_time_nullable_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -893,7 +893,7 @@ public function test_writing_timestamp_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -926,7 +926,7 @@ public function test_writing_timestamp_column_for_years_before_1970(string $engi static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -959,7 +959,7 @@ public function test_writing_timestamp_nullable_column(string $engineClass): voi static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -992,7 +992,7 @@ public function test_writing_uuid_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -1025,7 +1025,7 @@ public function test_writing_uuid_nullable_column(string $engineClass): void static::assertEquals( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/StructsWritingTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/StructsWritingTest.php index 6f4d5829e7..7b6e516176 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/StructsWritingTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/StructsWritingTest.php @@ -70,7 +70,7 @@ public function test_writing_flat_nullable_structure(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -121,7 +121,7 @@ public function test_writing_flat_structure(string $engineClass): void static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -173,7 +173,7 @@ public function test_writing_flat_structure_with_nullable_elements(string $engin static::assertSame( $inputData, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterTest.php index 5c7fc6f375..280b5286d6 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/IO/WriterTest.php @@ -320,7 +320,7 @@ public function test_writers_sharing_one_engine_write_independent_files(string $ static::assertSame( [['id' => 1], ['id' => 3]], iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->readStream($memory->readFrom(path('memory://first.parquet'))) ->values(), false, @@ -329,7 +329,7 @@ public function test_writers_sharing_one_engine_write_independent_files(string $ static::assertSame( [['id' => 2]], iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->readStream($memory->readFrom(path('memory://second.parquet'))) ->values(), false, @@ -394,12 +394,12 @@ public function test_writing_all_column_types(string $engineClass): void $path = TestParquetFile::path($this); - (new Writer(engine: $engine))->write($path, $schema, $rows); + new Writer(engine: $engine)->write($path, $schema, $rows); static::assertSame( $rows, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -430,7 +430,7 @@ public function test_writing_column_statistics(string $engineClass): void $writer->write($path, $schema, array_map(static fn($i) => ['int32' => $i], range(1, 100))); - $statistics = (new Reader(engine: $engine)) + $statistics = new Reader(engine: $engine) ->read($path) ->metadata() ->columnChunks()[0]->statistics(); @@ -451,7 +451,7 @@ public function test_writing_column_orders_per_leaf(string $engineClass): void { $engine = ParquetEngineMother::create($engineClass); $path = TestParquetFile::path($this); - (new Writer(engine: $engine))->write( + new Writer(engine: $engine)->write( $path, Schema::with( FlatColumn::string('string'), @@ -473,7 +473,7 @@ public function test_writing_column_orders_per_leaf(string $engineClass): void ]], ); - $metadata = (new Reader(engine: $engine)) + $metadata = new Reader(engine: $engine) ->read($path) ->metadata(); @@ -506,7 +506,7 @@ public function test_writing_float_statistics_in_total_order_with_nan_count(stri $path = TestParquetFile::path($this); $column = FlatColumn::double('double'); - (new Writer(engine: $engine))->write( + new Writer(engine: $engine)->write( $path, Schema::with($column), array_map(static fn(float $value): array => [ @@ -514,7 +514,7 @@ public function test_writing_float_statistics_in_total_order_with_nan_count(stri ], [NAN, 0.0, -0.0, 1.5, NAN]), ); - $statistics = (new Reader(engine: $engine)) + $statistics = new Reader(engine: $engine) ->read($path) ->metadata() ->columnChunks()[0]->statistics(); @@ -536,7 +536,7 @@ public function test_writing_uint64_reads_back_as_decimal_strings_on_both_engine ): void { $path = TestParquetFile::path($this); - (new Writer(engine: ParquetEngineMother::create($writerEngine)))->write( + new Writer(engine: ParquetEngineMother::create($writerEngine))->write( $path, Schema::with(new FlatColumn('u', PhysicalType::INT64, logicalType: LogicalType::integer(64, false))), [['u' => 0], ['u' => '9223372036854775808'], ['u' => '18446744073709551615']], @@ -544,7 +544,7 @@ public function test_writing_uint64_reads_back_as_decimal_strings_on_both_engine static::assertSame( [['u' => '0'], ['u' => '9223372036854775808'], ['u' => '18446744073709551615']], - ParquetRows::read((new Reader(engine: ParquetEngineMother::create($readerEngine)))->read($path), 10), + ParquetRows::read(new Reader(engine: ParquetEngineMother::create($readerEngine))->read($path), 10), ); } @@ -625,7 +625,7 @@ public function test_writing_the_converted_type_of_a_logical_type( ): void { $path = TestParquetFile::path($this); - (new Writer(engine: new PhpParquetEngine()))->write($path, Schema::with($column), []); + new Writer(engine: new PhpParquetEngine())->write($path, Schema::with($column), []); static::assertSame( $expected?->value, @@ -638,7 +638,7 @@ public function test_an_int16_column_round_trips(string $writerEngine, string $r { $path = TestParquetFile::path($this); - (new Writer(engine: ParquetEngineMother::create($writerEngine)))->write( + new Writer(engine: ParquetEngineMother::create($writerEngine))->write( $path, Schema::with(new FlatColumn('s', PhysicalType::INT32, ConvertedType::INT_16)), [['s' => 1], ['s' => -2], ['s' => 32_767], ['s' => null]], @@ -646,7 +646,7 @@ public function test_an_int16_column_round_trips(string $writerEngine, string $r static::assertSame( [['s' => 1], ['s' => -2], ['s' => 32_767], ['s' => null]], - ParquetRows::read((new Reader(engine: ParquetEngineMother::create($readerEngine)))->read($path), 10), + ParquetRows::read(new Reader(engine: ParquetEngineMother::create($readerEngine))->read($path), 10), ); } @@ -668,11 +668,11 @@ public function test_writing_column_statistics_with_null_values(string $engineCl $path = TestParquetFile::path($this); - (new Writer(engine: $engine))->write($path, $schema, $rows); + new Writer(engine: $engine)->write($path, $schema, $rows); $chunks = []; - foreach ((new Reader(engine: $engine)) + foreach (new Reader(engine: $engine) ->read($path) ->metadata() ->columnChunks() as $chunk) { @@ -695,7 +695,7 @@ public function test_writing_data_page_v2_statistics(): void $writer->write($path, $schema, array_map(static fn($i) => ['int32' => $i], range(1, 100))); - foreach ((new Reader(options: $options, engine: new PhpParquetEngine())) + foreach (new Reader(options: $options, engine: new PhpParquetEngine()) ->read($path) ->pageHeaders() as $pageHeader) { if (!$pageHeader->pageHeader->type()->isDataPage()) { @@ -740,7 +740,7 @@ public function test_writing_in_batches_to_file(string $engineClass): void static::assertSame( [$row, $row, $row, $row, $row, $row, $row, $row, $row, $row], iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -750,7 +750,7 @@ public function test_writing_in_batches_to_file(string $engineClass): void public function test_writer_options_apply_on_open_as_on_write(): void { - $options = (new Options())->set(Option::ROW_GROUP_SIZE_BYTES, 1)->set( + $options = new Options()->set(Option::ROW_GROUP_SIZE_BYTES, 1)->set( Option::ROW_GROUP_SIZE_CHECK_INTERVAL, 1, )->set(Option::PAGE_SIZE_CHECK_INTERVAL, 1); @@ -798,7 +798,7 @@ public function test_writing_in_batches_to_file_without_explicit_close(string $e static::assertSame( [$row, $row, $row, $row, $row, $row, $row, $row, $row, $row], iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -831,7 +831,7 @@ public function test_writing_in_batches_to_stream(string $engineClass): void static::assertSame( [$row, $row, $row, $row, $row, $row, $row, $row, $row, $row], iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -855,16 +855,16 @@ public function test_writing_one_row_that_is_nullable(string $engineClass): void ], ]); - static::assertNull((new Reader(engine: $engine)) + static::assertNull(new Reader(engine: $engine) ->read($path) ->metadata() ->columnChunks()[0]->statistics()?->max($column)); - static::assertNull((new Reader(engine: $engine)) + static::assertNull(new Reader(engine: $engine) ->read($path) ->metadata() ->columnChunks()[0]->statistics()?->min($column)); static::assertNull( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->metadata() ->columnChunks()[0] @@ -872,7 +872,7 @@ public function test_writing_one_row_that_is_nullable(string $engineClass): void ?->maxValue($column), ); static::assertNull( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->metadata() ->columnChunks()[0] @@ -911,7 +911,7 @@ public function test_writing_to_file(string $engineClass): void static::assertSame( [$row, $row, $row, $row, $row, $row, $row, $row, $row, $row], iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -951,7 +951,7 @@ public function test_writing_to_file_v2(string $engineClass, bool $dictionaryEna static::assertSame( 2, - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->metadata() ->version(), @@ -959,7 +959,7 @@ public function test_writing_to_file_v2(string $engineClass, bool $dictionaryEna static::assertSame( [$row, $row, $row, $row, $row, $row, $row, $row, $row, $row], iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -996,7 +996,7 @@ public function test_writing_to_stream(string $engineClass): void static::assertSame( [$row, $row, $row, $row, $row, $row, $row, $row, $row, $row], iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -1019,12 +1019,12 @@ public function test_writing_with_all_nullable_columns(string $engineClass): voi $path = TestParquetFile::path($this); - (new Writer(engine: $engine))->write($path, $schema, $rows); + new Writer(engine: $engine)->write($path, $schema, $rows); static::assertSame( $rows, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -1045,12 +1045,12 @@ public function test_writing_with_dictionary_encoding(string $engineClass): void $path = TestParquetFile::path($this); - (new Writer(engine: $engine))->write($path, $schema, $rows); + new Writer(engine: $engine)->write($path, $schema, $rows); static::assertSame( $rows, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -1076,12 +1076,12 @@ public function test_writing_with_empty_lists_and_maps(string $engineClass): voi $path = TestParquetFile::path($this); - (new Writer(engine: $engine))->write($path, $schema, $rows); + new Writer(engine: $engine)->write($path, $schema, $rows); static::assertSame( $rows, iterator_to_array( - (new Reader(engine: $engine)) + new Reader(engine: $engine) ->read($path) ->values(), ), @@ -1091,7 +1091,7 @@ public function test_writing_with_empty_lists_and_maps(string $engineClass): voi public function test_the_page_index_is_written_and_reads_back_on_both_engines(): void { $bytes = MemoryParquetFile::written( - Writer::php(options: (new Options())->set(Option::PAGE_SIZE_BYTES, 8)->set( + Writer::php(options: new Options()->set(Option::PAGE_SIZE_BYTES, 8)->set( Option::PAGE_SIZE_CHECK_INTERVAL, 2, )), @@ -1144,7 +1144,7 @@ public function test_the_page_index_is_written_and_reads_back_on_both_engines(): public function test_bloom_filters_are_written_after_each_row_group_for_the_columns_asked(): void { - $bytes = MemoryParquetFile::written(Writer::php(options: (new Options()) + $bytes = MemoryParquetFile::written(Writer::php(options: new Options() ->set(Option::ROW_GROUP_SIZE_BYTES, 1) ->set(Option::ROW_GROUP_SIZE_CHECK_INTERVAL, 3) ->set(Option::PAGE_SIZE_BYTES, 1) @@ -1162,7 +1162,7 @@ public function test_bloom_filters_are_written_after_each_row_group_for_the_colu static::assertGreaterThan($chunks[1]->fileOffset(), $chunks[0]->bloomFilterOffset()); foreach ($ids as $value) { - static::assertTrue($bloomFilter->check((new BloomHash())->of($id, $value))); + static::assertTrue($bloomFilter->check(new BloomHash()->of($id, $value))); } static::assertNull($file->indexes()->bloomFilter($rowGroup, $name)); @@ -1175,7 +1175,7 @@ public function test_both_engines_write_the_same_bloom_filter_bytes(): void static::markTestSkipped('arrow is not loaded'); } - $options = (new Options())->set(Option::COLUMNS_BLOOM_FILTERS, [ + $options = new Options()->set(Option::COLUMNS_BLOOM_FILTERS, [ 'id' => new BloomFilterOptions(0.05, 5000), 'name' => new BloomFilterOptions(0.01), ]); @@ -1200,7 +1200,7 @@ public function test_both_engines_write_the_same_bloom_filter_bytes(): void public function test_pages_of_a_list_column_start_at_row_boundaries(): void { $file = MemoryParquetFile::read(Reader::php(), MemoryParquetFile::written( - Writer::php(options: (new Options())->set(Option::PAGE_SIZE_BYTES, 16)->set( + Writer::php(options: new Options()->set(Option::PAGE_SIZE_BYTES, 16)->set( Option::PAGE_SIZE_CHECK_INTERVAL, 1, )), @@ -1242,7 +1242,7 @@ public function test_the_statistics_level_decides_chunk_statistics_and_the_colum static fn( StatisticsLevel $level, ): ParquetFile => MemoryParquetFile::read(Reader::php(), MemoryParquetFile::written( - Writer::php(options: (new Options())->set(Option::STATISTICS_LEVEL, $level)), + Writer::php(options: new Options()->set(Option::STATISTICS_LEVEL, $level)), Schema::with(FlatColumn::int64('id')), [['id' => 1], ['id' => 2]], )); @@ -1284,11 +1284,11 @@ public function test_page_header_statistics_are_written_only_when_asked(): void static::assertSame([null], $headers(new Options())); static::assertSame( 2, - $headers((new Options())->set(Option::PAGE_HEADER_STATISTICS, true))[0]?->maxValue(FlatColumn::int64('id')), + $headers(new Options()->set(Option::PAGE_HEADER_STATISTICS, true))[0]?->maxValue(FlatColumn::int64('id')), ); static::assertSame( [null], - $headers((new Options())->set(Option::PAGE_HEADER_STATISTICS, true)->set( + $headers(new Options()->set(Option::PAGE_HEADER_STATISTICS, true)->set( Option::STATISTICS_LEVEL, StatisticsLevel::CHUNK, )), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/OptionsTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/OptionsTest.php index aeec9445c0..65f760f238 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/OptionsTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/OptionsTest.php @@ -214,11 +214,11 @@ public function test_set_empty_arrays(): void public function test_an_enum_option_is_read_as_its_enum_class(): void { - static::assertSame(StatisticsLevel::PAGE, (new Options())->getEnum( + static::assertSame(StatisticsLevel::PAGE, new Options()->getEnum( Option::STATISTICS_LEVEL, StatisticsLevel::class, )); - static::assertSame(StatisticsLevel::NONE, (new Options())->set( + static::assertSame(StatisticsLevel::NONE, new Options()->set( Option::STATISTICS_LEVEL, StatisticsLevel::NONE, )->getEnum(Option::STATISTICS_LEVEL, StatisticsLevel::class)); @@ -231,7 +231,7 @@ public function test_an_enum_option_of_another_class_is_refused(): void 'Option STATISTICS_LEVEL is not a Flow\\Parquet\\Writer\\StatisticsLevel, but: Flow\\Parquet\\ParquetFile\\Compressions', ); - (new Options())->set(Option::STATISTICS_LEVEL, Compressions::GZIP)->getEnum( + new Options()->set(Option::STATISTICS_LEVEL, Compressions::GZIP)->getEnum( Option::STATISTICS_LEVEL, StatisticsLevel::class, ); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilderTest.php index b9ba0e96da..98b5531157 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Integration/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilderTest.php @@ -57,7 +57,7 @@ public function test_pages_past_the_dictionary_page_size_are_written_plain(strin static::assertSame($values, MemoryParquetFile::column( new Reader(engine: ParquetEngineMother::create($engine)), - MemoryParquetFile::dictionaryColumn($values, (new Options())->set(Option::DICTIONARY_PAGE_SIZE, 16)), + MemoryParquetFile::dictionaryColumn($values, new Options()->set(Option::DICTIONARY_PAGE_SIZE, 16)), 's', )); } @@ -66,7 +66,7 @@ public function test_the_chunk_lists_both_encodings_after_a_fallback_to_plain(): { $file = MemoryParquetFile::read(Reader::php(), MemoryParquetFile::dictionaryColumn( ['aaaa', 'bbbb', 'cccc', 'dddd', 'eeee', 'ffff'], - (new Options())->set(Option::DICTIONARY_PAGE_SIZE, 32), + new Options()->set(Option::DICTIONARY_PAGE_SIZE, 32), )); static::assertEqualsCanonicalizing( diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Mother/SbbfMother.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Mother/SbbfMother.php index 5cc5c9a696..22712a5056 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Mother/SbbfMother.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Mother/SbbfMother.php @@ -20,7 +20,7 @@ public static function with(FlatColumn $column, bool|float|int|string ...$values $builder = SbbfBuilder::for(new BloomFilterOptions(0.01, 100)); foreach ($values as $value) { - $builder->insert((new BloomHash())->of($column, $value)); + $builder->insert(new BloomHash()->of($column, $value)); } return $builder->build(); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/BloomFilterOptionsTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/BloomFilterOptionsTest.php index 19e1e1ea88..7ed6048399 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/BloomFilterOptionsTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/BloomFilterOptionsTest.php @@ -51,7 +51,7 @@ public function test_the_columns_option_is_read_by_flat_path_and_empty_when_unse static::assertSame([], BloomFilterOptions::forColumns(new Options())); static::assertSame( ['id' => $id], - BloomFilterOptions::forColumns((new Options())->set(Option::COLUMNS_BLOOM_FILTERS, ['id' => $id])), + BloomFilterOptions::forColumns(new Options()->set(Option::COLUMNS_BLOOM_FILTERS, ['id' => $id])), ); } @@ -62,6 +62,6 @@ public function test_a_columns_option_value_that_is_not_bloom_filter_options_is_ 'Option COLUMNS_BLOOM_FILTERS takes BloomFilterOptions, got string for column "id"', ); - BloomFilterOptions::forColumns((new Options())->set(Option::COLUMNS_BLOOM_FILTERS, ['id' => 'fast'])); + BloomFilterOptions::forColumns(new Options()->set(Option::COLUMNS_BLOOM_FILTERS, ['id' => 'fast'])); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/BloomFilterReaderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/BloomFilterReaderTest.php index 730eb73f19..f7488dd500 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/BloomFilterReaderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/BloomFilterReaderTest.php @@ -31,7 +31,7 @@ public function test_a_filter_is_read_at_once_when_its_length_is_known(): void static::assertEquals( $sbbf, - (new BloomFilterReader($stream))->read(ColumnChunkMother::withBloomFilter($id, 4, strlen($bytes))), + new BloomFilterReader($stream)->read(ColumnChunkMother::withBloomFilter($id, 4, strlen($bytes))), ); static::assertSame(1, $stream->reads); } @@ -44,7 +44,7 @@ public function test_a_filter_of_unknown_length_reads_its_header_then_its_bitset static::assertEquals( $sbbf, - (new BloomFilterReader($stream))->read(ColumnChunkMother::withBloomFilter($id, 4, null)), + new BloomFilterReader($stream)->read(ColumnChunkMother::withBloomFilter($id, 4, null)), ); static::assertSame(2, $stream->reads); } @@ -57,7 +57,7 @@ public function test_a_length_no_filter_fits_in_is_an_unknown_length(): void static::assertEquals( $sbbf, - (new BloomFilterReader($stream))->read(ColumnChunkMother::withBloomFilter($id, 4, 0)), + new BloomFilterReader($stream)->read(ColumnChunkMother::withBloomFilter($id, 4, 0)), ); static::assertSame(2, $stream->reads); } @@ -69,7 +69,7 @@ public function test_a_header_declaring_no_bitset_is_refused(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('The bloom filter at offset 4 declares 0 bytes'); - (new BloomFilterReader(new MemorySourceStream('PAR1' . $bytes)))->read(ColumnChunkMother::withBloomFilter( + new BloomFilterReader(new MemorySourceStream('PAR1' . $bytes))->read(ColumnChunkMother::withBloomFilter( FlatColumn::int64('id'), 4, strlen($bytes), @@ -80,7 +80,7 @@ public function test_a_chunk_without_a_filter_reads_nothing(): void { $stream = new ReadCountingSourceStream(new MemorySourceStream('PAR1')); - static::assertNull((new BloomFilterReader($stream))->read(ColumnChunkMother::withStatistics( + static::assertNull(new BloomFilterReader($stream)->read(ColumnChunkMother::withStatistics( FlatColumn::int64('id'), null, ))); @@ -97,8 +97,8 @@ public function test_a_filter_of_an_unknown_algorithm_hash_or_compression_is_no_ BloomFilterBytes::of($bitset, hash: new BloomFilterHash()), BloomFilterBytes::of($bitset, compression: new BloomFilterCompression()), ] as $bytes) { - static::assertNull((new BloomFilterReader(new MemorySourceStream('PAR1' - . $bytes)))->read(ColumnChunkMother::withBloomFilter($id, 4, strlen($bytes)))); + static::assertNull(new BloomFilterReader(new MemorySourceStream('PAR1' + . $bytes))->read(ColumnChunkMother::withBloomFilter($id, 4, strlen($bytes)))); } } @@ -106,7 +106,7 @@ public function test_an_offset_no_filter_can_be_read_from_is_no_filter(): void { $stream = new ReadCountingSourceStream(new MemorySourceStream('PAR1')); - static::assertNull((new BloomFilterReader($stream))->read(ColumnChunkMother::withBloomFilter( + static::assertNull(new BloomFilterReader($stream)->read(ColumnChunkMother::withBloomFilter( FlatColumn::int64('id'), -1, 40, @@ -121,7 +121,7 @@ public function test_a_bitset_shorter_than_its_header_declares_is_refused(): voi $this->expectException(RuntimeException::class); $this->expectExceptionMessage('The bloom filter at offset 4 declares 64 bytes, 32 were read'); - (new BloomFilterReader(new MemorySourceStream('PAR1' . $bytes)))->read(ColumnChunkMother::withBloomFilter( + new BloomFilterReader(new MemorySourceStream('PAR1' . $bytes))->read(ColumnChunkMother::withBloomFilter( FlatColumn::int64('id'), 4, strlen($bytes), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/BloomHashTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/BloomHashTest.php index b483ed50cb..f8d9bb75cf 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/BloomHashTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/BloomHashTest.php @@ -15,23 +15,23 @@ final class BloomHashTest extends TestCase public function test_byte_arrays_hash_without_their_length_prefix(): void { // xxh64 seed 0: "" = 0xef46db3751d8e999, "a" = 0xd24ec4f1a98c6e5b, "abc" = 0x44bc2cf5ad770999 - static::assertSame(-1_205_034_819_632_174_695, (new BloomHash())->of(FlatColumn::string('s'), '')); - static::assertSame(-3_292_477_735_350_538_661, (new BloomHash())->of(FlatColumn::string('s'), 'a')); - static::assertSame(4_952_883_123_889_572_249, (new BloomHash())->of(FlatColumn::string('s'), 'abc')); + static::assertSame(-1_205_034_819_632_174_695, new BloomHash()->of(FlatColumn::string('s'), '')); + static::assertSame(-3_292_477_735_350_538_661, new BloomHash()->of(FlatColumn::string('s'), 'a')); + static::assertSame(4_952_883_123_889_572_249, new BloomHash()->of(FlatColumn::string('s'), 'abc')); } public function test_integers_hash_as_little_endian_bytes(): void { // xxh64("\x01\x00\x00\x00") = 0xf42f94001fcb5351, xxh64(8 x "\xff") = 0x85d136adb773c6c9 - static::assertSame(-851_299_076_295_404_719, (new BloomHash())->of(FlatColumn::int32('i'), 1)); - static::assertSame(-8_804_195_676_797_548_855, (new BloomHash())->of(FlatColumn::int64('l'), -1)); + static::assertSame(-851_299_076_295_404_719, new BloomHash()->of(FlatColumn::int32('i'), 1)); + static::assertSame(-8_804_195_676_797_548_855, new BloomHash()->of(FlatColumn::int64('l'), -1)); } public function test_an_unsigned_64_bit_value_hashes_as_its_int64_bit_pattern(): void { static::assertSame( - (new BloomHash())->of(FlatColumn::int64('l'), -1), - (new BloomHash())->of( + new BloomHash()->of(FlatColumn::int64('l'), -1), + new BloomHash()->of( new FlatColumn('u', PhysicalType::INT64, logicalType: LogicalType::integer(64, false)), -1, ), @@ -41,13 +41,13 @@ public function test_an_unsigned_64_bit_value_hashes_as_its_int64_bit_pattern(): public function test_floating_point_values_hash_as_little_endian_ieee_754(): void { // xxh64 of 1.5 as f32 = 0x4f2d82595c483a0d, as f64 = 0x49f7b96b6b5ccaf9 - static::assertSame(5_705_359_623_260_224_013, (new BloomHash())->of(FlatColumn::float('f'), 1.5)); - static::assertSame(5_329_932_555_030_153_977, (new BloomHash())->of(FlatColumn::double('d'), 1.5)); + static::assertSame(5_705_359_623_260_224_013, new BloomHash()->of(FlatColumn::float('f'), 1.5)); + static::assertSame(5_329_932_555_030_153_977, new BloomHash()->of(FlatColumn::double('d'), 1.5)); } public function test_a_boolean_hashes_as_one_byte(): void { // xxh64("\x01") = 0x8a4127811b21e730 - static::assertSame(-8_484_456_787_529_832_656, (new BloomHash())->of(FlatColumn::boolean('b'), true)); + static::assertSame(-8_484_456_787_529_832_656, new BloomHash()->of(FlatColumn::boolean('b'), true)); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/SbbfBuilderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/SbbfBuilderTest.php index bad3c187f9..709b1e6705 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/SbbfBuilderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/SbbfBuilderTest.php @@ -21,13 +21,13 @@ public function test_inserted_values_are_found_after_folding(): void $builder = SbbfBuilder::for(new BloomFilterOptions(0.05, 1_048_576)); for ($id = 0; $id < 500; $id++) { - $builder->insert((new BloomHash())->of(FlatColumn::int64('id'), $id)); + $builder->insert(new BloomHash()->of(FlatColumn::int64('id'), $id)); } $sbbf = $builder->build(); for ($id = 0; $id < 500; $id++) { - static::assertTrue($sbbf->check((new BloomHash())->of(FlatColumn::int64('id'), $id))); + static::assertTrue($sbbf->check(new BloomHash()->of(FlatColumn::int64('id'), $id))); } } @@ -37,7 +37,7 @@ public function test_a_filter_too_full_to_fold_keeps_the_optimal_num_of_bytes(): $builder = SbbfBuilder::for(new BloomFilterOptions(0.01, 1000)); for ($id = 0; $id < 2000; $id++) { - $builder->insert((new BloomHash())->of(FlatColumn::int64('id'), $id)); + $builder->insert(new BloomHash()->of(FlatColumn::int64('id'), $id)); } static::assertSame( @@ -52,8 +52,8 @@ public function test_a_folded_filter_equals_one_built_at_its_size(): void $fresh = SbbfBuilder::for(new BloomFilterOptions(0.01, 2000)); for ($id = 0; $id < 2000; $id++) { - $folded->insert((new BloomHash())->of(FlatColumn::int64('id'), $id)); - $fresh->insert((new BloomHash())->of(FlatColumn::int64('id'), $id)); + $folded->insert(new BloomHash()->of(FlatColumn::int64('id'), $id)); + $fresh->insert(new BloomHash()->of(FlatColumn::int64('id'), $id)); } static::assertSame( @@ -69,8 +69,8 @@ public function test_an_ndv_left_out_is_the_arrow_rs_default(): void $explicit = SbbfBuilder::for(new BloomFilterOptions(0.01, BloomFilterOptions::DEFAULT_NDV)); for ($id = 0; $id < 2000; $id++) { - $default->insert((new BloomHash())->of(FlatColumn::int64('id'), $id)); - $explicit->insert((new BloomHash())->of(FlatColumn::int64('id'), $id)); + $default->insert(new BloomHash()->of(FlatColumn::int64('id'), $id)); + $explicit->insert(new BloomHash()->of(FlatColumn::int64('id'), $id)); } static::assertEquals($explicit->build(), $default->build()); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/SbbfTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/SbbfTest.php index 20f7252f38..c64e652f15 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/SbbfTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/BloomFilter/SbbfTest.php @@ -55,7 +55,7 @@ public function test_a_parquet_mr_filter_holds_the_values_it_was_written_with(): )); for ($a = 0; $a < 10; $a++) { - static::assertTrue($sbbf->check((new BloomHash())->of(FlatColumn::string('a'), 'a' . $a))); + static::assertTrue($sbbf->check(new BloomHash()->of(FlatColumn::string('a'), 'a' . $a))); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaBinaryPackedDecoderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaBinaryPackedDecoderTest.php index cc3650fa46..acd9c2a6b6 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaBinaryPackedDecoderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaBinaryPackedDecoderTest.php @@ -109,9 +109,9 @@ public function test_decode_large_values(): void #[TestWith([200])] public function test_decode_leaves_the_reader_at_the_end_of_its_stream(int $count): void { - $reader = new BinaryBufferReader((new DeltaBinaryPackedEncoder())->encode(range(1, $count)) . 'tail'); + $reader = new BinaryBufferReader(new DeltaBinaryPackedEncoder()->encode(range(1, $count)) . 'tail'); - static::assertSame(range(1, $count), (new DeltaBinaryPackedDecoder())->decode($reader, $count)); + static::assertSame(range(1, $count), new DeltaBinaryPackedDecoder()->decode($reader, $count)); static::assertSame('tail', $reader->readBytes(4)); } @@ -129,8 +129,8 @@ public function test_decode_round_trips_every_miniblock_bit_width(int $bitWidth) { $values = array_map(static fn(int $i): int => ($i % 2) === 0 ? 0 : 1 << ($bitWidth - 2), range(0, 129)); - static::assertSame($values, (new DeltaBinaryPackedDecoder())->decode( - new BinaryBufferReader((new DeltaBinaryPackedEncoder())->encode($values)), + static::assertSame($values, new DeltaBinaryPackedDecoder()->decode( + new BinaryBufferReader(new DeltaBinaryPackedEncoder()->encode($values)), count($values), )); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaBinaryPackedEncodingRoundtripTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaBinaryPackedEncodingRoundtripTest.php index 2ddf10c7ec..45f2fca3e2 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaBinaryPackedEncodingRoundtripTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaBinaryPackedEncodingRoundtripTest.php @@ -35,8 +35,8 @@ public static function problematicInt64ValuesProvider(): array #[DataProvider('problematicInt64ValuesProvider')] public function test_roundtrip_problematic_int64_values(array $values): void { - $encoded = (new DeltaBinaryPackedEncoder())->encode($values); - $decoded = (new DeltaBinaryPackedDecoder())->decode(new BinaryBufferReader($encoded), count($values)); + $encoded = new DeltaBinaryPackedEncoder()->encode($values); + $decoded = new DeltaBinaryPackedDecoder()->decode(new BinaryBufferReader($encoded), count($values)); static::assertSame($values, $decoded, 'Values should roundtrip correctly through delta encoding'); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaBinaryPackedInt64Test.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaBinaryPackedInt64Test.php index 758e6a2685..1e5fad8614 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaBinaryPackedInt64Test.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaBinaryPackedInt64Test.php @@ -55,8 +55,8 @@ public function test_delta_encoding_with_known_working_values(): void ]; foreach ($workingValues as $values) { - $encoded = (new DeltaBinaryPackedEncoder())->encode($values); - $decoded = (new DeltaBinaryPackedDecoder())->decode(new BinaryBufferReader($encoded), count($values)); + $encoded = new DeltaBinaryPackedEncoder()->encode($values); + $decoded = new DeltaBinaryPackedDecoder()->decode(new BinaryBufferReader($encoded), count($values)); static::assertSame( $values, @@ -72,8 +72,8 @@ public function test_delta_encoding_with_known_working_values(): void #[DataProvider('problematicInt64ValuesProvider')] public function test_int64_delta_encoding_roundtrip(array $values): void { - $encoded = (new DeltaBinaryPackedEncoder())->encode($values); - $decoded = (new DeltaBinaryPackedDecoder())->decode(new BinaryBufferReader($encoded), count($values)); + $encoded = new DeltaBinaryPackedEncoder()->encode($values); + $decoded = new DeltaBinaryPackedDecoder()->decode(new BinaryBufferReader($encoded), count($values)); $testName = $this->dataName(); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaByteArrayDecoderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaByteArrayDecoderTest.php index d7c0d2c07a..849160d75e 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaByteArrayDecoderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaByteArrayDecoderTest.php @@ -19,9 +19,9 @@ final class DeltaByteArrayDecoderTest extends TestCase { public function test_decode_leaves_the_bytes_after_the_stream(): void { - $reader = new BinaryBufferReader((new DeltaByteArrayEncoder())->encode(['ab', 'abc']) . 'tail'); + $reader = new BinaryBufferReader(new DeltaByteArrayEncoder()->encode(['ab', 'abc']) . 'tail'); - static::assertSame(['ab', 'abc'], (new DeltaByteArrayDecoder())->decode($reader, 2)); + static::assertSame(['ab', 'abc'], new DeltaByteArrayDecoder()->decode($reader, 2)); static::assertSame('tail', $reader->readBytes(4)); } @@ -29,8 +29,8 @@ public function test_decode_round_trips_values_crossing_block_and_miniblock_edge { $values = array_map(static fn(int $i): string => sprintf('key_%05d', $i), range(1, 300)); - static::assertSame($values, (new DeltaByteArrayDecoder())->decode( - new BinaryBufferReader((new DeltaByteArrayEncoder())->encode($values)), + static::assertSame($values, new DeltaByteArrayDecoder()->decode( + new BinaryBufferReader(new DeltaByteArrayEncoder()->encode($values)), 300, )); } @@ -41,7 +41,7 @@ public function test_decode_spec_example(): void static::assertSame( ['axis', 'axle', 'babble', 'babyhood'], - (new DeltaByteArrayDecoder())->decode(new BinaryBufferReader($encoder->encode([0, 2, 0, 3]) + new DeltaByteArrayDecoder()->decode(new BinaryBufferReader($encoder->encode([0, 2, 0, 3]) . $encoder->encode([4, 2, 6, 5]) . 'axislebabbleyhood'), 4), ); @@ -56,7 +56,7 @@ public function test_decode_throws_on_a_prefix_longer_than_the_previous_value(): 'Invalid DELTA_BYTE_ARRAY prefix length 5 of value 1, the previous value has 2 bytes', ); - (new DeltaByteArrayDecoder())->decode( + new DeltaByteArrayDecoder()->decode( new BinaryBufferReader($encoder->encode([0, 5]) . $encoder->encode([2, 1]) . 'abc'), 2, ); @@ -71,7 +71,7 @@ public function test_decode_throws_on_a_negative_prefix_length(): void 'Invalid DELTA_BYTE_ARRAY prefix length -1 of value 0, the previous value has 0 bytes', ); - (new DeltaByteArrayDecoder())->decode( + new DeltaByteArrayDecoder()->decode( new BinaryBufferReader($encoder->encode([-1]) . $encoder->encode([1]) . 'a'), 1, ); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaByteArrayEncoderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaByteArrayEncoderTest.php index 078403cbe0..68bc57afff 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaByteArrayEncoderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaByteArrayEncoderTest.php @@ -47,7 +47,7 @@ public function test_encode(array $values, array $prefixLengths, array $suffixes static::assertSame( $encoder->encode($prefixLengths) . $encoder->encode(array_map(strlen(...), $suffixes)) . implode('', $suffixes), - (new DeltaByteArrayEncoder())->encode($values), + new DeltaByteArrayEncoder()->encode($values), ); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaCalculatorTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaCalculatorTest.php index d90072f87b..5e4284bdd1 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaCalculatorTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaCalculatorTest.php @@ -349,7 +349,7 @@ public function test_roundtrip_preserves_values_with_extreme_cases(): void #[TestWith([[PHP_INT_MAX, PHP_INT_MIN], PHP_INT_MIN, [-1, 0]])] public function test_calculate_relative_deltas(array $deltas, int $minDelta, array $expected): void { - static::assertSame($expected, (new DeltaCalculator())->calculateRelativeDeltas($deltas, $minDelta)); + static::assertSame($expected, new DeltaCalculator()->calculateRelativeDeltas($deltas, $minDelta)); } /** @@ -362,13 +362,13 @@ public function test_calculate_relative_deltas(array $deltas, int $minDelta, arr #[TestWith([[-1, 0], PHP_INT_MIN, [PHP_INT_MAX, PHP_INT_MIN]])] public function test_calculate_absolute_deltas(array $relativeDeltas, int $minDelta, array $expected): void { - static::assertSame($expected, (new DeltaCalculator())->calculateAbsoluteDeltas($relativeDeltas, $minDelta)); + static::assertSame($expected, new DeltaCalculator()->calculateAbsoluteDeltas($relativeDeltas, $minDelta)); } public function test_calculate_absolute_and_relative_deltas_of_nothing(): void { - static::assertSame([], (new DeltaCalculator())->calculateAbsoluteDeltas([], 3)); - static::assertSame([], (new DeltaCalculator())->calculateRelativeDeltas([], 3)); + static::assertSame([], new DeltaCalculator()->calculateAbsoluteDeltas([], 3)); + static::assertSame([], new DeltaCalculator()->calculateRelativeDeltas([], 3)); } /** @@ -379,7 +379,7 @@ public function test_calculate_absolute_and_relative_deltas_of_nothing(): void #[TestWith([[2305843009213693953, -2305843009213693953], [-4611686018427387906]])] public function test_calculate_deltas_at_the_overflow_free_bound(array $values, array $expected): void { - static::assertSame($expected, (new DeltaCalculator())->calculateDeltas($values)); + static::assertSame($expected, new DeltaCalculator()->calculateDeltas($values)); } #[TestWith([0, 0])] @@ -391,6 +391,6 @@ public function test_calculate_deltas_at_the_overflow_free_bound(array $values, #[TestWith([PHP_INT_MIN, 0])] public function test_to_int32_wraps_to_signed_32_bits(int $value, int $expected): void { - static::assertSame($expected, (new DeltaCalculator())->toInt32($value)); + static::assertSame($expected, new DeltaCalculator()->toInt32($value)); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaLengthByteArrayDecoderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaLengthByteArrayDecoderTest.php index 6e1936322c..c9199c27f6 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaLengthByteArrayDecoderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaLengthByteArrayDecoderTest.php @@ -14,12 +14,12 @@ final class DeltaLengthByteArrayDecoderTest extends TestCase { public function test_decode_spec_example_leaves_the_bytes_after_the_stream(): void { - $reader = new BinaryBufferReader((new DeltaBinaryPackedEncoder())->encode([5, 5, 6, 6]) + $reader = new BinaryBufferReader(new DeltaBinaryPackedEncoder()->encode([5, 5, 6, 6]) . 'HelloWorldFoobarABCDEFtail'); static::assertSame( ['Hello', 'World', 'Foobar', 'ABCDEF'], - (new DeltaLengthByteArrayDecoder())->decode($reader, 4), + new DeltaLengthByteArrayDecoder()->decode($reader, 4), ); static::assertSame('tail', $reader->readBytes(4)); } @@ -29,8 +29,8 @@ public function test_decode_throws_on_a_negative_length(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Invalid DELTA_LENGTH_BYTE_ARRAY length -1 of value 0'); - (new DeltaLengthByteArrayDecoder())->decode( - new BinaryBufferReader((new DeltaBinaryPackedEncoder())->encode([-1]) . 'x'), + new DeltaLengthByteArrayDecoder()->decode( + new BinaryBufferReader(new DeltaBinaryPackedEncoder()->encode([-1]) . 'x'), 1, ); } @@ -40,8 +40,8 @@ public function test_decode_throws_when_the_data_ends_early(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('DELTA_LENGTH_BYTE_ARRAY data ends before value 0'); - (new DeltaLengthByteArrayDecoder())->decode( - new BinaryBufferReader((new DeltaBinaryPackedEncoder())->encode([5]) . 'abc'), + new DeltaLengthByteArrayDecoder()->decode( + new BinaryBufferReader(new DeltaBinaryPackedEncoder()->encode([5]) . 'abc'), 1, ); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaLengthByteArrayEncoderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaLengthByteArrayEncoderTest.php index 2efc287e21..d01564e204 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaLengthByteArrayEncoderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/DeltaLengthByteArrayEncoderTest.php @@ -12,22 +12,22 @@ final class DeltaLengthByteArrayEncoderTest extends TestCase { public function test_encode_empty_array_writes_an_empty_length_stream(): void { - static::assertSame("\x80\x01\x04\x00\x00", (new DeltaLengthByteArrayEncoder())->encode([])); + static::assertSame("\x80\x01\x04\x00\x00", new DeltaLengthByteArrayEncoder()->encode([])); } public function test_encode_empty_strings(): void { static::assertSame( - (new DeltaBinaryPackedEncoder())->encode([0, 1, 0]) . 'a', - (new DeltaLengthByteArrayEncoder())->encode(['', 'a', '']), + new DeltaBinaryPackedEncoder()->encode([0, 1, 0]) . 'a', + new DeltaLengthByteArrayEncoder()->encode(['', 'a', '']), ); } public function test_encode_spec_example(): void { static::assertSame( - (new DeltaBinaryPackedEncoder())->encode([5, 5, 6, 6]) . 'HelloWorldFoobarABCDEF', - (new DeltaLengthByteArrayEncoder())->encode(['Hello', 'World', 'Foobar', 'ABCDEF']), + new DeltaBinaryPackedEncoder()->encode([5, 5, 6, 6]) . 'HelloWorldFoobarABCDEF', + new DeltaLengthByteArrayEncoder()->encode(['Hello', 'World', 'Foobar', 'ABCDEF']), ); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/PhysicalCodecTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/PhysicalCodecTest.php index fcd8249fad..83469344f1 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/PhysicalCodecTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/PhysicalCodecTest.php @@ -56,8 +56,8 @@ public function test_round_trip(FlatColumn $column, bool|float|int|string $physi public function test_a_statistic_of_the_wrong_width_decodes_to_null(): void { - static::assertNull((new PhysicalCodec())->decodeStatistic(FlatColumn::int64('i'), "\x00\x00\x00\x00")); - static::assertNull((new PhysicalCodec())->decodeStatistic(FlatColumn::int32('i'), "\x00")); + static::assertNull(new PhysicalCodec()->decodeStatistic(FlatColumn::int64('i'), "\x00\x00\x00\x00")); + static::assertNull(new PhysicalCodec()->decodeStatistic(FlatColumn::int32('i'), "\x00")); } public function test_encoding_a_value_of_the_wrong_type_is_refused(): void @@ -65,13 +65,13 @@ public function test_encoding_a_value_of_the_wrong_type_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Column "i": string is not a INT64 physical value'); - (new PhysicalCodec())->encodeStatistic(FlatColumn::int64('i'), '1'); + new PhysicalCodec()->encodeStatistic(FlatColumn::int64('i'), '1'); } public function test_float_accepts_an_int(): void { - static::assertSame("\x00\x00\x00\x40", (new PhysicalCodec())->encodeStatistic(FlatColumn::float('f'), 2)); - static::assertSame("\x00\x00\x00\x00\x00\x00\x00\x40", (new PhysicalCodec())->encodeStatistic( + static::assertSame("\x00\x00\x00\x40", new PhysicalCodec()->encodeStatistic(FlatColumn::float('f'), 2)); + static::assertSame("\x00\x00\x00\x00\x00\x00\x00\x40", new PhysicalCodec()->encodeStatistic( FlatColumn::double('d'), 2, )); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/PlainValuesPackerTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/PlainValuesPackerTest.php index 5c73a0ff50..7120124c48 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/PlainValuesPackerTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Data/PlainValuesPackerTest.php @@ -30,8 +30,8 @@ public function test_byte_array_decimal_round_trip(): void $physical = [$converter->toParquetType(12345.67), $converter->toParquetType(-12345.67)]; $buffer = ''; - (new PlainValuesPacker(new BinaryBufferWriter($buffer)))->packValues($column, $physical); - $unpacked = iterator_to_array((new PlainValueUnpacker(new BinaryBufferReader($buffer)))->unpack($column, 2)); + new PlainValuesPacker(new BinaryBufferWriter($buffer))->packValues($column, $physical); + $unpacked = iterator_to_array(new PlainValueUnpacker(new BinaryBufferReader($buffer))->unpack($column, 2)); static::assertSame(["\x12\xD6\x87", "\xED\x29\x79"], $unpacked); static::assertSame([12345.67, -12345.67], [ @@ -55,8 +55,8 @@ public function test_fixed_len_byte_array_decimal_above_int64_round_trip(): void $physical = [$converter->toParquetType(1.2345678901234568E+39), $converter->toParquetType(-12345.67)]; $buffer = ''; - (new PlainValuesPacker(new BinaryBufferWriter($buffer)))->packValues($column, $physical); - $unpacked = iterator_to_array((new PlainValueUnpacker(new BinaryBufferReader($buffer)))->unpack($column, 2)); + new PlainValuesPacker(new BinaryBufferWriter($buffer))->packValues($column, $physical); + $unpacked = iterator_to_array(new PlainValueUnpacker(new BinaryBufferReader($buffer))->unpack($column, 2)); static::assertSame($physical, $unpacked); static::assertSame([1.2345678901234568E+39, -12345.67], [ @@ -70,11 +70,11 @@ public function test_int32_decimal_round_trip(): void $column = new FlatColumn('d', PhysicalType::INT32, logicalType: LogicalType::decimal(2, 9)); $buffer = ''; - (new PlainValuesPacker(new BinaryBufferWriter($buffer)))->packValues($column, [1234567]); + new PlainValuesPacker(new BinaryBufferWriter($buffer))->packValues($column, [1234567]); static::assertSame( [1234567], - iterator_to_array((new PlainValueUnpacker(new BinaryBufferReader($buffer)))->unpack($column, 1)), + iterator_to_array(new PlainValueUnpacker(new BinaryBufferReader($buffer))->unpack($column, 1)), ); } @@ -87,11 +87,11 @@ public function test_int32_time_round_trip(): void ); $buffer = ''; - (new PlainValuesPacker(new BinaryBufferWriter($buffer)))->packValues($column, [11045678]); + new PlainValuesPacker(new BinaryBufferWriter($buffer))->packValues($column, [11045678]); static::assertSame( [11045678], - iterator_to_array((new PlainValueUnpacker(new BinaryBufferReader($buffer)))->unpack($column, 1)), + iterator_to_array(new PlainValueUnpacker(new BinaryBufferReader($buffer))->unpack($column, 1)), ); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/ColumnData/DefinitionConverterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/ColumnData/DefinitionConverterTest.php index 07c06b3bbe..e779ec6d18 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/ColumnData/DefinitionConverterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/ColumnData/DefinitionConverterTest.php @@ -24,9 +24,9 @@ public function test_optional(int $level, mixed $value, mixed $result, ?string $ if ($exceptionMessage) { $this->expectExceptionMessage($exceptionMessage); - (new DefinitionConverter())->toValue($repetitions, definitionLevel: $level, value: $value); + new DefinitionConverter()->toValue($repetitions, definitionLevel: $level, value: $value); } else { - static::assertEquals($result, (new DefinitionConverter())->toValue( + static::assertEquals($result, new DefinitionConverter()->toValue( $repetitions, definitionLevel: $level, value: $value, @@ -51,9 +51,9 @@ public function test_optional_optional( if ($exceptionMessage) { $this->expectExceptionMessage($exceptionMessage); - (new DefinitionConverter())->toValue($repetitions, definitionLevel: $level, value: $value); + new DefinitionConverter()->toValue($repetitions, definitionLevel: $level, value: $value); } else { - static::assertEquals($result, (new DefinitionConverter())->toValue( + static::assertEquals($result, new DefinitionConverter()->toValue( $repetitions, definitionLevel: $level, value: $value, @@ -77,9 +77,9 @@ public function test_optional_repeated_optional( if ($exceptionMessage) { $this->expectExceptionMessage($exceptionMessage); - (new DefinitionConverter())->toValue($repetitions, definitionLevel: $level, value: $value); + new DefinitionConverter()->toValue($repetitions, definitionLevel: $level, value: $value); } else { - static::assertEquals($result, (new DefinitionConverter())->toValue( + static::assertEquals($result, new DefinitionConverter()->toValue( $repetitions, definitionLevel: $level, value: $value, @@ -111,9 +111,9 @@ public function test_optional_repeated_optional_repeated_optional( if ($exceptionMessage) { $this->expectExceptionMessage($exceptionMessage); - (new DefinitionConverter())->toValue($repetitions, definitionLevel: $level, value: $value); + new DefinitionConverter()->toValue($repetitions, definitionLevel: $level, value: $value); } else { - static::assertEquals($result, (new DefinitionConverter())->toValue( + static::assertEquals($result, new DefinitionConverter()->toValue( $repetitions, definitionLevel: $level, value: $value, @@ -149,9 +149,9 @@ public function test_optional_repeated_optional_repeated_optional_repeated_optio if ($exceptionMessage) { $this->expectExceptionMessage($exceptionMessage); - (new DefinitionConverter())->toValue($repetitions, definitionLevel: $level, value: $value); + new DefinitionConverter()->toValue($repetitions, definitionLevel: $level, value: $value); } else { - static::assertEquals($result, (new DefinitionConverter())->toValue( + static::assertEquals($result, new DefinitionConverter()->toValue( $repetitions, definitionLevel: $level, value: $value, @@ -175,9 +175,9 @@ public function test_optional_repeated_required( if ($exceptionMessage) { $this->expectExceptionMessage($exceptionMessage); - (new DefinitionConverter())->toValue($repetitions, definitionLevel: $level, value: $value); + new DefinitionConverter()->toValue($repetitions, definitionLevel: $level, value: $value); } else { - static::assertEquals($result, (new DefinitionConverter())->toValue( + static::assertEquals($result, new DefinitionConverter()->toValue( $repetitions, definitionLevel: $level, value: $value, @@ -200,9 +200,9 @@ public function test_optional_required( if ($exceptionMessage) { $this->expectExceptionMessage($exceptionMessage); - (new DefinitionConverter())->toValue($repetitions, definitionLevel: $level, value: $value); + new DefinitionConverter()->toValue($repetitions, definitionLevel: $level, value: $value); } else { - static::assertEquals($result, (new DefinitionConverter())->toValue( + static::assertEquals($result, new DefinitionConverter()->toValue( $repetitions, definitionLevel: $level, value: $value, @@ -221,9 +221,9 @@ public function test_required(int $level, mixed $value, mixed $result, ?string $ if ($exceptionMessage) { $this->expectExceptionMessage($exceptionMessage); - (new DefinitionConverter())->toValue($repetitions, definitionLevel: $level, value: $value); + new DefinitionConverter()->toValue($repetitions, definitionLevel: $level, value: $value); } else { - static::assertEquals($result, (new DefinitionConverter())->toValue( + static::assertEquals($result, new DefinitionConverter()->toValue( $repetitions, definitionLevel: $level, value: $value, @@ -245,9 +245,9 @@ public function test_required_optional( if ($exceptionMessage) { $this->expectExceptionMessage($exceptionMessage); - (new DefinitionConverter())->toValue($repetitions, definitionLevel: $level, value: $value); + new DefinitionConverter()->toValue($repetitions, definitionLevel: $level, value: $value); } else { - static::assertEquals($result, (new DefinitionConverter())->toValue( + static::assertEquals($result, new DefinitionConverter()->toValue( $repetitions, definitionLevel: $level, value: $value, @@ -276,9 +276,9 @@ public function test_required_repeated_required_repeated_required( if ($exceptionMessage) { $this->expectExceptionMessage($exceptionMessage); - (new DefinitionConverter())->toValue($repetitions, definitionLevel: $level, value: $value); + new DefinitionConverter()->toValue($repetitions, definitionLevel: $level, value: $value); } else { - static::assertEquals($result, (new DefinitionConverter())->toValue( + static::assertEquals($result, new DefinitionConverter()->toValue( $repetitions, definitionLevel: $level, value: $value, @@ -300,9 +300,9 @@ public function test_required_required( if ($exceptionMessage) { $this->expectExceptionMessage($exceptionMessage); - (new DefinitionConverter())->toValue($repetitions, definitionLevel: $level, value: $value); + new DefinitionConverter()->toValue($repetitions, definitionLevel: $level, value: $value); } else { - static::assertEquals($result, (new DefinitionConverter())->toValue( + static::assertEquals($result, new DefinitionConverter()->toValue( $repetitions, definitionLevel: $level, value: $value, diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/ColumnData/ReadFlatColumnValuesTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/ColumnData/ReadFlatColumnValuesTest.php index 6d0a8bf42f..f98d63cc15 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/ColumnData/ReadFlatColumnValuesTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/ColumnData/ReadFlatColumnValuesTest.php @@ -83,11 +83,11 @@ public function test_a_selection_over_another_row_count_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('A selection of 2 rows cannot select from a page of 3 rows'); - (new ReadFlatColumnValues( + new ReadFlatColumnValues( FlatColumn::int32('int32'), array_to_generator([1, 2, 3]), repetitionLevels: [0, 0, 0], definitionLevels: [1, 1, 1], - ))->select(RowSelection::all(2)); + )->select(RowSelection::all(2)); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelFlatTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelFlatTest.php index c1572efa8d..b3d508967f 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelFlatTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelFlatTest.php @@ -86,7 +86,7 @@ public function test_optional_int32(array $row, array $flatData): void [ $row, ], - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('int32'), new ReadColumnData($schema->get('int32'), $readFlatValues), )), @@ -154,7 +154,7 @@ public function test_required_int32(array $row, array $flatData, ?string $except [ $row, ], - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('int32'), new ReadColumnData($schema->get('int32'), $readFlatValues), )), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelListsTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelListsTest.php index 35475ba76e..ead94bede0 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelListsTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelListsTest.php @@ -131,7 +131,7 @@ public function test_optional_list_optional_int32(array $rows, array $expectedCo static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), @@ -296,7 +296,7 @@ public function test_optional_list_optional_list_optional_int32(array $rows, arr static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), @@ -416,7 +416,7 @@ public function test_optional_list_optional_list_optional_map_string_optional_in static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), @@ -613,9 +613,10 @@ public function test_optional_list_optional_list_optional_map_string_optional_st ); } - $assembledRows = iterator_to_array((new DremelAssembler( - DataConverter::initialize(Options::default()), - ))->assemble($schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues))); + $assembledRows = iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( + $schema->get('l'), + new ReadColumnData($schema->get('l'), $readFlatValues), + )); static::assertEquals( $rows, @@ -730,7 +731,7 @@ public function test_optional_list_optional_list_optional_struct_optional_int32_ static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), @@ -956,7 +957,7 @@ public function test_optional_list_optional_map_string_optional_int32( static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), @@ -1115,7 +1116,7 @@ public function test_optional_list_optional_struct_optional_int32_optional_list_ // self::assertEquals($expectedColumnData, $normalized); static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), @@ -1265,7 +1266,7 @@ public function test_optional_list_optional_struct_optional_int32_optional_map_i static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), @@ -1472,7 +1473,7 @@ public function test_optional_list_optional_struct_optional_int32_optional_strin static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), @@ -1561,7 +1562,7 @@ public function test_optional_list_optional_struct_optional_struct_optional_int3 static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), @@ -1634,7 +1635,7 @@ public function test_optional_list_required_int32(array $rows, array $expectedCo static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), @@ -1695,7 +1696,7 @@ public function test_required_list_required_int32(array $rows, array $expectedFl static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), @@ -1763,7 +1764,7 @@ public function test_required_list_required_list_required_int32(array $rows, arr static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), @@ -1871,7 +1872,7 @@ public function test_required_list_required_map_string_required_int32( static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), @@ -2009,7 +2010,7 @@ public function test_required_list_required_struct_required_int32_required_strin static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('l'), new ReadColumnData($schema->get('l'), $readFlatValues), )), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelMapsTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelMapsTest.php index 13c0b7080d..a81a356cb8 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelMapsTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelMapsTest.php @@ -172,7 +172,7 @@ public function test_optional_map_string_optional_int32( static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('m'), new ReadColumnData($schema->get('m'), $readFlatValues), )), @@ -381,7 +381,7 @@ public function test_optional_map_string_optional_list_optional_int32( static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('m'), new ReadColumnData($schema->get('m'), $readFlatValues), )), @@ -643,7 +643,7 @@ public function test_optional_map_string_optional_map_string_optional_int( static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('m'), new ReadColumnData($schema->get('m'), $readFlatValues), )), @@ -872,7 +872,7 @@ public function test_optional_map_string_optional_struct_optional_int32_optional static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('m'), new ReadColumnData($schema->get('m'), $readFlatValues), )), @@ -989,7 +989,7 @@ public function test_optional_map_string_optional_struct_optional_list_optional_ static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('m'), new ReadColumnData($schema->get('m'), $readFlatValues), )), @@ -1086,7 +1086,7 @@ public function test_optional_map_string_required_int32( static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('m'), new ReadColumnData($schema->get('m'), $readFlatValues), )), @@ -1180,7 +1180,7 @@ public function test_required_map_string_required_int32( static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('m'), new ReadColumnData($schema->get('m'), $readFlatValues), )), @@ -1279,7 +1279,7 @@ public function test_required_map_string_required_list_required_int32( static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('m'), new ReadColumnData($schema->get('m'), $readFlatValues), )), @@ -1408,7 +1408,7 @@ public function test_required_map_string_required_map_string_required_int( static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('m'), new ReadColumnData($schema->get('m'), $readFlatValues), )), @@ -1559,7 +1559,7 @@ public function test_required_map_string_required_struct_required_int32_required static::assertEquals( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('m'), new ReadColumnData($schema->get('m'), $readFlatValues), )), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelShredderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelShredderTest.php index 4046cdeca7..745a6bcb0d 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelShredderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelShredderTest.php @@ -313,10 +313,10 @@ public function test_shred_columns_equals_shred_of_the_same_rows(): void public function test_shred_columns_writes_a_column_the_array_lacks_as_nulls(): void { - $result = (new DremelShredder( + $result = new DremelShredder( new DisabledValidator(), DataConverter::initialize(Options::default()), - ))->shredColumns( + )->shredColumns( Schema::with(FlatColumn::int32('id'), FlatColumn::string('name')), ['id' => [1, 2], 'unknown' => ['x', 'y']], 2, @@ -334,7 +334,7 @@ public function test_shred_columns_names_the_writer_row_in_a_refusal(): void $this->expectException(ValidationException::class); $this->expectExceptionMessage('Column "id" row 12: '); - (new DremelShredder(new ColumnDataValidator(), DataConverter::initialize(Options::default())))->shredColumns( + new DremelShredder(new ColumnDataValidator(), DataConverter::initialize(Options::default()))->shredColumns( Schema::with(FlatColumn::int32('id')), ['id' => [1, 2, 4_000_000_000]], 3, diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelStructuresTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelStructuresTest.php index 98aebb8fca..55a4177ef0 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelStructuresTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/DremelStructuresTest.php @@ -67,7 +67,7 @@ public function test_a_null_optional_child_keeps_its_struct(NestedColumn $column static::assertSame( $rows, - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('s'), new ReadColumnData($schema->get('s'), FlatColumnPages::merged($schema, $rows)), )), @@ -216,7 +216,7 @@ public function test_optional_struct_optional_int_optional_string_optional_bool( [ $row, ], - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('s'), new ReadColumnData($schema->get('s'), $readFlatValues), )), @@ -350,7 +350,7 @@ public function test_optional_struct_optional_list_optional_int( [ $row, ], - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('s'), new ReadColumnData($schema->get('s'), $readFlatValues), )), @@ -513,7 +513,7 @@ public function test_optional_struct_optional_map_string_optional_int( [ $row, ], - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('s'), new ReadColumnData($schema->get('s'), $readFlatValues), )), @@ -660,7 +660,7 @@ public function test_optional_struct_optional_struct_optional_int32_optional_str [ $row, ], - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('s'), new ReadColumnData($schema->get('s'), $readFlatValues), )), @@ -792,7 +792,7 @@ public function test_required_struct_required_int_required_string_required_bool( [ $row, ], - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('s'), new ReadColumnData($schema->get('s'), $readFlatValues), )), @@ -900,7 +900,7 @@ public function test_required_struct_required_list_required_int( [ $row, ], - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('s'), new ReadColumnData($schema->get('s'), $readFlatValues), )), @@ -1023,7 +1023,7 @@ public function test_required_struct_required_map_string_required_int( [ $row, ], - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('s'), new ReadColumnData($schema->get('s'), $readFlatValues), )), @@ -1150,7 +1150,7 @@ public function test_required_struct_required_struct_required_int32_required_str [ $row, ], - iterator_to_array((new DremelAssembler(DataConverter::initialize(Options::default())))->assemble( + iterator_to_array(new DremelAssembler(DataConverter::initialize(Options::default()))->assemble( $schema->get('s'), new ReadColumnData($schema->get('s'), $readFlatValues), )), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/Validator/ColumnDataValidatorTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/Validator/ColumnDataValidatorTest.php index c4f2aadcd8..19240fb413 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/Validator/ColumnDataValidatorTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Dremel/Validator/ColumnDataValidatorTest.php @@ -46,7 +46,7 @@ public static function integers_in_range(): Generator #[DataProvider('integers_in_range')] public function test_an_integer_in_the_column_range_is_accepted(FlatColumn $column, int $value): void { - (new ColumnDataValidator())->validate($column, $value, 0); + new ColumnDataValidator()->validate($column, $value, 0); $this->expectNotToPerformAssertions(); } @@ -112,7 +112,7 @@ public function test_an_integer_out_of_the_column_range_is_refused_naming_its_ro $this->expectException(ValidationException::class); $this->expectExceptionMessage('Column "c" row 3: ' . $message); - (new ColumnDataValidator())->validate($column, $value, 3); + new ColumnDataValidator()->validate($column, $value, 3); } /** @@ -132,7 +132,7 @@ public static function uint64_values(): Generator #[DataProvider('uint64_values')] public function test_a_uint64_int_or_digit_string_is_accepted(FlatColumn $column, int|string $value): void { - (new ColumnDataValidator())->validate($column, $value, 0); + new ColumnDataValidator()->validate($column, $value, 0); $this->expectNotToPerformAssertions(); } @@ -160,7 +160,7 @@ public function test_a_uint64_value_that_is_neither_int_nor_digit_string_is_refu 'Column "c" row 2: ' . $shown . ' is out of the UINT_64 range [0, 18446744073709551615]', ); - (new ColumnDataValidator())->validate( + new ColumnDataValidator()->validate( new FlatColumn('c', PhysicalType::INT64, logicalType: LogicalType::integer(64, false)), $value, 2, @@ -181,7 +181,7 @@ public static function uuids(): Generator #[DataProvider('uuids')] public function test_a_uuid_of_32_hex_digits_is_accepted(mixed $value): void { - (new ColumnDataValidator())->validate(FlatColumn::uuid('c'), $value, 0); + new ColumnDataValidator()->validate(FlatColumn::uuid('c'), $value, 0); $this->expectNotToPerformAssertions(); } @@ -204,12 +204,12 @@ public function test_a_uuid_that_is_not_32_hex_digits_is_refused(mixed $value, s $this->expectException(ValidationException::class); $this->expectExceptionMessage('Column "c" row 1: ' . $type . ' is not a UUID of 32 hexadecimal digits'); - (new ColumnDataValidator())->validate(FlatColumn::uuid('c'), $value, 1); + new ColumnDataValidator()->validate(FlatColumn::uuid('c'), $value, 1); } public function test_a_fixed_length_value_of_its_length_is_accepted(): void { - (new ColumnDataValidator())->validate(FlatColumn::fixedSizeByteArray('c', 4), "\x00\x01\x02\x03", 0); + new ColumnDataValidator()->validate(FlatColumn::fixedSizeByteArray('c', 4), "\x00\x01\x02\x03", 0); $this->expectNotToPerformAssertions(); } @@ -219,7 +219,7 @@ public function test_a_fixed_length_value_of_another_length_is_refused(): void $this->expectException(ValidationException::class); $this->expectExceptionMessage('Column "c" row 2: a FIXED_LEN_BYTE_ARRAY(4) value is 5 bytes long'); - (new ColumnDataValidator())->validate(FlatColumn::fixedSizeByteArray('c', 4), '12345', 2); + new ColumnDataValidator()->validate(FlatColumn::fixedSizeByteArray('c', 4), '12345', 2); } /** @@ -238,20 +238,20 @@ public function test_invalid_utf8_is_refused(FlatColumn $column): void $this->expectException(ValidationException::class); $this->expectExceptionMessage('Column "c" row 0: the string is not valid UTF-8'); - (new ColumnDataValidator())->validate($column, "\xFF\xFE", 0); + new ColumnDataValidator()->validate($column, "\xFF\xFE", 0); } #[DataProvider('utf8_columns')] public function test_valid_utf8_is_accepted(FlatColumn $column): void { - (new ColumnDataValidator())->validate($column, 'zażółć', 0); + new ColumnDataValidator()->validate($column, 'zażółć', 0); $this->expectNotToPerformAssertions(); } public function test_invalid_utf8_into_a_plain_byte_array_is_accepted(): void { - (new ColumnDataValidator())->validate(new FlatColumn('c', PhysicalType::BYTE_ARRAY), "\xFF\xFE", 0); + new ColumnDataValidator()->validate(new FlatColumn('c', PhysicalType::BYTE_ARRAY), "\xFF\xFE", 0); $this->expectNotToPerformAssertions(); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/AdaptiveParquetEngineTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/AdaptiveParquetEngineTest.php index 3bf07dbab6..5b4dfe873d 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/AdaptiveParquetEngineTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/AdaptiveParquetEngineTest.php @@ -96,7 +96,7 @@ public function test_big_endian_is_read_by_the_php_engine(): void { static::assertInstanceOf( PhpParquetFileReader::class, - (new AdaptiveParquetEngine(ByteOrder::BIG_ENDIAN))->openForRead( + new AdaptiveParquetEngine(ByteOrder::BIG_ENDIAN)->openForRead( new MemorySourceStream(MemoryParquetFile::threeRowGroups()), ), ); @@ -114,10 +114,10 @@ public function test_without_arrow_files_are_opened_by_the_php_engine_whatever_i { $filesystem = memory_filesystem(); - static::assertInstanceOf(PhpParquetFileWriter::class, (new AdaptiveParquetEngine(extension: new ArrowExtension( + static::assertInstanceOf(PhpParquetFileWriter::class, new AdaptiveParquetEngine(extension: new ArrowExtension( false, null, - )))->openForWrite( + ))->openForWrite( $filesystem->writeTo(path('memory://out.parquet')), Schema::with(FlatColumn::int32('id')), Compressions::UNCOMPRESSED, diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/Arrow/OptionsConverterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/Arrow/OptionsConverterTest.php index f5507a17fd..66e2e4fbb1 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/Arrow/OptionsConverterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/Arrow/OptionsConverterTest.php @@ -26,7 +26,7 @@ public function test_engine_options_are_read_from_the_options(): void { static::assertSame( ['INT_96_AS_DATETIME' => false], - OptionsConverter::toEngine((new Options())->set(Option::INT_96_AS_DATETIME, false)), + OptionsConverter::toEngine(new Options()->set(Option::INT_96_AS_DATETIME, false)), ); } @@ -34,13 +34,13 @@ public function test_arrow_write_batch_size_is_a_write_option(): void { static::assertSame( 7, - OptionsConverter::toExtension((new Options())->set( + OptionsConverter::toExtension(new Options()->set( Option::ARROW_WRITE_BATCH_SIZE, 7, ))['ARROW_WRITE_BATCH_SIZE'], ); static::assertSame( - (new Options())->getInt(Option::ARROW_WRITE_BATCH_SIZE), + new Options()->getInt(Option::ARROW_WRITE_BATCH_SIZE), OptionsConverter::toExtension(new Options())['ARROW_WRITE_BATCH_SIZE'], ); } @@ -48,10 +48,7 @@ public function test_arrow_write_batch_size_is_a_write_option(): void public function test_dictionary_enabled_is_mapped(): void { static::assertFalse( - OptionsConverter::toExtension((new Options())->set( - Option::DICTIONARY_ENABLED, - false, - ))['DICTIONARY_ENABLED'], + OptionsConverter::toExtension(new Options()->set(Option::DICTIONARY_ENABLED, false))['DICTIONARY_ENABLED'], ); } @@ -59,7 +56,7 @@ public function test_page_maximum_rows_count_is_mapped(): void { static::assertSame( 50, - OptionsConverter::toExtension((new Options())->set( + OptionsConverter::toExtension(new Options()->set( Option::PAGE_MAXIMUM_ROWS_COUNT, 50, ))['PAGE_MAXIMUM_ROWS_COUNT'], @@ -70,7 +67,7 @@ public function test_row_group_maximum_rows_count_is_mapped(): void { static::assertSame( 300, - OptionsConverter::toExtension((new Options())->set( + OptionsConverter::toExtension(new Options()->set( Option::ROW_GROUP_MAXIMUM_ROWS_COUNT, 300, ))['ROW_GROUP_MAXIMUM_ROWS_COUNT'], @@ -86,7 +83,7 @@ public function test_statistics_truncate_length_is_mapped(): void { static::assertSame( 8, - OptionsConverter::toExtension((new Options())->set( + OptionsConverter::toExtension(new Options()->set( Option::STATISTICS_TRUNCATE_LENGTH, 8, ))['STATISTICS_TRUNCATE_LENGTH'], @@ -95,7 +92,7 @@ public function test_statistics_truncate_length_is_mapped(): void public function test_page_index_options_are_mapped_with_the_statistics_level_by_name(): void { - $result = OptionsConverter::toExtension((new Options())->set( + $result = OptionsConverter::toExtension(new Options()->set( Option::STATISTICS_LEVEL, StatisticsLevel::CHUNK, )->set(Option::COLUMN_INDEX_TRUNCATE_LENGTH, 16)->set(Option::PAGE_HEADER_STATISTICS, true)); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/ArrowExtensionTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/ArrowExtensionTest.php index 0669be2591..ad9d1a7742 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/ArrowExtensionTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/ArrowExtensionTest.php @@ -14,12 +14,12 @@ final class ArrowExtensionTest extends TestCase { public function test_an_extension_that_is_not_loaded_is_not_available(): void { - static::assertFalse((new ArrowExtension(false, null))->available()); + static::assertFalse(new ArrowExtension(false, null)->available()); } public function test_a_loaded_extension_of_the_expected_abi_is_available(): void { - static::assertTrue((new ArrowExtension(true, ArrowExtension::ABI))->available()); + static::assertTrue(new ArrowExtension(true, ArrowExtension::ABI)->available()); } public function test_a_loaded_extension_of_another_abi_is_refused(): void @@ -34,7 +34,7 @@ public function test_a_loaded_extension_of_another_abi_is_refused(): void . 'arrow-ext to the version of flow-php/parquet, or stop loading it to use the PHP implementation.', ); - (new ArrowExtension(true, ArrowExtension::ABI + 1, '0.46.0'))->available(); + new ArrowExtension(true, ArrowExtension::ABI + 1, '0.46.0')->available(); } public function test_a_loaded_extension_without_an_abi_is_refused(): void @@ -42,7 +42,7 @@ public function test_a_loaded_extension_without_an_abi_is_refused(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('The loaded arrow extension (0.44.1, ABI none) does not match flow-php/parquet'); - (new ArrowExtension(true, null, '0.44.1'))->available(); + new ArrowExtension(true, null, '0.44.1')->available(); } public function test_detect_reports_whether_arrow_is_loaded(): void diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/PhpParquetFileReaderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/PhpParquetFileReaderTest.php index a22c32cd45..178219caa2 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/PhpParquetFileReaderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/PhpParquetFileReaderTest.php @@ -256,10 +256,10 @@ public function test_a_file_without_the_parquet_magic_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Given file is not valid Parquet file'); - (new PhpParquetFileReader( + new PhpParquetFileReader( new MemorySourceStream('not a parquet file'), ByteOrder::LITTLE_ENDIAN, new Options(), - ))->footer(); + )->footer(); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/PhpParquetFileWriterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/PhpParquetFileWriterTest.php index 5e0adfd151..20645917c4 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/PhpParquetFileWriterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/PhpParquetFileWriterTest.php @@ -76,7 +76,7 @@ public function test_closing_writes_a_file_the_reader_reads_back(): void static::assertSame( [['id' => 1], ['id' => 2]], iterator_to_array( - (new Reader(engine: new PhpParquetEngine())) + new Reader(engine: new PhpParquetEngine()) ->readStream($memory->readFrom(path('memory://file.parquet'))) ->values(), false, @@ -127,7 +127,7 @@ public function test_an_array_batch_is_split_into_row_groups(): void $file->writeBatch([['id' => 1], ['id' => 2], ['id' => 3]]); $file->close(); - $parquet = (new Reader(engine: new PhpParquetEngine()))->readStream($memory->readFrom(path( + $parquet = new Reader(engine: new PhpParquetEngine())->readStream($memory->readFrom(path( 'memory://file.parquet', ))); static::assertSame([['id' => 1], ['id' => 2], ['id' => 3]], iterator_to_array($parquet->values(), false)); @@ -149,7 +149,7 @@ public function test_a_non_array_batch_is_split_into_row_groups(): void $file->writeBatch(new ArrayIterator([['id' => 1], ['id' => 2], ['id' => 3]])); $file->close(); - $parquet = (new Reader(engine: new PhpParquetEngine()))->readStream($memory->readFrom(path( + $parquet = new Reader(engine: new PhpParquetEngine())->readStream($memory->readFrom(path( 'memory://file.parquet', ))); static::assertSame([['id' => 1], ['id' => 2], ['id' => 3]], iterator_to_array($parquet->values(), false)); @@ -172,7 +172,7 @@ public function test_a_batch_closes_row_groups_at_the_maximum_rows_count(): void [300, 300, 300, 100], array_map( static fn(RowGroup $group): int => $group->rowsCount(), - (new Reader(engine: new PhpParquetEngine())) + new Reader(engine: new PhpParquetEngine()) ->readStream($memory->readFrom(path('memory://file.parquet'))) ->metadata() ->rowGroups() @@ -197,7 +197,7 @@ public function test_columns_close_row_groups_at_the_maximum_rows_count(): void [300, 300, 300, 100], array_map( static fn(RowGroup $group): int => $group->rowsCount(), - (new Reader(engine: new PhpParquetEngine())) + new Reader(engine: new PhpParquetEngine()) ->readStream($memory->readFrom(path('memory://file.parquet'))) ->metadata() ->rowGroups() @@ -224,7 +224,7 @@ public function test_rows_close_row_groups_at_the_maximum_rows_count(): void [300, 300, 300, 100], array_map( static fn(RowGroup $group): int => $group->rowsCount(), - (new Reader(engine: new PhpParquetEngine())) + new Reader(engine: new PhpParquetEngine()) ->readStream($memory->readFrom(path('memory://file.parquet'))) ->metadata() ->rowGroups() diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/RustParquetEngineTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/RustParquetEngineTest.php index dd5fda1ac9..5f8aff8c7a 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/RustParquetEngineTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Engine/RustParquetEngineTest.php @@ -44,7 +44,7 @@ public function test_lzo_is_refused(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('LZO compression is not supported by the Arrow engine'); - (new RustParquetEngine())->openForWrite( + new RustParquetEngine()->openForWrite( new StringDestinationStream(path('memory://out.parquet')), Schema::with(FlatColumn::int32('id')), Compressions::LZO, @@ -66,7 +66,7 @@ public function test_configuration_round_trips_the_options(): void public function test_a_default_engine_describes_the_default_options(): void { - static::assertSame(Options::default()->normalize(), (new RustParquetEngine())->normalize()['options']); + static::assertSame(Options::default()->normalize(), new RustParquetEngine()->normalize()['options']); } public function test_a_configuration_without_options_is_refused(): void diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Binding/PhysicalIntervalsTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Binding/PhysicalIntervalsTest.php index 3a3b192b0e..037dbfd84a 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Binding/PhysicalIntervalsTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Binding/PhysicalIntervalsTest.php @@ -89,27 +89,27 @@ public function test_contains_finds_the_value_among_sorted_intervals(int $value, public function test_contains_compares_floats_as_ieee_754(): void { - static::assertFalse((new PhysicalIntervals(PhysicalOrder::Double, [PhysicalInterval::unbounded()]))->contains( + static::assertFalse(new PhysicalIntervals(PhysicalOrder::Double, [PhysicalInterval::unbounded()])->contains( NAN, )); - static::assertTrue((new PhysicalIntervals(PhysicalOrder::Double, [new PhysicalInterval( + static::assertTrue(new PhysicalIntervals(PhysicalOrder::Double, [new PhysicalInterval( 0.0, true, 0.0, true, - )]))->contains(-0.0)); - static::assertFalse((new PhysicalIntervals(PhysicalOrder::Double, [new PhysicalInterval( + )])->contains(-0.0)); + static::assertFalse(new PhysicalIntervals(PhysicalOrder::Double, [new PhysicalInterval( -0.0, false, null, false, - )]))->contains(0.0)); - static::assertTrue((new PhysicalIntervals(PhysicalOrder::Double, [new PhysicalInterval( + )])->contains(0.0)); + static::assertTrue(new PhysicalIntervals(PhysicalOrder::Double, [new PhysicalInterval( -0.0, true, 1.0, false, - )]))->contains(0.0)); + )])->contains(0.0)); } public function test_covers_and_disjoint_honour_each_bound_and_its_inclusion(): void @@ -128,12 +128,9 @@ public function test_covers_and_disjoint_honour_each_bound_and_its_inclusion(): static::assertTrue($intervals->disjoint(-3, 0)); static::assertFalse($intervals->disjoint(4, 6)); static::assertFalse($intervals->disjoint(7, 9)); - static::assertTrue((new PhysicalIntervals(PhysicalOrder::Signed, []))->disjoint(1, 1)); - static::assertFalse((new PhysicalIntervals(PhysicalOrder::Signed, []))->covers(1, 1)); - static::assertTrue((new PhysicalIntervals(PhysicalOrder::Signed, [PhysicalInterval::unbounded()]))->covers( - 1, - 1, - )); + static::assertTrue(new PhysicalIntervals(PhysicalOrder::Signed, [])->disjoint(1, 1)); + static::assertFalse(new PhysicalIntervals(PhysicalOrder::Signed, [])->covers(1, 1)); + static::assertTrue(new PhysicalIntervals(PhysicalOrder::Signed, [PhysicalInterval::unbounded()])->covers(1, 1)); } public function test_covers_and_disjoint_search_among_many_intervals_and_ones_meeting_at_an_exclusive_bound(): void diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Binding/PreImage/BytesPreImageTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Binding/PreImage/BytesPreImageTest.php index da2fe659c9..2a51095055 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Binding/PreImage/BytesPreImageTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Binding/PreImage/BytesPreImageTest.php @@ -31,6 +31,6 @@ public function test_a_string_binds_its_bytes_and_json_has_no_pre_image(): void #[TestWith(['', [[null, false, null, false]]])] public function test_a_prefix_is_the_range_up_to_its_increment(string $prefix, array $expected): void { - static::assertSame($expected, PhysicalIntervalEdges::of((new BytesPreImage())->startsWith($prefix))); + static::assertSame($expected, PhysicalIntervalEdges::of(new BytesPreImage()->startsWith($prefix))); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Binding/PreImage/IntegerPreImageTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Binding/PreImage/IntegerPreImageTest.php index 0923639218..1873500bcb 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Binding/PreImage/IntegerPreImageTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Binding/PreImage/IntegerPreImageTest.php @@ -107,7 +107,7 @@ public function test_a_fraction_lies_between_two_integers(string $operator, floa public function test_an_infinity_is_beyond_exact_integers(): void { - static::assertNull((new IntegerPreImage(PHP_INT_MIN, PHP_INT_MAX))->equal(INF)); - static::assertEquals(new EqualRange(3, 2), (new IntegerPreImage(PHP_INT_MIN, PHP_INT_MAX))->equal(2.5)); + static::assertNull(new IntegerPreImage(PHP_INT_MIN, PHP_INT_MAX)->equal(INF)); + static::assertEquals(new EqualRange(3, 2), new IntegerPreImage(PHP_INT_MIN, PHP_INT_MAX)->equal(2.5)); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/FilterEvaluatorTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/FilterEvaluatorTest.php index 6c0a50050b..b910be306e 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/FilterEvaluatorTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/FilterEvaluatorTest.php @@ -32,21 +32,19 @@ public function test_a_comparison_on_null_is_null_and_so_is_its_negation(): void static::assertSame( [0], - (new FilterEvaluator(BoundFilter::bind(parquet_column('i')->equals(1), $schema, new Options())))->mask( + new FilterEvaluator(BoundFilter::bind(parquet_column('i')->equals(1), $schema, new Options()))->mask( $batch, ), ); static::assertSame( [2], - (new FilterEvaluator(BoundFilter::bind(parquet_column('i')->notEquals(1), $schema, new Options())))->mask( + new FilterEvaluator(BoundFilter::bind(parquet_column('i')->notEquals(1), $schema, new Options()))->mask( $batch, ), ); static::assertSame( [1], - (new FilterEvaluator(BoundFilter::bind(parquet_column('i')->isNull(), $schema, new Options())))->mask( - $batch, - ), + new FilterEvaluator(BoundFilter::bind(parquet_column('i')->isNull(), $schema, new Options()))->mask($batch), ); } @@ -57,27 +55,27 @@ public function test_nan_equals_nothing_and_its_negation_holds(): void static::assertSame( [1, 2], - (new FilterEvaluator(BoundFilter::bind(parquet_column('f')->lessThan(5.0), $schema, new Options())))->mask( + new FilterEvaluator(BoundFilter::bind(parquet_column('f')->lessThan(5.0), $schema, new Options()))->mask( $batch, ), ); static::assertSame( [1], - (new FilterEvaluator(BoundFilter::bind(parquet_column('f')->in([1.0, 9.0]), $schema, new Options())))->mask( + new FilterEvaluator(BoundFilter::bind(parquet_column('f')->in([1.0, 9.0]), $schema, new Options()))->mask( $batch, ), ); static::assertSame( [0, 3], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('f')->lessThan(5.0)->negate(), $schema, new Options(), - )))->mask($batch), + ))->mask($batch), ); static::assertSame( [2], - (new FilterEvaluator(BoundFilter::bind(parquet_column('f')->equals(0.0), $schema, new Options())))->mask( + new FilterEvaluator(BoundFilter::bind(parquet_column('f')->equals(0.0), $schema, new Options()))->mask( $batch, ), ); @@ -90,17 +88,15 @@ public function test_strings_compare_in_byte_order_and_a_non_ascii_prefix_matche static::assertSame( [0], - (new FilterEvaluator(BoundFilter::bind(parquet_column('s')->lessThan('9'), $schema, new Options())))->mask( + new FilterEvaluator(BoundFilter::bind(parquet_column('s')->lessThan('9'), $schema, new Options()))->mask( $batch, ), ); static::assertSame( [3], - (new FilterEvaluator(BoundFilter::bind( - parquet_column('s')->startsWith('ź'), - $schema, - new Options(), - )))->mask($batch), + new FilterEvaluator(BoundFilter::bind(parquet_column('s')->startsWith('ź'), $schema, new Options()))->mask( + $batch, + ), ); } @@ -111,45 +107,41 @@ public function test_unsigned_64_bit_values_compare_numerically_with_ints_digit_ static::assertSame( [1, 2], - (new FilterEvaluator(BoundFilter::bind(parquet_column('u')->greaterThan(9), $schema, new Options())))->mask( + new FilterEvaluator(BoundFilter::bind(parquet_column('u')->greaterThan(9), $schema, new Options()))->mask( $batch, ), ); static::assertSame( [1], - (new FilterEvaluator(BoundFilter::bind(parquet_column('u')->equals('10'), $schema, new Options())))->mask( + new FilterEvaluator(BoundFilter::bind(parquet_column('u')->equals('10'), $schema, new Options()))->mask( $batch, ), ); static::assertSame( [0], - (new FilterEvaluator(BoundFilter::bind(parquet_column('u')->lessThan(2.5), $schema, new Options())))->mask( + new FilterEvaluator(BoundFilter::bind(parquet_column('u')->lessThan(2.5), $schema, new Options()))->mask( $batch, ), ); static::assertSame( [2], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('u')->greaterThan(1.0e19), $schema, new Options(), - )))->mask($batch), + ))->mask($batch), ); static::assertSame( [], - (new FilterEvaluator(BoundFilter::bind( - parquet_column('u')->greaterThan(INF), - $schema, - new Options(), - )))->mask($batch), + new FilterEvaluator(BoundFilter::bind(parquet_column('u')->greaterThan(INF), $schema, new Options()))->mask( + $batch, + ), ); static::assertSame( [0, 1, 2], - (new FilterEvaluator(BoundFilter::bind( - parquet_column('u')->greaterThan(-1), - $schema, - new Options(), - )))->mask($batch), + new FilterEvaluator(BoundFilter::bind(parquet_column('u')->greaterThan(-1), $schema, new Options()))->mask( + $batch, + ), ); } @@ -159,11 +151,11 @@ public function test_a_float_on_an_integer_column_compares_numerically(): void static::assertSame( [1, 2], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('i')->greaterThan(2.5), $schema, new Options(), - )))->mask(['i' => [ + ))->mask(['i' => [ 2, 3, 4, @@ -188,43 +180,37 @@ public function test_uuid_boolean_decimal_and_float32_columns_compare_their_deco static::assertSame( [1], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('uid')->greaterThan('00000000-0000-4000-8000-000000000001'), $schema, new Options(), - )))->mask($batch), + ))->mask($batch), ); static::assertSame( [1], - (new FilterEvaluator(BoundFilter::bind( - parquet_column('flag')->equals(false), - $schema, - new Options(), - )))->mask($batch), + new FilterEvaluator(BoundFilter::bind(parquet_column('flag')->equals(false), $schema, new Options()))->mask( + $batch, + ), ); static::assertSame( [0], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('amount')->equals(12.25), $schema, new Options(), - )))->mask($batch), + ))->mask($batch), ); static::assertSame( [], - (new FilterEvaluator(BoundFilter::bind( - parquet_column('ratio')->equals(0.1), - $schema, - new Options(), - )))->mask($batch), + new FilterEvaluator(BoundFilter::bind(parquet_column('ratio')->equals(0.1), $schema, new Options()))->mask( + $batch, + ), ); static::assertSame( [0], - (new FilterEvaluator(BoundFilter::bind( - parquet_column('ratio')->equals(20.5), - $schema, - new Options(), - )))->mask($batch), + new FilterEvaluator(BoundFilter::bind(parquet_column('ratio')->equals(20.5), $schema, new Options()))->mask( + $batch, + ), ); } @@ -232,14 +218,14 @@ public function test_an_uppercase_uuid_literal_matches_the_lowercase_value_it_na { static::assertSame( [1], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('id')->in([ '00000000-0000-4000-8000-0000000000AA', '00000000-0000-4000-8000-0000000000BB', ]), Schema::with(FlatColumn::uuid('id')), new Options(), - )))->mask(['id' => ['00000000-0000-4000-8000-000000000001', '00000000-0000-4000-8000-0000000000aa']]), + ))->mask(['id' => ['00000000-0000-4000-8000-000000000001', '00000000-0000-4000-8000-0000000000aa']]), ); } @@ -247,11 +233,11 @@ public function test_a_mixed_in_matches_each_kind_numerically(): void { static::assertSame( [0, 2], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('i')->in([3, 33.0]), Schema::with(FlatColumn::int64('i')), new Options(), - )))->mask(['i' => [3, 4, 33]]), + ))->mask(['i' => [3, 4, 33]]), ); } @@ -259,11 +245,11 @@ public function test_an_in_orders_a_value_beyond_2_pow_53_against_literals_it_ha { static::assertSame( [0, 2], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('i')->in([(float) 2 ** 53, 5]), Schema::with(FlatColumn::int64('i')), new Options(), - )))->mask(['i' => [2 ** 53 + 1, 2 ** 53 + 3, 5]]), + ))->mask(['i' => [2 ** 53 + 1, 2 ** 53 + 3, 5]]), ); } @@ -271,35 +257,35 @@ public function test_an_in_matches_decoded_numbers_date_times_and_unsigned_64_bi { static::assertSame( [0, 2], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('d')->in([1, 2.5]), Schema::with(FlatColumn::double('d')), new Options(), - )))->mask(['d' => [1.0, 2.0, 2.5, NAN]]), + ))->mask(['d' => [1.0, 2.0, 2.5, NAN]]), ); static::assertSame( [1], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('t')->in([new DateTimeImmutable('2024-01-01 02:00 +02:00')]), Schema::with(FlatColumn::dateTime('t')), new Options(), - )))->mask(['t' => [new DateTimeImmutable('2024-01-02 UTC'), new DateTimeImmutable('2024-01-01 UTC')]]), + ))->mask(['t' => [new DateTimeImmutable('2024-01-02 UTC'), new DateTimeImmutable('2024-01-01 UTC')]]), ); static::assertSame( [0, 2], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('u')->in([2, '18446744073709551615']), Schema::with(FlatColumnMother::uint64()), new Options(), - )))->mask(['u' => ['2', '10', '18446744073709551615']]), + ))->mask(['u' => ['2', '10', '18446744073709551615']]), ); static::assertSame( [1], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('u')->in([10.0]), Schema::with(FlatColumnMother::uint64()), new Options(), - )))->mask(['u' => ['2', '10']]), + ))->mask(['u' => ['2', '10']]), ); } @@ -307,11 +293,11 @@ public function test_date_times_compare_by_instant(): void { static::assertSame( [0], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('t')->equals(new DateTimeImmutable('2024-01-01 02:00 +02:00')), Schema::with(FlatColumn::dateTime('t')), new Options(), - )))->mask([ + ))->mask([ 't' => [ new DateTimeImmutable('2024-01-01 00:00 UTC'), new DateTimeImmutable('2024-01-01 00:00:01 UTC'), @@ -324,11 +310,11 @@ public function test_a_json_column_compares_its_text(): void { static::assertSame( [0], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('j')->startsWith('{"a"'), Schema::with(FlatColumn::json('j')), new Options(), - )))->mask(['j' => ['{"a": 1}', '[1]']]), + ))->mask(['j' => ['{"a": 1}', '[1]']]), ); } @@ -339,19 +325,19 @@ public function test_a_struct_leaf_is_read_through_its_struct_and_a_null_struct_ static::assertSame( [0], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('address.city')->equals('x'), $schema, new Options(), - )))->mask($batch), + ))->mask($batch), ); static::assertSame( [1], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('address.city')->isNull(), $schema, new Options(), - )))->mask($batch), + ))->mask($batch), ); } @@ -361,27 +347,27 @@ public function test_a_column_the_file_lacks_is_null(): void static::assertSame( [0, 1], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('missing')->isNull(), $schema, new Options(), - )))->mask(['i' => [1, 2]]), + ))->mask(['i' => [1, 2]]), ); static::assertSame( [], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('missing')->equals(1), $schema, new Options(), - )))->mask(['i' => [1, 2]]), + ))->mask(['i' => [1, 2]]), ); static::assertSame( [], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('missing')->notEquals(1), $schema, new Options(), - )))->mask(['i' => [ + ))->mask(['i' => [ 1, 2, ]]), @@ -396,27 +382,27 @@ public function test_composites_follow_three_valued_logic(): void static::assertSame( [0, 1], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( $unknown->or(parquet_column('i')->equals(1)), $schema, new Options(), - )))->mask($batch), + ))->mask($batch), ); static::assertSame( [1], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( $unknown->and(parquet_column('i')->equals(1)), $schema, new Options(), - )))->mask($batch), + ))->mask($batch), ); static::assertSame( [0], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( $unknown->and(parquet_column('i')->equals(2))->negate(), $schema, new Options(), - )))->mask(['i' => [1, 2], 'n' => [null, null]]), + ))->mask(['i' => [1, 2], 'n' => [null, null]]), ); } @@ -427,17 +413,17 @@ public function test_in_and_starts_with_on_null_are_null(): void static::assertSame( [2], - (new FilterEvaluator(BoundFilter::bind(parquet_column('s')->notIn(['a']), $schema, new Options())))->mask( + new FilterEvaluator(BoundFilter::bind(parquet_column('s')->notIn(['a']), $schema, new Options()))->mask( $batch, ), ); static::assertSame( [2], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( parquet_column('s')->startsWith('a')->negate(), $schema, new Options(), - )))->mask($batch), + ))->mask($batch), ); } @@ -445,7 +431,7 @@ public function test_the_roots_are_the_root_columns_of_the_present_leaves(): voi { static::assertSame( ['address', 'i'], - (new FilterEvaluator(BoundFilter::bind( + new FilterEvaluator(BoundFilter::bind( new All( parquet_column('address.city')->isNull(), parquet_column('i')->equals(1), @@ -453,7 +439,7 @@ public function test_the_roots_are_the_root_columns_of_the_present_leaves(): voi ), Schema::with(FlatColumn::int64('i'), NestedColumn::struct('address', [FlatColumn::string('city')])), new Options(), - )))->roots(), + ))->roots(), ); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/PageZoneMapsAtRowTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/PageZoneMapsAtRowTest.php index 7f48daa519..bacb696ee6 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/PageZoneMapsAtRowTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/PageZoneMapsAtRowTest.php @@ -25,7 +25,7 @@ public function test_a_view_answers_with_the_page_holding_its_row_and_shares_the )], ); - static::assertSame(2, (new PageZoneMapsAtRow($pages, 3))->zone($a)?->min); - static::assertSame($pages->zone($a, 0), (new PageZoneMapsAtRow($pages, 1))->zone($a)); + static::assertSame(2, new PageZoneMapsAtRow($pages, 3)->zone($a)?->min); + static::assertSame($pages->zone($a, 0), new PageZoneMapsAtRow($pages, 1)->zone($a)); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/PageZoneMapsTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/PageZoneMapsTest.php index 6dedc28c79..5a8c9f174c 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/PageZoneMapsTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/PageZoneMapsTest.php @@ -60,11 +60,11 @@ public function test_bytes_bounds_are_inexact(): void static::assertEquals( new ZoneMap('a', 'b', false, false, 0, null, 4, false), - (new PageZoneMaps($chunks, ['name' => PageIndexMother::consistent( + new PageZoneMaps($chunks, ['name' => PageIndexMother::consistent( new ColumnIndex([false], ['a'], ['b'], BoundaryOrder::ASCENDING, [0]), PageIndexMother::pagesAt(0), 4, - )]))->at(0)->zone($name), + )])->at(0)->zone($name), ); } @@ -72,12 +72,12 @@ public function test_nan_counts_are_kept_and_nan_bounds_under_the_total_order_me { $ratio = FlatColumn::double('ratio'); $chunks = new MetadataRowGroupChunks( - (new SpyFooter( + new SpyFooter( Schema::with($ratio), 4, [new RowGroup([ColumnChunkMother::withStatistics($ratio, null)], 4)], [ColumnOrder::Ieee754TotalOrder], - ))->metadata(), + )->metadata(), ); $pageIndexes = ['ratio' => PageIndexMother::consistent( new ColumnIndex( @@ -94,26 +94,26 @@ public function test_nan_counts_are_kept_and_nan_bounds_under_the_total_order_me static::assertEquals( new ZoneMap(1.5, 2.5, true, true, 0, 1, 2, false), - (new PageZoneMaps($chunks, $pageIndexes))->at(0)->zone($ratio), + new PageZoneMaps($chunks, $pageIndexes)->at(0)->zone($ratio), ); - static::assertTrue((new PageZoneMaps($chunks, $pageIndexes))->at(3)->zone($ratio)?->allNaN); + static::assertTrue(new PageZoneMaps($chunks, $pageIndexes)->at(3)->zone($ratio)?->allNaN); } public function test_bounds_an_order_does_not_trust_are_absent(): void { $a = FlatColumn::int64('a'); - $chunks = new MetadataRowGroupChunks((new SpyFooter(Schema::with($a), 4, [new RowGroup( + $chunks = new MetadataRowGroupChunks(new SpyFooter(Schema::with($a), 4, [new RowGroup( [ColumnChunkMother::withStatistics($a, null)], 4, - )]))->metadata()); + )])->metadata()); static::assertEquals( new ZoneMap(null, null, true, true, 0, null, 4, false), - (new PageZoneMaps($chunks, ['a' => PageIndexMother::consistent( + new PageZoneMaps($chunks, ['a' => PageIndexMother::consistent( PageIndexMother::int64([[0, 3]]), PageIndexMother::pagesAt(0), 4, - )]))->at(0)->zone($a), + )])->at(0)->zone($a), ); } @@ -121,7 +121,7 @@ public function test_a_column_without_a_page_index_has_no_zone(): void { $chunks = new MetadataRowGroupChunks(FooterMother::oneGroup(4, $a = FlatColumn::int64('a'))->metadata()); - static::assertNull((new PageZoneMaps($chunks, []))->at(0)->zone($a)); + static::assertNull(new PageZoneMaps($chunks, [])->at(0)->zone($a)); } public function test_each_page_is_decoded_once(): void diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/RowGroupZoneMapsTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/RowGroupZoneMapsTest.php index fc774eb68a..bb67645c4e 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/RowGroupZoneMapsTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/Evaluation/RowGroupZoneMapsTest.php @@ -31,7 +31,7 @@ public function test_a_zone_is_the_chunk_statistics_under_the_column_order(): vo static::assertEquals( new ZoneMap(3, 4, true, true, 0, null, 2, false), - (new RowGroupZoneMaps(new MetadataRowGroupChunks($metadata), 1))->zone($id), + new RowGroupZoneMaps(new MetadataRowGroupChunks($metadata), 1)->zone($id), ); } @@ -45,10 +45,10 @@ public function test_bounds_an_order_does_not_trust_are_absent(): void static::assertEquals( new ZoneMap(null, null, true, true, 1, null, 2, false), - (new RowGroupZoneMaps( + new RowGroupZoneMaps( RustRowGroupChunks::fromThrift([2], ['id' => [ThriftBytes::of($chunk->toThrift())]], ['id' => null]), 0, - ))->zone($id), + )->zone($id), ); } @@ -56,14 +56,14 @@ public function test_bytes_bounds_without_exactness_flags_are_inexact(): void { $name = FlatColumn::string('name'); $chunk = ColumnChunkMother::withStatistics($name, new Statistics(null, null, 0, null, 'b', 'a')); - $zone = (new RowGroupZoneMaps( + $zone = new RowGroupZoneMaps( RustRowGroupChunks::fromThrift( [2], ['name' => [ThriftBytes::of($chunk->toThrift())]], ['name' => ThriftBytes::of(ColumnOrder::TypeDefined->toThrift())], ), 0, - ))->zone($name); + )->zone($name); static::assertEquals(new ZoneMap('a', 'b', false, false, 0, null, 2, false), $zone); } @@ -73,10 +73,10 @@ public function test_a_chunk_without_statistics_has_no_zone(): void $id = FlatColumn::int64('id'); $chunk = ColumnChunkMother::withStatistics($id, null); - static::assertNull((new RowGroupZoneMaps( + static::assertNull(new RowGroupZoneMaps( RustRowGroupChunks::fromThrift([2], ['id' => [ThriftBytes::of($chunk->toThrift())]], ['id' => null]), 0, - ))->zone($id)); + )->zone($id)); } public function test_deprecated_bounds_are_never_used_even_under_a_trusted_order(): void @@ -86,14 +86,14 @@ public function test_deprecated_bounds_are_never_used_even_under_a_trusted_order static::assertEquals( new ZoneMap(null, null, false, false, 0, null, 2, false), - (new RowGroupZoneMaps( + new RowGroupZoneMaps( RustRowGroupChunks::fromThrift( [2], ['name' => [ThriftBytes::of($chunk->toThrift())]], ['name' => ThriftBytes::of(ColumnOrder::TypeDefined->toThrift())], ), 0, - ))->zone($name), + )->zone($name), ); } @@ -110,10 +110,10 @@ public function test_a_nan_bound_under_total_order_makes_the_zone_all_nan(): voi ['score' => ThriftBytes::of($order->toThrift())], ); - static::assertTrue((new RowGroupZoneMaps($chunks(ColumnOrder::Ieee754TotalOrder), 0))->zone($score)?->allNaN); + static::assertTrue(new RowGroupZoneMaps($chunks(ColumnOrder::Ieee754TotalOrder), 0)->zone($score)?->allNaN); static::assertEquals( new ZoneMap(null, null, true, true, 0, 2, 2, false), - (new RowGroupZoneMaps($chunks(ColumnOrder::TypeDefined), 0))->zone($score), + new RowGroupZoneMaps($chunks(ColumnOrder::TypeDefined), 0)->zone($score), ); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/NotTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/NotTest.php index dce23a1296..a2857e16af 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/NotTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Filter/NotTest.php @@ -23,7 +23,7 @@ public function test_negating_twice_returns_the_child(): void $child = parquet_column('id')->lessThan(5); static::assertSame($child, $child->negate()->negate()); - static::assertSame($child, (new Not($child))->negate()); + static::assertSame($child, new Not($child)->negate()); } public function test_a_not_visits_as_a_not(): void diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/CodecTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/CodecTest.php index c3dfd0c7cc..4c32394c86 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/CodecTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/CodecTest.php @@ -37,7 +37,7 @@ public function test_gzip(): void { $data = 'this is some test data to be compressed'; - $codec = new Codec((new Options())->set(Option::GZIP_COMPRESSION_LEVEL, 9)); + $codec = new Codec(new Options()->set(Option::GZIP_COMPRESSION_LEVEL, 9)); static::assertSame($data, $codec->decompress($codec->compress($data, Compressions::GZIP), Compressions::GZIP)); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/DecimalConverterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/DecimalConverterTest.php index 1af79242b2..f7693ab93a 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/DecimalConverterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/DecimalConverterTest.php @@ -63,7 +63,7 @@ public function test_for_column_on_byte_array_decimals_uses_minimal_bytes(): voi #[TestWith([2, 123456789012345678, 1234567890123456.8])] public function test_from_parquet_type(int $scale, int $value, float $expected): void { - static::assertSame($expected, (new DecimalConverter(PhysicalType::INT64, 18, $scale))->fromParquetType($value)); + static::assertSame($expected, new DecimalConverter(PhysicalType::INT64, 18, $scale)->fromParquetType($value)); } #[TestWith([9, 2, 12345.67, 1234567])] @@ -72,7 +72,7 @@ public function test_to_parquet_type(int $precision, int $scale, float $value, i { static::assertSame( $expected, - (new DecimalConverter(PhysicalType::INT32, $precision, $scale))->toParquetType($value), + new DecimalConverter(PhysicalType::INT32, $precision, $scale)->toParquetType($value), ); } @@ -80,7 +80,7 @@ public function test_to_parquet_type_over_precision_throws(): void { $this->expectException(OverflowException::class); - (new DecimalConverter(PhysicalType::INT32, 9, 2))->toParquetType(12345678.9); + new DecimalConverter(PhysicalType::INT32, 9, 2)->toParquetType(12345678.9); } #[TestWith([true])] @@ -90,6 +90,6 @@ public function test_to_parquet_type_refuses_a_non_number(mixed $value): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Decimal must be written as int or float, got '); - (new DecimalConverter(PhysicalType::INT64, 10, 2))->toParquetType($value); + new DecimalConverter(PhysicalType::INT64, 10, 2)->toParquetType($value); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/Int32DateConverterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/Int32DateConverterTest.php index e9f4957723..db72233502 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/Int32DateConverterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/Int32DateConverterTest.php @@ -42,7 +42,7 @@ public function test_to_parquet_type(string $dateTime, string $timeZone, int $ex { static::assertSame( $expected, - (new Int32DateConverter())->toParquetType(new DateTimeImmutable($dateTime, new DateTimeZone($timeZone))), + new Int32DateConverter()->toParquetType(new DateTimeImmutable($dateTime, new DateTimeZone($timeZone))), ); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/Int64DateTimeConverterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/Int64DateTimeConverterTest.php index 9c81f1e8e5..0d64d18ef8 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/Int64DateTimeConverterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/Int64DateTimeConverterTest.php @@ -21,7 +21,7 @@ final class Int64DateTimeConverterTest extends TestCase { public function test_converting_date_times(): void { - $date = (new DateTimeImmutable('2021-01-01')) + $date = new DateTimeImmutable('2021-01-01') ->setTimezone(new DateTimeZone('UTC')) ->setTime(14, 56, 24, 54324); @@ -72,7 +72,7 @@ public function test_from_parquet_type(TimeUnit $unit, int $value, string $expec { static::assertSame( $expected, - (new Int64DateTimeConverter($unit)) + new Int64DateTimeConverter($unit) ->fromParquetType($value) ->format('Y-m-d H:i:s.u P'), ); @@ -86,7 +86,7 @@ public function test_to_parquet_type(TimeUnit $unit, string $dateTime, int $expe { static::assertSame( $expected, - (new Int64DateTimeConverter($unit))->toParquetType(new DateTimeImmutable($dateTime)), + new Int64DateTimeConverter($unit)->toParquetType(new DateTimeImmutable($dateTime)), ); } @@ -97,7 +97,7 @@ public function test_to_parquet_type_outside_nanos_range_throws(): void 'DateTime 2262-04-12T00:00:00+00:00 is outside the TIMESTAMP(NANOS) range 1677-09-21 – 2262-04-11', ); - (new Int64DateTimeConverter(TimeUnit::NANOSECONDS))->toParquetType( + new Int64DateTimeConverter(TimeUnit::NANOSECONDS)->toParquetType( new DateTimeImmutable('2262-04-12 00:00:00 UTC'), ); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/Int96DateTimeConverterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/Int96DateTimeConverterTest.php index 4c53b44f29..d75cadf35e 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/Int96DateTimeConverterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/Int96DateTimeConverterTest.php @@ -42,7 +42,7 @@ public function test_int96_reads_as_the_microsecond_it_falls_in(string $bytes, s { static::assertSame( $datetime, - (new Int96DateTimeConverter()) + new Int96DateTimeConverter() ->fromParquetType($bytes) ->format('Y-m-d H:i:s.u'), ); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/TimeConverterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/TimeConverterTest.php index 824f7b9435..0597e0ea92 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/TimeConverterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/TimeConverterTest.php @@ -20,7 +20,7 @@ final class TimeConverterTest extends TestCase public function test_converting_diff_between_two_datetimes_to_time(): void { $start = new DateTimeImmutable('2023-01-01 00:00:00 UTC'); - $end = (new DateTimeImmutable('2023-01-01 00:00:0 UTC'))->setTime(15, 25, 30, 15040); + $end = new DateTimeImmutable('2023-01-01 00:00:0 UTC')->setTime(15, 25, 30, 15040); $diff = $start->diff($end); $converter = new TimeConverter(TimeUnit::MICROSECONDS); @@ -51,7 +51,7 @@ public function test_from_parquet_type(TimeUnit $unit, int $value, string $expec { static::assertSame( $expected, - (new TimeConverter($unit)) + new TimeConverter($unit) ->fromParquetType($value) ->format('%H:%I:%S.%F'), ); @@ -62,10 +62,10 @@ public function test_from_parquet_type(TimeUnit $unit, int $value, string $expec #[TestWith([TimeUnit::NANOSECONDS, 11045678901000])] public function test_to_parquet_type(TimeUnit $unit, int $expected): void { - $interval = (new DateTimeImmutable('2020-01-01 00:00:00 UTC'))->diff( + $interval = new DateTimeImmutable('2020-01-01 00:00:00 UTC')->diff( new DateTimeImmutable('2020-01-01 03:04:05.678901 UTC'), ); - static::assertSame($expected, (new TimeConverter($unit))->toParquetType($interval)); + static::assertSame($expected, new TimeConverter($unit)->toParquetType($interval)); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/UnsignedInt32ConverterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/UnsignedInt32ConverterTest.php index 6eb2ce1969..0f11744e2b 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/UnsignedInt32ConverterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/UnsignedInt32ConverterTest.php @@ -22,7 +22,7 @@ final class UnsignedInt32ConverterTest extends TestCase #[TestWith([2_147_483_647, 2_147_483_647])] public function test_uint32_reads_back_as_itself(int $stored, int $value): void { - static::assertSame($value, (new UnsignedInt32Converter())->fromParquetType($stored)); + static::assertSame($value, new UnsignedInt32Converter()->fromParquetType($stored)); } public function test_a_value_that_is_not_an_int_is_refused(): void @@ -30,12 +30,12 @@ public function test_a_value_that_is_not_an_int_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected int, got string'); - (new UnsignedInt32Converter())->fromParquetType('1'); + new UnsignedInt32Converter()->fromParquetType('1'); } public function test_writes_are_the_value_itself(): void { - static::assertSame(4_000_000_000, (new UnsignedInt32Converter())->toParquetType(4_000_000_000)); + static::assertSame(4_000_000_000, new UnsignedInt32Converter()->toParquetType(4_000_000_000)); } public function test_for_column_reads_the_converted_type(): void diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/UnsignedInt64ConverterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/UnsignedInt64ConverterTest.php index 7d355ef276..8f822d9b51 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/UnsignedInt64ConverterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/UnsignedInt64ConverterTest.php @@ -33,7 +33,7 @@ public function test_bit_pattern_reads_as_its_decimal_string_and_back(int $physi public function test_an_int_writes_as_itself(): void { - static::assertSame(PHP_INT_MAX, (new UnsignedInt64Converter())->toParquetType(PHP_INT_MAX)); + static::assertSame(PHP_INT_MAX, new UnsignedInt64Converter()->toParquetType(PHP_INT_MAX)); } #[TestWith([-1, '-1'])] @@ -49,7 +49,7 @@ public function test_a_value_out_of_uint64_is_refused(mixed $value, string $show $this->expectExceptionMessage('Expected an int >= 0 or a digit string up to 18446744073709551615, got ' . $shown); - (new UnsignedInt64Converter())->toParquetType($value); + new UnsignedInt64Converter()->toParquetType($value); } public function test_reading_anything_but_an_int_is_refused(): void @@ -57,7 +57,7 @@ public function test_reading_anything_but_an_int_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Expected int, got string'); - (new UnsignedInt64Converter())->fromParquetType('1'); + new UnsignedInt64Converter()->fromParquetType('1'); } public function test_for_column_takes_converted_and_logical_uint64_only(): void diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/UuidConverterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/UuidConverterTest.php index ddfc01f82d..920d97231c 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/UuidConverterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Data/Converter/UuidConverterTest.php @@ -46,7 +46,7 @@ public function test_malformed_uuid_is_refused(string $uuid): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Invalid UUID format: ' . $uuid); - (new UuidConverter())->toParquetType($uuid); + new UuidConverter()->toParquetType($uuid); } public function test_reading_anything_but_16_bytes_is_refused(): void @@ -54,7 +54,7 @@ public function test_reading_anything_but_16_bytes_is_refused(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('UUID must be read as 16 bytes from Parquet file'); - (new UuidConverter())->fromParquetType('550e8400-e29b-41d4-a716-446655440000'); + new UuidConverter()->fromParquetType('550e8400-e29b-41d4-a716-446655440000'); } public function test_writing_a_non_uuid_value_is_refused(): void @@ -62,6 +62,6 @@ public function test_writing_a_non_uuid_value_is_refused(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('UUID must be written as a string or Stringable object'); - (new UuidConverter())->toParquetType(1); + new UuidConverter()->toParquetType(1); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Index/StreamIndexesTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Index/StreamIndexesTest.php index 19ae4ff5fb..bfc2eed6d7 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Index/StreamIndexesTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Index/StreamIndexesTest.php @@ -107,10 +107,10 @@ public function test_a_bloom_filter_that_fails_to_decode_is_none(string $bytes): { $id = FlatColumn::int64('id'); - static::assertNull((new StreamIndexes(new SpyFooter(Schema::with($id), 2, [new RowGroup( + static::assertNull(new StreamIndexes(new SpyFooter(Schema::with($id), 2, [new RowGroup( [ColumnChunkMother::withBloomFilter($id, 4, strlen($bytes))], 2, - )]), new MemorySourceStream('PAR1' . $bytes)))->bloomFilter(0, $id)); + )]), new MemorySourceStream('PAR1' . $bytes))->bloomFilter(0, $id)); } public function test_a_chunk_without_indexes_reads_nothing(): void @@ -158,9 +158,9 @@ public function test_a_column_index_that_fails_to_decode_is_none(string $bytes): { $id = FlatColumn::int64('id'); - static::assertNull((new StreamIndexes(new SpyFooter(Schema::with($id), 2, [new RowGroup([ + static::assertNull(new StreamIndexes(new SpyFooter(Schema::with($id), 2, [new RowGroup([ ColumnChunkMother::withIndexes($id, new IndexLocation(4, strlen($bytes)), null), - ], 2)]), new MemorySourceStream('PAR1' . $bytes)))->columnIndex(0, $id)); + ], 2)]), new MemorySourceStream('PAR1' . $bytes))->columnIndex(0, $id)); } /** @@ -172,20 +172,20 @@ public static function malformed_offset_indexes(): iterable yield 'no pages' => [ThriftBytes::of(new ThriftOffsetIndex(['page_locations' => []]))]; yield 'no page locations' => [ThriftBytes::of(new ThriftOffsetIndex([]))]; yield 'a page outside the chunk' => [ThriftBytes::of( - (new OffsetIndex([new PageLocation(20, 10, 0)]))->toThrift(), + new OffsetIndex([new PageLocation(20, 10, 0)])->toThrift(), )]; - yield 'an empty page' => [ThriftBytes::of((new OffsetIndex([new PageLocation(4, 0, 0)]))->toThrift())]; + yield 'an empty page' => [ThriftBytes::of(new OffsetIndex([new PageLocation(4, 0, 0)])->toThrift())]; yield 'pages out of order' => [ThriftBytes::of( - (new OffsetIndex([ + new OffsetIndex([ new PageLocation(14, 10, 0), new PageLocation(4, 10, 1), - ]))->toThrift(), + ])->toThrift(), )]; yield 'rows past the row group' => [ThriftBytes::of( - (new OffsetIndex([ + new OffsetIndex([ new PageLocation(4, 10, 0), new PageLocation(14, 10, 2), - ]))->toThrift(), + ])->toThrift(), )]; } @@ -194,8 +194,8 @@ public function test_an_offset_index_that_fails_to_decode_or_does_not_fit_its_ch { $id = FlatColumn::int64('id'); - static::assertNull((new StreamIndexes(new SpyFooter(Schema::with($id), 2, [new RowGroup([ + static::assertNull(new StreamIndexes(new SpyFooter(Schema::with($id), 2, [new RowGroup([ ColumnChunkMother::withIndexes($id, null, new IndexLocation(4, strlen($bytes))), - ], 2)]), new MemorySourceStream('PAR1' . $bytes)))->offsetIndex(0, $id)); + ], 2)]), new MemorySourceStream('PAR1' . $bytes))->offsetIndex(0, $id)); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/MetadataRowGroupChunksTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/MetadataRowGroupChunksTest.php index 347cb63c75..830e29f5d8 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/MetadataRowGroupChunksTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/MetadataRowGroupChunksTest.php @@ -30,6 +30,6 @@ public function test_a_row_group_the_file_lacks_is_refused(): void $this->expectException(OutOfBoundsException::class); $this->expectExceptionMessage('Row group 3 does not exist'); - (new MetadataRowGroupChunks($metadata))->chunk(3, $metadata->schema()->getFlat('id')); + new MetadataRowGroupChunks($metadata)->chunk(3, $metadata->schema()->getFlat('id')); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/MetadataTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/MetadataTest.php index 451ee8217f..62a6d1b033 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/MetadataTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/MetadataTest.php @@ -22,7 +22,7 @@ public function test_column_orders_round_trip_per_leaf(): void NestedColumn::struct('point', [FlatColumn::double('x'), FlatColumn::int64('y')]), ); $read = Metadata::fromThrift( - (new Metadata( + new Metadata( $schema, new RowGroups([]), 0, @@ -33,7 +33,7 @@ public function test_column_orders_round_trip_per_leaf(): void ColumnOrder::Ieee754TotalOrder, ColumnOrder::TypeDefined, ], - ))->toThrift(), + )->toThrift(), ); static::assertSame(ColumnOrder::TypeDefined, $read->columnOrder($schema->getFlat('name'))); @@ -47,7 +47,7 @@ public function test_footer_without_column_orders_is_absent(): void static::assertSame( ColumnOrder::Absent, Metadata::fromThrift( - (new Metadata($schema, new RowGroups([]), 0, 1, null))->toThrift(), + new Metadata($schema, new RowGroups([]), 0, 1, null)->toThrift(), )->columnOrder($schema->getFlat('name')), ); } @@ -55,7 +55,7 @@ public function test_footer_without_column_orders_is_absent(): void public function test_footer_with_fewer_column_orders_than_leaves_is_refused(): void { $schema = Schema::with(FlatColumn::string('a'), FlatColumn::string('b')); - $thrift = (new Metadata($schema, new RowGroups([]), 0, 1, null))->toThrift(); + $thrift = new Metadata($schema, new RowGroups([]), 0, 1, null)->toThrift(); $thrift->column_orders = [ColumnOrder::TypeDefined->toThrift()]; $this->expectException(InvalidArgumentException::class); @@ -87,7 +87,7 @@ public function test_an_unknown_column_order_is_written_back_as_unknown(): void { $schema = Schema::with(FlatColumn::string('a'), FlatColumn::double('b')); $read = Metadata::fromThrift( - (new Metadata( + new Metadata( $schema, new RowGroups([]), 0, @@ -97,7 +97,7 @@ public function test_an_unknown_column_order_is_written_back_as_unknown(): void ColumnOrder::Unknown, ColumnOrder::Ieee754TotalOrder, ], - ))->toThrift(), + )->toThrift(), ); static::assertSame(ColumnOrder::Unknown, $read->columnOrder($schema->getFlat('a'))); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Page/Header/DataPageHeaderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Page/Header/DataPageHeaderTest.php index 7618ba05b2..31a5629b16 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Page/Header/DataPageHeaderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Page/Header/DataPageHeaderTest.php @@ -17,13 +17,13 @@ final class DataPageHeaderTest extends TestCase public function test_page_statistics_are_kept_through_thrift(): void { $header = DataPageHeader::fromThrift( - (new DataPageHeader( + new DataPageHeader( Encodings::PLAIN, Encodings::RLE, Encodings::RLE, 2, new Statistics(null, null, 1, null, pack('P', 9), pack('P', 1)), - ))->toThrift(), + )->toThrift(), ); static::assertSame(1, $header->statistics()?->minValue(FlatColumn::int64('id'))); @@ -35,7 +35,7 @@ public function test_a_page_without_statistics_has_none(): void { static::assertNull( DataPageHeader::fromThrift( - (new DataPageHeader(Encodings::PLAIN, Encodings::RLE, Encodings::RLE, 2))->toThrift(), + new DataPageHeader(Encodings::PLAIN, Encodings::RLE, Encodings::RLE, 2)->toThrift(), )->statistics(), ); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Page/Header/DataPageHeaderV2Test.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Page/Header/DataPageHeaderV2Test.php index f160951da8..acad5cf736 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Page/Header/DataPageHeaderV2Test.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Page/Header/DataPageHeaderV2Test.php @@ -18,7 +18,7 @@ public function test_is_compressed_reads_a_missing_flag_as_true(?bool $flag, boo { static::assertSame( $expected, - (new DataPageHeaderV2(2, 0, 2, Encodings::PLAIN, 0, 0, $flag, null))->isCompressed(), + new DataPageHeaderV2(2, 0, 2, Encodings::PLAIN, 0, 0, $flag, null)->isCompressed(), ); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/PageIndex/OffsetIndexTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/PageIndex/OffsetIndexTest.php index ce5b31b04c..f757c7e364 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/PageIndex/OffsetIndexTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/PageIndex/OffsetIndexTest.php @@ -76,7 +76,7 @@ public function test_pages_fit_a_chunk_when_they_lie_inside_it_one_after_another $locations[] = new PageLocation($offset, $size, $page * 5); } - static::assertSame($fits, (new OffsetIndex($locations))->fits( + static::assertSame($fits, new OffsetIndex($locations)->fits( ColumnChunkMother::spanning(FlatColumn::int64('id'), 100, 30), 10, )); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/RowGroup/ColumnChunkTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/RowGroup/ColumnChunkTest.php index d5d0581fd5..0e5bec0e59 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/RowGroup/ColumnChunkTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/RowGroup/ColumnChunkTest.php @@ -81,7 +81,7 @@ public function test_a_chunk_records_the_bloom_filter_written_for_it(): void public function test_a_location_no_index_can_be_read_from_is_no_location(): void { - $thrift = (new ColumnChunk( + $thrift = new ColumnChunk( PhysicalType::INT64, Compressions::UNCOMPRESSED, 2, @@ -94,7 +94,7 @@ public function test_a_location_no_index_can_be_read_from_is_no_location(): void 4, null, null, - ))->toThrift(); + )->toThrift(); $thrift->column_index_offset = 100; $thrift->column_index_length = 0; $thrift->offset_index_offset = -1; diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Schema/FlatColumnTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Schema/FlatColumnTest.php index c1c70abc09..7174ab757c 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Schema/FlatColumnTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Schema/FlatColumnTest.php @@ -185,11 +185,11 @@ public function test_a_logical_type_writes_its_converted_type(LogicalType $logic static::assertSame($converted, $logical->convertedType()); static::assertSame( $converted->value, - (new FlatColumn('c', PhysicalType::BYTE_ARRAY, logicalType: $logical))->toThrift()->converted_type, + new FlatColumn('c', PhysicalType::BYTE_ARRAY, logicalType: $logical)->toThrift()->converted_type, ); static::assertSame( $converted->value, - (new FlatColumn('c', PhysicalType::BYTE_ARRAY, $converted, $logical))->toThrift()->converted_type, + new FlatColumn('c', PhysicalType::BYTE_ARRAY, $converted, $logical)->toThrift()->converted_type, ); } @@ -197,23 +197,23 @@ public function test_a_logical_type_writes_its_converted_type(LogicalType $logic public function test_a_logical_type_without_a_converted_equivalent_writes_none(LogicalType $logical): void { static::assertNull($logical->convertedType()); - static::assertNull((new FlatColumn( + static::assertNull(new FlatColumn( 'c', PhysicalType::BYTE_ARRAY, logicalType: $logical, - ))->toThrift()->converted_type); + )->toThrift()->converted_type); } public function test_a_converted_type_alone_is_written_as_given(): void { static::assertSame( ConvertedType::INTERVAL->value, - (new FlatColumn( + new FlatColumn( 'c', PhysicalType::FIXED_LEN_BYTE_ARRAY, ConvertedType::INTERVAL, typeLength: 12, - ))->toThrift()->converted_type, + )->toThrift()->converted_type, ); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Schema/LogicalType/IntegerTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Schema/LogicalType/IntegerTest.php index 01f5a189c2..93f67023fb 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Schema/LogicalType/IntegerTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFile/Schema/LogicalType/IntegerTest.php @@ -70,7 +70,7 @@ public function test_for_column_without_an_integer_annotation(): void #[TestWith([64, false])] public function test_thrift_round_trip(int $bitWidth, bool $isSigned): void { - $thrift = (new Integer($bitWidth, $isSigned))->toThrift(); + $thrift = new Integer($bitWidth, $isSigned)->toThrift(); static::assertEquals(new IntType(['bitWidth' => $bitWidth, 'isSigned' => $isSigned]), $thrift); static::assertEquals(new Integer($bitWidth, $isSigned), Integer::fromThrift($thrift)); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFileTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFileTest.php index 1319786287..d8d058951c 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFileTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ParquetFileTest.php @@ -75,11 +75,11 @@ public function test_options_are_the_ones_the_file_was_opened_with(): void static::assertSame( $options, - (new ParquetFile( + new ParquetFile( new MemorySourceStream('PAR1'), $options, new SpyParquetFileReader(Schema::with(FlatColumn::int64('id'))), - ))->options(), + )->options(), ); } @@ -423,7 +423,7 @@ public function test_a_bound_filter_with_a_limit_reads_only_the_pages_up_to_the_ public function test_a_filtered_read_on_a_struct_leaf_reads_each_page_of_the_leaf_once(): void { $bytes = MemoryParquetFile::written( - Writer::php(options: (new Options())->set(Option::PAGE_SIZE_BYTES, 16)->set( + Writer::php(options: new Options()->set(Option::PAGE_SIZE_BYTES, 16)->set( Option::PAGE_SIZE_CHECK_INTERVAL, 2, )->set(Option::COLUMNS_ENCODINGS, ['address.city' => Encodings::PLAIN])), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ChunkBufferTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ChunkBufferTest.php index 8c66e989ba..3632482086 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ChunkBufferTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ChunkBufferTest.php @@ -23,7 +23,7 @@ public function test_a_chunk_is_buffered_from_its_first_page(): void $file = MemoryParquetFile::read(Reader::php(), $bytes); $chunk = $file->metadata()->rowGroups()->all()[0]->getColumnChunk($file->schema()->getFlat('word')); - $buffer = (new ChunkBuffer(new Options()))->of($chunk, new MemorySourceStream($bytes)); + $buffer = new ChunkBuffer(new Options())->of($chunk, new MemorySourceStream($bytes)); static::assertSame($chunk->totalCompressedSize(), strlen((string) stream_get_contents($buffer))); } @@ -37,7 +37,7 @@ public function test_a_parquet_816_chunk_is_extended_by_its_dictionary_page_head ->rowGroups() ->all()[0]->getColumnChunk($file->schema()->getFlat('word'))); - $buffer = (new ChunkBuffer(new Options()))->of($chunk, new MemorySourceStream($bytes)); + $buffer = new ChunkBuffer(new Options())->of($chunk, new MemorySourceStream($bytes)); static::assertGreaterThan($chunk->totalCompressedSize(), strlen((string) stream_get_contents($buffer))); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ColumnChunkReaderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ColumnChunkReaderTest.php index 0c20ea275b..46bea5af33 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ColumnChunkReaderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ColumnChunkReaderTest.php @@ -30,10 +30,10 @@ public function test_the_given_pages_are_read_in_one_call(): void $offsetIndex = $file->indexes()->offsetIndex(0, $id) ?? static::fail('No offset index'); $stream = new ReadCountingSourceStream(new MemorySourceStream($bytes)); - $pages = iterator_to_array((new ColumnChunkReader( + $pages = iterator_to_array(new ColumnChunkReader( new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options(), - ))->read($file->metadata()->rowGroups()->all()[0]->getColumnChunk($id), $id, $stream, $offsetIndex, [2, 3])); + )->read($file->metadata()->rowGroups()->all()[0]->getColumnChunk($id), $id, $stream, $offsetIndex, [2, 3])); static::assertSame( [4 => [4, 5], 6 => [6, 7]], @@ -58,10 +58,10 @@ public function test_the_dictionary_page_is_read_beside_the_given_pages(): void $offsetIndex = $file->indexes()->offsetIndex(0, $word) ?? static::fail('No offset index'); $stream = new ReadCountingSourceStream(new MemorySourceStream($bytes)); - $pages = iterator_to_array((new ColumnChunkReader( + $pages = iterator_to_array(new ColumnChunkReader( new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options(), - ))->read($chunk, $word, $stream, $offsetIndex, [3])); + )->read($chunk, $word, $stream, $offsetIndex, [3])); static::assertSame( [6 => ['w0', 'w1']], @@ -112,10 +112,10 @@ public function test_adjacent_pages_and_the_dictionary_are_read_in_one_call(): v $offsetIndex = $file->indexes()->offsetIndex(0, $word) ?? static::fail('No offset index'); $stream = new ReadCountingSourceStream(new MemorySourceStream($bytes)); - iterator_to_array((new ColumnChunkReader( + iterator_to_array(new ColumnChunkReader( new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options(), - ))->read($chunk, $word, $stream, $offsetIndex, [0, 1])); + )->read($chunk, $word, $stream, $offsetIndex, [0, 1])); static::assertSame(1, $stream->reads); static::assertSame($offsetIndex->pages[2]->offset - $chunk->pageOffset(), $stream->bytes); @@ -129,10 +129,10 @@ public function test_a_dictionary_the_data_page_offset_points_at_is_read_beside_ $chunk = $file->metadata()->rowGroups()->all()[0]->getColumnChunk($word); $offsetIndex = $file->indexes()->offsetIndex(0, $word) ?? static::fail('No offset index'); - $pages = iterator_to_array((new ColumnChunkReader( + $pages = iterator_to_array(new ColumnChunkReader( new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options(), - ))->read(ColumnChunkMother::parquet816($chunk), $word, new MemorySourceStream($bytes), $offsetIndex, [3])); + )->read(ColumnChunkMother::parquet816($chunk), $word, new MemorySourceStream($bytes), $offsetIndex, [3])); static::assertSame( [6 => ['w0', 'w1']], @@ -150,7 +150,7 @@ public function test_no_pages_read_nothing_and_return_the_given_dictionary(): vo $word = $file->schema()->getFlat('word'); $stream = new ReadCountingSourceStream(new MemorySourceStream($bytes)); - $pages = (new ColumnChunkReader(new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options()))->read( + $pages = new ColumnChunkReader(new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options())->read( $file->metadata()->rowGroups()->all()[0]->getColumnChunk($word), $word, $stream, @@ -171,10 +171,10 @@ public function test_without_an_offset_index_the_whole_chunk_is_read_once(): voi $chunk = $file->metadata()->rowGroups()->all()[0]->getColumnChunk($id); $stream = new ReadCountingSourceStream(new MemorySourceStream($bytes)); - $pages = iterator_to_array((new ColumnChunkReader( + $pages = iterator_to_array(new ColumnChunkReader( new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options(), - ))->read($chunk, $id, $stream)); + )->read($chunk, $id, $stream)); static::assertSame([0, 2, 4, 6, 8, 10], array_keys($pages)); static::assertSame(1, $stream->reads); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ColumnDataDecoderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ColumnDataDecoderTest.php index 3ebec75057..e26be86a4b 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ColumnDataDecoderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ColumnDataDecoderTest.php @@ -28,11 +28,11 @@ public static function delta_string_pages_provider(): array return [ 'DELTA_LENGTH_BYTE_ARRAY' => [ Encodings::DELTA_LENGTH_BYTE_ARRAY, - (new DeltaLengthByteArrayEncoder())->encode(['axis', 'axle', '']), + new DeltaLengthByteArrayEncoder()->encode(['axis', 'axle', '']), ], 'DELTA_BYTE_ARRAY' => [ Encodings::DELTA_BYTE_ARRAY, - (new DeltaByteArrayEncoder())->encode(['axis', 'axle', '']), + new DeltaByteArrayEncoder()->encode(['axis', 'axle', '']), ], ]; } @@ -43,7 +43,7 @@ public function test_delta_string_page_v1_decodes(Encodings $encoding, string $b static::assertSame( ['axis', 'axle', ''], iterator_to_array( - (new ColumnDataDecoder()) + new ColumnDataDecoder() ->decodeData( $buffer, FlatColumn::string('s', Repetition::REQUIRED), @@ -61,7 +61,7 @@ public function test_delta_string_page_v2_decodes(Encodings $encoding, string $b static::assertSame( ['axis', 'axle', ''], iterator_to_array( - (new ColumnDataDecoder()) + new ColumnDataDecoder() ->decodeDataV2( $buffer, FlatColumn::string('s', Repetition::REQUIRED), @@ -82,7 +82,7 @@ public function test_an_rle_boolean_page_v1_decodes(): void static::assertSame( [true, false, true], iterator_to_array( - (new ColumnDataDecoder()) + new ColumnDataDecoder() ->decodeData( $storage->getBuffer(), $column, @@ -103,7 +103,7 @@ public function test_an_rle_boolean_page_v2_decodes(): void static::assertSame( [true, false, true], iterator_to_array( - (new ColumnDataDecoder()) + new ColumnDataDecoder() ->decodeDataV2( $storage->getBuffer(), $column, diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ColumnReaderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ColumnReaderTest.php index 91e8e2ecb0..40b583b440 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ColumnReaderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/ColumnReaderTest.php @@ -43,7 +43,7 @@ final class ColumnReaderTest extends TestCase public function test_a_flat_column_reads_the_rows_of_one_row_group(int $group, array $ids): void { $stream = new MemorySourceStream(MemoryParquetFile::threeRowGroups()); - $metadata = (new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options()))->footer()->metadata(); + $metadata = new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options())->footer()->metadata(); $reader = new ColumnReader( new SelectedPages( new ColumnChunkReader(new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options()), @@ -79,7 +79,7 @@ public function test_a_flat_column_reads_only_the_selected_rows_of_a_row_group( array $ids, ): void { $stream = new MemorySourceStream(MemoryParquetFile::threeRowGroups()); - $metadata = (new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options()))->footer()->metadata(); + $metadata = new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options())->footer()->metadata(); $reader = new ColumnReader( new SelectedPages( new ColumnChunkReader(new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options()), @@ -106,7 +106,7 @@ public function test_a_flat_column_reads_only_the_selected_rows_of_a_row_group( public function test_a_nested_column_reads_the_rows_of_one_row_group(): void { $stream = new MemorySourceStream(MemoryParquetFile::threeRowGroups()); - $metadata = (new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options()))->footer()->metadata(); + $metadata = new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options())->footer()->metadata(); $reader = new ColumnReader( new SelectedPages( new ColumnChunkReader(new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options()), @@ -133,7 +133,7 @@ public function test_a_nested_column_reads_the_rows_of_one_row_group(): void public function test_a_nested_leaf_keeps_only_the_masked_rows_inside_a_page(): void { $stream = new MemorySourceStream(MemoryParquetFile::pagedColumns()); - $footer = (new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options()))->footer(); + $footer = new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options())->footer(); $metadata = $footer->metadata(); $reader = new ColumnReader( new SelectedPages( @@ -185,7 +185,7 @@ public function test_physical_values_are_undecoded_and_null_where_the_leaf_or_it ['day' => new DateTimeImmutable('1970-01-05 UTC'), 'address' => ['city' => 'b']], ], )); - $metadata = (new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options()))->footer()->metadata(); + $metadata = new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options())->footer()->metadata(); $reader = new ColumnReader( new SelectedPages( new ColumnChunkReader(new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options()), @@ -233,11 +233,11 @@ public function test_physical_values_are_undecoded_and_null_where_the_leaf_or_it public function test_the_dictionary_read_for_the_physical_values_is_not_read_again_for_the_output(): void { $bytes = MemoryParquetFile::pagedColumns(); - $footer = (new PhpParquetFileReader( + $footer = new PhpParquetFileReader( new MemorySourceStream($bytes), ByteOrder::LITTLE_ENDIAN, new Options(), - ))->footer(); + )->footer(); $indexes = new StreamIndexes($footer, new MemorySourceStream($bytes)); $word = $footer->metadata()->schema()->getFlat('word'); $rowGroup = $footer->metadata()->rowGroups()->all()[0]; @@ -271,7 +271,7 @@ public function test_the_dictionary_read_for_the_physical_values_is_not_read_aga public function test_physical_values_of_a_repeated_leaf_are_refused(): void { $stream = new MemorySourceStream(MemoryParquetFile::threeRowGroups()); - $metadata = (new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options()))->footer()->metadata(); + $metadata = new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options())->footer()->metadata(); $reader = new ColumnReader( new SelectedPages( new ColumnChunkReader(new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options()), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/PageRunTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/PageRunTest.php index 24497f539f..fdc8d9632f 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/PageRunTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/PageRunTest.php @@ -12,7 +12,7 @@ final class PageRunTest extends TestCase { public function test_an_extended_run_keeps_its_start(): void { - $run = (new PageRun(100, 120))->extendedTo(150); + $run = new PageRun(100, 120)->extendedTo(150); static::assertSame([100, 150, 50], [$run->start, $run->end, $run->length]); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/PageValuesDecoderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/PageValuesDecoderTest.php index 51511305dd..c17596e29a 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/PageValuesDecoderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/PageValuesDecoderTest.php @@ -32,7 +32,7 @@ public function test_a_dictionary_page_without_values_reads_nothing(): void static::assertSame( [], iterator_to_array( - (new PageValuesDecoder())->decode( + new PageValuesDecoder()->decode( $reader, FlatColumn::string('s', Repetition::REQUIRED), Encodings::RLE_DICTIONARY, @@ -50,8 +50,8 @@ public function test_decodes_delta_binary_packed_int32_wrapping_at_32_bits(): vo $values = [-2147483648, 2147483647, 0, -1, 1]; static::assertSame($values, iterator_to_array( - (new PageValuesDecoder())->decode( - new BinaryBufferReader((new DeltaBinaryPackedEncoder(physicalType: PhysicalType::INT32))->encode( + new PageValuesDecoder()->decode( + new BinaryBufferReader(new DeltaBinaryPackedEncoder(physicalType: PhysicalType::INT32)->encode( $values, )), FlatColumn::int32('i', Repetition::REQUIRED), @@ -67,8 +67,8 @@ public function test_decodes_delta_byte_array(): void static::assertSame( ['axis', 'axle'], iterator_to_array( - (new PageValuesDecoder())->decode( - new BinaryBufferReader((new DeltaByteArrayEncoder())->encode(['axis', 'axle'])), + new PageValuesDecoder()->decode( + new BinaryBufferReader(new DeltaByteArrayEncoder()->encode(['axis', 'axle'])), FlatColumn::fixedSizeByteArray('f', 4, Repetition::REQUIRED), Encodings::DELTA_BYTE_ARRAY, 2, @@ -83,8 +83,8 @@ public function test_decodes_delta_length_byte_array(): void static::assertSame( ['a', ''], iterator_to_array( - (new PageValuesDecoder())->decode( - new BinaryBufferReader((new DeltaLengthByteArrayEncoder())->encode(['a', ''])), + new PageValuesDecoder()->decode( + new BinaryBufferReader(new DeltaLengthByteArrayEncoder()->encode(['a', ''])), FlatColumn::string('s', Repetition::REQUIRED), Encodings::DELTA_LENGTH_BYTE_ARRAY, 2, @@ -99,8 +99,8 @@ public function test_decodes_dictionary_indices_to_values_and_unknown_indices_to static::assertSame( ['b', 'a', null], iterator_to_array( - (new PageValuesDecoder())->decode( - new BinaryBufferReader((new RLEBitPackedPacker(new RLEBitPackedHybrid()))->packWithBitWidth(2, [ + new PageValuesDecoder()->decode( + new BinaryBufferReader(new RLEBitPackedPacker(new RLEBitPackedHybrid())->packWithBitWidth(2, [ 1, 0, 2, @@ -124,7 +124,7 @@ public function test_decodes_plain(): void static::assertSame( [7, -3], iterator_to_array( - (new PageValuesDecoder())->decode( + new PageValuesDecoder()->decode( new BinaryBufferReader($storage->getBuffer()), $column, Encodings::PLAIN, @@ -144,7 +144,7 @@ public function test_decodes_rle_booleans(): void static::assertSame( [true, false, true], iterator_to_array( - (new PageValuesDecoder())->decode( + new PageValuesDecoder()->decode( new BinaryBufferReader($storage->getBuffer()), $column, Encodings::RLE, @@ -160,8 +160,8 @@ public function test_delta_binary_packed_rejects_a_string_column(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Delta encoding only supports INT32 and INT64 physical types'); - iterator_to_array((new PageValuesDecoder())->decode( - new BinaryBufferReader((new DeltaBinaryPackedEncoder())->encode([1])), + iterator_to_array(new PageValuesDecoder()->decode( + new BinaryBufferReader(new DeltaBinaryPackedEncoder()->encode([1])), FlatColumn::string('s', Repetition::REQUIRED), Encodings::DELTA_BINARY_PACKED, 1, @@ -175,8 +175,8 @@ public function test_delta_byte_array_rejects_a_fixed_len_byte_array_value_of_th "DELTA_BYTE_ARRAY value 1 of FIXED_LEN_BYTE_ARRAY column 'f' has 3 bytes, expected 4", ); - iterator_to_array((new PageValuesDecoder())->decode( - new BinaryBufferReader((new DeltaByteArrayEncoder())->encode(['abcd', 'abc'])), + iterator_to_array(new PageValuesDecoder()->decode( + new BinaryBufferReader(new DeltaByteArrayEncoder()->encode(['abcd', 'abc'])), FlatColumn::fixedSizeByteArray('f', 4, Repetition::REQUIRED), Encodings::DELTA_BYTE_ARRAY, 2, @@ -190,8 +190,8 @@ public function test_delta_byte_array_rejects_an_int32_column(): void 'DELTA_BYTE_ARRAY encoding only supports BYTE_ARRAY and FIXED_LEN_BYTE_ARRAY physical types', ); - iterator_to_array((new PageValuesDecoder())->decode( - new BinaryBufferReader((new DeltaByteArrayEncoder())->encode(['a'])), + iterator_to_array(new PageValuesDecoder()->decode( + new BinaryBufferReader(new DeltaByteArrayEncoder()->encode(['a'])), FlatColumn::int32('i', Repetition::REQUIRED), Encodings::DELTA_BYTE_ARRAY, 1, @@ -203,8 +203,8 @@ public function test_delta_length_byte_array_rejects_an_int32_column(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('DELTA_LENGTH_BYTE_ARRAY encoding only supports BYTE_ARRAY physical type'); - iterator_to_array((new PageValuesDecoder())->decode( - new BinaryBufferReader((new DeltaLengthByteArrayEncoder())->encode(['a'])), + iterator_to_array(new PageValuesDecoder()->decode( + new BinaryBufferReader(new DeltaLengthByteArrayEncoder()->encode(['a'])), FlatColumn::int32('i', Repetition::REQUIRED), Encodings::DELTA_LENGTH_BYTE_ARRAY, 1, @@ -216,7 +216,7 @@ public function test_rle_on_a_non_boolean_column_is_not_supported(): void $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Encoding RLE not supported'); - iterator_to_array((new PageValuesDecoder())->decode( + iterator_to_array(new PageValuesDecoder()->decode( new BinaryBufferReader("\x00\x00\x00\x00"), FlatColumn::int32('i', Repetition::REQUIRED), Encodings::RLE, diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/Pruning/BloomFilterPrunerTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/Pruning/BloomFilterPrunerTest.php index b28043f7c6..226ea632ba 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/Pruning/BloomFilterPrunerTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/Pruning/BloomFilterPrunerTest.php @@ -37,7 +37,7 @@ public function test_a_group_whose_filter_lacks_the_literal_is_dropped_and_match new RowSelection(new RowSelector(2, true), new RowSelector(2, false), new RowSelector(2, true)), $matched, ), - (new BloomFilterPruner(new MetadataRowGroupChunks($footer->metadata()), $indexes))->prune( + new BloomFilterPruner(new MetadataRowGroupChunks($footer->metadata()), $indexes)->prune( BoundFilter::bind(parquet_column('id')->equals(4), $footer->schema(), new Options()), new PrunedRows(RowSelection::all(6), $matched), ), @@ -53,10 +53,10 @@ public function test_no_filter_is_read_for_a_range_predicate(): void ]]); $rows = new PrunedRows(RowSelection::all(4), RowSelection::none(4)); - static::assertEquals($rows, (new BloomFilterPruner( + static::assertEquals($rows, new BloomFilterPruner( new MetadataRowGroupChunks($footer->metadata()), $indexes, - ))->prune(BoundFilter::bind(parquet_column('id')->greaterThan(4), $footer->schema(), new Options()), $rows)); + )->prune(BoundFilter::bind(parquet_column('id')->greaterThan(4), $footer->schema(), new Options()), $rows)); static::assertSame([], $indexes->reads); } @@ -73,7 +73,7 @@ public function test_a_group_selecting_no_row_or_matched_already_reads_no_filter static::assertEquals( new PrunedRows($matched, $matched), - (new BloomFilterPruner(new MetadataRowGroupChunks($footer->metadata()), $indexes))->prune( + new BloomFilterPruner(new MetadataRowGroupChunks($footer->metadata()), $indexes)->prune( BoundFilter::bind(parquet_column('id')->equals(4), $footer->schema(), new Options()), new PrunedRows($selected, $matched), ), diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/SelectedPagesTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/SelectedPagesTest.php index 68b0bc6e35..1af85f3e47 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/SelectedPagesTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/SelectedPagesTest.php @@ -29,27 +29,22 @@ final class SelectedPagesTest extends TestCase public function test_only_the_pages_holding_a_selected_row_are_yielded_with_their_rows(): void { $bytes = MemoryParquetFile::pagedColumns(); - $footer = (new PhpParquetFileReader( + $footer = new PhpParquetFileReader( new MemorySourceStream($bytes), ByteOrder::LITTLE_ENDIAN, new Options(), - ))->footer(); + )->footer(); $indexes = new StreamIndexes($footer, new MemorySourceStream($bytes)); $id = $footer->metadata()->schema()->getFlat('id'); $stream = new ReadCountingSourceStream(new MemorySourceStream($bytes)); $offsetIndex = $indexes->offsetIndex(0, $id) ?? static::fail('No offset index'); - $pages = iterator_to_array((new SelectedPages( + $pages = iterator_to_array(new SelectedPages( new ColumnChunkReader(new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options()), - ))->read( - $id, - $footer->metadata()->rowGroups()->all()[0], - 0, - $stream, - RowSelection::window(12, 3, 2), - $indexes, - ['pages' => [], 'dictionary' => null], - )); + )->read($id, $footer->metadata()->rowGroups()->all()[0], 0, $stream, RowSelection::window(12, 3, 2), $indexes, [ + 'pages' => [], + 'dictionary' => null, + ])); static::assertSame( [2 => [[2, 3], 1], 4 => [[4, 5], 1]], @@ -67,20 +62,20 @@ public function test_only_the_pages_holding_a_selected_row_are_yielded_with_thei public function test_trimmed_pages_hold_only_the_selected_rows(): void { $bytes = MemoryParquetFile::pagedColumns(); - $footer = (new PhpParquetFileReader( + $footer = new PhpParquetFileReader( new MemorySourceStream($bytes), ByteOrder::LITTLE_ENDIAN, new Options(), - ))->footer(); + )->footer(); $stream = new MemorySourceStream($bytes); static::assertSame( [[3], [4]], array_map( static fn(ReadFlatColumnValues $page): array => $page->rawValues(), - iterator_to_array((new SelectedPages( + iterator_to_array(new SelectedPages( new ColumnChunkReader(new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options()), - ))->trimmed( + )->trimmed( $footer->metadata()->schema()->getFlat('id'), $footer->metadata()->rowGroups()->all()[0], 0, @@ -96,11 +91,11 @@ public function test_trimmed_pages_hold_only_the_selected_rows(): void public function test_a_decoded_page_is_served_and_only_the_other_selected_page_read(): void { $bytes = MemoryParquetFile::pagedColumns(); - $footer = (new PhpParquetFileReader( + $footer = new PhpParquetFileReader( new MemorySourceStream($bytes), ByteOrder::LITTLE_ENDIAN, new Options(), - ))->footer(); + )->footer(); $indexes = new StreamIndexes($footer, new MemorySourceStream($bytes)); $id = $footer->metadata()->schema()->getFlat('id'); $stream = new ReadCountingSourceStream(new MemorySourceStream($bytes)); @@ -109,9 +104,9 @@ public function test_a_decoded_page_is_served_and_only_the_other_selected_page_r [[50], [6]], array_map( static fn(ReadFlatColumnValues $page): array => $page->rawValues(), - iterator_to_array((new SelectedPages( + iterator_to_array(new SelectedPages( new ColumnChunkReader(new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options()), - ))->trimmed( + )->trimmed( $id, $footer->metadata()->rowGroups()->all()[0], 0, @@ -131,16 +126,16 @@ public function test_a_decoded_page_is_served_and_only_the_other_selected_page_r public function test_when_every_selected_page_is_decoded_nothing_is_read_and_the_given_dictionary_returned(): void { $bytes = MemoryParquetFile::pagedColumns(); - $footer = (new PhpParquetFileReader( + $footer = new PhpParquetFileReader( new MemorySourceStream($bytes), ByteOrder::LITTLE_ENDIAN, new Options(), - ))->footer(); + )->footer(); $stream = new ReadCountingSourceStream(new MemorySourceStream($bytes)); - $pages = (new SelectedPages( + $pages = new SelectedPages( new ColumnChunkReader(new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options()), - ))->read( + )->read( $footer->metadata()->schema()->getFlat('word'), $footer->metadata()->rowGroups()->all()[0], 0, @@ -166,7 +161,7 @@ public function test_when_every_selected_page_is_decoded_nothing_is_read_and_the public function test_without_an_offset_index_the_decoded_pages_are_served_alone(): void { $bytes = MemoryParquetFile::pagedColumns(); - $metadata = (new PhpParquetFileReader(new MemorySourceStream($bytes), ByteOrder::LITTLE_ENDIAN, new Options())) + $metadata = new PhpParquetFileReader(new MemorySourceStream($bytes), ByteOrder::LITTLE_ENDIAN, new Options()) ->footer() ->metadata(); $stream = new ReadCountingSourceStream(new MemorySourceStream($bytes)); @@ -175,9 +170,9 @@ public function test_without_an_offset_index_the_decoded_pages_are_served_alone( [[40, 50], [60]], array_map( static fn(ReadFlatColumnValues $page): array => $page->rawValues(), - iterator_to_array((new SelectedPages( + iterator_to_array(new SelectedPages( new ColumnChunkReader(new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options()), - ))->trimmed( + )->trimmed( $metadata->schema()->getFlat('id'), $metadata->rowGroups()->all()[0], 0, @@ -200,14 +195,14 @@ public function test_without_an_offset_index_the_decoded_pages_are_served_alone( public function test_a_row_group_decoding_more_rows_than_its_selection_is_refused(): void { $stream = new MemorySourceStream(MemoryParquetFile::threeRowGroups()); - $metadata = (new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options()))->footer()->metadata(); + $metadata = new PhpParquetFileReader($stream, ByteOrder::LITTLE_ENDIAN, new Options())->footer()->metadata(); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Row group 0 decodes more than the 1 rows its metadata declares'); - iterator_to_array((new SelectedPages( + iterator_to_array(new SelectedPages( new ColumnChunkReader(new PageReader(ByteOrder::LITTLE_ENDIAN, new Options()), new Options()), - ))->read( + )->read( $metadata->schema()->getFlat('id'), $metadata->rowGroups()->all()[0], 0, diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/SkippedMatchesTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/SkippedMatchesTest.php index 406cfb6939..193e17c07c 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/SkippedMatchesTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Reader/SkippedMatchesTest.php @@ -12,7 +12,7 @@ final class SkippedMatchesTest extends TestCase { public function test_it_carries_the_matches_skipped(): void { - static::assertSame(3, (new SkippedMatches(3))->count); + static::assertSame(3, new SkippedMatches(3)->count); } public function test_a_negative_count_is_refused(): void diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ReaderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ReaderTest.php index 627e0732df..97f9c21c5a 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ReaderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/ReaderTest.php @@ -21,7 +21,7 @@ public function test_the_default_engine_is_adaptive(): void static::assertInstanceOf( AdaptiveParquetEngine::class, - (new ReflectionClass($reader)) + new ReflectionClass($reader) ->getProperty('engine') ->getValue($reader), ); @@ -33,7 +33,7 @@ public function test_php_factory_creates_reader_with_php_engine(): void static::assertInstanceOf( PhpParquetEngine::class, - (new ReflectionClass($reader)) + new ReflectionClass($reader) ->getProperty('engine') ->getValue($reader), ); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnChunkBuilder/FlatColumnChunkBuilderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnChunkBuilder/FlatColumnChunkBuilderTest.php index 2cb99deb27..a5b607f3a2 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnChunkBuilder/FlatColumnChunkBuilderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnChunkBuilder/FlatColumnChunkBuilderTest.php @@ -1187,7 +1187,7 @@ public function test_delta_binary_packed_storage_is_full_at_its_plain_size( PhysicalType $type, int $valuesToFill, ): void { - $options = (new Options())->set(Option::PAGE_SIZE_BYTES, 100)->set(Option::WRITER_VERSION, 2); + $options = new Options()->set(Option::PAGE_SIZE_BYTES, 100)->set(Option::WRITER_VERSION, 2); $column = new FlatColumn('test_col', $type); $builder = new FlatColumnChunkBuilder( $column, @@ -1211,7 +1211,7 @@ public function test_delta_binary_packed_storage_is_full_at_its_plain_size( #[DataProvider('compression_types_provider')] public function test_delta_binary_packed_storage_writes_with_every_compression(Compressions $compression): void { - $options = (new Options())->set(Option::WRITER_VERSION, 2); + $options = new Options()->set(Option::WRITER_VERSION, 2); $column = FlatColumn::int32('test_col'); $builder = new FlatColumnChunkBuilder( $column, @@ -1235,7 +1235,7 @@ public function test_pages_carry_the_storage_encoding( bool|int|string $value, int $writerVersion, ): void { - $options = (new Options())->set(Option::WRITER_VERSION, $writerVersion); + $options = new Options()->set(Option::WRITER_VERSION, $writerVersion); $builder = new FlatColumnChunkBuilder( $column, $options, diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilderTest.php index 35cb36108a..1486d0e885 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnChunkBuilder/RLEDictionaryChunkBuilderTest.php @@ -268,7 +268,7 @@ public function test_a_chunk_of_nulls_writes_an_empty_dictionary_page(): void public function test_a_chunk_where_every_page_overflowed_writes_no_dictionary_page(): void { $column = FlatColumn::string('test_col'); - $options = (new Options())->set(Option::DICTIONARY_PAGE_SIZE, 1); + $options = new Options()->set(Option::DICTIONARY_PAGE_SIZE, 1); $builder = new RLEDictionaryChunkBuilder( $column, $options, @@ -300,7 +300,7 @@ public function test_an_all_null_page_writes_the_bit_width_byte(): void $builder->addColumn(new WriteFlatColumnValues($column, [0, 0], [0, 0], [])); static::assertStringEndsWith( - (new RLEBitPackedPacker(new RLEBitPackedHybrid()))->packWithLength(1, [0, 0]) . "\x00", + new RLEBitPackedPacker(new RLEBitPackedHybrid())->packWithLength(1, [0, 0]) . "\x00", $builder->flush(4)[0]->binaryBuffer, ); } @@ -1122,7 +1122,7 @@ public function test_overflow_pages_use_the_fallback_storage_encoding( bool $indexed, ): void { $column = FlatColumn::string('test_col'); - $options = (new Options())->set(Option::DICTIONARY_PAGE_SIZE, 1); + $options = new Options()->set(Option::DICTIONARY_PAGE_SIZE, 1); $builder = new RLEDictionaryChunkBuilder( $column, $options, diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnChunkBuildersTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnChunkBuildersTest.php index d9ce3bf451..a4dc6fcb58 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnChunkBuildersTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnChunkBuildersTest.php @@ -40,7 +40,7 @@ public function test_bloom_filters_hold_the_non_null_values_of_the_columns_asked $schema = Schema::with($id, NestedColumn::struct('address', [$city]), FlatColumn::int64('other')); $builders = ColumnChunkBuilders::initialize( $schema, - (new Options())->set(Option::COLUMNS_BLOOM_FILTERS, [ + new Options()->set(Option::COLUMNS_BLOOM_FILTERS, [ 'id' => new BloomFilterOptions(), 'address.city' => new BloomFilterOptions(), ]), @@ -59,15 +59,15 @@ public function test_bloom_filters_hold_the_non_null_values_of_the_columns_asked $bloomFilters[$container->columnChunk->flatPath()] = $container->bloomFilter; } - static::assertTrue($bloomFilters['id']?->check((new BloomHash())->of($id, 7))); - static::assertTrue($bloomFilters['address.city']?->check((new BloomHash())->of($city, 'Oslo'))); + static::assertTrue($bloomFilters['id']?->check(new BloomHash()->of($id, 7))); + static::assertTrue($bloomFilters['address.city']?->check(new BloomHash()->of($city, 'Oslo'))); static::assertNull($bloomFilters['other']); foreach ($builders->flush(4) as $container) { $bloomFilters[$container->columnChunk->flatPath()] = $container->bloomFilter; } - static::assertFalse($bloomFilters['id']?->check((new BloomHash())->of($id, 7))); + static::assertFalse($bloomFilters['id']?->check(new BloomHash()->of($id, 7))); } public function test_a_chunk_without_a_non_null_value_gets_one_empty_block(): void @@ -75,7 +75,7 @@ public function test_a_chunk_without_a_non_null_value_gets_one_empty_block(): vo $schema = Schema::with(FlatColumn::int64('id')); $builders = ColumnChunkBuilders::initialize( $schema, - (new Options())->set(Option::COLUMNS_BLOOM_FILTERS, ['id' => new BloomFilterOptions()]), + new Options()->set(Option::COLUMNS_BLOOM_FILTERS, ['id' => new BloomFilterOptions()]), Compressions::UNCOMPRESSED, ); $ids = new WriteFlatColumnValues($schema->getFlat('id'), [0], [0], []); @@ -93,7 +93,7 @@ public function test_a_bloom_filter_option_that_is_not_bloom_filter_options_is_r ColumnChunkBuilders::initialize( Schema::with(FlatColumn::int64('id')), - (new Options())->set(Option::COLUMNS_BLOOM_FILTERS, ['id' => 0.05]), + new Options()->set(Option::COLUMNS_BLOOM_FILTERS, ['id' => 0.05]), Compressions::UNCOMPRESSED, ); } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnEncodingPolicyTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnEncodingPolicyTest.php index f6a4247a5c..3c61fef0d3 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnEncodingPolicyTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnEncodingPolicyTest.php @@ -103,13 +103,13 @@ public function test_a_column_without_a_requested_encoding_gets_the_default( ): void { static::assertSame( $encoding, - (new ColumnEncodingPolicy($writerVersion, $dictionaryEnabled))->encodingFor($column), + new ColumnEncodingPolicy($writerVersion, $dictionaryEnabled)->encodingFor($column), ); } public function test_a_requested_dictionary_wins_over_a_disabled_dictionary(): void { - static::assertSame(Encodings::RLE_DICTIONARY, (new ColumnEncodingPolicy(1, false))->encodingFor( + static::assertSame(Encodings::RLE_DICTIONARY, new ColumnEncodingPolicy(1, false)->encodingFor( FlatColumn::string('c'), Encodings::RLE_DICTIONARY, )); @@ -117,7 +117,7 @@ public function test_a_requested_dictionary_wins_over_a_disabled_dictionary(): v public function test_a_requested_encoding_the_column_takes_is_kept(): void { - static::assertSame(Encodings::DELTA_LENGTH_BYTE_ARRAY, (new ColumnEncodingPolicy(1))->encodingFor( + static::assertSame(Encodings::DELTA_LENGTH_BYTE_ARRAY, new ColumnEncodingPolicy(1)->encodingFor( FlatColumn::string('c'), Encodings::DELTA_LENGTH_BYTE_ARRAY, )); @@ -133,7 +133,7 @@ public function test_a_requested_encoding_the_column_cannot_take_is_refused( $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage($message); - (new ColumnEncodingPolicy($writerVersion))->encodingFor($column, $encoding); + new ColumnEncodingPolicy($writerVersion)->encodingFor($column, $encoding); } public function test_fallback_encodings_follow_arrow_rs(): void diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnListsTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnListsTest.php index 172206a034..90e9482338 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnListsTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ColumnListsTest.php @@ -12,13 +12,13 @@ final class ColumnListsTest extends TestCase { public function test_the_length_every_list_has(): void { - static::assertSame(2, (new ColumnLists())->length(['id' => [1, 2], 'name' => ['a', null]])); - static::assertSame(0, (new ColumnLists())->length(['id' => [], 'name' => []])); + static::assertSame(2, new ColumnLists()->length(['id' => [1, 2], 'name' => ['a', null]])); + static::assertSame(0, new ColumnLists()->length(['id' => [], 'name' => []])); } public function test_no_lists_hold_no_rows(): void { - static::assertSame(0, (new ColumnLists())->length([])); + static::assertSame(0, new ColumnLists()->length([])); } public function test_lists_of_different_lengths_are_refused_with_every_length(): void @@ -26,6 +26,6 @@ public function test_lists_of_different_lengths_are_refused_with_every_length(): $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('writeColumns() takes lists of one length, got "id": 3, "name": 2, "tags": 3'); - (new ColumnLists())->length(['id' => [1, 2, 3], 'name' => ['a', 'b'], 'tags' => [[], [], []]]); + new ColumnLists()->length(['id' => [1, 2, 3], 'name' => ['a', 'b'], 'tags' => [[], [], []]]); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/ObjectDictionaryBuilderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/ObjectDictionaryBuilderTest.php index aaa269213e..dfc053c5fc 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/ObjectDictionaryBuilderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/PageBuilder/DictionaryBuilder/ObjectDictionaryBuilderTest.php @@ -91,7 +91,7 @@ public function test_date_interval_negative_values(): void { $column = new FlatColumn('test_column', PhysicalType::INT64); $interval1 = new DateInterval('P1D'); - $interval2 = (new DateTimeImmutable('2023-01-02'))->diff(new DateTimeImmutable('2023-01-01')); + $interval2 = new DateTimeImmutable('2023-01-02')->diff(new DateTimeImmutable('2023-01-01')); $data = new WriteFlatColumnValues($column, values: [$interval1, $interval2, $interval1]); $result = $this->builder->build($data); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/RowGroupBuilderTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/RowGroupBuilderTest.php index f92805cdbd..ad5ebeae5e 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/RowGroupBuilderTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/RowGroupBuilderTest.php @@ -398,7 +398,7 @@ public function test_page_check_interval_triggers_page_closing(int $interval): v public function test_pages_close_at_the_maximum_rows_count(): void { - $options = (new Options())->set(Option::PAGE_MAXIMUM_ROWS_COUNT, 10)->set(Option::PAGE_SIZE_CHECK_INTERVAL, 5); + $options = new Options()->set(Option::PAGE_MAXIMUM_ROWS_COUNT, 10)->set(Option::PAGE_SIZE_CHECK_INTERVAL, 5); $builder = new RowGroupBuilder( Schema::with(FlatColumn::int32('id')), Compressions::UNCOMPRESSED, @@ -419,7 +419,7 @@ public function test_pages_close_at_the_maximum_rows_count(): void public function test_a_flushed_row_group_counts_the_next_groups_page_rows_from_zero(): void { - $options = (new Options())->set(Option::PAGE_MAXIMUM_ROWS_COUNT, 10)->set(Option::PAGE_SIZE_CHECK_INTERVAL, 5); + $options = new Options()->set(Option::PAGE_MAXIMUM_ROWS_COUNT, 10)->set(Option::PAGE_SIZE_CHECK_INTERVAL, 5); $builder = new RowGroupBuilder( Schema::with(FlatColumn::int32('id')), Compressions::UNCOMPRESSED, @@ -442,7 +442,7 @@ public function test_a_flushed_row_group_counts_the_next_groups_page_rows_from_z public function test_a_row_group_is_full_at_the_maximum_rows_count(): void { - $options = (new Options())->set(Option::ROW_GROUP_MAXIMUM_ROWS_COUNT, 3); + $options = new Options()->set(Option::ROW_GROUP_MAXIMUM_ROWS_COUNT, 3); $builder = new RowGroupBuilder( Schema::with(FlatColumn::int32('id')), Compressions::UNCOMPRESSED, @@ -465,7 +465,7 @@ public function test_a_row_group_is_full_at_the_maximum_rows_count(): void #[TestWith([-1])] public function test_a_row_group_maximum_rows_count_below_one_is_refused(int $rows): void { - $options = (new Options())->set(Option::ROW_GROUP_MAXIMUM_ROWS_COUNT, $rows); + $options = new Options()->set(Option::ROW_GROUP_MAXIMUM_ROWS_COUNT, $rows); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ROW_GROUP_MAXIMUM_ROWS_COUNT must be greater than 0, ' . $rows . ' given'); @@ -482,7 +482,7 @@ public function test_a_row_group_maximum_rows_count_below_one_is_refused(int $ro #[TestWith([-1])] public function test_a_page_maximum_rows_count_below_one_is_refused(int $rows): void { - $options = (new Options())->set(Option::PAGE_MAXIMUM_ROWS_COUNT, $rows); + $options = new Options()->set(Option::PAGE_MAXIMUM_ROWS_COUNT, $rows); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('PAGE_MAXIMUM_ROWS_COUNT must be greater than 0, ' . $rows . ' given'); @@ -499,7 +499,7 @@ public function test_a_page_maximum_rows_count_below_one_is_refused(int $rows): #[TestWith([-1])] public function test_a_row_group_size_below_one_byte_is_refused(int $bytes): void { - $options = (new Options())->set(Option::ROW_GROUP_SIZE_BYTES, $bytes); + $options = new Options()->set(Option::ROW_GROUP_SIZE_BYTES, $bytes); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('ROW_GROUP_SIZE_BYTES must be greater than 0, ' . $bytes . ' given'); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/StatisticsOptionsTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/StatisticsOptionsTest.php index 8fdc40e3de..cf1e27371c 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/StatisticsOptionsTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/StatisticsOptionsTest.php @@ -25,7 +25,7 @@ public function test_chunk_statistics_are_written_unless_the_level_is_none(): vo [StatisticsLevel::CHUNK, true], [StatisticsLevel::PAGE, true], ] as [$level, $written]) { - $statistics = StatisticsOptions::fromOptions((new Options())->set(Option::STATISTICS_LEVEL, $level)); + $statistics = StatisticsOptions::fromOptions(new Options()->set(Option::STATISTICS_LEVEL, $level)); $counter = $statistics->counter($id); $counter->addBatch([1]); @@ -39,7 +39,7 @@ public function test_page_header_statistics_need_the_page_level_and_the_option() $options = static fn( StatisticsLevel $level, bool $header, - ): StatisticsOptions => StatisticsOptions::fromOptions((new Options())->set( + ): StatisticsOptions => StatisticsOptions::fromOptions(new Options()->set( Option::STATISTICS_LEVEL, $level, )->set(Option::PAGE_HEADER_STATISTICS, $header)); @@ -54,7 +54,7 @@ public function test_page_header_statistics_need_the_page_level_and_the_option() public function test_each_page_index_is_new_and_truncates_to_the_column_index_length(): void { $name = FlatColumn::string('name'); - $statistics = StatisticsOptions::fromOptions((new Options())->set(Option::COLUMN_INDEX_TRUNCATE_LENGTH, 4)); + $statistics = StatisticsOptions::fromOptions(new Options()->set(Option::COLUMN_INDEX_TRUNCATE_LENGTH, 4)); $page = $statistics->counter($name); $page->addBatch([str_repeat('a', 10)]); $first = $statistics->pageIndex($name); @@ -70,6 +70,6 @@ public function test_a_column_index_truncate_length_below_one_is_refused(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('COLUMN_INDEX_TRUNCATE_LENGTH must be greater than 0, 0 given'); - StatisticsOptions::fromOptions((new Options())->set(Option::COLUMN_INDEX_TRUNCATE_LENGTH, 0)); + StatisticsOptions::fromOptions(new Options()->set(Option::COLUMN_INDEX_TRUNCATE_LENGTH, 0)); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/StatisticsTruncationTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/StatisticsTruncationTest.php index 0aaf5e25ca..ff76e4289a 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/StatisticsTruncationTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/StatisticsTruncationTest.php @@ -121,7 +121,7 @@ public static function untouched(): Generator #[DataProvider('increment_utf8')] public function test_increment_utf8(string $prefix, string $expected): void { - static::assertSame($expected, (new StatisticsTruncation(strlen($prefix)))->max( + static::assertSame($expected, new StatisticsTruncation(strlen($prefix))->max( FlatColumn::string('s'), $prefix . 'x', )); @@ -150,14 +150,14 @@ public function test_not_incrementable_utf8_max_stays_whole(string $prefix): voi { $value = $prefix . 'x'; - static::assertSame($value, (new StatisticsTruncation(strlen($prefix)))->max(FlatColumn::string('s'), $value)); + static::assertSame($value, new StatisticsTruncation(strlen($prefix))->max(FlatColumn::string('s'), $value)); } public function test_not_incrementable_binary_max_stays_whole(): void { $value = "\xff\xff\xff\x00"; - static::assertSame($value, (new StatisticsTruncation(3))->max( + static::assertSame($value, new StatisticsTruncation(3)->max( new FlatColumn('b', PhysicalType::BYTE_ARRAY), $value, )); diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/BooleanValueStorageTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/BooleanValueStorageTest.php index 9ed06a63d7..b8915fca5a 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/BooleanValueStorageTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/BooleanValueStorageTest.php @@ -16,7 +16,7 @@ final class BooleanValueStorageTest extends TestCase { public function test_encoding(): void { - static::assertSame(Encodings::PLAIN, (new BooleanValueStorage())->encoding()); + static::assertSame(Encodings::PLAIN, new BooleanValueStorage()->encoding()); } /** diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/BufferValueStorageTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/BufferValueStorageTest.php index fc8e69ed6b..80ef46cb1f 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/BufferValueStorageTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/BufferValueStorageTest.php @@ -12,6 +12,6 @@ final class BufferValueStorageTest extends TestCase { public function test_encoding(): void { - static::assertSame(Encodings::PLAIN, (new BufferValueStorage())->encoding()); + static::assertSame(Encodings::PLAIN, new BufferValueStorage()->encoding()); } } diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/DeltaBinaryPackedValueStorageTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/DeltaBinaryPackedValueStorageTest.php index 73dd725c85..1c4adb8b5c 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/DeltaBinaryPackedValueStorageTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/DeltaBinaryPackedValueStorageTest.php @@ -15,7 +15,7 @@ final class DeltaBinaryPackedValueStorageTest extends TestCase { public function test_encoding(): void { - static::assertSame(Encodings::DELTA_BINARY_PACKED, (new DeltaBinaryPackedValueStorage())->encoding()); + static::assertSame(Encodings::DELTA_BINARY_PACKED, new DeltaBinaryPackedValueStorage()->encoding()); } public function test_get_buffer_encodes_non_null_values(): void @@ -23,12 +23,12 @@ public function test_get_buffer_encodes_non_null_values(): void $storage = new DeltaBinaryPackedValueStorage(); $storage->addValues(FlatColumn::int32('c'), [1, null, 2]); - static::assertSame((new DeltaBinaryPackedEncoder())->encode([1, 2]), $storage->getBuffer()); + static::assertSame(new DeltaBinaryPackedEncoder()->encode([1, 2]), $storage->getBuffer()); } public function test_get_buffer_without_values_is_an_empty_stream_header(): void { - static::assertSame("\x80\x01\x04\x00\x00", (new DeltaBinaryPackedValueStorage())->getBuffer()); + static::assertSame("\x80\x01\x04\x00\x00", new DeltaBinaryPackedValueStorage()->getBuffer()); } public function test_rejects_a_non_integer_value(): void @@ -36,7 +36,7 @@ public function test_rejects_a_non_integer_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Delta encoding requires integer values, got string'); - (new DeltaBinaryPackedValueStorage())->addValues(FlatColumn::int32('c'), ['1']); + new DeltaBinaryPackedValueStorage()->addValues(FlatColumn::int32('c'), ['1']); } public function test_rejects_a_non_integer_column(): void @@ -44,7 +44,7 @@ public function test_rejects_a_non_integer_column(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Delta encoding only supports INT32 and INT64 physical types'); - (new DeltaBinaryPackedValueStorage())->addValues(FlatColumn::string('c'), ['a']); + new DeltaBinaryPackedValueStorage()->addValues(FlatColumn::string('c'), ['a']); } public function test_reset_clears_values_and_size(): void diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/DeltaByteArrayValueStorageTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/DeltaByteArrayValueStorageTest.php index 00ea0d867c..f75020034f 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/DeltaByteArrayValueStorageTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/DeltaByteArrayValueStorageTest.php @@ -15,7 +15,7 @@ final class DeltaByteArrayValueStorageTest extends TestCase { public function test_encoding(): void { - static::assertSame(Encodings::DELTA_BYTE_ARRAY, (new DeltaByteArrayValueStorage())->encoding()); + static::assertSame(Encodings::DELTA_BYTE_ARRAY, new DeltaByteArrayValueStorage()->encoding()); } public function test_get_buffer_encodes_non_null_values(): void @@ -23,12 +23,12 @@ public function test_get_buffer_encodes_non_null_values(): void $storage = new DeltaByteArrayValueStorage(); $storage->addValues(FlatColumn::string('c'), ['axis', null, 'axle']); - static::assertSame((new DeltaByteArrayEncoder())->encode(['axis', 'axle']), $storage->getBuffer()); + static::assertSame(new DeltaByteArrayEncoder()->encode(['axis', 'axle']), $storage->getBuffer()); } public function test_get_buffer_without_values_is_two_empty_length_streams(): void { - static::assertSame("\x80\x01\x04\x00\x00\x80\x01\x04\x00\x00", (new DeltaByteArrayValueStorage())->getBuffer()); + static::assertSame("\x80\x01\x04\x00\x00\x80\x01\x04\x00\x00", new DeltaByteArrayValueStorage()->getBuffer()); } public function test_rejects_a_non_byte_array_column(): void @@ -38,7 +38,7 @@ public function test_rejects_a_non_byte_array_column(): void 'DELTA_BYTE_ARRAY encoding only supports BYTE_ARRAY and FIXED_LEN_BYTE_ARRAY physical types', ); - (new DeltaByteArrayValueStorage())->addValues(FlatColumn::int64('c'), [1]); + new DeltaByteArrayValueStorage()->addValues(FlatColumn::int64('c'), [1]); } public function test_rejects_a_non_string_value(): void @@ -46,7 +46,7 @@ public function test_rejects_a_non_string_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('DELTA_BYTE_ARRAY encoding requires string values, got integer'); - (new DeltaByteArrayValueStorage())->addValues(FlatColumn::string('c'), [1]); + new DeltaByteArrayValueStorage()->addValues(FlatColumn::string('c'), [1]); } public function test_reset_clears_values_and_size(): void diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/DeltaLengthByteArrayValueStorageTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/DeltaLengthByteArrayValueStorageTest.php index f21e721cfa..47c84a6f26 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/DeltaLengthByteArrayValueStorageTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/DeltaLengthByteArrayValueStorageTest.php @@ -15,7 +15,7 @@ final class DeltaLengthByteArrayValueStorageTest extends TestCase { public function test_encoding(): void { - static::assertSame(Encodings::DELTA_LENGTH_BYTE_ARRAY, (new DeltaLengthByteArrayValueStorage())->encoding()); + static::assertSame(Encodings::DELTA_LENGTH_BYTE_ARRAY, new DeltaLengthByteArrayValueStorage()->encoding()); } public function test_get_buffer_encodes_non_null_values(): void @@ -23,12 +23,12 @@ public function test_get_buffer_encodes_non_null_values(): void $storage = new DeltaLengthByteArrayValueStorage(); $storage->addValues(FlatColumn::string('c'), ['ab', null, '']); - static::assertSame((new DeltaLengthByteArrayEncoder())->encode(['ab', '']), $storage->getBuffer()); + static::assertSame(new DeltaLengthByteArrayEncoder()->encode(['ab', '']), $storage->getBuffer()); } public function test_get_buffer_without_values_is_an_empty_length_stream(): void { - static::assertSame("\x80\x01\x04\x00\x00", (new DeltaLengthByteArrayValueStorage())->getBuffer()); + static::assertSame("\x80\x01\x04\x00\x00", new DeltaLengthByteArrayValueStorage()->getBuffer()); } public function test_rejects_a_fixed_len_byte_array_column(): void @@ -36,7 +36,7 @@ public function test_rejects_a_fixed_len_byte_array_column(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('DELTA_LENGTH_BYTE_ARRAY encoding only supports BYTE_ARRAY physical type'); - (new DeltaLengthByteArrayValueStorage())->addValues(FlatColumn::fixedSizeByteArray('c', 4), ['abcd']); + new DeltaLengthByteArrayValueStorage()->addValues(FlatColumn::fixedSizeByteArray('c', 4), ['abcd']); } public function test_rejects_a_non_string_value(): void @@ -44,7 +44,7 @@ public function test_rejects_a_non_string_value(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('DELTA_LENGTH_BYTE_ARRAY encoding requires string values, got integer'); - (new DeltaLengthByteArrayValueStorage())->addValues(FlatColumn::string('c'), [1]); + new DeltaLengthByteArrayValueStorage()->addValues(FlatColumn::string('c'), [1]); } public function test_reset_clears_values_and_size(): void diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/RLEBooleanValueStorageTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/RLEBooleanValueStorageTest.php index 9cc2be5251..34888cb13a 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/RLEBooleanValueStorageTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/Writer/ValueStorage/RLEBooleanValueStorageTest.php @@ -18,7 +18,7 @@ final class RLEBooleanValueStorageTest extends TestCase { public function test_encoding(): void { - static::assertSame(Encodings::RLE, (new RLEBooleanValueStorage())->encoding()); + static::assertSame(Encodings::RLE, new RLEBooleanValueStorage()->encoding()); } public function test_get_buffer_is_the_length_prefixed_hybrid_of_the_non_null_values(): void @@ -27,14 +27,14 @@ public function test_get_buffer_is_the_length_prefixed_hybrid_of_the_non_null_va $storage->addValues(FlatColumn::boolean('c'), [true, null, false, true]); static::assertSame( - (new RLEBitPackedPacker(new RLEBitPackedHybrid()))->packWithLength(1, [1, 0, 1]), + new RLEBitPackedPacker(new RLEBitPackedHybrid())->packWithLength(1, [1, 0, 1]), $storage->getBuffer(), ); } public function test_get_buffer_without_values_is_an_empty_run(): void { - static::assertSame("\x00\x00\x00\x00", (new RLEBooleanValueStorage())->getBuffer()); + static::assertSame("\x00\x00\x00\x00", new RLEBooleanValueStorage()->getBuffer()); } public function test_reset_clears_the_values(): void diff --git a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/WriterTest.php b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/WriterTest.php index e3bf3233d2..58c283e2b7 100644 --- a/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/WriterTest.php +++ b/src/lib/parquet/tests/Flow/Parquet/Tests/Unit/WriterTest.php @@ -18,7 +18,7 @@ public function test_the_default_engine_writes(): void static::assertInstanceOf( AdaptiveParquetEngine::class, - (new ReflectionClass($writer)) + new ReflectionClass($writer) ->getProperty('engine') ->getValue($writer), ); @@ -30,7 +30,7 @@ public function test_php_factory_creates_writer_with_php_engine(): void static::assertInstanceOf( PhpParquetEngine::class, - (new ReflectionClass($writer)) + new ReflectionClass($writer) ->getProperty('engine') ->getValue($writer), ); diff --git a/src/lib/postgresql/composer.json b/src/lib/postgresql/composer.json index a3da4f38b6..809af335e3 100644 --- a/src/lib/postgresql/composer.json +++ b/src/lib/postgresql/composer.json @@ -11,7 +11,7 @@ "ast" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "flow-php/telemetry": "self.version", "flow-php/types": "self.version", "google/protobuf": "^4.0 || ^5.0", diff --git a/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/CountModifier.php b/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/CountModifier.php index 52e6f3a753..bed964b4f9 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/CountModifier.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/CountModifier.php @@ -28,7 +28,7 @@ public static function nodeClasses(): array public function modify(object $node, ModificationContext $context): int|object|null { if ($node instanceof ParseResult) { - (new ParsedQuery($node))->statements()->assertReadOnlySelect(); + new ParsedQuery($node)->statements()->assertReadOnlySelect(); return null; } @@ -57,9 +57,9 @@ private function removeOrderBy(SelectStmt $stmt): void private function wrapWithCount(SelectStmt $stmt): Node { - return (new Node())->setSelectStmt( + return new Node()->setSelectStmt( select(agg_count()) - ->from((new SubqueryReference((new Node())->setSelectStmt($stmt)))->as('_count_subq')) + ->from(new SubqueryReference(new Node()->setSelectStmt($stmt))->as('_count_subq')) ->toAst(), ); } diff --git a/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/KeysetPaginationModifier.php b/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/KeysetPaginationModifier.php index ea7fd0d366..5b394df8f5 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/KeysetPaginationModifier.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/KeysetPaginationModifier.php @@ -60,7 +60,7 @@ public static function nodeClasses(): array public function modify(object $node, ModificationContext $context): int|object|null { if ($node instanceof ParseResult) { - (new ParsedQuery($node))->statements()->assertReadOnlySelect(); + new ParsedQuery($node)->statements()->assertReadOnlySelect(); return null; } @@ -79,7 +79,7 @@ public function modify(object $node, ModificationContext $context): int|object|n } if ($statement->hasOrderBy()) { - (new KeysetSortClause($this->config->columns))->assertMatches($node->getSortClause()); + new KeysetSortClause($this->config->columns)->assertMatches($node->getSortClause()); } if ($statement->hasSetOperation()) { @@ -265,7 +265,7 @@ private function buildRowComparisonExpr(array $columnRefs, string $operator): No foreach (array_keys($columnRefs) as $index) { $paramRef = new ParamRef(); $paramRef->setNumber($index + 1 + $this->parameterOffset); - $params[] = (new Node())->setParamRef($paramRef); + $params[] = new Node()->setParamRef($paramRef); } $opName = new PBString(); @@ -273,19 +273,19 @@ private function buildRowComparisonExpr(array $columnRefs, string $operator): No $aExpr = new A_Expr(); $aExpr->setKind(A_Expr_Kind::AEXPR_OP); - $aExpr->setName([(new Node())->setString($opName)]); - $aExpr->setLexpr((new Node())->setRowExpr( - (new RowExpr()) + $aExpr->setName([new Node()->setString($opName)]); + $aExpr->setLexpr(new Node()->setRowExpr( + new RowExpr() ->setArgs($columnRefs) ->setRowFormat(CoercionForm::COERCE_IMPLICIT_CAST), )); - $aExpr->setRexpr((new Node())->setRowExpr( - (new RowExpr()) + $aExpr->setRexpr(new Node()->setRowExpr( + new RowExpr() ->setArgs($params) ->setRowFormat(CoercionForm::COERCE_IMPLICIT_CAST), )); - return (new Node())->setAExpr($aExpr); + return new Node()->setAExpr($aExpr); } private function createColumnRef(string $columnName): Node @@ -330,10 +330,10 @@ private function wrapSetOperationWithKeyset(SelectStmt $stmt, ModificationContex } $outerSelect = select(star()) - ->from((new SubqueryReference((new Node())->setSelectStmt($stmt)))->as('_keyset_subq')) + ->from(new SubqueryReference(new Node()->setSelectStmt($stmt))->as('_keyset_subq')) ->toAst(); - if ((new SelectStatement($stmt))->hasOrderBy()) { + if (new SelectStatement($stmt)->hasOrderBy()) { $outerSelect->setSortClause(array_map(static function (Node $sort): Node { $copy = new Node(); $copy->mergeFrom($sort); @@ -347,6 +347,6 @@ private function wrapSetOperationWithKeyset(SelectStmt $stmt, ModificationContex $this->applyLimit($outerSelect); $this->applyCursor($outerSelect, $context); - return (new Node())->setSelectStmt($outerSelect); + return new Node()->setSelectStmt($outerSelect); } } diff --git a/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/KeysetSortClause.php b/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/KeysetSortClause.php index 1be84606b8..f7d77bda66 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/KeysetSortClause.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/KeysetSortClause.php @@ -59,7 +59,7 @@ public function assertMatches(iterable $sortClause): void || $sortBy->getSortbyNulls() !== SortByNulls::SORTBY_NULLS_DEFAULT || $direction !== $key->order || $columnRef === null - || (new Column($columnRef))->name() !== QualifiedIdentifier::parse($key->column)->name() + || new Column($columnRef)->name() !== QualifiedIdentifier::parse($key->column)->name() ) { throw new PaginationException(sprintf( 'Keyset pagination requires ORDER BY item #%d to be the key "%s %s" with no NULLS clause, ordinal, expression or USING', diff --git a/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/OffsetPaginationModifier.php b/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/OffsetPaginationModifier.php index 40749e52e3..2e366311e4 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/OffsetPaginationModifier.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/AST/Transformers/OffsetPaginationModifier.php @@ -37,7 +37,7 @@ public static function nodeClasses(): array public function modify(object $node, ModificationContext $context): int|object|null { if ($node instanceof ParseResult) { - (new ParsedQuery($node))->statements()->assertReadOnlySelect(); + new ParsedQuery($node)->statements()->assertReadOnlySelect(); return null; } @@ -47,11 +47,11 @@ public function modify(object $node, ModificationContext $context): int|object|n return null; } - if ($this->hasOffset() && !(new SelectStatement($node))->hasOrderBy()) { + if ($this->hasOffset() && !new SelectStatement($node)->hasOrderBy()) { throw new PaginationException('OFFSET without ORDER BY produces non-deterministic results'); } - if ((new SelectStatement($node))->hasSetOperation()) { + if (new SelectStatement($node)->hasSetOperation()) { return $this->wrapSetOperationWithPagination($node); } @@ -87,10 +87,10 @@ private function hasOffset(): bool private function wrapSetOperationWithPagination(SelectStmt $stmt): Node { $outerSelect = select(star()) - ->from((new SubqueryReference((new Node())->setSelectStmt($stmt)))->as('_pagination_subq')) + ->from(new SubqueryReference(new Node()->setSelectStmt($stmt))->as('_pagination_subq')) ->toAst(); $this->applyPagination($outerSelect); - return (new Node())->setSelectStmt($outerSelect); + return new Node()->setSelectStmt($outerSelect); } } diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Client/Infrastructure/PgSql/PgSqlClient.php b/src/lib/postgresql/src/Flow/PostgreSql/Client/Infrastructure/PgSql/PgSqlClient.php index 70b0aa998e..7b03adb48c 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Client/Infrastructure/PgSql/PgSqlClient.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Client/Infrastructure/PgSql/PgSqlClient.php @@ -235,7 +235,7 @@ public function describe(Sql|string $sql, array $parameters = []): array return array_map(static fn(array $column): array => [ 'name' => $column['name'], 'type' => column_type_from_string($column['type']), - ], (new ResultColumns())->of($result)); + ], new ResultColumns()->of($result)); } finally { pg_free_result($result); } @@ -262,18 +262,18 @@ public function explain(Sql|string $sql, array $parameters = [], ?ExplainConfig $config ??= ExplainConfig::forAnalysis(); $query = $sql instanceof Sql ? $sql->toSql() : $sql; - $parsed = (new Parser())->parse($query); + $parsed = new Parser()->parse($query); $parsed->traverse(new ExplainModifier($config)); $explainQuery = $parsed->deparse(); if (!$config->analyze) { - return (new ExplainParser())->parse($this->fetchScalarString($explainQuery, $parameters)); + return new ExplainParser()->parse($this->fetchScalarString($explainQuery, $parameters)); } $this->beginTransaction(); try { - return (new ExplainParser())->parse($this->fetchScalarString($explainQuery, $parameters)); + return new ExplainParser()->parse($this->fetchScalarString($explainQuery, $parameters)); } finally { $this->rollBack(); } @@ -694,7 +694,7 @@ private function convertingColumns(Result $result): array { $types = []; - foreach ((new ResultColumns())->of($result) as $column) { + foreach (new ResultColumns()->of($result) as $column) { $types[$column['name']] = $column['type']; } diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Client/Infrastructure/PgSql/PgSqlCursor.php b/src/lib/postgresql/src/Flow/PostgreSql/Client/Infrastructure/PgSql/PgSqlCursor.php index e073f55206..721f816931 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Client/Infrastructure/PgSql/PgSqlCursor.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Client/Infrastructure/PgSql/PgSqlCursor.php @@ -117,7 +117,7 @@ private function columnMeta(): array return []; } - return $this->columnMetaCache = (new ResultColumns())->of($this->result); + return $this->columnMetaCache = new ResultColumns()->of($this->result); } /** diff --git a/src/lib/postgresql/src/Flow/PostgreSql/DSL/client.php b/src/lib/postgresql/src/Flow/PostgreSql/DSL/client.php index 42c2d15263..ae47d37bf0 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/DSL/client.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/DSL/client.php @@ -67,7 +67,7 @@ function pgsql_connection(#[SensitiveParameter] string $connectionString): Conne #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function pgsql_connection_dsn(#[SensitiveParameter] string $dsn): ConnectionParameters { - return (new DsnParser())->parse($dsn); + return new DsnParser()->parse($dsn); } /** diff --git a/src/lib/postgresql/src/Flow/PostgreSql/DSL/parser.php b/src/lib/postgresql/src/Flow/PostgreSql/DSL/parser.php index 75240b9714..e8255260f8 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/DSL/parser.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/DSL/parser.php @@ -38,7 +38,7 @@ function sql_parser(): Parser #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function sql_parse(string $sql): ParsedQuery { - return (new Parser())->parse($sql); + return new Parser()->parse($sql); } /** @@ -48,7 +48,7 @@ function sql_parse(string $sql): ParsedQuery #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function sql_fingerprint(string $sql): ?string { - return (new Parser())->fingerprint($sql); + return new Parser()->fingerprint($sql); } /** @@ -59,7 +59,7 @@ function sql_fingerprint(string $sql): ?string #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function sql_normalize(string $sql): ?string { - return (new Parser())->normalize($sql); + return new Parser()->normalize($sql); } /** @@ -69,7 +69,7 @@ function sql_normalize(string $sql): ?string #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function sql_normalize_utility(string $sql): ?string { - return (new Parser())->normalizeUtility($sql); + return new Parser()->normalizeUtility($sql); } /** @@ -80,7 +80,7 @@ function sql_normalize_utility(string $sql): ?string #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function sql_split(string $sql): array { - return (new Parser())->split($sql); + return new Parser()->split($sql); } /** @@ -119,7 +119,7 @@ function sql_deparse(ParsedQuery $query, ?DeparseOptions $options = null): strin #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function sql_format(string $sql, ?DeparseOptions $options = null): string { - return (new Parser()) + return new Parser() ->parse($sql) ->deparse($options ?? DeparseOptions::new()); } @@ -131,7 +131,7 @@ function sql_format(string $sql, ?DeparseOptions $options = null): string #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function sql_summary(string $sql, int $options = 0, int $truncateLimit = 0): string { - return (new Parser())->summary($sql, $options, $truncateLimit); + return new Parser()->summary($sql, $options, $truncateLimit); } /** @@ -146,7 +146,7 @@ function sql_summary(string $sql, int $options = 0, int $truncateLimit = 0): str #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function sql_to_paginated_query(string $sql, int $limit, int $offset = 0): string { - $query = (new Parser())->parse($sql); + $query = new Parser()->parse($sql); $query->traverse(new OffsetPaginationModifier(new OffsetPaginationConfig($limit, $offset))); return $query->deparse(); @@ -163,7 +163,7 @@ function sql_to_paginated_query(string $sql, int $limit, int $offset = 0): strin #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function sql_to_limited_query(string $sql, int $limit): string { - $query = (new Parser())->parse($sql); + $query = new Parser()->parse($sql); $query->traverse(new OffsetPaginationModifier(new OffsetPaginationConfig($limit))); return $query->deparse(); @@ -182,7 +182,7 @@ function sql_to_limited_query(string $sql, int $limit): string #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function sql_to_count_query(string $sql): string { - $query = (new Parser())->parse($sql); + $query = new Parser()->parse($sql); $query->traverse(new CountModifier()); return $query->deparse(); @@ -204,7 +204,7 @@ function sql_to_count_query(string $sql): string #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function sql_to_keyset_query(string $sql, int $limit, array $columns, ?array $cursor = null): string { - $query = (new Parser())->parse($sql); + $query = new Parser()->parse($sql); $query->traverse(new KeysetPaginationModifier(new KeysetPaginationConfig($limit, $columns, $cursor))); return $query->deparse(); @@ -269,7 +269,7 @@ function sql_query_order_by(ParsedQuery $query): OrderByExtractor #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function sql_query_depth(string $sql): int { - return (new QueryDepth(sql_parse($sql)))->depth(); + return new QueryDepth(sql_parse($sql))->depth(); } /** @@ -287,7 +287,7 @@ function sql_query_depth(string $sql): int function sql_to_explain(string $sql, ?ExplainConfig $config = null): string { $config ??= ExplainConfig::forAnalysis(); - $query = (new Parser())->parse($sql); + $query = new Parser()->parse($sql); $query->traverse(new ExplainModifier($config)); return $query->deparse(); @@ -341,7 +341,7 @@ function sql_explain_modifier(ExplainConfig $config): ExplainModifier #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function sql_explain_parse(string $jsonOutput): Plan { - return (new ExplainParser())->parse($jsonOutput); + return new ExplainParser()->parse($jsonOutput); } /** diff --git a/src/lib/postgresql/src/Flow/PostgreSql/DSL/schema.php b/src/lib/postgresql/src/Flow/PostgreSql/DSL/schema.php index 6736b04ed1..827df0a045 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/DSL/schema.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/DSL/schema.php @@ -1084,7 +1084,7 @@ function column_type_custom(string $typeName, ?string $schema = null): ColumnTyp #[DocumentationDSL(module: Module::PG_QUERY, type: DSLType::HELPER)] function column_type_from_string(string $typeName): ColumnType { - return (new ColumnTypeParser())->parse($typeName); + return new ColumnTypeParser()->parse($typeName); } // ValueType DSL functions - Scalar types diff --git a/src/lib/postgresql/src/Flow/PostgreSql/ParsedQuery.php b/src/lib/postgresql/src/Flow/PostgreSql/ParsedQuery.php index e9ffad0c91..b96f67c640 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/ParsedQuery.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/ParsedQuery.php @@ -52,7 +52,7 @@ public function deparse(?DeparseOptions $options = null): string return $this->sql; } - if ((new ReflectionFunction('pg_query_deparse_opts'))->getNumberOfParameters() < 7) { + if (new ReflectionFunction('pg_query_deparse_opts')->getNumberOfParameters() < 7) { throw new ExtensionOutdatedException(); } diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Parser.php b/src/lib/postgresql/src/Flow/PostgreSql/Parser.php index 8d31277a02..034fa6cd2f 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Parser.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Parser.php @@ -25,7 +25,7 @@ public function fingerprint(string $sql): ?string public function normalize(string $sql): ?string { - return pg_query_normalize((new NamedParameterNormalizer())->normalize($sql)) ?: null; + return pg_query_normalize(new NamedParameterNormalizer()->normalize($sql)) ?: null; } public function normalizeUtility(string $sql): ?string diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Parser/ExpressionParser.php b/src/lib/postgresql/src/Flow/PostgreSql/Parser/ExpressionParser.php index 5595e1808e..ed7acc6b71 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Parser/ExpressionParser.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Parser/ExpressionParser.php @@ -55,7 +55,7 @@ public function normalize(string $expression): string public function deparseNode(Node $node): string { - return $this->stripSelectWrapper((new ParsedQuery($this->wrapInSelect($node)))->deparse()); + return $this->stripSelectWrapper(new ParsedQuery($this->wrapInSelect($node))->deparse()); } public function parse(string $expression): Node diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/AstDeparser.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/AstDeparser.php index 5596f0dfb7..51cf0fcc73 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/AstDeparser.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/AstDeparser.php @@ -28,6 +28,6 @@ public function deparse(object $ast): string ]), ]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Clause/CTE.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Clause/CTE.php index add2a6b2b0..c9ae3af8f2 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Clause/CTE.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Clause/CTE.php @@ -235,10 +235,9 @@ public function withColumns(array $columns): self */ private static function stringNodes(array $names): array { - return array_values(array_map( - static fn(string $name): Node => (new Node())->setString((new PBString())->setSval($name)), - $names, - )); + return array_values(array_map(static fn(string $name): Node => new Node()->setString(new PBString()->setSval( + $name, + )), $names)); } /** diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Clause/ReturningClause.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Clause/ReturningClause.php index ded60d4f63..1661085342 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Clause/ReturningClause.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Clause/ReturningClause.php @@ -117,7 +117,7 @@ public function toAst(): Node $expressionNode = $expression->toAst(); if ($expressionNode->getResTarget() === null) { - $expressionNode = (new Node())->setResTarget((new ResTarget())->setVal($expressionNode)); + $expressionNode = new Node()->setResTarget(new ResTarget()->setVal($expressionNode)); } $expressionNodes[] = $expressionNode; @@ -127,13 +127,13 @@ public function toAst(): Node $returningClause->setExprs($expressionNodes); $returningClause->setOptions($options); - return (new Node())->setReturningClause($returningClause); + return new Node()->setReturningClause($returningClause); } private static function optionNode(int $kind, string $alias): Node { - return (new Node())->setReturningOption( - (new ReturningOption()) + return new Node()->setReturningOption( + new ReturningOption() ->setOption($kind) ->setValue($alias), ); diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Copy/CopyFromBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Copy/CopyFromBuilder.php index a5f205e698..e154c0e567 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Copy/CopyFromBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Copy/CopyFromBuilder.php @@ -363,7 +363,7 @@ public function table(string $table, string ...$columns): CopyFromSourceStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CopyStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Copy/CopyToBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Copy/CopyToBuilder.php index f1d7d3f062..e3d913b1aa 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Copy/CopyToBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Copy/CopyToBuilder.php @@ -365,7 +365,7 @@ public function table(string $table, string ...$columns): CopyToDestinationStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CopyStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Cursor/CloseCursorBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Cursor/CloseCursorBuilder.php index 6f84c87d8c..ab8f31e2aa 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Cursor/CloseCursorBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Cursor/CloseCursorBuilder.php @@ -25,7 +25,7 @@ public static function closeAll(): CloseCursorFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): ClosePortalStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Cursor/DeclareCursorBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Cursor/DeclareCursorBuilder.php index e8158b88df..8c9b04f6b0 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Cursor/DeclareCursorBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Cursor/DeclareCursorBuilder.php @@ -60,7 +60,7 @@ public static function createFromSql(string $cursorName, string|Sql $query): Dec { return self::createFromParsed( $cursorName, - (new Parser())->parse($query instanceof Sql ? $query->toSql() : $query), + new Parser()->parse($query instanceof Sql ? $query->toSql() : $query), ); } @@ -89,7 +89,7 @@ public function scroll(): DeclareCursorOptionsStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DeclareCursorStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Cursor/FetchCursorBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Cursor/FetchCursorBuilder.php index 1022899557..ba0040b7d6 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Cursor/FetchCursorBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Cursor/FetchCursorBuilder.php @@ -65,7 +65,7 @@ public function prior(): self public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): FetchStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Delete/DeleteBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Delete/DeleteBuilder.php index 99b87f0ab8..7c05e418f7 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Delete/DeleteBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Delete/DeleteBuilder.php @@ -122,7 +122,7 @@ public static function fromAst(DeleteStmt $deleteStmt): static where: $whereCondition, returning: $returningClause === null ? null - : ReturningClause::fromAst((new Node())->setReturningClause($returningClause)), + : ReturningClause::fromAst(new Node()->setReturningClause($returningClause)), ); } @@ -186,7 +186,7 @@ public function returningAll(): DeleteFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DeleteStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Expression/Collate.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Expression/Collate.php index b0f4a057a1..f2d570e080 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Expression/Collate.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Expression/Collate.php @@ -78,10 +78,10 @@ public function toAst(): Node $collateClause = new CollateClause(); $collateClause->setArg($this->expression->toAst()); $collateClause->setCollname(array_map( - static fn(string $part): Node => (new Node())->setString((new PBString())->setSval($part)), + static fn(string $part): Node => new Node()->setString(new PBString()->setSval($part)), $this->collation->parts(), )); - return (new Node())->setCollateClause($collateClause); + return new Node()->setCollateClause($collateClause); } } diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Insert/InsertBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Insert/InsertBuilder.php index 22d17446b8..cec6587ffb 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Insert/InsertBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Insert/InsertBuilder.php @@ -149,7 +149,7 @@ public static function fromAst(Node $node): static public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): SelectStmt @@ -192,7 +192,7 @@ public function toAst(): SelectStmt $onConflict, $returningClause === null ? null - : ReturningClause::fromAst((new Node())->setReturningClause($returningClause)), + : ReturningClause::fromAst(new Node()->setReturningClause($returningClause)), ); } @@ -350,7 +350,7 @@ public function select(SelectFinalStep $select): InsertOnConflictStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): InsertStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Listen/ListenBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Listen/ListenBuilder.php index a40e4a2ea4..54e1a6e524 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Listen/ListenBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Listen/ListenBuilder.php @@ -20,11 +20,11 @@ public static function create(string $channel): ListenFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): ListenStmt { - return (new ListenStmt())->setConditionname($this->channel); + return new ListenStmt()->setConditionname($this->channel); } } diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Merge/MergeBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Merge/MergeBuilder.php index 9e81716d62..1c06eb1b0f 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Merge/MergeBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Merge/MergeBuilder.php @@ -147,7 +147,7 @@ public function returningAll(): MergeFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): MergeStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Notify/NotifyBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Notify/NotifyBuilder.php index 297ded3a9e..3b2f268fd5 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Notify/NotifyBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Notify/NotifyBuilder.php @@ -21,12 +21,12 @@ public static function create(string $channel): NotifyFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): NotifyStmt { - $stmt = (new NotifyStmt())->setConditionname($this->channel); + $stmt = new NotifyStmt()->setConditionname($this->channel); if ($this->payload !== '') { $stmt->setPayload($this->payload); diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceBuilder.php index 8f4fbc3d90..d1bf885237 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceBuilder.php @@ -214,7 +214,7 @@ public function startWith(int $start): AlterSequenceOptionsStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterSeqStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceLoggingBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceLoggingBuilder.php index b56be5ce29..f569eadc25 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceLoggingBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceLoggingBuilder.php @@ -34,7 +34,7 @@ public static function createUnlogged(string $sequence, ?string $schema, bool $i public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterTableStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceOwnerBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceOwnerBuilder.php index 368c6c7723..7dec40035d 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceOwnerBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceOwnerBuilder.php @@ -31,7 +31,7 @@ public static function create(string $sequence, ?string $schema, string $owner, public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterTableStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceSchemaBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceSchemaBuilder.php index 45ce713302..fa4506e996 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceSchemaBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/AlterSequenceSchemaBuilder.php @@ -25,7 +25,7 @@ public static function create(string $sequence, ?string $schema, string $newSche public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterObjectSchemaStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/RenameSequenceBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/RenameSequenceBuilder.php index fda22db9f3..a20d1f3087 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/RenameSequenceBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterSequence/RenameSequenceBuilder.php @@ -26,7 +26,7 @@ public static function create(string $sequence, ?string $schema, string $newName public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): RenameStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/AlterTableBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/AlterTableBuilder.php index a5dfc9d0fa..a1091e6851 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/AlterTableBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/AlterTableBuilder.php @@ -315,7 +315,7 @@ public function setUnlogged(): AlterTableLoggingFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterTableStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/AlterTableLoggingBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/AlterTableLoggingBuilder.php index 02ecf07119..b52ee38b38 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/AlterTableLoggingBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/AlterTableLoggingBuilder.php @@ -34,7 +34,7 @@ public static function createUnlogged(string $table, ?string $schema, bool $ifEx public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterTableStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/AlterTableSchemaBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/AlterTableSchemaBuilder.php index 42fc163249..a0d61bb3dd 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/AlterTableSchemaBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/AlterTableSchemaBuilder.php @@ -25,7 +25,7 @@ public static function create(string $table, ?string $schema, string $newSchema, public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterObjectSchemaStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/RenameTableBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/RenameTableBuilder.php index c062792bdc..a5bfcc6b24 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/RenameTableBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/AlterTable/RenameTableBuilder.php @@ -48,7 +48,7 @@ public static function renameTo(string $table, ?string $schema, string $newName, public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): RenameStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/ColumnDefinition.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/ColumnDefinition.php index 8798abf012..60faff8fee 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/ColumnDefinition.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/ColumnDefinition.php @@ -273,9 +273,9 @@ private function createLiteralNode(bool|float|int|string|null $value): Node } elseif (is_int($value)) { $aConst = new A_Const(['ival' => new PBInteger(['ival' => $value])]); } elseif (is_float($value)) { - $aConst->setFval((new PBFloat())->setFval((string) $value)); + $aConst->setFval(new PBFloat()->setFval((string) $value)); } else { - $aConst->setSval((new PBString())->setSval($value)); + $aConst->setSval(new PBString()->setSval($value)); } $node = new Node(); diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/CreateSequence/CreateSequenceBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/CreateSequence/CreateSequenceBuilder.php index eab81cc6d4..e4d45cad05 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/CreateSequence/CreateSequenceBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/CreateSequence/CreateSequenceBuilder.php @@ -201,7 +201,7 @@ public function temporary(): self public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreateSeqStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/CreateTable/CreateTableBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/CreateTable/CreateTableBuilder.php index b2d9c993f8..43a013d177 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/CreateTable/CreateTableBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/CreateTable/CreateTableBuilder.php @@ -271,7 +271,7 @@ public function temporary(): CreateTableTemporaryStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreateStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/CreateTableAs/CreateTableAsBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/CreateTableAs/CreateTableAsBuilder.php index 099d1aaea5..8fcd988619 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/CreateTableAs/CreateTableAsBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/CreateTableAs/CreateTableAsBuilder.php @@ -53,7 +53,7 @@ public function ifNotExists(): CreateTableAsFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreateTableAsStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Database/CreateDatabaseBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Database/CreateDatabaseBuilder.php index 7ad47dbd68..043312cf94 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Database/CreateDatabaseBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Database/CreateDatabaseBuilder.php @@ -118,7 +118,7 @@ public function template(string $name): self public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreatedbStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Database/DropDatabaseBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Database/DropDatabaseBuilder.php index 01ade4aa5a..2e53013cc1 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Database/DropDatabaseBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Database/DropDatabaseBuilder.php @@ -34,7 +34,7 @@ public function ifExists(): self public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropdbStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Domain/AlterDomainBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Domain/AlterDomainBuilder.php index 3fa6d188dd..3a2f7bb74c 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Domain/AlterDomainBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Domain/AlterDomainBuilder.php @@ -105,7 +105,7 @@ public function setNotNull(): AlterDomainFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterDomainStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Domain/CreateDomainBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Domain/CreateDomainBuilder.php index 98e5fa3b7e..d2d8e4a3af 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Domain/CreateDomainBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Domain/CreateDomainBuilder.php @@ -137,7 +137,7 @@ public function null(): CreateDomainOptionsStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreateDomainStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Domain/DropDomainBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Domain/DropDomainBuilder.php index 1c6e043647..c46cc55808 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Domain/DropDomainBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Domain/DropDomainBuilder.php @@ -48,7 +48,7 @@ public function restrict(): DropDomainFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/DropSequence/DropSequenceBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/DropSequence/DropSequenceBuilder.php index bef34482b7..d6e4b275d7 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/DropSequence/DropSequenceBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/DropSequence/DropSequenceBuilder.php @@ -53,7 +53,7 @@ public function sequence(string ...$names): DropSequenceFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/DropTable/DropTableBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/DropTable/DropTableBuilder.php index 1cc738f722..b0abc3cb43 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/DropTable/DropTableBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/DropTable/DropTableBuilder.php @@ -48,7 +48,7 @@ public function restrict(): DropTableFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/AlterExtensionBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/AlterExtensionBuilder.php index b14fa8ff13..eff5d01c87 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/AlterExtensionBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/AlterExtensionBuilder.php @@ -58,7 +58,7 @@ public function setSchema(string $schema): AlterExtensionSchemaFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterExtensionStmt|AlterExtensionContentsStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/AlterExtensionSchemaBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/AlterExtensionSchemaBuilder.php index 72007e60c1..0c71231df6 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/AlterExtensionSchemaBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/AlterExtensionSchemaBuilder.php @@ -24,7 +24,7 @@ public static function create(string $name, string $newSchema): self public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterObjectSchemaStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/CreateExtensionBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/CreateExtensionBuilder.php index 4e064b4a76..b469b900de 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/CreateExtensionBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/CreateExtensionBuilder.php @@ -44,7 +44,7 @@ public function schema(string $schema): CreateExtensionOptionsStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreateExtensionStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/DropExtensionBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/DropExtensionBuilder.php index 99070f5db8..841db694c3 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/DropExtensionBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Extension/DropExtensionBuilder.php @@ -46,7 +46,7 @@ public function restrict(): DropExtensionFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/AlterFunctionBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/AlterFunctionBuilder.php index 0331cbc9af..087a8adc93 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/AlterFunctionBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/AlterFunctionBuilder.php @@ -111,7 +111,7 @@ public function stable(): AlterFunctionFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterFunctionStmt|RenameStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/AlterProcedureBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/AlterProcedureBuilder.php index cb86314046..f0fdd8ecec 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/AlterProcedureBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/AlterProcedureBuilder.php @@ -126,7 +126,7 @@ public function set(string $parameter, string $value): AlterProcedureFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterFunctionStmt|RenameStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/CallBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/CallBuilder.php index dba3bda235..bb5d1205e9 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/CallBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/CallBuilder.php @@ -40,7 +40,7 @@ public static function create(string $procedure): CallFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CallStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/CreateFunctionBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/CreateFunctionBuilder.php index 68a890c434..92c97c62d3 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/CreateFunctionBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/CreateFunctionBuilder.php @@ -232,7 +232,7 @@ public function strict(): CreateFunctionOptionsStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreateFunctionStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/CreateProcedureBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/CreateProcedureBuilder.php index 0337a7a139..ca0461b329 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/CreateProcedureBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/CreateProcedureBuilder.php @@ -108,7 +108,7 @@ public function set(string $parameter, string $value): CreateProcedureOptionsSte public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreateFunctionStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/DoBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/DoBuilder.php index ddac886994..5bb5983738 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/DoBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/DoBuilder.php @@ -29,7 +29,7 @@ public function language(string $language): DoFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DoStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/DropFunctionBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/DropFunctionBuilder.php index 45d5483432..4b54ebd49e 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/DropFunctionBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/DropFunctionBuilder.php @@ -57,7 +57,7 @@ public function restrict(): DropFunctionFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/DropProcedureBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/DropProcedureBuilder.php index 342f198d68..ade06cedbc 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/DropProcedureBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Function/DropProcedureBuilder.php @@ -57,7 +57,7 @@ public function restrict(): DropProcedureFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/GrantBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/GrantBuilder.php index a87ade42aa..1642872798 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/GrantBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/GrantBuilder.php @@ -83,7 +83,7 @@ public function to(string ...$roles): GrantFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): GrantStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/GrantRoleBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/GrantRoleBuilder.php index 7d5f24e5cb..4b5ae402cc 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/GrantRoleBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/GrantRoleBuilder.php @@ -38,7 +38,7 @@ public function to(string ...$roles): GrantRoleFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): GrantRoleStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/RevokeBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/RevokeBuilder.php index f75c4c63c3..79439900bf 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/RevokeBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/RevokeBuilder.php @@ -113,7 +113,7 @@ public function restrict(): RevokeFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): GrantStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/RevokeRoleBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/RevokeRoleBuilder.php index 2976835b6e..903100b6b9 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/RevokeRoleBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Grant/RevokeRoleBuilder.php @@ -47,7 +47,7 @@ public function restrict(): RevokeRoleFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): GrantRoleStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/AlterIndex/AlterTablespaceIndexBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/AlterIndex/AlterTablespaceIndexBuilder.php index 7956c4ce9d..fda3213148 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/AlterIndex/AlterTablespaceIndexBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/AlterIndex/AlterTablespaceIndexBuilder.php @@ -32,7 +32,7 @@ public static function create( public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterTableStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/AlterIndex/RenameIndexBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/AlterIndex/RenameIndexBuilder.php index 87f03e48d6..9fb4715cac 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/AlterIndex/RenameIndexBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/AlterIndex/RenameIndexBuilder.php @@ -25,7 +25,7 @@ public static function create(string $index, ?string $schema, string $newName, b public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): RenameStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/CreateIndex/CreateIndexBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/CreateIndex/CreateIndexBuilder.php index d4eafe676b..825c22b801 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/CreateIndex/CreateIndexBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/CreateIndex/CreateIndexBuilder.php @@ -239,7 +239,7 @@ public function tablespace(string $tablespace): CreateIndexFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): IndexStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/DropIndex/DropIndexBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/DropIndex/DropIndexBuilder.php index 689f6e88fb..01290d1293 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/DropIndex/DropIndexBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/DropIndex/DropIndexBuilder.php @@ -54,7 +54,7 @@ public function restrict(): DropIndexFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/Reindex/ReindexBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/Reindex/ReindexBuilder.php index 63651e795a..9135593695 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/Reindex/ReindexBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Index/Reindex/ReindexBuilder.php @@ -60,7 +60,7 @@ public function tablespace(string $tablespace): ReindexFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): ReindexStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Ownership/DropOwnedBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Ownership/DropOwnedBuilder.php index 5174491484..86d2744430 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Ownership/DropOwnedBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Ownership/DropOwnedBuilder.php @@ -40,7 +40,7 @@ public function restrict(): DropOwnedFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropOwnedStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Ownership/ReassignOwnedBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Ownership/ReassignOwnedBuilder.php index e813076d93..53f593ee09 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Ownership/ReassignOwnedBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Ownership/ReassignOwnedBuilder.php @@ -34,7 +34,7 @@ public function to(string $newRole): ReassignOwnedFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): ReassignOwnedStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/AlterRoleBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/AlterRoleBuilder.php index a2df867f39..8f0322e9bf 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/AlterRoleBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/AlterRoleBuilder.php @@ -116,7 +116,7 @@ public function superuser(): AlterRoleFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterRoleStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/AlterRoleRenameBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/AlterRoleRenameBuilder.php index 87cdaece75..4642d50805 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/AlterRoleRenameBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/AlterRoleRenameBuilder.php @@ -22,7 +22,7 @@ public static function create(string $name, string $newName): self public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): RenameStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/CreateRoleBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/CreateRoleBuilder.php index 8a4c636a24..33fe9b32b4 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/CreateRoleBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/CreateRoleBuilder.php @@ -117,7 +117,7 @@ public function superuser(): CreateRoleOptionsStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreateRoleStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/DropRoleBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/DropRoleBuilder.php index 099d95acee..a960444719 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/DropRoleBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Role/DropRoleBuilder.php @@ -34,7 +34,7 @@ public function ifExists(): DropRoleFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropRoleStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Rule/CreateRuleBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Rule/CreateRuleBuilder.php index 589320e1a1..062a47addc 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Rule/CreateRuleBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Rule/CreateRuleBuilder.php @@ -171,7 +171,7 @@ public function to(string $table, ?string $schema = null): CreateRuleWhereStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): RuleStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Rule/DropRuleBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Rule/DropRuleBuilder.php index a0592fe445..50cf922242 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Rule/DropRuleBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Rule/DropRuleBuilder.php @@ -56,7 +56,7 @@ public function restrict(): DropRuleFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/AlterSchemaOwnerBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/AlterSchemaOwnerBuilder.php index 5e482e81a7..17b2f9dc80 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/AlterSchemaOwnerBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/AlterSchemaOwnerBuilder.php @@ -26,7 +26,7 @@ public static function create(string $name, string $owner): self public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterOwnerStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/AlterSchemaRenameBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/AlterSchemaRenameBuilder.php index 2621bf5172..6ff872033c 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/AlterSchemaRenameBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/AlterSchemaRenameBuilder.php @@ -22,7 +22,7 @@ public static function create(string $name, string $newName): self public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): RenameStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/CreateSchemaBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/CreateSchemaBuilder.php index 3e5cb7633b..e1a4f0b4a1 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/CreateSchemaBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/CreateSchemaBuilder.php @@ -34,7 +34,7 @@ public function ifNotExists(): CreateSchemaOptionsStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreateSchemaStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/DropSchemaBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/DropSchemaBuilder.php index 0adea3c551..00f7a28870 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/DropSchemaBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Schema/DropSchemaBuilder.php @@ -46,7 +46,7 @@ public function restrict(): DropSchemaFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Session/ResetRoleBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Session/ResetRoleBuilder.php index 036e99654c..a75217784a 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Session/ResetRoleBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Session/ResetRoleBuilder.php @@ -19,7 +19,7 @@ public static function create(): ResetRoleFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): VariableSetStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Session/SetRoleBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Session/SetRoleBuilder.php index 8f43c68891..9a9c07481e 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Session/SetRoleBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Session/SetRoleBuilder.php @@ -24,7 +24,7 @@ public static function create(string $role): SetRoleFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): VariableSetStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Trigger/AlterTriggerBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Trigger/AlterTriggerBuilder.php index 91692eaf03..2bc654f5ae 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Trigger/AlterTriggerBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Trigger/AlterTriggerBuilder.php @@ -66,7 +66,7 @@ public function renameTo(string $newName): AlterTriggerFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): RenameStmt|AlterObjectDependsStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Trigger/CreateTriggerBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Trigger/CreateTriggerBuilder.php index c588524d38..10752b19e5 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Trigger/CreateTriggerBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Trigger/CreateTriggerBuilder.php @@ -452,7 +452,7 @@ public function referencingOldTableAs(string $name): CreateTriggerOptionsStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreateTrigStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Trigger/DropTriggerBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Trigger/DropTriggerBuilder.php index 2e2114e31a..c53b3348e7 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Trigger/DropTriggerBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Trigger/DropTriggerBuilder.php @@ -56,7 +56,7 @@ public function restrict(): DropTriggerFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Truncate/TruncateBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Truncate/TruncateBuilder.php index 698ee1b0ac..9201264658 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Truncate/TruncateBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Truncate/TruncateBuilder.php @@ -51,7 +51,7 @@ public function restrict(): TruncateFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): TruncateStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/AlterEnumTypeBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/AlterEnumTypeBuilder.php index 8236138ee5..c1caf2d197 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/AlterEnumTypeBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/AlterEnumTypeBuilder.php @@ -64,7 +64,7 @@ public function renameValue(string $oldValue, string $newValue): AlterEnumTypeFi public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterEnumStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/CreateCompositeTypeBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/CreateCompositeTypeBuilder.php index d7120450f1..8ea5010de7 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/CreateCompositeTypeBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/CreateCompositeTypeBuilder.php @@ -42,7 +42,7 @@ public function attributes(TypeAttribute ...$attributes): CreateCompositeTypeFin public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CompositeTypeStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/CreateEnumTypeBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/CreateEnumTypeBuilder.php index 8d7387637d..d6e8b4fdda 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/CreateEnumTypeBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/CreateEnumTypeBuilder.php @@ -37,7 +37,7 @@ public function labels(string ...$labels): CreateEnumTypeFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreateEnumStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/CreateRangeTypeBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/CreateRangeTypeBuilder.php index 2a9d560da7..f78394a616 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/CreateRangeTypeBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/CreateRangeTypeBuilder.php @@ -62,7 +62,7 @@ public function subtypeOpclass(string $opclass): CreateRangeTypeOptionsStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreateRangeStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/DropTypeBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/DropTypeBuilder.php index 1ce902cba3..cfed1a3597 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/DropTypeBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/Type/DropTypeBuilder.php @@ -48,7 +48,7 @@ public function restrict(): DropTypeFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/AlterMatViewOwnerBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/AlterMatViewOwnerBuilder.php index b52b8594b8..d98fa1cea0 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/AlterMatViewOwnerBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/AlterMatViewOwnerBuilder.php @@ -30,7 +30,7 @@ public static function create(string $view, ?string $schema, string $owner): sel public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterTableStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/AlterMatViewSchemaBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/AlterMatViewSchemaBuilder.php index 7b06ddad43..23f0190f26 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/AlterMatViewSchemaBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/AlterMatViewSchemaBuilder.php @@ -25,7 +25,7 @@ public static function create(string $view, ?string $schema, string $newSchema, public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterObjectSchemaStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/AlterMatViewTablespaceBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/AlterMatViewTablespaceBuilder.php index b61e5ef8ad..773a1d360a 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/AlterMatViewTablespaceBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/AlterMatViewTablespaceBuilder.php @@ -29,7 +29,7 @@ public static function create(string $view, ?string $schema, string $tablespace, public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterTableStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/RenameMatViewBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/RenameMatViewBuilder.php index de22602b7e..ff263695d6 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/RenameMatViewBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterMaterializedView/RenameMatViewBuilder.php @@ -26,7 +26,7 @@ public static function create(string $view, ?string $schema, string $newName, bo public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): RenameStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterView/AlterViewOwnerBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterView/AlterViewOwnerBuilder.php index ce12f3f937..b366209c92 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterView/AlterViewOwnerBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterView/AlterViewOwnerBuilder.php @@ -30,7 +30,7 @@ public static function create(string $view, ?string $schema, string $owner): sel public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterTableStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterView/AlterViewSchemaBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterView/AlterViewSchemaBuilder.php index babe894d51..8a96e2de8d 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterView/AlterViewSchemaBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterView/AlterViewSchemaBuilder.php @@ -25,7 +25,7 @@ public static function create(string $view, ?string $schema, string $newSchema, public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): AlterObjectSchemaStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterView/RenameViewBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterView/RenameViewBuilder.php index 8d855079e8..764d7e3e9c 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterView/RenameViewBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/AlterView/RenameViewBuilder.php @@ -26,7 +26,7 @@ public static function create(string $view, ?string $schema, string $newName, bo public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): RenameStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/CreateMaterializedView/CreateMaterializedViewBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/CreateMaterializedView/CreateMaterializedViewBuilder.php index 2164033992..01ee6f62b7 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/CreateMaterializedView/CreateMaterializedViewBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/CreateMaterializedView/CreateMaterializedViewBuilder.php @@ -106,7 +106,7 @@ public function tablespace(string $tablespace): CreateMatViewDataStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CreateTableAsStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/CreateView/CreateViewBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/CreateView/CreateViewBuilder.php index 7f6eb3fb6e..e2ad73bff2 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/CreateView/CreateViewBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/CreateView/CreateViewBuilder.php @@ -100,7 +100,7 @@ public function temporary(): CreateViewOptionsStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): ViewStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/DropMaterializedView/DropMaterializedViewBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/DropMaterializedView/DropMaterializedViewBuilder.php index 105925bfeb..152ad5874a 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/DropMaterializedView/DropMaterializedViewBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/DropMaterializedView/DropMaterializedViewBuilder.php @@ -48,7 +48,7 @@ public function restrict(): DropMatViewFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/DropView/DropViewBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/DropView/DropViewBuilder.php index 3747f56e40..71bca8faf1 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/DropView/DropViewBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/DropView/DropViewBuilder.php @@ -48,7 +48,7 @@ public function restrict(): DropViewFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DropStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/RefreshMaterializedView/RefreshMaterializedViewBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/RefreshMaterializedView/RefreshMaterializedViewBuilder.php index 80a8b1159b..0e033d23ee 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/RefreshMaterializedView/RefreshMaterializedViewBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Schema/View/RefreshMaterializedView/RefreshMaterializedViewBuilder.php @@ -37,7 +37,7 @@ public function concurrently(): RefreshMatViewFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): RefreshMatViewStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Select/ParsedSelect.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Select/ParsedSelect.php index 7df44cc6dc..3480500bf3 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Select/ParsedSelect.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Select/ParsedSelect.php @@ -52,6 +52,6 @@ public function toSql(): string $parseResult = new ParseResult(); $parseResult->setStmts([$rawStmt]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Select/SelectBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Select/SelectBuilder.php index 1d8a659152..413633a583 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Select/SelectBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Select/SelectBuilder.php @@ -777,7 +777,7 @@ public function selectDistinctOn( public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): SelectStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/BeginBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/BeginBuilder.php index 7a00e9838c..48f6bc70d5 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/BeginBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/BeginBuilder.php @@ -53,7 +53,7 @@ public function readWrite(): BeginOptionsStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): TransactionStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/CommitBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/CommitBuilder.php index 10297704a2..236560f30c 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/CommitBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/CommitBuilder.php @@ -31,7 +31,7 @@ public function andNoChain(): CommitFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): TransactionStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/PreparedTransactionBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/PreparedTransactionBuilder.php index 43343b8f9e..a04a45d4fb 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/PreparedTransactionBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/PreparedTransactionBuilder.php @@ -32,7 +32,7 @@ public static function rollbackPrepared(string $gid): PreparedTransactionFinalSt public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): TransactionStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/RollbackBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/RollbackBuilder.php index a82e8e6f68..2ce134a88d 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/RollbackBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/RollbackBuilder.php @@ -32,7 +32,7 @@ public function andNoChain(): RollbackFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): TransactionStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/SavepointBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/SavepointBuilder.php index 65db9de107..9cf58cf4ea 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/SavepointBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/SavepointBuilder.php @@ -27,7 +27,7 @@ public static function release(string $name): SavepointFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): TransactionStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/SetTransactionBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/SetTransactionBuilder.php index f06214f5d1..c7eeeab7ba 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/SetTransactionBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Transaction/SetTransactionBuilder.php @@ -65,7 +65,7 @@ public function snapshot(string $snapshotId): SetTransactionFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): VariableSetStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Unlisten/UnlistenBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Unlisten/UnlistenBuilder.php index 37a1573d9e..023d5b4cd5 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Unlisten/UnlistenBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Unlisten/UnlistenBuilder.php @@ -25,11 +25,11 @@ public static function create(string $channel): UnlistenFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): UnlistenStmt { - return (new UnlistenStmt())->setConditionname($this->channel); + return new UnlistenStmt()->setConditionname($this->channel); } } diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Update/UpdateBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Update/UpdateBuilder.php index 5f0501a97b..de1dcfee1f 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Update/UpdateBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Update/UpdateBuilder.php @@ -151,7 +151,7 @@ public static function fromAst(UpdateStmt $updateStmt): static $where, $returningClause === null ? null - : ReturningClause::fromAst((new Node())->setReturningClause($returningClause)), + : ReturningClause::fromAst(new Node()->setReturningClause($returningClause)), ); } @@ -246,7 +246,7 @@ public function setAll(array $assignments): UpdateFromStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): UpdateStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/AnalyzeBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/AnalyzeBuilder.php index 8cac673eca..0dc5d39fb4 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/AnalyzeBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/AnalyzeBuilder.php @@ -52,7 +52,7 @@ public function tables(string ...$tables): AnalyzeFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): VacuumStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/ClusterBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/ClusterBuilder.php index 35fd641275..3211e2dc5f 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/ClusterBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/ClusterBuilder.php @@ -36,7 +36,7 @@ public function table(string $table): ClusterFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): ClusterStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/CommentBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/CommentBuilder.php index 61fbecd69a..19260b9b7d 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/CommentBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/CommentBuilder.php @@ -39,7 +39,7 @@ public function isNull(): CommentFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): CommentStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/DiscardBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/DiscardBuilder.php index 00f600f1c1..8288f75fca 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/DiscardBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/DiscardBuilder.php @@ -20,7 +20,7 @@ public static function create(DiscardType $type): DiscardFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): DiscardStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/ExplainBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/ExplainBuilder.php index 2c57373ab9..e74cc901d0 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/ExplainBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/ExplainBuilder.php @@ -178,7 +178,7 @@ public function timing(bool $enabled = true): ExplainFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): ExplainStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/LockBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/LockBuilder.php index 7decc1682d..db5776104d 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/LockBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/LockBuilder.php @@ -78,7 +78,7 @@ public function shareUpdateExclusive(): LockFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): LockStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/VacuumBuilder.php b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/VacuumBuilder.php index c5d8bdb68c..177cd1edcd 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/VacuumBuilder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/QueryBuilder/Utility/VacuumBuilder.php @@ -245,7 +245,7 @@ public function tables(string ...$tables): VacuumFinalStep public function toSql(): string { - return (new AstDeparser())->deparse($this->toAst()); + return new AstDeparser()->deparse($this->toAst()); } public function toAst(): VacuumStmt diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Column.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Column.php index 03752cbb4c..ec9b4a1788 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Column.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Column.php @@ -33,7 +33,7 @@ public function __construct( ) { $this->generationExpression = $generationExpression; $this->generationExpressionKey = $generationExpression !== null - ? (new ExpressionParser())->normalize($generationExpression) + ? new ExpressionParser()->normalize($generationExpression) : null; } @@ -48,7 +48,7 @@ public static function create( ?string $generationExpression = null, ?int $ordinalPosition = null, ): self { - $formattedDefault = (new ColumnDefaultFormatter())->format($default); + $formattedDefault = new ColumnDefaultFormatter()->format($default); return new self( $name, diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/ColumnDefault.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/ColumnDefault.php index 4cb24d7662..4255380536 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/ColumnDefault.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/ColumnDefault.php @@ -38,7 +38,7 @@ private function __construct( */ public static function fromExpression(string $expression, ColumnType $columnType): self { - $node = (new ExpressionParser())->parse($expression); + $node = new ExpressionParser()->parse($expression); $typeCast = $node->getTypeCast(); diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Constraint/CheckConstraint.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Constraint/CheckConstraint.php index 37e1e0860e..fb03499b73 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Constraint/CheckConstraint.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Constraint/CheckConstraint.php @@ -21,7 +21,7 @@ public function __construct( public bool $noInherit = false, ) { $this->expression = $expression; - $this->expressionKey = (new ExpressionParser())->normalize($expression); + $this->expressionKey = new ExpressionParser()->normalize($expression); } /** diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Constraint/ExcludeConstraint.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Constraint/ExcludeConstraint.php index 072ffb1cf9..2f078cc9ce 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Constraint/ExcludeConstraint.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Constraint/ExcludeConstraint.php @@ -21,7 +21,7 @@ public function __construct( public string $definition, public ?string $name = null, ) { - $this->parsed = (new ExcludeDefinitionParser(new ExpressionParser()))->parse($definition); + $this->parsed = new ExcludeDefinitionParser(new ExpressionParser())->parse($definition); $this->comparisonKey = $this->parsed->normalized(new ExpressionParser()); } diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/AstViewDependencyResolver.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/AstViewDependencyResolver.php index 576beecb59..7e75ab5da7 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/AstViewDependencyResolver.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/AstViewDependencyResolver.php @@ -123,7 +123,7 @@ private function computeDepths(array $affected, array $viewDependsOn, array $all private function extractDependencies(string $definition, string $defaultSchema): array { $parsedQuery = $this->parser->parse($definition); - $tables = (new Tables($parsedQuery))->all(); + $tables = new Tables($parsedQuery)->all(); $deps = []; foreach ($tables as $table) { diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/ColumnDiff.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/ColumnDiff.php index c0e5a46e87..45d8f737c6 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/ColumnDiff.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/ColumnDiff.php @@ -52,12 +52,12 @@ public function generate(): array if ($this->target->default !== null) { $colDef = $colDef->defaultRaw(ExpressionFactory::fromAst( - (new ExpressionParser())->parse($this->target->default->applicableSql()), + new ExpressionParser()->parse($this->target->default->applicableSql()), )); } if ($this->target->isGenerated && $this->target->generationExpression !== null) { - $colDef = $colDef->generatedAs(ExpressionFactory::fromAst((new ExpressionParser())->parse($this->target->generationExpression))); + $colDef = $colDef->generatedAs(ExpressionFactory::fromAst(new ExpressionParser()->parse($this->target->generationExpression))); } if ($this->target->isIdentity) { @@ -89,7 +89,7 @@ public function generate(): array ->alterColumnSetDefault( $columnName, ExpressionFactory::fromAst( - (new ExpressionParser())->parse($this->target->default->applicableSql()), + new ExpressionParser()->parse($this->target->default->applicableSql()), ), ); } elseif ($typeChanged && $this->target->default !== null) { @@ -97,9 +97,7 @@ public function generate(): array ->table($this->qualifiedTableName) ->alterColumnSetDefault( $columnName, - ExpressionFactory::fromAst( - (new ExpressionParser())->parse($this->target->default->applicableSql()), - ), + ExpressionFactory::fromAst(new ExpressionParser()->parse($this->target->default->applicableSql())), ); } diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/DomainDiff.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/DomainDiff.php index a7516b0a4f..973afe4e01 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/DomainDiff.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/DomainDiff.php @@ -53,7 +53,7 @@ public function generate(): array : alter() ->domain($this->target->qualifiedName()) ->setDefault(ExpressionFactory::fromAst( - (new ExpressionParser())->parse($this->target->default->applicableSql()), + new ExpressionParser()->parse($this->target->default->applicableSql()), )); } @@ -78,7 +78,7 @@ public function generate(): array $sqls[] = alter() ->domain($this->target->qualifiedName()) - ->addConstraint($cc->name, ConditionFactory::fromAst((new ExpressionParser())->parse($cc->expression))); + ->addConstraint($cc->name, ConditionFactory::fromAst(new ExpressionParser()->parse($cc->expression))); } return $sqls; diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/SchemaDiff.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/SchemaDiff.php index fe3585de1e..310ed6fbba 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/SchemaDiff.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/SchemaDiff.php @@ -90,7 +90,7 @@ public function __construct( public function generate(): array { return [ - ...(new Schema( + ...new Schema( $this->target->name, $this->addedTables, $this->addedSequences, @@ -99,7 +99,7 @@ public function generate(): array $this->addedFunctions, $this->addedProcedures, $this->addedDomains, - ))->toSql($this->tableOrderStrategy, $this->viewOrderStrategy, $this->materializedViewOrderStrategy), + )->toSql($this->tableOrderStrategy, $this->viewOrderStrategy, $this->materializedViewOrderStrategy), ...$this->modifiedSqls(), ...$this->renamedTableSqls(), ...$this->dropObjectSqls( diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/TableDiff.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/TableDiff.php index b3e23c26eb..c0fbe1a6e2 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/TableDiff.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Diff/TableDiff.php @@ -179,7 +179,7 @@ public function generate(): array if ($col->default !== null) { $colDef = $colDef->defaultRaw(ExpressionFactory::fromAst( - (new ExpressionParser())->parse($col->default->applicableSql()), + new ExpressionParser()->parse($col->default->applicableSql()), )); } @@ -188,7 +188,7 @@ public function generate(): array } if ($col->isGenerated && $col->generationExpression !== null) { - $colDef = $colDef->generatedAs(ExpressionFactory::fromAst((new ExpressionParser())->parse($col->generationExpression))); + $colDef = $colDef->generatedAs(ExpressionFactory::fromAst(new ExpressionParser()->parse($col->generationExpression))); } $sqls[] = alter()->table($qualifiedName)->addColumn($colDef); @@ -229,7 +229,7 @@ public function generate(): array } foreach ($this->addedCheckConstraints as $cc) { - $constraint = CheckConstraintBuilder::create(ConditionFactory::fromAst((new ExpressionParser())->parse($cc->expression))); + $constraint = CheckConstraintBuilder::create(ConditionFactory::fromAst(new ExpressionParser()->parse($cc->expression))); if ($cc->name !== null) { $constraint = $constraint->name($cc->name); @@ -252,7 +252,7 @@ public function generate(): array } $expressionParser = new ExpressionParser(); - $parsed = (new ExcludeDefinitionParser($expressionParser))->parse($ec->definition); + $parsed = new ExcludeDefinitionParser($expressionParser)->parse($ec->definition); $constraint = ExcludeConstraintBuilder::create($parsed->accessMethod)->name($ecName); foreach ($parsed->elements as $element) { diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Domain.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Domain.php index 130d08fcd7..54b0320e47 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Domain.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Domain.php @@ -48,7 +48,7 @@ public static function create( array $checkConstraints = [], ?string $schema = null, ): self { - $formattedDefault = (new ColumnDefaultFormatter())->format($default); + $formattedDefault = new ColumnDefaultFormatter()->format($default); return new self( $name, @@ -117,7 +117,7 @@ public function toSql(): Sql if ($this->default !== null) { $builder = $builder->default(ExpressionFactory::fromAst( - (new ExpressionParser())->parse($this->default->applicableSql()), + new ExpressionParser()->parse($this->default->applicableSql()), )); } @@ -125,7 +125,7 @@ public function toSql(): Sql if ($cc->name !== null) { $builder = $builder->constraint($cc->name); } - $builder = $builder->check(ConditionFactory::fromAst((new ExpressionParser())->parse($cc->expression))); + $builder = $builder->check(ConditionFactory::fromAst(new ExpressionParser()->parse($cc->expression))); } return $builder; diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Index.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Index.php index 2018a22538..3619bc67e5 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Index.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Index.php @@ -33,7 +33,7 @@ public function __construct( ?string $predicate = null, ) { $this->predicate = $predicate; - $this->predicateKey = $predicate !== null ? (new ExpressionParser())->normalize($predicate) : null; + $this->predicateKey = $predicate !== null ? new ExpressionParser()->normalize($predicate) : null; } /** @@ -71,7 +71,7 @@ public function toSql(string $tableName, ?string $schema = null): CreateIndexFin return $sql; } - return $sql->where(ConditionFactory::fromAst((new ExpressionParser())->parse($this->predicate))); + return $sql->where(ConditionFactory::fromAst(new ExpressionParser()->parse($this->predicate))); } public function predicateKey(): ?string diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/MaterializedViewDependencyOrder.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/MaterializedViewDependencyOrder.php index e4aacd05ab..85898672de 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/MaterializedViewDependencyOrder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/MaterializedViewDependencyOrder.php @@ -124,7 +124,7 @@ private function extractReferencedNames(string $definition): array { return array_values(array_unique(array_map( static fn(Table $table): string => $table->name(), - (new Tables($this->parser->parse($definition)))->all(), + new Tables($this->parser->parse($definition))->all(), ))); } } diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Table.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Table.php index 2df077af12..1245b39383 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Table.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Table.php @@ -404,7 +404,7 @@ public function toSql(): array if ($col->default !== null) { $colDef = $colDef->defaultRaw(ExpressionFactory::fromAst( - (new ExpressionParser())->parse($col->default->applicableSql()), + new ExpressionParser()->parse($col->default->applicableSql()), )); } @@ -413,7 +413,7 @@ public function toSql(): array } if ($col->isGenerated && $col->generationExpression !== null) { - $colDef = $colDef->generatedAs(ExpressionFactory::fromAst((new ExpressionParser())->parse($col->generationExpression))); + $colDef = $colDef->generatedAs(ExpressionFactory::fromAst(new ExpressionParser()->parse($col->generationExpression))); } $tableBuilder = $tableBuilder->column($colDef); @@ -442,7 +442,7 @@ public function toSql(): array } foreach ($this->checkConstraints as $cc) { - $constraint = CheckConstraintBuilder::create(ConditionFactory::fromAst((new ExpressionParser())->parse($cc->expression))); + $constraint = CheckConstraintBuilder::create(ConditionFactory::fromAst(new ExpressionParser()->parse($cc->expression))); if ($cc->name !== null) { $constraint = $constraint->name($cc->name); diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Trigger.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Trigger.php index 8814d6edad..4f6364db46 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/Trigger.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/Trigger.php @@ -32,7 +32,7 @@ public function __construct( public bool $forEachRow = false, public ?string $whenCondition = null, ) { - $this->whenConditionKey = $whenCondition !== null ? (new ExpressionParser())->normalize($whenCondition) : null; + $this->whenConditionKey = $whenCondition !== null ? new ExpressionParser()->normalize($whenCondition) : null; } /** @@ -88,7 +88,7 @@ public function toSql(string $tableName, string $schema): CreateTriggerFinalStep } if ($this->whenCondition !== null) { - $optionsStep = $optionsStep->when(ConditionFactory::fromAst((new ExpressionParser())->parse($this->whenCondition))); + $optionsStep = $optionsStep->when(ConditionFactory::fromAst(new ExpressionParser()->parse($this->whenCondition))); } return $optionsStep->execute($this->functionName); diff --git a/src/lib/postgresql/src/Flow/PostgreSql/Schema/ViewDependencyOrder.php b/src/lib/postgresql/src/Flow/PostgreSql/Schema/ViewDependencyOrder.php index 4257733fec..aefa224ce1 100644 --- a/src/lib/postgresql/src/Flow/PostgreSql/Schema/ViewDependencyOrder.php +++ b/src/lib/postgresql/src/Flow/PostgreSql/Schema/ViewDependencyOrder.php @@ -124,7 +124,7 @@ private function extractReferencedNames(string $definition): array { return array_values(array_unique(array_map( static fn(Table $table): string => $table->name(), - (new Tables($this->parser->parse($definition)))->all(), + new Tables($this->parser->parse($definition))->all(), ))); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Exception/MigrationLockedExceptionTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Exception/MigrationLockedExceptionTest.php index c74d5e8442..f66a1ed4c7 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Exception/MigrationLockedExceptionTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Exception/MigrationLockedExceptionTest.php @@ -14,7 +14,7 @@ public function test_message_names_the_lock(): void { static::assertSame( 'Another process is running migrations (lock "public.flow_migrations"). Run the command again when it finishes.', - (new MigrationLockedException('public.flow_migrations'))->getMessage(), + new MigrationLockedException('public.flow_migrations')->getMessage(), ); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Lock/AdvisoryMigrationLockTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Lock/AdvisoryMigrationLockTest.php index bdb6ad912f..05b21cc6b0 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Lock/AdvisoryMigrationLockTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Lock/AdvisoryMigrationLockTest.php @@ -16,7 +16,7 @@ public function test_key_is_the_xxh64_hash_of_the_name(): void { $client = new SpyClient(); - (new AdvisoryMigrationLock($client))->acquire('public.flow_migrations'); + new AdvisoryMigrationLock($client)->acquire('public.flow_migrations'); static::assertSame([8752161640987805066], $client->scalarQueries[0]['parameters']); } @@ -25,7 +25,7 @@ public function test_release_queries_pg_advisory_unlock(): void { $client = new SpyClient(); - (new AdvisoryMigrationLock($client))->release('public.flow_migrations'); + new AdvisoryMigrationLock($client)->release('public.flow_migrations'); static::assertSame( [['sql' => 'SELECT pg_advisory_unlock($1)', 'parameters' => [8752161640987805066]]], @@ -40,7 +40,7 @@ public function test_release_throws_when_the_lock_was_not_held(): void $this->expectExceptionObject(MigrationException::advisoryLockNotHeld('public.flow_migrations')); - (new AdvisoryMigrationLock($client))->release('public.flow_migrations'); + new AdvisoryMigrationLock($client)->release('public.flow_migrations'); } #[TestWith([true])] @@ -50,7 +50,7 @@ public function test_acquire_returns_the_query_result(bool $acquired): void $client = new SpyClient(); $client->scalarBoolResults = [$acquired]; - static::assertSame($acquired, (new AdvisoryMigrationLock($client))->acquire('public.flow_migrations')); + static::assertSame($acquired, new AdvisoryMigrationLock($client)->acquire('public.flow_migrations')); static::assertSame('SELECT pg_try_advisory_lock($1)', $client->scalarQueries[0]['sql']); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Lock/NoMigrationLockTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Lock/NoMigrationLockTest.php index e1d634eb5e..2bd166e3d9 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Lock/NoMigrationLockTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Migrations/Tests/Unit/Lock/NoMigrationLockTest.php @@ -21,6 +21,6 @@ public function test_release_without_acquire_does_not_throw(): void { $this->expectNotToPerformAssertions(); - (new NoMigrationLock())->release('public.flow_migrations'); + new NoMigrationLock()->release('public.flow_migrations'); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/ColumnDefaultNoFalsePositiveDriftTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/ColumnDefaultNoFalsePositiveDriftTest.php index 35a364f68b..b5c01e0fb9 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/ColumnDefaultNoFalsePositiveDriftTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/ColumnDefaultNoFalsePositiveDriftTest.php @@ -78,7 +78,7 @@ public function test_declared_defaults_do_not_drift_against_introspected_implici foreach ($declared as $name => $declaredColumn) { static::assertSame( [], - (new ColumnDiff(self::SCHEMA . '.' . self::TABLE, $table->column($name), $declaredColumn))->generate(), + new ColumnDiff(self::SCHEMA . '.' . self::TABLE, $table->column($name), $declaredColumn)->generate(), sprintf('Column "%s" reported spurious drift', $name), ); } @@ -98,11 +98,11 @@ public function test_all_defaults_including_sequence_round_trip_without_drift(): foreach (['n', 's', 't', 'ts', 'seq_col'] as $name) { static::assertSame( [], - (new ColumnDiff( + new ColumnDiff( self::SCHEMA . '.' . self::TABLE, $first->column($name), $second->column($name), - ))->generate(), + )->generate(), sprintf('Column "%s" reported spurious drift on round-trip', $name), ); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/ColumnDefaultStaleCastDriftConvergenceTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/ColumnDefaultStaleCastDriftConvergenceTest.php index c2d8a61810..4a9bee3dec 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/ColumnDefaultStaleCastDriftConvergenceTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/ColumnDefaultStaleCastDriftConvergenceTest.php @@ -91,7 +91,7 @@ public function test_stale_cast_drift_is_detected_and_converges_without_type_cha ->table(self::TARGET_TABLE) ->column('amount'); - $sqls = (new ColumnDiff(self::SCHEMA . '.' . self::SOURCE_TABLE, $source, $target))->generate(); + $sqls = new ColumnDiff(self::SCHEMA . '.' . self::SOURCE_TABLE, $source, $target)->generate(); static::assertCount(1, $sqls); static::assertSame( @@ -117,7 +117,7 @@ public function test_stale_cast_drift_is_detected_and_converges_without_type_cha static::assertSame( [], - (new ColumnDiff(self::SCHEMA . '.' . self::SOURCE_TABLE, $sourceAfter, $target))->generate(), + new ColumnDiff(self::SCHEMA . '.' . self::SOURCE_TABLE, $sourceAfter, $target)->generate(), ); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/ColumnTypeChangeDefaultConvergenceTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/ColumnTypeChangeDefaultConvergenceTest.php index cfb7406445..c7f2f495d2 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/ColumnTypeChangeDefaultConvergenceTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/ColumnTypeChangeDefaultConvergenceTest.php @@ -80,7 +80,7 @@ public function test_type_change_reapplies_default_so_pg_attrdef_is_retyped(): v ->table(self::TARGET_TABLE) ->column('amount'); - foreach ((new ColumnDiff(self::SCHEMA . '.' . self::SOURCE_TABLE, $source, $target))->generate() as $sql) { + foreach (new ColumnDiff(self::SCHEMA . '.' . self::SOURCE_TABLE, $source, $target)->generate() as $sql) { $this->pgsqlContext()->client()->execute($sql->toSql()); } @@ -98,7 +98,7 @@ public function test_type_change_reapplies_default_so_pg_attrdef_is_retyped(): v static::assertSame( [], - (new ColumnDiff(self::SCHEMA . '.' . self::SOURCE_TABLE, $sourceAfter, $target))->generate(), + new ColumnDiff(self::SCHEMA . '.' . self::SOURCE_TABLE, $sourceAfter, $target)->generate(), ); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/SchemaExpressionRoundTripTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/SchemaExpressionRoundTripTest.php index be8b07671f..156b26d8c5 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/SchemaExpressionRoundTripTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/Client/SchemaExpressionRoundTripTest.php @@ -70,11 +70,11 @@ public function test_collated_generated_column_round_trips(): void ->table('t'); static::assertTrue( - (new TableComparator( + new TableComparator( new IndexComparator(new GreedySimilarityRenameStrategy(new SimilarTextStrategy())), new ConstraintComparator(), new GreedySimilarityRenameStrategy(new SimilarTextStrategy()), - )) + ) ->compare($introspected, $declared) ->isEmpty(), ); @@ -105,11 +105,11 @@ public function test_introspected_table_has_no_drift_against_declared(): void ->table('t'); static::assertTrue( - (new TableComparator( + new TableComparator( new IndexComparator(new GreedySimilarityRenameStrategy(new SimilarTextStrategy())), new ConstraintComparator(), new GreedySimilarityRenameStrategy(new SimilarTextStrategy()), - )) + ) ->compare($introspected, $declared) ->isEmpty(), ); @@ -157,11 +157,11 @@ public function test_qualified_trigger_function_round_trips(): void ->table('t'); static::assertTrue( - (new TableComparator( + new TableComparator( new IndexComparator(new GreedySimilarityRenameStrategy(new SimilarTextStrategy())), new ConstraintComparator(), new GreedySimilarityRenameStrategy(new SimilarTextStrategy()), - )) + ) ->compare($introspected, $declared) ->isEmpty(), ); diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/QueryBuilder/Database/ViewDiffDatabaseTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/QueryBuilder/Database/ViewDiffDatabaseTest.php index 670e50c340..90ed2fcb0a 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/QueryBuilder/Database/ViewDiffDatabaseTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Integration/QueryBuilder/Database/ViewDiffDatabaseTest.php @@ -70,7 +70,7 @@ public function test_catalog_materialized_view_matches_single_line_definition(): ->client() ->execute(create()->materializedView(self::MATVIEW_SIMPLE)->as($select)->toSql()); - $catalogSchema = (new PgCatalogProvider($this->pgsqlContext()->client(), ['public']))->get()->get('public'); + $catalogSchema = new PgCatalogProvider($this->pgsqlContext()->client(), ['public'])->get()->get('public'); $catalogMatViews = array_values(array_filter( $catalogSchema->materializedViews, static fn(MaterializedView $mv): bool => $mv->name === self::MATVIEW_SIMPLE, @@ -104,7 +104,7 @@ public function test_catalog_view_matches_single_line_definition(): void $select = select(col('id'), col('name'))->from(table(self::TABLE_SOURCE)); $this->pgsqlContext()->client()->execute(create()->view(self::VIEW_SIMPLE)->as($select)->toSql()); - $catalogSchema = (new PgCatalogProvider($this->pgsqlContext()->client(), ['public']))->get()->get('public'); + $catalogSchema = new PgCatalogProvider($this->pgsqlContext()->client(), ['public'])->get()->get('public'); $catalogViews = array_values(array_filter( $catalogSchema->views, static fn(View $v): bool => $v->name === self::VIEW_SIMPLE, diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Mother/ReplaceColumnRefModifier.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Mother/ReplaceColumnRefModifier.php index 14f3209e9f..db116d1d02 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Mother/ReplaceColumnRefModifier.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Mother/ReplaceColumnRefModifier.php @@ -28,6 +28,6 @@ public function modify(object $node, ModificationContext $context): ?Node return null; } - return (new Node())->setParamRef((new ParamRef())->setNumber(99)); + return new Node()->setParamRef(new ParamRef()->setNumber(99)); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/Transformers/KeysetPaginationConfigTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/Transformers/KeysetPaginationConfigTest.php index 92cc09a2cf..f503b11652 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/Transformers/KeysetPaginationConfigTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/Transformers/KeysetPaginationConfigTest.php @@ -27,14 +27,14 @@ public function test_null_cursor_value_is_rejected(): void public function test_parameter_cursor_is_accepted(): void { - static::assertEquals(param(2), (new KeysetPaginationConfig(10, [sql_keyset_column('id')], param(2)))->cursor); + static::assertEquals(param(2), new KeysetPaginationConfig(10, [sql_keyset_column('id')], param(2))->cursor); } public function test_scalar_cursor_values_are_accepted(): void { static::assertSame( ['a', 1, 1.5, true], - (new KeysetPaginationConfig(10, [sql_keyset_column('id')], ['a', 1, 1.5, true]))->cursor, + new KeysetPaginationConfig(10, [sql_keyset_column('id')], ['a', 1, 1.5, true])->cursor, ); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/Transformers/KeysetSortClauseTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/Transformers/KeysetSortClauseTest.php index 699b8fa7c5..0fe047885f 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/Transformers/KeysetSortClauseTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/Transformers/KeysetSortClauseTest.php @@ -91,10 +91,10 @@ public function test_describe_lists_keys_with_directions(): void { static::assertSame( '"created_at DESC, id ASC"', - (new KeysetSortClause([ + new KeysetSortClause([ sql_keyset_column('created_at', SortOrder::DESC), sql_keyset_column('id'), - ]))->describe(), + ])->describe(), ); } @@ -106,7 +106,7 @@ public function test_order_by_equal_to_the_keys_is_accepted(string $sql, array $ { $this->expectNotToPerformAssertions(); - (new KeysetSortClause($columns))->assertMatches( + new KeysetSortClause($columns)->assertMatches( sql_parse($sql)->statements()->assertReadOnlySelect()->raw()->getSortClause(), ); } @@ -123,7 +123,7 @@ public function test_order_by_different_from_the_keys_is_rejected( $this->expectException(PaginationException::class); $this->expectExceptionMessage($message); - (new KeysetSortClause($columns))->assertMatches( + new KeysetSortClause($columns)->assertMatches( sql_parse($sql)->statements()->assertReadOnlySelect()->raw()->getSortClause(), ); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/Transformers/TypeCastStripperTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/Transformers/TypeCastStripperTest.php index 26cf57db6b..666d4e2706 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/Transformers/TypeCastStripperTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/Transformers/TypeCastStripperTest.php @@ -90,6 +90,6 @@ public function test_strip_top_level_cast(): void private function normalize(string $expression): string { // Routes through ExpressionParser::normalize(), which uses TypeCastStripper. - return (new ExpressionParser(new TypeCastStripper()))->normalize($expression); + return new ExpressionParser(new TypeCastStripper())->normalize($expression); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/TraverserTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/TraverserTest.php index b1d21522d1..500f7220f2 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/TraverserTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/AST/TraverserTest.php @@ -92,7 +92,7 @@ public static function nodeClasses(): array public function modify(object $node, ModificationContext $context): Node { - return (new Node())->setResTarget(new ResTarget()); + return new Node()->setResTarget(new ResTarget()); } }; $spy = new class implements NodeModifier { @@ -213,7 +213,7 @@ public static function nodeClasses(): array public function modify(object $node, ModificationContext $context): ParamRef { - return (new ParamRef())->setNumber(99); + return new ParamRef()->setNumber(99); } }; @@ -363,7 +363,7 @@ public function test_skips_raw_statement_without_statement(): void $parseResult = sql_parse('SELECT a FROM t')->raw(); $parseResult->setStmts([new RawStmt(), ...iterator_to_array($parseResult->getStmts())]); - (new Traverser($collector))->traverse($parseResult); + new Traverser($collector)->traverse($parseResult); static::assertSame( ['t'], @@ -385,18 +385,18 @@ public function test_visit_order_follows_descriptor_order(): void public function test_walks_a_hand_built_five_thousand_deep_expression(): void { - $expression = (new Node())->setParamRef((new ParamRef())->setNumber(1)); + $expression = new Node()->setParamRef(new ParamRef()->setNumber(1)); for ($i = 0; $i < 5000; $i++) { - $expression = (new Node())->setAExpr((new A_Expr())->setLexpr($expression)); + $expression = new Node()->setAExpr(new A_Expr()->setLexpr($expression)); } $collector = new ParamRefCollector(); - (new Traverser( + new Traverser( $collector, - ))->traverse((new ParseResult())->setStmts([(new RawStmt())->setStmt((new Node())->setSelectStmt((new SelectStmt())->setTargetList([ - (new Node())->setResTarget((new ResTarget())->setVal($expression)), + )->traverse(new ParseResult()->setStmts([new RawStmt()->setStmt(new Node()->setSelectStmt(new SelectStmt()->setTargetList([ + new Node()->setResTarget(new ResTarget()->setVal($expression)), ])))])); static::assertCount(1, $collector->getParamRefs()); @@ -529,7 +529,7 @@ public function leave(object $node): ?int } }; - (new Traverser($visitor))->traverse($this->parseQuery('SELECT id FROM users')); + new Traverser($visitor)->traverse($this->parseQuery('SELECT id FROM users')); static::assertSame(['enter ' . ParseResult::class, 'leave ' . ParseResult::class], $visitor->visits); } @@ -560,7 +560,7 @@ public function leave(object $node): ?int } }; - (new Traverser($visitor))->traverse($this->parseQuery('SELECT id FROM users')); + new Traverser($visitor)->traverse($this->parseQuery('SELECT id FROM users')); static::assertSame( [ @@ -599,7 +599,7 @@ public function leave(object $node): ?int } }; - (new Traverser($visitor))->traverse($this->parseQuery('SELECT id FROM users')); + new Traverser($visitor)->traverse($this->parseQuery('SELECT id FROM users')); static::assertSame(['enter ' . ParseResult::class], $visitor->visits); } @@ -727,7 +727,7 @@ public function modify(object $node, ModificationContext $context): null } }; - (new Traverser($modifier))->traverse($this->parseQuery('SELECT id FROM users; SELECT id FROM admins')); + new Traverser($modifier)->traverse($this->parseQuery('SELECT id FROM users; SELECT id FROM admins')); static::assertSame( [ParseResult::class . '@0', SelectStmt::class . '@1', SelectStmt::class . '@1'], @@ -757,7 +757,7 @@ public function modify(object $node, ModificationContext $context): ?int } }; - (new Traverser($modifier))->traverse($this->parseQuery('SELECT id FROM users')); + new Traverser($modifier)->traverse($this->parseQuery('SELECT id FROM users')); static::assertSame(0, $modifier->statements); } @@ -784,7 +784,7 @@ public function modify(object $node, ModificationContext $context): ?int } }; - (new Traverser($modifier))->traverse($this->parseQuery('SELECT id FROM users')); + new Traverser($modifier)->traverse($this->parseQuery('SELECT id FROM users')); static::assertSame(0, $modifier->statements); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/ConnectionParametersTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/ConnectionParametersTest.php index 458750a1a8..77390dec24 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/ConnectionParametersTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/ConnectionParametersTest.php @@ -366,7 +366,7 @@ public function test_with_database_suffix_empty_is_no_op(): void public function test_with_database_suffix_round_trips_with_dsn_parser(): void { - $params = (new DsnParser()) + $params = new DsnParser() ->parse('postgresql://user:pass@localhost:5432/mydb') ->withDatabaseSuffix('_x'); diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/ContextTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/ContextTest.php index 59d787870f..24b687a752 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/ContextTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/ContextTest.php @@ -24,26 +24,26 @@ public function test_all_returns_user_data(): void public function test_catalog_returns_null_when_unset(): void { - static::assertNull((new Context())->catalog()); + static::assertNull(new Context()->catalog()); } public function test_catalog_returns_provided_instance(): void { $catalog = new Catalog([]); - static::assertSame($catalog, (new Context(catalog: $catalog))->catalog()); + static::assertSame($catalog, new Context(catalog: $catalog)->catalog()); } public function test_get_propagates_type_assertion_failure(): void { $this->expectException(InvalidTypeException::class); - (new Context(data: ['count' => 'not-an-int']))->get('count', type_integer()); + new Context(data: ['count' => 'not-an-int'])->get('count', type_integer()); } public function test_get_returns_asserted_value(): void { - static::assertSame(42, (new Context(data: ['tenant' => 42]))->get('tenant', type_integer())); + static::assertSame(42, new Context(data: ['tenant' => 42])->get('tenant', type_integer())); } public function test_get_throws_for_missing_key(): void @@ -51,17 +51,17 @@ public function test_get_throws_for_missing_key(): void $this->expectException(ContextException::class); $this->expectExceptionMessage('Context has no value for key "missing".'); - (new Context())->get('missing', type_string()); + new Context()->get('missing', type_string()); } public function test_has_returns_false_for_missing_key(): void { - static::assertFalse((new Context())->has('tenant')); + static::assertFalse(new Context()->has('tenant')); } public function test_has_returns_true_for_existing_key(): void { - static::assertTrue((new Context(data: ['tenant' => 42]))->has('tenant')); + static::assertTrue(new Context(data: ['tenant' => 42])->has('tenant')); } public function test_merge_catalog_prefers_other_when_set(): void @@ -69,7 +69,7 @@ public function test_merge_catalog_prefers_other_when_set(): void $selfCatalog = new Catalog([]); $otherCatalog = new Catalog([]); - $result = (new Context(catalog: $selfCatalog))->merge(new Context(catalog: $otherCatalog)); + $result = new Context(catalog: $selfCatalog)->merge(new Context(catalog: $otherCatalog)); static::assertSame($otherCatalog, $result->catalog()); } @@ -78,14 +78,14 @@ public function test_merge_catalog_preserves_self_when_other_null(): void { $catalog = new Catalog([]); - $result = (new Context(catalog: $catalog))->merge(new Context()); + $result = new Context(catalog: $catalog)->merge(new Context()); static::assertSame($catalog, $result->catalog()); } public function test_merge_data_other_wins_on_key_conflict(): void { - $result = (new Context(data: ['a' => 1, 'b' => 2]))->merge(new Context(data: ['b' => 20, 'c' => 30])); + $result = new Context(data: ['a' => 1, 'b' => 2])->merge(new Context(data: ['b' => 20, 'c' => 30])); static::assertSame(['a' => 1, 'b' => 20, 'c' => 30], $result->all()); } @@ -110,7 +110,7 @@ public function test_with_does_not_mutate_original(): void public function test_with_overwrites_existing_key(): void { - $context = (new Context(data: ['key' => 'old']))->with('key', 'new'); + $context = new Context(data: ['key' => 'old'])->with('key', 'new'); static::assertSame('new', $context->get('key', type_string())); } @@ -119,7 +119,7 @@ public function test_with_preserves_catalog(): void { $catalog = new Catalog([]); - $modified = (new Context($catalog))->with('extra', 'value'); + $modified = new Context($catalog)->with('extra', 'value'); static::assertSame($catalog, $modified->catalog()); static::assertSame('value', $modified->get('extra', type_string())); diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/DescribeQueryTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/DescribeQueryTest.php index 109d5e1033..f78378f97d 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/DescribeQueryTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/DescribeQueryTest.php @@ -21,7 +21,7 @@ public function test_an_error_inside_the_query_is_located_in_the_callers_sql(): // PostgreSQL reported 32 for this query wrapped in the probe; "missing" is at 16 in the caller's SQL. static::assertSame( 16, - (new DescribeQuery())->errorIn('SELECT id FROM missing', PostgreSqlError::fromDiagnostics( + new DescribeQuery()->errorIn('SELECT id FROM missing', PostgreSqlError::fromDiagnostics( '42P01', 'relation "missing" does not exist', position: 32, @@ -31,7 +31,7 @@ public function test_an_error_inside_the_query_is_located_in_the_callers_sql(): public function test_a_stripped_trailing_semicolon_is_outside_the_callers_sql(): void { - static::assertNull((new DescribeQuery())->errorIn('SELECT id FROM missing;', PostgreSqlError::fromDiagnostics( + static::assertNull(new DescribeQuery()->errorIn('SELECT id FROM missing;', PostgreSqlError::fromDiagnostics( '42601', 'syntax error', position: 40, @@ -44,7 +44,7 @@ public function test_an_error_at_the_edges_of_the_callers_sql_keeps_its_position { static::assertSame( $position, - (new DescribeQuery())->errorIn('SELECT id FROM missing', PostgreSqlError::fromDiagnostics( + new DescribeQuery()->errorIn('SELECT id FROM missing', PostgreSqlError::fromDiagnostics( '42601', 'syntax error', position: $wrapped, @@ -56,7 +56,7 @@ public function test_an_error_without_diagnostics_keeps_its_category(): void { static::assertSame( PostgreSqlErrorCategory::UNKNOWN, - (new DescribeQuery())->errorIn( + new DescribeQuery()->errorIn( 'SELECT id FROM orders', PostgreSqlError::unknown('connection lost'), )->category, @@ -69,7 +69,7 @@ public function test_an_error_without_diagnostics_keeps_its_category(): void #[TestWith([200])] public function test_an_error_outside_the_callers_sql_has_no_position(int $position): void { - static::assertNull((new DescribeQuery())->errorIn('SELECT id FROM missing', PostgreSqlError::fromDiagnostics( + static::assertNull(new DescribeQuery()->errorIn('SELECT id FROM missing', PostgreSqlError::fromDiagnostics( '42601', 'syntax error', position: $position, @@ -78,7 +78,7 @@ public function test_an_error_outside_the_callers_sql_has_no_position(int $posit public function test_an_error_without_a_position_keeps_none(): void { - static::assertNull((new DescribeQuery())->errorIn('SELECT id FROM orders', PostgreSqlError::fromDiagnostics( + static::assertNull(new DescribeQuery()->errorIn('SELECT id FROM orders', PostgreSqlError::fromDiagnostics( '42501', 'denied', ))->position); @@ -86,7 +86,7 @@ public function test_an_error_without_a_position_keeps_none(): void public function test_every_diagnostic_but_the_position_is_kept(): void { - $error = (new DescribeQuery())->errorIn('SELECT id FROM orders', PostgreSqlError::fromDiagnostics( + $error = new DescribeQuery()->errorIn('SELECT id FROM orders', PostgreSqlError::fromDiagnostics( '42703', 'column', 'detail', @@ -112,7 +112,7 @@ public function test_a_plain_query_is_wrapped(): void { static::assertSame( "SELECT * FROM (\nSELECT id FROM orders\n) flow_describe LIMIT 0", - (new DescribeQuery())->of('SELECT id FROM orders'), + new DescribeQuery()->of('SELECT id FROM orders'), ); } @@ -120,7 +120,7 @@ public function test_a_sql_object_is_rendered_through_to_sql(): void { static::assertSame( "SELECT * FROM (\nSELECT id, label FROM orders\n) flow_describe LIMIT 0", - (new DescribeQuery())->of(select(col('id'), col('label'))->from(table('orders'))), + new DescribeQuery()->of(select(col('id'), col('label'))->from(table('orders'))), ); } @@ -130,7 +130,7 @@ public function test_a_trailing_line_comment_is_closed_by_the_newline(): void // comment and reports "syntax error at end of input". static::assertSame( "SELECT * FROM (\nSELECT id FROM orders -- trailing\n) flow_describe LIMIT 0", - (new DescribeQuery())->of('SELECT id FROM orders -- trailing'), + new DescribeQuery()->of('SELECT id FROM orders -- trailing'), ); } @@ -138,7 +138,7 @@ public function test_a_trailing_semicolon_is_stripped(): void { static::assertSame( "SELECT * FROM (\nSELECT id FROM orders\n) flow_describe LIMIT 0", - (new DescribeQuery())->of("SELECT id FROM orders; \n"), + new DescribeQuery()->of("SELECT id FROM orders; \n"), ); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/Exception/NoResultExceptionTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/Exception/NoResultExceptionTest.php index 8dddf3df4b..06d23ad40f 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/Exception/NoResultExceptionTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/Exception/NoResultExceptionTest.php @@ -12,10 +12,7 @@ final class NoResultExceptionTest extends TestCase { public function test_default_message(): void { - static::assertSame( - 'Expected at least one row, but none were returned', - (new NoResultException())->getMessage(), - ); + static::assertSame('Expected at least one row, but none were returned', new NoResultException()->getMessage()); } public function test_extends_data_access_exception(): void diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/Exception/TooManyRowsExceptionTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/Exception/TooManyRowsExceptionTest.php index 10384b7e94..2be8207d5d 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/Exception/TooManyRowsExceptionTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/Exception/TooManyRowsExceptionTest.php @@ -12,10 +12,7 @@ final class TooManyRowsExceptionTest extends TestCase { public function test_count_in_message(): void { - static::assertSame( - 'Expected at most one row, but 5 were returned', - (new TooManyRowsException(5))->getMessage(), - ); + static::assertSame('Expected at most one row, but 5 were returned', new TooManyRowsException(5)->getMessage()); } public function test_extends_data_access_exception(): void diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/NotificationTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/NotificationTest.php index 805b813bc6..ef090158fa 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/NotificationTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/NotificationTest.php @@ -20,6 +20,6 @@ public function test_exposes_channel_payload_and_pid(): void public function test_payload_can_be_empty_string(): void { - static::assertSame('', (new Notification('my_channel', '', 1))->payload); + static::assertSame('', new Notification('my_channel', '', 1)->payload); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/QueryTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/QueryTest.php index d5225b60c1..a1ae64b54b 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/QueryTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/QueryTest.php @@ -12,23 +12,23 @@ final class QueryTest extends TestCase { public function test_exposes_parameters(): void { - static::assertSame([1, 'x'], (new Query('SELECT $1, $2', [1, 'x']))->parameters()); + static::assertSame([1, 'x'], new Query('SELECT $1, $2', [1, 'x'])->parameters()); } public function test_exposes_sql_builder(): void { $sql = self::createStub(Sql::class); - static::assertSame($sql, (new Query($sql))->sql()); + static::assertSame($sql, new Query($sql)->sql()); } public function test_exposes_sql_string(): void { - static::assertSame('SELECT 1', (new Query('SELECT 1'))->sql()); + static::assertSame('SELECT 1', new Query('SELECT 1')->sql()); } public function test_parameters_default_to_empty_list(): void { - static::assertSame([], (new Query('SELECT 1'))->parameters()); + static::assertSame([], new Query('SELECT 1')->parameters()); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/RowMapper/ConstructorMapperTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/RowMapper/ConstructorMapperTest.php index 3390c62e4b..c6b84d4579 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/RowMapper/ConstructorMapperTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/RowMapper/ConstructorMapperTest.php @@ -27,7 +27,7 @@ public function test_allows_extra_columns_in_row(): void 'extra_column' => 'ignored', ]; - $result = (new ConstructorMapper(SimpleDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(SimpleDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(SimpleDto::class, $result); static::assertSame(1, $result->id); @@ -41,7 +41,7 @@ public function test_handles_null_value_in_row(): void 'nickname' => null, ]; - $result = (new ConstructorMapper(NullableDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(NullableDto::class)->map($row, MapperContextMother::any()); static::assertNull($result->nickname); } @@ -64,7 +64,7 @@ public function test_maps_all_supported_types(): void 'tags' => $tags, ]; - $result = (new ConstructorMapper(FullTypedDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(FullTypedDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(FullTypedDto::class, $result); static::assertSame(42, $result->id); @@ -85,7 +85,7 @@ public function test_maps_array_type(): void 'tags' => $tags, ]; - $result = (new ConstructorMapper(ArrayDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(ArrayDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(ArrayDto::class, $result); static::assertSame($tags, $result->tags); @@ -99,7 +99,7 @@ public function test_maps_bool_type(): void 'verified' => false, ]; - $result = (new ConstructorMapper(BoolDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(BoolDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(BoolDto::class, $result); static::assertTrue($result->active); @@ -114,7 +114,7 @@ public function test_maps_datetime_type(): void 'createdAt' => $createdAt, ]; - $result = (new ConstructorMapper(DateTimeDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(DateTimeDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(DateTimeDto::class, $result); static::assertSame($createdAt, $result->createdAt); @@ -128,7 +128,7 @@ public function test_maps_float_special_values(): void 'discount' => NAN, ]; - $result = (new ConstructorMapper(FloatDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(FloatDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(FloatDto::class, $result); static::assertSame(INF, $result->price); @@ -143,7 +143,7 @@ public function test_maps_float_type(): void 'discount' => 0.15, ]; - $result = (new ConstructorMapper(FloatDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(FloatDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(FloatDto::class, $result); static::assertSame(99.99, $result->price); @@ -158,7 +158,7 @@ public function test_maps_json_type(): void 'metadata' => $json, ]; - $result = (new ConstructorMapper(JsonDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(JsonDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(JsonDto::class, $result); static::assertSame($json, $result->metadata); @@ -174,7 +174,7 @@ public function test_maps_nullable_complex_types(): void 'id' => 1, ]; - $result = (new ConstructorMapper(NullableTypedDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(NullableTypedDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(NullableTypedDto::class, $result); static::assertSame(1, $result->id); @@ -199,7 +199,7 @@ public function test_maps_nullable_complex_types_with_values(): void 'tags' => $tags, ]; - $result = (new ConstructorMapper(NullableTypedDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(NullableTypedDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(NullableTypedDto::class, $result); static::assertSame($createdAt, $result->createdAt); @@ -215,7 +215,7 @@ public function test_maps_nullable_parameters(): void 'name' => 'John Doe', ]; - $result = (new ConstructorMapper(NullableDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(NullableDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(NullableDto::class, $result); static::assertSame(1, $result->id); @@ -231,7 +231,7 @@ public function test_maps_row_to_simple_dto(): void 'email' => 'john@example.com', ]; - $result = (new ConstructorMapper(SimpleDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(SimpleDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(SimpleDto::class, $result); static::assertSame(1, $result->id); @@ -247,7 +247,7 @@ public function test_maps_uuid_type(): void 'uuid' => $uuid, ]; - $result = (new ConstructorMapper(UuidDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(UuidDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(UuidDto::class, $result); static::assertSame($uuid, $result->uuid); @@ -270,7 +270,7 @@ public function test_throws_for_missing_required_parameter(): void $this->expectException(MappingException::class); $this->expectExceptionMessage('Property "name" not found'); - (new ConstructorMapper(SimpleDto::class))->map($row, MapperContextMother::any()); + new ConstructorMapper(SimpleDto::class)->map($row, MapperContextMother::any()); } public function test_uses_default_values(): void @@ -280,7 +280,7 @@ public function test_uses_default_values(): void 'name' => 'John Doe', ]; - $result = (new ConstructorMapper(DefaultValueDto::class))->map($row, MapperContextMother::any()); + $result = new ConstructorMapper(DefaultValueDto::class)->map($row, MapperContextMother::any()); static::assertInstanceOf(DefaultValueDto::class, $result); static::assertSame(1, $result->id); diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/RowMapper/StaticFactoryMapperTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/RowMapper/StaticFactoryMapperTest.php index ca809835a8..2626fad325 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/RowMapper/StaticFactoryMapperTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/RowMapper/StaticFactoryMapperTest.php @@ -25,11 +25,11 @@ public function test_accepts_but_ignores_context_argument(): void { $row = ['id' => 1, 'name' => 'John Doe', 'email' => 'john@example.com']; - $withAny = (new StaticFactoryMapper(SimpleFactoryDto::class, 'fromRow'))->map($row, MapperContextMother::any()); - $withData = (new StaticFactoryMapper( + $withAny = new StaticFactoryMapper(SimpleFactoryDto::class, 'fromRow')->map($row, MapperContextMother::any()); + $withData = new StaticFactoryMapper( SimpleFactoryDto::class, 'fromRow', - ))->map($row, MapperContextMother::withData(['tenant_id' => 42])); + )->map($row, MapperContextMother::withData(['tenant_id' => 42])); static::assertEquals($withAny, $withData); } @@ -38,7 +38,7 @@ public function test_does_not_pass_context_to_factory(): void { $row = ['id' => 7]; - (new StaticFactoryMapper(CapturedRowFactoryDto::class, 'fromRow'))->map($row, MapperContextMother::withData([ + new StaticFactoryMapper(CapturedRowFactoryDto::class, 'fromRow')->map($row, MapperContextMother::withData([ 'extra' => 'ignored', ])); @@ -66,7 +66,7 @@ public function test_maps_row_to_object_via_static_factory(): void { $row = ['id' => 42, 'name' => 'John Doe', 'email' => 'john@example.com']; - $result = (new StaticFactoryMapper(SimpleFactoryDto::class, 'fromRow'))->map($row, MapperContextMother::any()); + $result = new StaticFactoryMapper(SimpleFactoryDto::class, 'fromRow')->map($row, MapperContextMother::any()); static::assertInstanceOf(SimpleFactoryDto::class, $result); static::assertSame(42, $result->id); @@ -78,7 +78,7 @@ public function test_passes_row_unchanged_to_factory(): void { $row = ['id' => 1, 'name' => 'Bob', 'tags' => ['a', 'b'], 'meta' => null]; - (new StaticFactoryMapper(CapturedRowFactoryDto::class, 'fromRow'))->map($row, MapperContextMother::any()); + new StaticFactoryMapper(CapturedRowFactoryDto::class, 'fromRow')->map($row, MapperContextMother::any()); static::assertNotNull(CapturedRowFactoryDto::$lastArgs); static::assertSame($row, CapturedRowFactoryDto::$lastArgs[0]); @@ -88,7 +88,7 @@ public function test_returns_subclass_when_factory_returns_subclass(): void { $row = ['name' => 'Rex']; - $result = (new StaticFactoryMapper(Animal::class, 'fromRow'))->map($row, MapperContextMother::any()); + $result = new StaticFactoryMapper(Animal::class, 'fromRow')->map($row, MapperContextMother::any()); static::assertInstanceOf(Dog::class, $result); static::assertInstanceOf(Animal::class, $result); @@ -141,7 +141,7 @@ public function test_throws_when_factory_method_is_not_static(): void public function test_wraps_factory_throwable_in_mapping_exception(): void { try { - (new StaticFactoryMapper(ThrowingFactoryDto::class, 'fromRow'))->map([ + new StaticFactoryMapper(ThrowingFactoryDto::class, 'fromRow')->map([ 'id' => 1, ], MapperContextMother::any()); static::fail('Expected MappingException was not thrown'); diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/Types/ArrayLiteralParserTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/Types/ArrayLiteralParserTest.php index a3d4355a9d..9ddf82af5c 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/Types/ArrayLiteralParserTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Client/Types/ArrayLiteralParserTest.php @@ -55,7 +55,7 @@ public function test_a_malformed_literal_is_refused(string $literal, string $rea $this->expectException(ValueConversionException::class); $this->expectExceptionMessage($reason); - (new ArrayLiteralParser())->parse($literal); + new ArrayLiteralParser()->parse($literal); } /** @@ -64,6 +64,6 @@ public function test_a_malformed_literal_is_refused(string $literal, string $rea #[DataProvider('provide_well_formed_literals')] public function test_a_well_formed_literal_parses(string $literal, array $expected): void { - static::assertSame($expected, (new ArrayLiteralParser())->parse($literal)); + static::assertSame($expected, new ArrayLiteralParser()->parse($literal)); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Extractors/OrderByTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Extractors/OrderByTest.php index cccc983289..94068f4d4b 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Extractors/OrderByTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Extractors/OrderByTest.php @@ -24,14 +24,14 @@ protected function setUp(): void public function test_order_by_collate_is_supported(): void { - static::assertCount(1, (new OrderBy(sql_parse('SELECT name FROM t ORDER BY name COLLATE "C"')))->all()); + static::assertCount(1, new OrderBy(sql_parse('SELECT name FROM t ORDER BY name COLLATE "C"'))->all()); } public function test_window_order_by_items_are_reported(): void { static::assertCount( 2, - (new OrderBy(sql_parse('SELECT a, row_number() OVER (ORDER BY b) FROM t ORDER BY a')))->all(), + new OrderBy(sql_parse('SELECT a, row_number() OVER (ORDER BY b) FROM t ORDER BY a'))->all(), ); } @@ -39,7 +39,7 @@ public function test_aggregate_order_by_collate_is_supported(): void { static::assertCount( 1, - (new OrderBy(sql_parse('SELECT string_agg(x, \',\' ORDER BY y COLLATE "C") FROM t')))->all(), + new OrderBy(sql_parse('SELECT string_agg(x, \',\' ORDER BY y COLLATE "C") FROM t'))->all(), ); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Extractors/QueryDepthTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Extractors/QueryDepthTest.php index f959b43b48..f271b659aa 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Extractors/QueryDepthTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Extractors/QueryDepthTest.php @@ -24,19 +24,19 @@ protected function setUp(): void public function test_depth_for_create_view(): void { - static::assertSame(1, (new QueryDepth(sql_parse('CREATE VIEW v AS SELECT 1')))->depth()); + static::assertSame(1, new QueryDepth(sql_parse('CREATE VIEW v AS SELECT 1'))->depth()); } public function test_depth_for_explain(): void { - static::assertSame(1, (new QueryDepth(sql_parse('EXPLAIN SELECT 1')))->depth()); + static::assertSame(1, new QueryDepth(sql_parse('EXPLAIN SELECT 1'))->depth()); } public function test_depth_for_window_subquery(): void { static::assertSame( 2, - (new QueryDepth(sql_parse('SELECT sum(a) OVER (PARTITION BY (SELECT 1)) FROM t')))->depth(), + new QueryDepth(sql_parse('SELECT sum(a) OVER (PARTITION BY (SELECT 1)) FROM t'))->depth(), ); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/ParsedQueryTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/ParsedQueryTest.php index 42f008b557..03d492746a 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/ParsedQueryTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/ParsedQueryTest.php @@ -158,9 +158,7 @@ public function test_deparse_with_preserve_comments_of_query_without_source_has_ { static::assertSame( sql_parse(self::COMMENTED_SQL)->deparse(sql_deparse_options()), - (new ParsedQuery(sql_parse(self::COMMENTED_SQL)->raw()))->deparse( - sql_deparse_options()->preserveComments(), - ), + new ParsedQuery(sql_parse(self::COMMENTED_SQL)->raw())->deparse(sql_deparse_options()->preserveComments()), ); } @@ -184,7 +182,7 @@ public function test_extension_outdated_exception_tells_how_to_keep_working(): v { static::assertSame( 'The loaded pg_query extension does not keep comments in deparse. Update flow-php/pg-query-ext to 0.49 or later, or remove the DeparseOptions::preserveComments() call.', - (new ExtensionOutdatedException())->getMessage(), + new ExtensionOutdatedException()->getMessage(), ); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/AstDeparserTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/AstDeparserTest.php index 1be02edc7b..226018a495 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/AstDeparserTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/AstDeparserTest.php @@ -22,12 +22,12 @@ protected function setUp(): void public function test_a_statement_node_is_deparsed(): void { - static::assertSame('LISTEN my_channel', (new AstDeparser())->deparse(listen('my_channel')->toAst())); + static::assertSame('LISTEN my_channel', new AstDeparser()->deparse(listen('my_channel')->toAst())); } public function test_a_multi_word_statement_node_is_deparsed(): void { - static::assertSame('CLOSE my_cursor', (new AstDeparser())->deparse(new ClosePortalStmt([ + static::assertSame('CLOSE my_cursor', new AstDeparser()->deparse(new ClosePortalStmt([ 'portalname' => 'my_cursor', ]))); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Clause/CTETest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Clause/CTETest.php index 480d3cd888..e96a646e58 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Clause/CTETest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Clause/CTETest.php @@ -28,7 +28,7 @@ final class CTETest extends TestCase { public function test_converts_simple_cte_to_ast(): void { - $query = (new Node())->setSelectStmt(select(star())->from(table('users'))->toAst()); + $query = new Node()->setSelectStmt(select(star())->from(table('users'))->toAst()); $cte = new CTE('active_users', $query); $node = $cte->toAst(); @@ -63,7 +63,7 @@ public function test_converts_to_ast_with_column_names(): void public function test_cte_getters(): void { - $query = (new Node())->setSelectStmt(select(star())->from(table('users'))->toAst()); + $query = new Node()->setSelectStmt(select(star())->from(table('users'))->toAst()); $cte = new CTE('test_cte', $query, ['col1', 'col2'], CTEMaterialization::MATERIALIZED); static::assertSame('test_cte', $cte->name()); diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Clause/ReturningClauseTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Clause/ReturningClauseTest.php index 1d9665a17b..38270fadd5 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Clause/ReturningClauseTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Clause/ReturningClauseTest.php @@ -21,7 +21,7 @@ public function test_aliases_without_alias_throws(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('returningAliases() needs an old or a new alias'); - (new ReturningClause())->aliases(null, null); + new ReturningClause()->aliases(null, null); } public function test_aliases_without_expressions_throw_at_to_ast(): void @@ -31,7 +31,7 @@ public function test_aliases_without_expressions_throw_at_to_ast(): void 'RETURNING WITH (OLD AS o, NEW AS n) needs a RETURNING list. Call returning() or returningAll() after returningAliases().', ); - (new ReturningClause()) + new ReturningClause() ->aliases('o', 'n') ->toAst(); } @@ -45,7 +45,7 @@ public function test_from_ast_of_another_node_throws(): void public function test_from_ast_reads_expressions_and_aliases(): void { - $clause = (new ReturningClause()) + $clause = new ReturningClause() ->aliases('o', 'n') ->returning(col('id', 'o'), col('id', 'n')); @@ -59,12 +59,12 @@ public function test_returning_without_expressions_throws(): void 'returning() needs at least one expression. Call returningAll() for RETURNING *.', ); - (new ReturningClause())->returning(); + new ReturningClause()->returning(); } public function test_to_ast_maps_expressions_and_aliases(): void { - $returningClause = (new ReturningClause()) + $returningClause = new ReturningClause() ->aliases('o', 'n') ->returning(col('id', 'o'), col('id', 'n')) ->toAst() @@ -91,7 +91,7 @@ public function test_to_ast_maps_expressions_and_aliases(): void public function test_to_ast_without_aliases_has_no_options(): void { - $returningClause = (new ReturningClause()) + $returningClause = new ReturningClause() ->returning(col('id')) ->toAst() ->getReturningClause(); diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/AndConditionTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/AndConditionTest.php index 94774dc812..1f12ebd578 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/AndConditionTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/AndConditionTest.php @@ -55,7 +55,7 @@ public function test_from_ast_round_trips_child_node(string $child): void "SELECT 1 FROM t WHERE a = 1 AND {$child}", select(literal(1)) ->from(table('t')) - ->where(AndCondition::fromAst((new ExpressionParser())->parse("a = 1 AND {$child}"))) + ->where(AndCondition::fromAst(new ExpressionParser()->parse("a = 1 AND {$child}"))) ->toSql(), ); } @@ -66,7 +66,7 @@ public function test_from_ast_round_trips_three_null_tests(): void 'SELECT 1 FROM t WHERE started_at IS NOT NULL AND failed_at IS NULL AND finished_at IS NULL', select(literal(1)) ->from(table('t')) - ->where(AndCondition::fromAst((new ExpressionParser())->parse( + ->where(AndCondition::fromAst(new ExpressionParser()->parse( 'started_at IS NOT NULL AND failed_at IS NULL AND finished_at IS NULL', ))) ->toSql(), diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/BetweenTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/BetweenTest.php index 9a535f8d10..006a2a3bda 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/BetweenTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/BetweenTest.php @@ -221,7 +221,7 @@ public function test_round_trip_renders_between_variant(string $sql): void "SELECT 1 FROM t WHERE {$sql}", select(literal(1)) ->from(table('t')) - ->where(Between::fromAst((new ExpressionParser())->parse($sql))) + ->where(Between::fromAst(new ExpressionParser()->parse($sql))) ->toSql(), ); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/ConditionFactoryTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/ConditionFactoryTest.php index 73df35fd81..dd9a948f4d 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/ConditionFactoryTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/ConditionFactoryTest.php @@ -57,7 +57,7 @@ public function test_from_ast_names_unsupported_a_expr_kind(): void $this->expectException(UnsupportedNodeException::class); $this->expectExceptionMessage('Unsupported node type: A_Expr kind: AEXPR_NULLIF'); - ConditionFactory::fromAst((new ExpressionParser())->parse('NULLIF(a, b)')); + ConditionFactory::fromAst(new ExpressionParser()->parse('NULLIF(a, b)')); } public function test_from_ast_names_unsupported_bool_expr_type(): void @@ -75,13 +75,13 @@ public function test_from_ast_names_unsupported_sub_link_type(): void $this->expectException(UnsupportedNodeException::class); $this->expectExceptionMessage('Unsupported node type: SubLink type: ARRAY_SUBLINK'); - ConditionFactory::fromAst((new ExpressionParser())->parse('ARRAY(SELECT 1)')); + ConditionFactory::fromAst(new ExpressionParser()->parse('ARRAY(SELECT 1)')); } #[DataProvider('row_comparisons_with_subquery')] public function test_from_ast_round_trips_row_comparison_with_subquery(string $sql, string $expected): void { - $condition = ConditionFactory::fromAst((new ExpressionParser())->parse($sql)); + $condition = ConditionFactory::fromAst(new ExpressionParser()->parse($sql)); static::assertInstanceOf(Comparison::class, $condition); static::assertSame( @@ -97,7 +97,7 @@ public function test_from_ast_round_trips_top_level_node(string $sql): void "SELECT 1 FROM t WHERE {$sql}", select(literal(1)) ->from(table('t')) - ->where(ConditionFactory::fromAst((new ExpressionParser())->parse($sql))) + ->where(ConditionFactory::fromAst(new ExpressionParser()->parse($sql))) ->toSql(), ); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/NotConditionTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/NotConditionTest.php index b8d9132067..82aca2eb30 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/NotConditionTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/NotConditionTest.php @@ -58,7 +58,7 @@ public function test_from_ast_round_trips_child_node(string $sql, string $expect "SELECT 1 FROM t WHERE {$expected}", select(literal(1)) ->from(table('t')) - ->where(NotCondition::fromAst((new ExpressionParser())->parse($sql))) + ->where(NotCondition::fromAst(new ExpressionParser()->parse($sql))) ->toSql(), ); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/OrConditionTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/OrConditionTest.php index ca47fcf2a5..c17de1f00c 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/OrConditionTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Condition/OrConditionTest.php @@ -55,7 +55,7 @@ public function test_from_ast_round_trips_child_node(string $child): void "SELECT 1 FROM t WHERE a = 1 OR {$child}", select(literal(1)) ->from(table('t')) - ->where(OrCondition::fromAst((new ExpressionParser())->parse("a = 1 OR {$child}"))) + ->where(OrCondition::fromAst(new ExpressionParser()->parse("a = 1 OR {$child}"))) ->toSql(), ); } @@ -66,9 +66,7 @@ public function test_from_ast_round_trips_two_null_tests(): void 'SELECT 1 FROM t WHERE failed_at IS NULL OR finished_at IS NULL', select(literal(1)) ->from(table('t')) - ->where(OrCondition::fromAst((new ExpressionParser())->parse( - 'failed_at IS NULL OR finished_at IS NULL', - ))) + ->where(OrCondition::fromAst(new ExpressionParser()->parse('failed_at IS NULL OR finished_at IS NULL'))) ->toSql(), ); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Copy/CopyFromBuilderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Copy/CopyFromBuilderTest.php index 4feed30cd2..f4fff625fe 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Copy/CopyFromBuilderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Copy/CopyFromBuilderTest.php @@ -352,6 +352,6 @@ private function deparse(CopyStmt $copyStmt): string $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Copy/CopyToBuilderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Copy/CopyToBuilderTest.php index 5d9019afab..8c614319c3 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Copy/CopyToBuilderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Copy/CopyToBuilderTest.php @@ -342,6 +342,6 @@ private function deparse(CopyStmt $copyStmt): string $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Delete/DeleteBuilderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Delete/DeleteBuilderTest.php index 9ec401247f..6204970fb9 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Delete/DeleteBuilderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Delete/DeleteBuilderTest.php @@ -88,7 +88,7 @@ public function test_delete_complex_query(): void $query = DeleteBuilder::with($withClause) ->from('order_items', 'oi') - ->using((new Table('cancelled_orders'))->as('co')) + ->using(new Table('cancelled_orders')->as('co')) ->where( new Comparison( Column::tableColumn('oi', 'order_id'), @@ -221,12 +221,12 @@ public function test_delete_with_multiple_using_tables(): void { $query = DeleteBuilder::create() ->from('order_items', 'oi') - ->using((new Table('orders'))->as('o'), (new Table('customers'))->as('c')) - ->where((new Comparison( + ->using(new Table('orders')->as('o'), new Table('customers')->as('c')) + ->where(new Comparison( Column::tableColumn('oi', 'order_id'), ComparisonOperator::EQ, Column::tableColumn('o', 'id'), - ))->and( + )->and( new Comparison( Column::tableColumn('o', 'customer_id'), ComparisonOperator::EQ, @@ -268,12 +268,12 @@ public function test_delete_with_multiple_using_tables_deparsed_output(): void $delete = DeleteBuilder::create() ->from('order_items', 'oi') - ->using((new Table('orders'))->as('o'), (new Table('customers'))->as('c')) - ->where((new Comparison( + ->using(new Table('orders')->as('o'), new Table('customers')->as('c')) + ->where(new Comparison( Column::tableColumn('oi', 'order_id'), ComparisonOperator::EQ, Column::tableColumn('o', 'id'), - ))->and( + )->and( new Comparison( Column::tableColumn('o', 'customer_id'), ComparisonOperator::EQ, @@ -437,12 +437,12 @@ public function test_delete_with_using_and_aliased_table(): void { $query = DeleteBuilder::create() ->from('order_items', 'oi') - ->using((new Table('orders'))->as('o')) - ->where((new Comparison( + ->using(new Table('orders')->as('o')) + ->where(new Comparison( Column::tableColumn('oi', 'order_id'), ComparisonOperator::EQ, Column::tableColumn('o', 'id'), - ))->and( + )->and( new Comparison( Column::tableColumn('o', 'status'), ComparisonOperator::EQ, @@ -473,12 +473,12 @@ public function test_delete_with_using_deparsed_output(): void $delete = DeleteBuilder::create() ->from('order_items', 'oi') - ->using((new Table('orders'))->as('o')) - ->where((new Comparison( + ->using(new Table('orders')->as('o')) + ->where(new Comparison( Column::tableColumn('oi', 'order_id'), ComparisonOperator::EQ, Column::tableColumn('o', 'id'), - ))->and( + )->and( new Comparison( Column::tableColumn('o', 'status'), ComparisonOperator::EQ, @@ -644,7 +644,7 @@ public function test_round_trip_complex(): void $original = DeleteBuilder::with($withClause) ->from('order_items', 'oi') - ->using((new Table('cancelled_orders'))->as('co')) + ->using(new Table('cancelled_orders')->as('co')) ->where( new Comparison( Column::tableColumn('oi', 'order_id'), @@ -743,7 +743,7 @@ public function test_round_trip_with_using(): void { $original = DeleteBuilder::create() ->from('order_items', 'oi') - ->using((new Table('orders'))->as('o')) + ->using(new Table('orders')->as('o')) ->where( new Comparison( Column::tableColumn('oi', 'order_id'), @@ -907,6 +907,6 @@ private function deparse(DeleteStmt $deleteStmt): string $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/AggregateCallTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/AggregateCallTest.php index 683932be6c..dc455e4256 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/AggregateCallTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/AggregateCallTest.php @@ -44,7 +44,7 @@ public function test_aggregate_count_star_deparsed_output(): void $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - $deparsed = (new ParsedQuery($parseResult))->deparse(); + $deparsed = new ParsedQuery($parseResult)->deparse(); static::assertSame('SELECT count(*) FROM users', $deparsed); } @@ -67,7 +67,7 @@ public function test_aggregate_sum_deparsed_output(): void $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - $deparsed = (new ParsedQuery($parseResult))->deparse(); + $deparsed = new ParsedQuery($parseResult)->deparse(); static::assertSame('SELECT sum(amount) FROM orders', $deparsed); } @@ -90,7 +90,7 @@ public function test_aggregate_with_distinct_deparsed_output(): void $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - $deparsed = (new ParsedQuery($parseResult))->deparse(); + $deparsed = new ParsedQuery($parseResult)->deparse(); static::assertSame('SELECT count(DISTINCT user_id) FROM sessions', $deparsed); } @@ -264,7 +264,7 @@ public function test_throws_exception_for_empty_function_name(): void { $this->expectException(InvalidExpressionException::class); - (new ReflectionClass(AggregateCall::class))->newInstance([], []); + new ReflectionClass(AggregateCall::class)->newInstance([], []); } public function test_throws_exception_for_star_with_arguments(): void diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/AliasedExpressionTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/AliasedExpressionTest.php index 4d9e222421..f4b1da4bc7 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/AliasedExpressionTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/AliasedExpressionTest.php @@ -40,7 +40,7 @@ public function test_aliased_column_deparsed_output(): void $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - $deparsed = (new ParsedQuery($parseResult))->deparse(); + $deparsed = new ParsedQuery($parseResult)->deparse(); static::assertSame('SELECT user_id AS id FROM users', $deparsed); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/BinaryExpressionTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/BinaryExpressionTest.php index 4f83309c8d..bbc9649a55 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/BinaryExpressionTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/BinaryExpressionTest.php @@ -61,7 +61,7 @@ public function test_binary_expression_deparsed_output(): void $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - $deparsed = (new ParsedQuery($parseResult))->deparse(); + $deparsed = new ParsedQuery($parseResult)->deparse(); static::assertSame('SELECT price * 1.1 FROM products', $deparsed); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/CaseExpressionTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/CaseExpressionTest.php index e493b7eb55..ad39171416 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/CaseExpressionTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/CaseExpressionTest.php @@ -185,7 +185,7 @@ public function test_throws_exception_for_empty_when_clauses(): void { $this->expectException(InvalidExpressionException::class); - (new ReflectionClass(CaseExpression::class))->newInstance(null, []); + new ReflectionClass(CaseExpression::class)->newInstance(null, []); } public function test_with_else_creates_new_instance(): void diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/CoalesceTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/CoalesceTest.php index 20a89e65e0..1b40ec2f7b 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/CoalesceTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/CoalesceTest.php @@ -60,7 +60,7 @@ public function test_coalesce_deparsed_output(): void $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - $deparsed = (new ParsedQuery($parseResult))->deparse(); + $deparsed = new ParsedQuery($parseResult)->deparse(); static::assertSame("SELECT COALESCE(email, 'no-email@example.com') FROM users", $deparsed); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/CollateTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/CollateTest.php index 267957ae7e..f70ff34f45 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/CollateTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/CollateTest.php @@ -39,7 +39,7 @@ protected function setUp(): void public function test_as_aliases(): void { - $aliased = (new Collate(col('name'), 'C'))->as('n'); + $aliased = new Collate(col('name'), 'C')->as('n'); static::assertInstanceOf(AliasedExpression::class, $aliased); static::assertSame('SELECT name COLLATE "C" AS n', select($aliased)->toSql()); @@ -67,7 +67,7 @@ public function test_from_ast_throws_on_non_string_collname(): void $this->expectException(InvalidAstException::class); $this->expectExceptionMessage('Invalid value for field "collname" in CollateClause node: expected String node'); - Collate::fromAst((new Node())->setCollateClause((new CollateClause()) + Collate::fromAst(new Node()->setCollateClause(new CollateClause() ->setArg(col('name')->toAst()) ->setCollname([ new Node(), @@ -79,7 +79,7 @@ public function test_from_ast_throws_without_arg(): void $this->expectException(InvalidAstException::class); $this->expectExceptionMessage('Missing required field "arg" in CollateClause node'); - Collate::fromAst((new Node())->setCollateClause(new CollateClause())); + Collate::fromAst(new Node()->setCollateClause(new CollateClause())); } public function test_from_ast_throws_without_collname(): void @@ -87,7 +87,7 @@ public function test_from_ast_throws_without_collname(): void $this->expectException(InvalidAstException::class); $this->expectExceptionMessage('Missing required field "collname" in CollateClause node'); - Collate::fromAst((new Node())->setCollateClause((new CollateClause())->setArg(col('name')->toAst()))); + Collate::fromAst(new Node()->setCollateClause(new CollateClause()->setArg(col('name')->toAst()))); } public function test_to_ast_deparses_schema_qualified_collation(): void diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/FunctionCallTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/FunctionCallTest.php index 2707f7f4ae..a2b96f095f 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/FunctionCallTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/FunctionCallTest.php @@ -130,7 +130,7 @@ public function test_throws_exception_for_empty_function_name(): void { $this->expectException(InvalidExpressionException::class); - (new ReflectionClass(FunctionCall::class))->newInstance([], []); + new ReflectionClass(FunctionCall::class)->newInstance([], []); } public function test_with_args_creates_new_instance(): void @@ -167,6 +167,6 @@ public function test_func_allows_regular_function_name(): void public function test_function_call_constructor_still_allows_keyword_name_for_round_trip(): void { - static::assertSame(['greatest'], (new FunctionCall(['greatest'], [col('a')]))->getFuncName()); + static::assertSame(['greatest'], new FunctionCall(['greatest'], [col('a')])->getFuncName()); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/MergeActionFunctionTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/MergeActionFunctionTest.php index 1a911034dd..8f7f92c8d1 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/MergeActionFunctionTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/MergeActionFunctionTest.php @@ -26,7 +26,7 @@ public function test_from_ast_reads_merge_support_func_node(): void { static::assertEquals( merge_action(), - MergeActionFunction::fromAst((new Node())->setMergeSupportFunc(new MergeSupportFunc())), + MergeActionFunction::fromAst(new Node()->setMergeSupportFunc(new MergeSupportFunc())), ); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/WindowFunctionTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/WindowFunctionTest.php index b9e7c3537f..71f5b87171 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/WindowFunctionTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Expression/WindowFunctionTest.php @@ -98,10 +98,10 @@ public function test_creates_window_function_without_partition_or_order(): void public function test_recreates_from_ast(): void { $funcNameNode = new Node(); - $funcNameNode->setString((new PBString())->setSval('row_number')); + $funcNameNode->setString(new PBString()->setSval('row_number')); $partitionNode = Column::name('category')->toAst(); - $orderByNode = (new OrderBy(Column::name('created_at')))->toNode(); + $orderByNode = new OrderBy(Column::name('created_at'))->toNode(); $windowDef = new WindowDef(); $windowDef->setPartitionClause([$partitionNode]); @@ -142,7 +142,7 @@ public function test_throws_exception_for_empty_function_name(): void { $this->expectException(InvalidExpressionException::class); - (new ReflectionClass(WindowFunction::class))->newInstance([]); + new ReflectionClass(WindowFunction::class)->newInstance([]); } public function test_with_args_creates_new_instance(): void diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Insert/InsertBuilderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Insert/InsertBuilderTest.php index 564f127dbf..3a31ccbf7e 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Insert/InsertBuilderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Insert/InsertBuilderTest.php @@ -840,6 +840,6 @@ private function deparse(InsertStmt $insertStmt): string $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Merge/MergeBuilderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Merge/MergeBuilderTest.php index 5046660cea..03afb003a8 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Merge/MergeBuilderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Merge/MergeBuilderTest.php @@ -922,6 +922,6 @@ private function deparse(MergeStmt $mergeStmt): string $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Select/SelectBuilderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Select/SelectBuilderTest.php index 3b98f7fbc7..aa11162d0d 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Select/SelectBuilderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Select/SelectBuilderTest.php @@ -186,9 +186,9 @@ public function test_round_trip_with_joins(): void { $original = SelectBuilder::create() ->select(Column::tableColumn('u', 'name'), Column::tableColumn('o', 'total')) - ->from((new Table('users'))->as('u')) + ->from(new Table('users')->as('u')) ->leftJoin( - (new Table('orders'))->as('o'), + new Table('orders')->as('o'), new Comparison( Column::tableColumn('u', 'id'), ComparisonOperator::EQ, @@ -675,9 +675,9 @@ public function test_select_with_full_join(): void { $query = SelectBuilder::create() ->select(Star::all()) - ->from((new Table('users'))->as('u')) + ->from(new Table('users')->as('u')) ->fullJoin( - (new Table('orders'))->as('o'), + new Table('orders')->as('o'), new Comparison( Column::tableColumn('u', 'id'), ComparisonOperator::EQ, @@ -750,9 +750,9 @@ public function test_select_with_inner_join(): void { $query = SelectBuilder::create() ->select(Star::all()) - ->from((new Table('users'))->as('u')) + ->from(new Table('users')->as('u')) ->join( - (new Table('orders'))->as('o'), + new Table('orders')->as('o'), new Comparison( Column::tableColumn('u', 'id'), ComparisonOperator::EQ, @@ -820,9 +820,9 @@ public function test_select_with_join(): void { $query = SelectBuilder::create() ->select(Column::tableColumn('u', 'name'), Column::tableColumn('o', 'total')) - ->from((new Table('users'))->as('u')) + ->from(new Table('users')->as('u')) ->leftJoin( - (new Table('orders'))->as('o'), + new Table('orders')->as('o'), new Comparison( Column::tableColumn('u', 'id'), ComparisonOperator::EQ, @@ -949,9 +949,9 @@ public function test_select_with_multiple_joins(): void { $query = SelectBuilder::create() ->select(Star::all()) - ->from((new Table('users'))->as('u')) + ->from(new Table('users')->as('u')) ->leftJoin( - (new Table('orders'))->as('o'), + new Table('orders')->as('o'), new Comparison( Column::tableColumn('u', 'id'), ComparisonOperator::EQ, @@ -959,7 +959,7 @@ public function test_select_with_multiple_joins(): void ), ) ->leftJoin( - (new Table('payments'))->as('p'), + new Table('payments')->as('p'), new Comparison( Column::tableColumn('o', 'id'), ComparisonOperator::EQ, @@ -1180,9 +1180,9 @@ public function test_select_with_right_join(): void { $query = SelectBuilder::create() ->select(Star::all()) - ->from((new Table('users'))->as('u')) + ->from(new Table('users')->as('u')) ->rightJoin( - (new Table('orders'))->as('o'), + new Table('orders')->as('o'), new Comparison( Column::tableColumn('u', 'id'), ComparisonOperator::EQ, diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/BeginBuilderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/BeginBuilderTest.php index e610f2904c..c248174e4d 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/BeginBuilderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/BeginBuilderTest.php @@ -165,6 +165,6 @@ private function deparse(TransactionStmt $stmt): string $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/CommitBuilderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/CommitBuilderTest.php index 65f9fb7317..2da057aebc 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/CommitBuilderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/CommitBuilderTest.php @@ -89,6 +89,6 @@ private function deparse(TransactionStmt $stmt): string $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/PreparedTransactionBuilderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/PreparedTransactionBuilderTest.php index 44760538d5..67addee27b 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/PreparedTransactionBuilderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/PreparedTransactionBuilderTest.php @@ -106,6 +106,6 @@ private function deparse(TransactionStmt $stmt): string $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/RollbackBuilderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/RollbackBuilderTest.php index 5e2e89cc79..b0753dc598 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/RollbackBuilderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/RollbackBuilderTest.php @@ -101,6 +101,6 @@ private function deparse(TransactionStmt $stmt): string $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/SavepointBuilderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/SavepointBuilderTest.php index db7e37492d..0bc50a93b6 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/SavepointBuilderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/SavepointBuilderTest.php @@ -83,6 +83,6 @@ private function deparse(TransactionStmt $stmt): string $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/SetTransactionBuilderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/SetTransactionBuilderTest.php index f5bf33af3f..95fa12cd31 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/SetTransactionBuilderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Transaction/SetTransactionBuilderTest.php @@ -132,6 +132,6 @@ private function deparse(VariableSetStmt $stmt): string $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Update/UpdateBuilderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Update/UpdateBuilderTest.php index df0d4f708a..59b6863b0f 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Update/UpdateBuilderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/QueryBuilder/Update/UpdateBuilderTest.php @@ -75,7 +75,7 @@ public function test_complex_update_with_all_clauses(): void ->set('status', Literal::string('shipped')) ->set('shipped_at', new FunctionCall(['now'])) ->setAll([]) - ->from((new Table('shipments'))->as('s')) + ->from(new Table('shipments')->as('s')) ->where(new Comparison(Column::name('o.id'), ComparisonOperator::EQ, Column::name('s.order_id'))) ->returning(Column::name('o.id'), Column::name('o.status')); @@ -171,7 +171,7 @@ public function test_round_trip_complex(): void ->set('status', Literal::string('completed')) ->set('completed_at', new FunctionCall(['now'])) ->setAll([]) - ->from((new Table('order_items'))->as('oi')) + ->from(new Table('order_items')->as('oi')) ->where(new Comparison(Column::name('o.id'), ComparisonOperator::EQ, Column::name('oi.order_id'))) ->returning(Column::name('o.id')); @@ -215,7 +215,7 @@ public function test_round_trip_with_from(): void ->update('orders', 'o') ->set('status', Column::name('s.status')) ->setAll([]) - ->from((new Table('order_status'))->as('s')); + ->from(new Table('order_status')->as('s')); $ast = $original->toAst(); @@ -478,7 +478,7 @@ public function test_update_with_from(): void ->update('orders', 'o') ->set('status', Column::name('s.status')) ->setAll([]) - ->from((new Table('order_status'))->as('s')) + ->from(new Table('order_status')->as('s')) ->where(new Comparison(Column::name('o.status_id'), ComparisonOperator::EQ, Column::name('s.id'))); $ast = $query->toAst(); @@ -508,7 +508,7 @@ public function test_update_with_from_deparsed_output(): void ->update('orders', 'o') ->set('status', Column::tableColumn('s', 'status')) ->setAll([]) - ->from((new Table('order_status'))->as('s')) + ->from(new Table('order_status')->as('s')) ->where( new Comparison( Column::tableColumn('o', 'status_id'), @@ -550,7 +550,7 @@ public function test_update_with_multiple_from_tables(): void ->update('products', 'p') ->set('price', Column::name('pp.price')) ->setAll([]) - ->from((new Table('product_prices'))->as('pp'), (new Table('categories'))->as('c')); + ->from(new Table('product_prices')->as('pp'), new Table('categories')->as('c')); $ast = $query->toAst(); $fromClause = $ast->getFromClause(); @@ -878,6 +878,6 @@ private function deparse(UpdateStmt $updateStmt): string $parseResult = $parsed->raw(); $parseResult->setStmts([$rawStmt]); - return (new ParsedQuery($parseResult))->deparse(); + return new ParsedQuery($parseResult)->deparse(); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/CatalogTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/CatalogTest.php index 3fb895ea1e..630a2c9ec6 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/CatalogTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/CatalogTest.php @@ -300,7 +300,7 @@ public function test_merge_empty_catalog_with_catalog(): void schema_table('users', [schema_column_integer('id', nullable: false)]), ])]); - $result = (new Catalog([]))->merge($catalog); + $result = new Catalog([])->merge($catalog); static::assertSame(['public'], $result->names()); static::assertTrue($result->get('public')->hasTable('users')); @@ -318,7 +318,7 @@ public function test_merge_extensions_by_name_other_wins(): void public function test_merge_two_empty_catalogs(): void { - $result = (new Catalog([]))->merge(new Catalog([])); + $result = new Catalog([])->merge(new Catalog([])); static::assertSame([], $result->all()); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/CatalogDiffTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/CatalogDiffTest.php index e00440cf3c..0578327dc1 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/CatalogDiffTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/CatalogDiffTest.php @@ -32,7 +32,7 @@ public function test_creates_added_extension(): void { $catalog = new Catalog([schema('public')]); - $sqls = (new CatalogDiff($catalog, $catalog, addedExtensions: [schema_extension('uuid-ossp')]))->generate(); + $sqls = new CatalogDiff($catalog, $catalog, addedExtensions: [schema_extension('uuid-ossp')])->generate(); static::assertCount(1, $sqls); static::assertSame('CREATE EXTENSION "uuid-ossp" SCHEMA public', $sqls[0]->toSql()); @@ -138,7 +138,7 @@ public function test_drops_removed_extension(): void { $catalog = new Catalog([schema('public')]); - $sqls = (new CatalogDiff($catalog, $catalog, removedExtensions: [schema_extension('uuid-ossp')]))->generate(); + $sqls = new CatalogDiff($catalog, $catalog, removedExtensions: [schema_extension('uuid-ossp')])->generate(); static::assertCount(1, $sqls); static::assertSame('DROP EXTENSION "uuid-ossp"', $sqls[0]->toSql()); @@ -202,28 +202,28 @@ public function test_is_not_empty_when_added_extensions(): void { $catalog = new Catalog([schema('public')]); - static::assertFalse((new CatalogDiff($catalog, $catalog, addedExtensions: [schema_extension( + static::assertFalse(new CatalogDiff($catalog, $catalog, addedExtensions: [schema_extension( 'uuid-ossp', - )]))->isEmpty()); + )])->isEmpty()); } public function test_is_not_empty_when_modified_extensions(): void { $catalog = new Catalog([schema('public'), schema('extp')]); - static::assertFalse((new CatalogDiff($catalog, $catalog, modifiedExtensions: [new ExtensionDiff( + static::assertFalse(new CatalogDiff($catalog, $catalog, modifiedExtensions: [new ExtensionDiff( schema_extension('pgcrypto'), schema_extension('pgcrypto', schema: 'extp'), - )]))->isEmpty()); + )])->isEmpty()); } public function test_is_not_empty_when_removed_extensions(): void { $catalog = new Catalog([schema('public')]); - static::assertFalse((new CatalogDiff($catalog, $catalog, removedExtensions: [schema_extension( + static::assertFalse(new CatalogDiff($catalog, $catalog, removedExtensions: [schema_extension( 'uuid-ossp', - )]))->isEmpty()); + )])->isEmpty()); } public function test_not_empty_when_schema_added(): void diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/ConstraintComparatorTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/ConstraintComparatorTest.php index d7e48af493..026a361730 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/ConstraintComparatorTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/ConstraintComparatorTest.php @@ -286,7 +286,7 @@ public function test_foreign_key_removed(): void public function test_unnamed_checks_are_keyed_by_normalised_expression(): void { - $result = (new ConstraintComparator())->diffCheckConstraints([new CheckConstraint( + $result = new ConstraintComparator()->diffCheckConstraints([new CheckConstraint( "((status)::text = 'active'::text)", )], [new CheckConstraint("status = 'active'")]); diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/LevenshteinStrategyTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/LevenshteinStrategyTest.php index 2be942e0fb..02c894ef54 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/LevenshteinStrategyTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/LevenshteinStrategyTest.php @@ -11,22 +11,22 @@ final class LevenshteinStrategyTest extends TestCase { public function test_both_empty_strings_score_100(): void { - static::assertSame(100.0, (new LevenshteinStrategy())->similarity('', '')); + static::assertSame(100.0, new LevenshteinStrategy()->similarity('', '')); } public function test_custom_threshold(): void { - static::assertSame(75.0, (new LevenshteinStrategy(75.0))->threshold()); + static::assertSame(75.0, new LevenshteinStrategy(75.0)->threshold()); } public function test_default_threshold_is_50(): void { - static::assertSame(50.0, (new LevenshteinStrategy())->threshold()); + static::assertSame(50.0, new LevenshteinStrategy()->threshold()); } public function test_identical_names_score_100(): void { - static::assertSame(100.0, (new LevenshteinStrategy())->similarity('column_name', 'column_name')); + static::assertSame(100.0, new LevenshteinStrategy()->similarity('column_name', 'column_name')); } public function test_levenshtein_penalizes_suffix_removal_more_than_similar_text(): void @@ -41,30 +41,26 @@ public function test_levenshtein_penalizes_suffix_removal_more_than_similar_text public function test_one_empty_string_scores_0(): void { - static::assertSame(0.0, (new LevenshteinStrategy())->similarity('', 'something')); + static::assertSame(0.0, new LevenshteinStrategy()->similarity('', 'something')); } public function test_realistic_column_rename_suffix_removed(): void { static::assertEqualsWithDelta( 70.0, - (new LevenshteinStrategy())->similarity('net_commission_cents', 'net_commission'), + new LevenshteinStrategy()->similarity('net_commission_cents', 'net_commission'), 0.01, ); } public function test_single_character_typo_scores_above_90(): void { - static::assertEqualsWithDelta( - 90.91, - (new LevenshteinStrategy())->similarity('column_name', 'column_namx'), - 0.01, - ); + static::assertEqualsWithDelta(90.91, new LevenshteinStrategy()->similarity('column_name', 'column_namx'), 0.01); } public function test_unrelated_names_score_low(): void { - $score = (new LevenshteinStrategy())->similarity('foo', 'xyz_completely_different'); + $score = new LevenshteinStrategy()->similarity('foo', 'xyz_completely_different'); static::assertLessThan(20.0, $score); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/LongestCommonSubstringStrategyTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/LongestCommonSubstringStrategyTest.php index 9415899d3c..300da0aabc 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/LongestCommonSubstringStrategyTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/LongestCommonSubstringStrategyTest.php @@ -11,7 +11,7 @@ final class LongestCommonSubstringStrategyTest extends TestCase { public function test_both_empty_strings_score_100(): void { - static::assertSame(100.0, (new LongestCommonSubstringStrategy())->similarity('', '')); + static::assertSame(100.0, new LongestCommonSubstringStrategy()->similarity('', '')); } public function test_common_prefix_with_different_suffix(): void @@ -26,40 +26,40 @@ public function test_common_prefix_with_different_suffix(): void public function test_custom_threshold(): void { - static::assertSame(75.0, (new LongestCommonSubstringStrategy(75.0))->threshold()); + static::assertSame(75.0, new LongestCommonSubstringStrategy(75.0)->threshold()); } public function test_default_threshold_is_50(): void { - static::assertSame(50.0, (new LongestCommonSubstringStrategy())->threshold()); + static::assertSame(50.0, new LongestCommonSubstringStrategy()->threshold()); } public function test_identical_names_score_100(): void { - static::assertSame(100.0, (new LongestCommonSubstringStrategy())->similarity('column_name', 'column_name')); + static::assertSame(100.0, new LongestCommonSubstringStrategy()->similarity('column_name', 'column_name')); } public function test_no_common_characters_scores_0(): void { - static::assertSame(0.0, (new LongestCommonSubstringStrategy())->similarity('abc', 'xyz')); + static::assertSame(0.0, new LongestCommonSubstringStrategy()->similarity('abc', 'xyz')); } public function test_one_empty_string_scores_0(): void { - static::assertSame(0.0, (new LongestCommonSubstringStrategy())->similarity('', 'something')); + static::assertSame(0.0, new LongestCommonSubstringStrategy()->similarity('', 'something')); } public function test_realistic_column_rename_suffix_removed(): void { static::assertEqualsWithDelta( 70.0, - (new LongestCommonSubstringStrategy())->similarity('net_commission_cents', 'net_commission'), + new LongestCommonSubstringStrategy()->similarity('net_commission_cents', 'net_commission'), 0.01, ); } public function test_reversed_single_chars_share_one_character_substring(): void { - static::assertSame(50.0, (new LongestCommonSubstringStrategy())->similarity('ax', 'xa')); + static::assertSame(50.0, new LongestCommonSubstringStrategy()->similarity('ax', 'xa')); } } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/SimilarTextStrategyTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/SimilarTextStrategyTest.php index 3243c1a35a..7eff5ac04a 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/SimilarTextStrategyTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/SimilarTextStrategyTest.php @@ -11,34 +11,34 @@ final class SimilarTextStrategyTest extends TestCase { public function test_custom_threshold(): void { - static::assertSame(75.0, (new SimilarTextStrategy(75.0))->threshold()); + static::assertSame(75.0, new SimilarTextStrategy(75.0)->threshold()); } public function test_default_threshold_is_50(): void { - static::assertSame(50.0, (new SimilarTextStrategy())->threshold()); + static::assertSame(50.0, new SimilarTextStrategy()->threshold()); } public function test_empty_strings_score_0(): void { - static::assertSame(0.0, (new SimilarTextStrategy())->similarity('', '')); + static::assertSame(0.0, new SimilarTextStrategy()->similarity('', '')); } public function test_identical_names_score_100(): void { - static::assertSame(100.0, (new SimilarTextStrategy())->similarity('column_name', 'column_name')); + static::assertSame(100.0, new SimilarTextStrategy()->similarity('column_name', 'column_name')); } public function test_partial_overlap_scores_between_50_and_100(): void { - static::assertEqualsWithDelta(66.67, (new SimilarTextStrategy())->similarity('last_name', 'full_name'), 0.01); + static::assertEqualsWithDelta(66.67, new SimilarTextStrategy()->similarity('last_name', 'full_name'), 0.01); } public function test_realistic_column_rename_scores_above_80(): void { static::assertEqualsWithDelta( 82.35, - (new SimilarTextStrategy())->similarity('net_commission_cents', 'net_commission'), + new SimilarTextStrategy()->similarity('net_commission_cents', 'net_commission'), 0.01, ); } @@ -57,7 +57,7 @@ public function test_unrelated_names_score_below_threshold(): void { static::assertEqualsWithDelta( 7.41, - (new SimilarTextStrategy())->similarity('foo', 'xyz_completely_different'), + new SimilarTextStrategy()->similarity('foo', 'xyz_completely_different'), 0.01, ); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/TableDiffTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/TableDiffTest.php index 106628c08a..71a83101b1 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/TableDiffTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/Diff/TableDiffTest.php @@ -563,12 +563,12 @@ public function test_drops_index_if_exists(): void static::assertSame( 'DROP INDEX IF EXISTS pivotly.idx_users_name', - (new TableDiff( + new TableDiff( $table, $table, removedIndexes: [schema_index('idx_users_name', ['name'])], dropIfExists: true, - ))->generate()[0]->toSql(), + )->generate()[0]->toSql(), ); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/ForeignKeyDependencyOrderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/ForeignKeyDependencyOrderTest.php index 53b7bbd959..6a36ee528c 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/ForeignKeyDependencyOrderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/ForeignKeyDependencyOrderTest.php @@ -39,7 +39,7 @@ public function test_circular_dependency_throws_exception(): void $this->expectException(SchemaException::class); $this->expectExceptionMessage('Circular foreign key dependency'); - (new ForeignKeyDependencyOrder())->order([$tableA, $tableB]); + new ForeignKeyDependencyOrder()->order([$tableA, $tableB]); } public function test_diamond_dependency(): void @@ -73,7 +73,7 @@ public function test_diamond_dependency(): void schema: 'public', ); - $result = (new ForeignKeyDependencyOrder())->order([$bottom, $left, $right, $root]); + $result = new ForeignKeyDependencyOrder()->order([$bottom, $left, $right, $root]); $names = array_map(static fn($t) => $t->name, $result); @@ -87,7 +87,7 @@ public function test_diamond_dependency(): void public function test_empty_list(): void { - static::assertSame([], (new ForeignKeyDependencyOrder())->order([])); + static::assertSame([], new ForeignKeyDependencyOrder()->order([])); } public function test_fk_referencing_table_outside_the_list_is_ignored(): void @@ -112,7 +112,7 @@ public function test_fk_referencing_table_outside_the_list_is_ignored(): void schema: 'public', ); - $result = (new ForeignKeyDependencyOrder())->order([$independent, $child]); + $result = new ForeignKeyDependencyOrder()->order([$independent, $child]); static::assertCount(2, $result); } @@ -142,7 +142,7 @@ public function test_linear_chain(): void schema: 'public', ); - $result = (new ForeignKeyDependencyOrder())->order([$child, $parent, $grandparent]); + $result = new ForeignKeyDependencyOrder()->order([$child, $parent, $grandparent]); $names = array_map(static fn($t) => $t->name, $result); @@ -167,7 +167,7 @@ public function test_self_referencing_fk(): void schema: 'public', ); - $result = (new ForeignKeyDependencyOrder())->order([$products, $categories]); + $result = new ForeignKeyDependencyOrder()->order([$products, $categories]); $names = array_map(static fn($t) => $t->name, $result); @@ -183,7 +183,7 @@ public function test_single_table(): void schema: 'public', ); - $result = (new ForeignKeyDependencyOrder())->order([$table]); + $result = new ForeignKeyDependencyOrder()->order([$table]); static::assertCount(1, $result); static::assertSame('users', $result[0]->name); @@ -197,7 +197,7 @@ public function test_tables_without_fks_preserve_order(): void $tableC = schema_table('gamma', [schema_column_integer('id')], schema_primary_key(['id']), schema: 'public'); - $result = (new ForeignKeyDependencyOrder())->order([$tableA, $tableB, $tableC]); + $result = new ForeignKeyDependencyOrder()->order([$tableA, $tableB, $tableC]); $names = array_map(static fn($t) => $t->name, $result); diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/MaterializedViewDependencyOrderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/MaterializedViewDependencyOrderTest.php index f435f30f6e..c96d91cccd 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/MaterializedViewDependencyOrderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/MaterializedViewDependencyOrderTest.php @@ -22,7 +22,7 @@ public function test_circular_dependency_throws_exception(): void $this->expectException(SchemaException::class); $this->expectExceptionMessage('Circular dependency detected between materialized views'); - (new MaterializedViewDependencyOrder(new Parser()))->order([$viewA, $viewB]); + new MaterializedViewDependencyOrder(new Parser())->order([$viewA, $viewB]); } public function test_cte_name_is_not_a_dependency(): void @@ -34,14 +34,14 @@ public function test_cte_name_is_not_a_dependency(): void ['a', 'b'], array_map( static fn(MaterializedView $v) => $v->name, - (new MaterializedViewDependencyOrder(new Parser()))->order([$a, $b]), + new MaterializedViewDependencyOrder(new Parser())->order([$a, $b]), ), ); } public function test_empty_list(): void { - static::assertSame([], (new MaterializedViewDependencyOrder(new Parser()))->order([])); + static::assertSame([], new MaterializedViewDependencyOrder(new Parser())->order([])); } public function test_for_update_of_alias_is_not_a_dependency(): void @@ -53,7 +53,7 @@ public function test_for_update_of_alias_is_not_a_dependency(): void ['a', 'b'], array_map( static fn(MaterializedView $v) => $v->name, - (new MaterializedViewDependencyOrder(new Parser()))->order([$a, $b]), + new MaterializedViewDependencyOrder(new Parser())->order([$a, $b]), ), ); } @@ -64,7 +64,7 @@ public function test_repeated_reference_is_not_a_cycle(): void $subquery = new MaterializedView('v2', 'SELECT a FROM v1 WHERE a IN (SELECT a FROM v1)'); $locked = new MaterializedView('v3', 'SELECT a FROM v1 FOR UPDATE OF v1'); - $result = (new MaterializedViewDependencyOrder(new Parser()))->order([$subquery, $locked, $base]); + $result = new MaterializedViewDependencyOrder(new Parser())->order([$subquery, $locked, $base]); static::assertSame(['v1', 'v2', 'v3'], array_map(static fn(MaterializedView $v) => $v->name, $result)); } @@ -74,7 +74,7 @@ public function test_linear_chain(): void $base = new MaterializedView('base_mv', 'SELECT id, name FROM users'); $top = new MaterializedView('top_mv', 'SELECT * FROM base_mv'); - $result = (new MaterializedViewDependencyOrder(new Parser()))->order([$top, $base]); + $result = new MaterializedViewDependencyOrder(new Parser())->order([$top, $base]); $names = array_map(static fn(MaterializedView $v) => $v->name, $result); @@ -86,7 +86,7 @@ public function test_self_referencing_materialized_view(): void $recursive = new MaterializedView('recursive_mv', 'SELECT * FROM recursive_mv'); $other = new MaterializedView('other_mv', 'SELECT * FROM recursive_mv'); - $result = (new MaterializedViewDependencyOrder(new Parser()))->order([$other, $recursive]); + $result = new MaterializedViewDependencyOrder(new Parser())->order([$other, $recursive]); $names = array_map(static fn(MaterializedView $v) => $v->name, $result); @@ -97,7 +97,7 @@ public function test_single_materialized_view(): void { $view = new MaterializedView('my_mv', 'SELECT * FROM users'); - $result = (new MaterializedViewDependencyOrder(new Parser()))->order([$view]); + $result = new MaterializedViewDependencyOrder(new Parser())->order([$view]); static::assertCount(1, $result); static::assertSame('my_mv', $result[0]->name); @@ -108,7 +108,7 @@ public function test_views_without_dependencies_preserve_order(): void $viewA = new MaterializedView('alpha', 'SELECT 1 AS val'); $viewB = new MaterializedView('beta', 'SELECT 2 AS val'); - $result = (new MaterializedViewDependencyOrder(new Parser()))->order([$viewA, $viewB]); + $result = new MaterializedViewDependencyOrder(new Parser())->order([$viewA, $viewB]); $names = array_map(static fn(MaterializedView $v) => $v->name, $result); diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/NoExecutionOrderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/NoExecutionOrderTest.php index a88bfe9730..a97c3a157a 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/NoExecutionOrderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/NoExecutionOrderTest.php @@ -21,7 +21,7 @@ public function test_returns_tables_in_original_order(): void $tableC = schema_table('gamma', [schema_column_integer('id')], schema_primary_key(['id']), schema: 'public'); - $result = (new NoExecutionOrder())->order([$tableC, $tableA, $tableB]); + $result = new NoExecutionOrder()->order([$tableC, $tableA, $tableB]); static::assertSame([$tableC, $tableA, $tableB], $result); } diff --git a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/ViewDependencyOrderTest.php b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/ViewDependencyOrderTest.php index 0c3db1aeab..8c8dc3dd0f 100644 --- a/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/ViewDependencyOrderTest.php +++ b/src/lib/postgresql/tests/Flow/PostgreSql/Tests/Unit/Schema/ViewDependencyOrderTest.php @@ -22,7 +22,7 @@ public function test_circular_dependency_throws_exception(): void $this->expectException(SchemaException::class); $this->expectExceptionMessage('Circular view dependency'); - (new ViewDependencyOrder(new Parser()))->order([$viewA, $viewB]); + new ViewDependencyOrder(new Parser())->order([$viewA, $viewB]); } public function test_cte_name_is_not_a_dependency(): void @@ -32,13 +32,13 @@ public function test_cte_name_is_not_a_dependency(): void static::assertSame( ['a', 'b'], - array_map(static fn(View $v) => $v->name, (new ViewDependencyOrder(new Parser()))->order([$a, $b])), + array_map(static fn(View $v) => $v->name, new ViewDependencyOrder(new Parser())->order([$a, $b])), ); } public function test_empty_list(): void { - static::assertSame([], (new ViewDependencyOrder(new Parser()))->order([])); + static::assertSame([], new ViewDependencyOrder(new Parser())->order([])); } public function test_for_update_of_alias_is_not_a_dependency(): void @@ -48,7 +48,7 @@ public function test_for_update_of_alias_is_not_a_dependency(): void static::assertSame( ['a', 'b'], - array_map(static fn(View $v) => $v->name, (new ViewDependencyOrder(new Parser()))->order([$a, $b])), + array_map(static fn(View $v) => $v->name, new ViewDependencyOrder(new Parser())->order([$a, $b])), ); } @@ -58,7 +58,7 @@ public function test_linear_chain(): void $middle = new View('middle_view', 'SELECT id FROM base_view WHERE id > 0'); $top = new View('top_view', 'SELECT * FROM middle_view'); - $result = (new ViewDependencyOrder(new Parser()))->order([$top, $middle, $base]); + $result = new ViewDependencyOrder(new Parser())->order([$top, $middle, $base]); $names = array_map(static fn(View $v) => $v->name, $result); @@ -71,7 +71,7 @@ public function test_repeated_reference_is_not_a_cycle(): void $subquery = new View('v2', 'SELECT a FROM v1 WHERE a IN (SELECT a FROM v1)'); $locked = new View('v3', 'SELECT a FROM v1 FOR UPDATE OF v1'); - $result = (new ViewDependencyOrder(new Parser()))->order([$subquery, $locked, $base]); + $result = new ViewDependencyOrder(new Parser())->order([$subquery, $locked, $base]); static::assertSame(['v1', 'v2', 'v3'], array_map(static fn(View $v) => $v->name, $result)); } @@ -81,7 +81,7 @@ public function test_self_referencing_view(): void $recursive = new View('recursive_view', 'SELECT * FROM recursive_view'); $other = new View('other_view', 'SELECT * FROM recursive_view'); - $result = (new ViewDependencyOrder(new Parser()))->order([$other, $recursive]); + $result = new ViewDependencyOrder(new Parser())->order([$other, $recursive]); $names = array_map(static fn(View $v) => $v->name, $result); @@ -92,7 +92,7 @@ public function test_single_view(): void { $view = new View('my_view', 'SELECT * FROM users'); - $result = (new ViewDependencyOrder(new Parser()))->order([$view]); + $result = new ViewDependencyOrder(new Parser())->order([$view]); static::assertCount(1, $result); static::assertSame('my_view', $result[0]->name); @@ -103,7 +103,7 @@ public function test_view_referencing_external_table_is_not_affected(): void $viewA = new View('view_a', 'SELECT * FROM external_table'); $viewB = new View('view_b', 'SELECT * FROM another_external'); - $result = (new ViewDependencyOrder(new Parser()))->order([$viewA, $viewB]); + $result = new ViewDependencyOrder(new Parser())->order([$viewA, $viewB]); static::assertCount(2, $result); static::assertSame('view_a', $result[0]->name); @@ -116,7 +116,7 @@ public function test_views_without_dependencies_preserve_order(): void $viewB = new View('beta', 'SELECT 2 AS val'); $viewC = new View('gamma', 'SELECT 3 AS val'); - $result = (new ViewDependencyOrder(new Parser()))->order([$viewA, $viewB, $viewC]); + $result = new ViewDependencyOrder(new Parser())->order([$viewA, $viewB, $viewC]); $names = array_map(static fn(View $v) => $v->name, $result); diff --git a/src/lib/snappy/composer.json b/src/lib/snappy/composer.json index 4ce546f4f6..6739ba9daa 100644 --- a/src/lib/snappy/composer.json +++ b/src/lib/snappy/composer.json @@ -13,7 +13,7 @@ "compression" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "config": { "optimize-autoloader": true, diff --git a/src/lib/snappy/polyfill.php b/src/lib/snappy/polyfill.php index 15f55ed8e9..8d61b12273 100644 --- a/src/lib/snappy/polyfill.php +++ b/src/lib/snappy/polyfill.php @@ -7,13 +7,13 @@ if (!function_exists('snappy_compress')) { function snappy_compress(string $plainText): string { - return (new Snappy())->compress($plainText); + return new Snappy()->compress($plainText); } } if (!function_exists('snappy_uncompress')) { function snappy_uncompress(string $compressedText): string|false { - return (new Snappy())->uncompress($compressedText); + return new Snappy()->uncompress($compressedText); } } diff --git a/src/lib/snappy/src/Flow/Snappy/Snappy.php b/src/lib/snappy/src/Flow/Snappy/Snappy.php index ea2ff7926b..7a27367aad 100644 --- a/src/lib/snappy/src/Flow/Snappy/Snappy.php +++ b/src/lib/snappy/src/Flow/Snappy/Snappy.php @@ -21,7 +21,7 @@ public function compress(string $plainText): string $byteArray = array_values(unpack('C*', $plainText) ?: []); $outputBuffer = []; - (new SnappyCompressor($byteArray))->compressToBuffer($outputBuffer); + new SnappyCompressor($byteArray)->compressToBuffer($outputBuffer); return pack('C*', ...$outputBuffer); } @@ -35,7 +35,7 @@ public function uncompress(string $compressedText): string|false $byteArray = array_values(unpack('C*', $compressedText) ?: []); $outputBuffer = []; - if (!(new SnappyDecompressor($byteArray))->uncompressToBuffer($outputBuffer)) { + if (!new SnappyDecompressor($byteArray)->uncompressToBuffer($outputBuffer)) { return false; } diff --git a/src/lib/telemetry/composer.json b/src/lib/telemetry/composer.json index f859fe1ed0..6f363f03c0 100644 --- a/src/lib/telemetry/composer.json +++ b/src/lib/telemetry/composer.json @@ -9,7 +9,7 @@ "tracing" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "composer-runtime-api": "^2.2", "psr/clock": "^1.0", "symfony/polyfill-mbstring": "^1.33" diff --git a/src/lib/telemetry/src/Flow/Telemetry/ErrorHandler/UdpSyslogHandler.php b/src/lib/telemetry/src/Flow/Telemetry/ErrorHandler/UdpSyslogHandler.php index 1416542856..d5a3ebb996 100644 --- a/src/lib/telemetry/src/Flow/Telemetry/ErrorHandler/UdpSyslogHandler.php +++ b/src/lib/telemetry/src/Flow/Telemetry/ErrorHandler/UdpSyslogHandler.php @@ -59,7 +59,7 @@ public function handle(Throwable $error): void } $priority = $this->facility->value | $this->severity->value; - $timestamp = (new DateTimeImmutable())->format(DateTimeInterface::RFC3339); + $timestamp = new DateTimeImmutable()->format(DateTimeInterface::RFC3339); $hostname = gethostname(); if ($hostname === false) { diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Integration/Logger/LoggingIntegrationTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Integration/Logger/LoggingIntegrationTest.php index 8be85c7c62..bedbed0613 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Integration/Logger/LoggingIntegrationTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Integration/Logger/LoggingIntegrationTest.php @@ -49,7 +49,7 @@ public function test_complete_logging_workflow(): void throw new RuntimeException('Database connection failed'); } catch (Throwable $e) { $logger->emit( - (new LogRecord()) + new LogRecord() ->setSeverity(Severity::ERROR) ->setBody('Database error') ->setException($e), diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Integration/Resource/Detector/GitDetectorTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Integration/Resource/Detector/GitDetectorTest.php index 64e79382c1..7aee9c40ef 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Integration/Resource/Detector/GitDetectorTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Integration/Resource/Detector/GitDetectorTest.php @@ -22,7 +22,7 @@ public function test_detect_keeps_scp_like_ssh_remote_untouched(): void 'git@github.com:flow-php/phpstan-types-bridge.git', ); - $resource = (new GitDetector($directory))->detect(); + $resource = new GitDetector($directory)->detect(); static::assertSame( 'git@github.com:flow-php/phpstan-types-bridge.git', @@ -34,7 +34,7 @@ public function test_detect_returns_branch_name_and_type_when_not_detached(): vo { $directory = $this->gitContext->createLocalRepository(GitContext::BRANCH); - $resource = (new GitDetector($directory))->detect(); + $resource = new GitDetector($directory)->detect(); static::assertSame(GitContext::BRANCH, $resource->get(VcsAttribute::REF_HEAD_NAME->value)); static::assertSame('branch', $resource->get(VcsAttribute::REF_HEAD_TYPE->value)); @@ -44,7 +44,7 @@ public function test_detect_returns_empty_resource_outside_a_work_tree(): void { $directory = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'flow_telemetry_git_non_existing_' . uniqid(); - $resource = (new GitDetector($directory))->detect(); + $resource = new GitDetector($directory)->detect(); static::assertSame(0, $resource->count()); } @@ -53,7 +53,7 @@ public function test_detect_returns_head_revision(): void { $directory = $this->gitContext->createLocalRepository(GitContext::BRANCH); - $resource = (new GitDetector($directory))->detect(); + $resource = new GitDetector($directory)->detect(); $revision = $resource->get(VcsAttribute::REF_HEAD_REVISION->value); @@ -65,7 +65,7 @@ public function test_detect_returns_repository_url(): void { $directory = $this->gitContext->createLocalRepository(GitContext::BRANCH); - $resource = (new GitDetector($directory))->detect(); + $resource = new GitDetector($directory)->detect(); static::assertSame(GitContext::REPOSITORY_URL, $resource->get(VcsAttribute::REPOSITORY_URL->value)); } @@ -74,7 +74,7 @@ public function test_detect_returns_tag_name_and_type_in_detached_head(): void { $directory = $this->gitContext->createLocalRepository(GitContext::TAG); - $resource = (new GitDetector($directory))->detect(); + $resource = new GitDetector($directory)->detect(); static::assertSame(GitContext::TAG, $resource->get(VcsAttribute::REF_HEAD_NAME->value)); static::assertSame('tag', $resource->get(VcsAttribute::REF_HEAD_TYPE->value)); @@ -90,7 +90,7 @@ public function test_detect_strips_credentials_from_repository_url(): void 'https://user:secret@github.com/flow-php/phpstan-types-bridge.git', ); - $resource = (new GitDetector($directory))->detect(); + $resource = new GitDetector($directory)->detect(); static::assertSame( 'https://github.com/flow-php/phpstan-types-bridge.git', @@ -108,7 +108,7 @@ public function test_detect_uses_explicit_git_binary_path(): void $directory = $this->gitContext->createLocalRepository(GitContext::BRANCH); - $resource = (new GitDetector($directory, $gitBinary))->detect(); + $resource = new GitDetector($directory, $gitBinary)->detect(); static::assertSame(GitContext::BRANCH, $resource->get(VcsAttribute::REF_HEAD_NAME->value)); } diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Mother/ErrorHandlerSpy.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Mother/ErrorHandlerSpy.php index 78edc3387a..da8c77a7c0 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Mother/ErrorHandlerSpy.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Mother/ErrorHandlerSpy.php @@ -7,7 +7,7 @@ use Flow\Telemetry\ErrorHandler\ErrorHandler; use Throwable; -use function array_key_last; +use function array_last; use function count; final class ErrorHandlerSpy implements ErrorHandler @@ -39,6 +39,6 @@ public function last(): ?Throwable return null; } - return $this->errors[array_key_last($this->errors)]; + return array_last($this->errors); } } diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Mother/LogEntryMother.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Mother/LogEntryMother.php index 7a4651542f..0819c94d3f 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Mother/LogEntryMother.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Mother/LogEntryMother.php @@ -17,7 +17,7 @@ final class LogEntryMother public static function scoped(InstrumentationScope $scope, Resource $resource): LogEntry { return new LogEntry( - (new LogRecord()) + new LogRecord() ->setSeverity(Severity::INFO) ->setBody('Hello world'), $resource, @@ -37,7 +37,7 @@ public static function create( ?SpanContext $spanContext = null, ): LogEntry { return new LogEntry( - (new LogRecord()) + new LogRecord() ->setSeverity($severity) ->setBody($body) ->setAttributes($attributes), @@ -58,7 +58,7 @@ public static function deterministic( ?SpanContext $spanContext = null, ): LogEntry { return new LogEntry( - (new LogRecord()) + new LogRecord() ->setSeverity($severity) ->setBody($body) ->setAttributes($attributes), diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Mother/ScopeMother.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Mother/ScopeMother.php index b961a5daf0..3e67192ff5 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Mother/ScopeMother.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Mother/ScopeMother.php @@ -15,6 +15,6 @@ final class ScopeMother */ public static function attached(): Scope { - return (new MemoryContextStorage())->attach(Context::root()); + return new MemoryContextStorage()->attach(Context::root()); } } diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/ClientUrlAttributesTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/ClientUrlAttributesTest.php index 63a6bd3273..bd76126aee 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/ClientUrlAttributesTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/ClientUrlAttributesTest.php @@ -16,7 +16,7 @@ public function test_default_sanitizer_redacts_sensitive_query_parameters(): voi { static::assertSame( 'https://h/x?access_token=REDACTED&fields=id', - (new ClientUrlAttributes())->of('https://h/x?access_token=T&fields=id')['url.full'], + new ClientUrlAttributes()->of('https://h/x?access_token=T&fields=id')['url.full'], ); } @@ -29,7 +29,7 @@ public function test_full_url(): void 'server.address' => 'graph.facebook.com', 'server.port' => 8443, ], - (new ClientUrlAttributes(url_sanitizer(['fb_exchange_token'])))->of( + new ClientUrlAttributes(url_sanitizer(['fb_exchange_token']))->of( 'https://u:p@graph.facebook.com:8443/me?fb_exchange_token=T&fields=id', ), ); @@ -40,7 +40,7 @@ public function test_full_url(): void #[TestWith(['/x', 'http', 80])] public function test_scheme_and_port_fall_back_to_defaults(string $url, string $scheme, int $port): void { - $attributes = (new ClientUrlAttributes())->of($url); + $attributes = new ClientUrlAttributes()->of($url); static::assertSame($scheme, $attributes['url.scheme']); static::assertSame($port, $attributes['server.port']); @@ -48,6 +48,6 @@ public function test_scheme_and_port_fall_back_to_defaults(string $url, string $ public function test_server_address_falls_back_to_unknown_without_host(): void { - static::assertSame('unknown', (new ClientUrlAttributes())->of('/x')['server.address']); + static::assertSame('unknown', new ClientUrlAttributes()->of('/x')['server.address']); } } diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Context/BaggageTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Context/BaggageTest.php index 5e74bf7480..25df52f266 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Context/BaggageTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Context/BaggageTest.php @@ -66,7 +66,7 @@ public function test_baggage_is_immutable(): void public function test_chained_operations(): void { - $baggage = (new Baggage()) + $baggage = new Baggage() ->with('a', '1') ->with('b', '2') ->with('c', '3') diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Context/ContextTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Context/ContextTest.php index 02b9bf001c..209dab0df2 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Context/ContextTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Context/ContextTest.php @@ -79,7 +79,7 @@ public function test_trace_id_is_derived_from_active_span(): void public function test_default_baggage_is_empty(): void { - static::assertTrue((new Context())->baggage->isEmpty()); + static::assertTrue(new Context()->baggage->isEmpty()); } public function test_from_array_creates_context_with_active_span(): void @@ -131,7 +131,7 @@ public function test_is_root_context_based_on_active_span(bool $hasActiveSpan): public function test_normalize_from_array_round_trip_with_active_span(): void { $span = SpanContext::create(TraceId::generate(), SpanId::generate()); - $original = (new Context(null, new Baggage(['a' => '1', 'b' => '2'])))->withActiveSpan($span); + $original = new Context(null, new Baggage(['a' => '1', 'b' => '2']))->withActiveSpan($span); $restored = Context::fromArray($original->normalize()); @@ -156,7 +156,7 @@ public function test_normalize_from_array_round_trip_root_context(): void public function test_normalize_returns_array_with_active_span(): void { - $context = (new Context(null, new Baggage(['user.id' => '12345'])))->withActiveSpan(SpanContext::create( + $context = new Context(null, new Baggage(['user.id' => '12345']))->withActiveSpan(SpanContext::create( TraceId::fromHex('0af7651916cd43dd8448eb211c80319c'), SpanId::fromHex('00f067aa0ba902b7'), )); @@ -171,7 +171,7 @@ public function test_normalize_returns_array_with_active_span(): void public function test_normalize_returns_array_for_root_context(): void { - $normalized = (new Context(null, new Baggage(['user.id' => '12345'])))->normalize(); + $normalized = new Context(null, new Baggage(['user.id' => '12345']))->normalize(); static::assertNull($normalized['activeSpan']); static::assertSame(['entries' => ['user.id' => '12345']], $normalized['baggage']); @@ -229,7 +229,7 @@ public function test_with_baggage_replaces_baggage(): void #[DataProvider('provideBaggageEntries')] public function test_without_active_span_preserves_baggage(array $entries): void { - $context = (new Context(null, new Baggage($entries)))->withActiveSpan(SpanContext::create( + $context = new Context(null, new Baggage($entries))->withActiveSpan(SpanContext::create( TraceId::generate(), SpanId::generate(), )); diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/ErrorHandler/CompositeErrorHandlerTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/ErrorHandler/CompositeErrorHandlerTest.php index 2d9ea11695..981fd8909d 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/ErrorHandler/CompositeErrorHandlerTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/ErrorHandler/CompositeErrorHandlerTest.php @@ -56,6 +56,6 @@ public function test_handles_an_empty_handler_list(): void { $this->expectNotToPerformAssertions(); - (new CompositeErrorHandler())->handle(new RuntimeException('boom')); + new CompositeErrorHandler()->handle(new RuntimeException('boom')); } } diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/LogRecordTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/LogRecordTest.php index 7d8cf2436b..afa567e6b1 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/LogRecordTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/LogRecordTest.php @@ -114,7 +114,7 @@ public function test_observed_timestamp_and_timestamp_are_independent(): void $timestamp = new DateTimeImmutable('2024-01-01 10:00:00'); $observedTimestamp = new DateTimeImmutable('2024-01-01 10:00:01'); - $record = (new LogRecord()) + $record = new LogRecord() ->setTimestamp($timestamp) ->setObservedTimestamp($observedTimestamp); @@ -132,7 +132,7 @@ public function test_observed_timestamp_default_is_null(): void public function test_set_attribute_accepts_datetime_immutable(): void { $datetime = new DateTimeImmutable('2024-06-15 12:30:00'); - $record = (new LogRecord())->setAttribute('event.time', $datetime); + $record = new LogRecord()->setAttribute('event.time', $datetime); static::assertSame($datetime, $record->attributes->get('event.time')); } @@ -150,7 +150,7 @@ public function test_set_attribute_returns_new_instance(): void public function test_set_attributes_merges_with_existing(): void { - $record = (new LogRecord())->setAttribute('existing', 'value'); + $record = new LogRecord()->setAttribute('existing', 'value'); $newRecord = $record->setAttributes([ 'new1' => 'value1', @@ -181,7 +181,7 @@ public function test_set_body_returns_new_instance(): void public function test_set_exception_adds_exception_attributes(): void { $exception = new RuntimeException('Something went wrong'); - $record = (new LogRecord())->setException($exception); + $record = new LogRecord()->setException($exception); static::assertSame(RuntimeException::class, $record->attributes->get('exception.type')); static::assertSame('Something went wrong', $record->attributes->get('exception.message')); diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/Processor/BatchingLogProcessorTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/Processor/BatchingLogProcessorTest.php index c71eb7d0a4..a135255ba6 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/Processor/BatchingLogProcessorTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/Processor/BatchingLogProcessorTest.php @@ -144,7 +144,7 @@ public function test_process_stores_all_log_record_fields(): void $processor = new BatchingLogProcessor($exporter, 10); $processor->process( new LogEntry( - (new LogRecord()) + new LogRecord() ->setSeverity(Severity::ERROR) ->setBody('Error message') ->setAttributes($attributes), @@ -239,7 +239,7 @@ public function test_age_clock_resets_after_flush(): void private function createEntry(Severity $severity, string $body): LogEntry { return new LogEntry( - (new LogRecord()) + new LogRecord() ->setSeverity($severity) ->setBody($body), $this->resource, diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/Processor/CompositeLogProcessorTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/Processor/CompositeLogProcessorTest.php index c38e40d0a9..d84880a350 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/Processor/CompositeLogProcessorTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/Processor/CompositeLogProcessorTest.php @@ -100,7 +100,7 @@ public function test_works_with_empty_processors_array(): void private function createEntry(): LogEntry { return new LogEntry( - (new LogRecord()) + new LogRecord() ->setSeverity(Severity::INFO) ->setBody('test message'), ResourceMother::default(), diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/Processor/PassThroughLogProcessorTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/Processor/PassThroughLogProcessorTest.php index 4aab74ed84..9e9ca18349 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/Processor/PassThroughLogProcessorTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/Processor/PassThroughLogProcessorTest.php @@ -99,7 +99,7 @@ public function test_process_routes_exporter_throwable_to_error_handler(): void private function createEntry(Severity $severity, string $body, array $attributes = []): LogEntry { return new LogEntry( - (new LogRecord()) + new LogRecord() ->setSeverity($severity) ->setBody($body) ->setAttributes($attributes), diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/VoidLoggerProviderTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/VoidLoggerProviderTest.php index b07a2f6abc..bfaf788873 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/VoidLoggerProviderTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Logger/VoidLoggerProviderTest.php @@ -16,11 +16,11 @@ final class VoidLoggerProviderTest extends TestCase { public function test_logger_returns_logger(): void { - $logger = (new LoggerProvider( - new VoidLogProcessor(), - ClockMother::frozen(), - new MemoryContextStorage(), - ))->logger(ResourceMother::default(), 'test', '1.0'); + $logger = new LoggerProvider(new VoidLogProcessor(), ClockMother::frozen(), new MemoryContextStorage())->logger( + ResourceMother::default(), + 'test', + '1.0', + ); static::assertInstanceOf(Logger::class, $logger); } diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Meter/MemoryMeterProviderTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Meter/MemoryMeterProviderTest.php index a0e69bc712..8e796c29d9 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Meter/MemoryMeterProviderTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Meter/MemoryMeterProviderTest.php @@ -44,10 +44,10 @@ public function test_meter_collects_metrics_on_flush(): void public function test_meter_returns_meter_instance(): void { - static::assertInstanceOf(Meter::class, (new MeterProvider( + static::assertInstanceOf(Meter::class, new MeterProvider( $this->createProcessor(), ClockMother::frozen(), - ))->meter(ResourceMother::default(), 'test-lib', '1.0.0')); + )->meter(ResourceMother::default(), 'test-lib', '1.0.0')); } public function test_metrics_returns_empty_before_flush(): void diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Composite/CompositeExporterTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Composite/CompositeExporterTest.php index eabe2f6ecc..2e7b885a41 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Composite/CompositeExporterTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Composite/CompositeExporterTest.php @@ -30,7 +30,7 @@ public function test_forwards_logs_batch_to_every_exporter(): void $second = new ExporterSpy(); $signal = Signals::logs([LogEntryMother::create('Log', Severity::INFO)]); - (new CompositeExporter([$first, $second]))->export($signal); + new CompositeExporter([$first, $second])->export($signal); static::assertSame([$signal], $first->exported()); static::assertSame([$signal], $second->exported()); @@ -42,7 +42,7 @@ public function test_forwards_metrics_batch_to_every_exporter(): void $second = new ExporterSpy(); $signal = Signals::metrics([MetricMother::counter('test.metric', 1)]); - (new CompositeExporter([$first, $second]))->export($signal); + new CompositeExporter([$first, $second])->export($signal); static::assertSame([$signal], $first->exported()); static::assertSame([$signal], $second->exported()); @@ -54,7 +54,7 @@ public function test_forwards_traces_batch_to_every_exporter(): void $second = new ExporterSpy(); $signal = Signals::traces([SpanMother::withName('span')]); - (new CompositeExporter([$first, $second]))->export($signal); + new CompositeExporter([$first, $second])->export($signal); static::assertSame([$signal], $first->exported()); static::assertSame([$signal], $second->exported()); @@ -79,7 +79,7 @@ public function test_export_does_not_short_circuit_on_failure(): void $failing = new ExporterSpy(false); $trailing = new ExporterSpy(true); - (new CompositeExporter([$failing, $trailing]))->export(Signals::traces([SpanMother::withName('span')])); + new CompositeExporter([$failing, $trailing])->export(Signals::traces([SpanMother::withName('span')])); static::assertSame(1, $trailing->exportedCount()); } @@ -89,7 +89,7 @@ public function test_shutdown_shuts_down_every_exporter(): void $first = new ExporterSpy(); $second = new ExporterSpy(); - (new CompositeExporter([$first, $second]))->shutdown(); + new CompositeExporter([$first, $second])->shutdown(); static::assertSame(1, $first->shutdownCount()); static::assertSame(1, $second->shutdownCount()); @@ -97,12 +97,12 @@ public function test_shutdown_shuts_down_every_exporter(): void public function test_empty_exporter_list_export_is_noop_returning_true(): void { - static::assertTrue((new CompositeExporter([]))->export(Signals::traces([SpanMother::withName('span')]))); + static::assertTrue(new CompositeExporter([])->export(Signals::traces([SpanMother::withName('span')]))); } public function test_empty_exporter_list_shutdown_is_noop(): void { - (new CompositeExporter([]))->shutdown(); + new CompositeExporter([])->shutdown(); $this->addToAssertionCount(1); } @@ -113,7 +113,7 @@ public function test_captures_into_memory_while_other_exporter_still_receives_ba $fake = new ExporterSpy(); $span = SpanMother::withName('span'); - (new CompositeExporter([$fake, $store]))->export(Signals::traces([$span])); + new CompositeExporter([$fake, $store])->export(Signals::traces([$span])); static::assertSame([$span], $store->spans()); static::assertSame(1, $fake->exportedCount()); diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Conditional/ConditionalExporterTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Conditional/ConditionalExporterTest.php index 14abf92d6b..2a3707e927 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Conditional/ConditionalExporterTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Conditional/ConditionalExporterTest.php @@ -25,41 +25,41 @@ public function test_forwards_batch_when_enabled(): void $inner = new ExporterSpy(); $signal = Signals::traces([SpanMother::withName('span')]); - (new ConditionalExporter(true, $inner))->export($signal); + new ConditionalExporter(true, $inner)->export($signal); static::assertSame([$signal], $inner->exported()); } public function test_returns_inner_result_when_enabled(): void { - static::assertFalse((new ConditionalExporter( + static::assertFalse(new ConditionalExporter( true, new ExporterSpy(false), - ))->export(Signals::traces([SpanMother::withName('span')]))); + )->export(Signals::traces([SpanMother::withName('span')]))); } public function test_drops_batch_without_calling_inner_when_disabled(): void { $inner = new ExporterSpy(); - (new ConditionalExporter(false, $inner))->export(Signals::traces([SpanMother::withName('span')])); + new ConditionalExporter(false, $inner)->export(Signals::traces([SpanMother::withName('span')])); static::assertSame(0, $inner->exportedCount()); } public function test_reports_success_when_disabled(): void { - static::assertTrue((new ConditionalExporter( + static::assertTrue(new ConditionalExporter( false, new ExporterSpy(false), - ))->export(Signals::traces([SpanMother::withName('span')]))); + )->export(Signals::traces([SpanMother::withName('span')]))); } public function test_shutdown_delegates_to_inner_when_enabled(): void { $inner = new ExporterSpy(); - (new ConditionalExporter(true, $inner))->shutdown(); + new ConditionalExporter(true, $inner)->shutdown(); static::assertSame(1, $inner->shutdownCount()); } @@ -68,7 +68,7 @@ public function test_shutdown_delegates_to_inner_when_disabled(): void { $inner = new ExporterSpy(); - (new ConditionalExporter(false, $inner))->shutdown(); + new ConditionalExporter(false, $inner)->shutdown(); static::assertSame(1, $inner->shutdownCount()); } diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Memory/MemoryLogProcessorTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Memory/MemoryLogProcessorTest.php index fdcb09d7f5..5adf659742 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Memory/MemoryLogProcessorTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Memory/MemoryLogProcessorTest.php @@ -162,7 +162,7 @@ public function test_reset_clears_all_entries(): void private function createLogEntry(string $body, Severity $severity): LogEntry { return new LogEntry( - (new LogRecord()) + new LogRecord() ->setSeverity($severity) ->setBody($body), ResourceMother::default(), diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Void/VoidExporterTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Void/VoidExporterTest.php index 1fec89d23d..65aace66dc 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Void/VoidExporterTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Provider/Void/VoidExporterTest.php @@ -22,17 +22,17 @@ final class VoidExporterTest extends TestCase { public function test_export_empty_logs_returns_true(): void { - static::assertTrue((new VoidExporter())->export(Signals::logs([]))); + static::assertTrue(new VoidExporter()->export(Signals::logs([]))); } public function test_export_empty_metrics_returns_true(): void { - static::assertTrue((new VoidExporter())->export(Signals::metrics([]))); + static::assertTrue(new VoidExporter()->export(Signals::metrics([]))); } public function test_export_empty_traces_returns_true(): void { - static::assertTrue((new VoidExporter())->export(Signals::traces([]))); + static::assertTrue(new VoidExporter()->export(Signals::traces([]))); } public function test_export_logs_batch_returns_true(): void @@ -42,7 +42,7 @@ public function test_export_logs_batch_returns_true(): void LogEntryMother::create('Log 2', Severity::WARN), ]); - static::assertTrue((new VoidExporter())->export($batch)); + static::assertTrue(new VoidExporter()->export($batch)); } public function test_export_metrics_batch_returns_true(): void @@ -59,7 +59,7 @@ public function test_export_metrics_batch_returns_true(): void ), ]); - static::assertTrue((new VoidExporter())->export($batch)); + static::assertTrue(new VoidExporter()->export($batch)); } public function test_export_traces_batch_returns_true(): void @@ -69,7 +69,7 @@ public function test_export_traces_batch_returns_true(): void SpanMother::withName('span-2'), ]); - static::assertTrue((new VoidExporter())->export($batch)); + static::assertTrue(new VoidExporter()->export($batch)); } public function test_implements_exporter(): void diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Tracer/MemoryTracerProviderTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Tracer/MemoryTracerProviderTest.php index 0ff3a522c4..544bda01ab 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Tracer/MemoryTracerProviderTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Tracer/MemoryTracerProviderTest.php @@ -64,7 +64,7 @@ public function test_default_sampler_honours_an_unsampled_remote_parent(): void TraceFlags::default(), ))); - $tracer = (new TracerProvider($processor, ClockMother::frozen(), $contextStorage))->tracer( + $tracer = new TracerProvider($processor, ClockMother::frozen(), $contextStorage)->tracer( ResourceMother::default(), 'test', ); @@ -98,11 +98,11 @@ public function test_processor_records_spans_from_tracers(): void public function test_tracer_returns_tracer_instance(): void { - static::assertInstanceOf(Tracer::class, (new TracerProvider( + static::assertInstanceOf(Tracer::class, new TracerProvider( $this->createProcessor(), ClockMother::frozen(), new MemoryContextStorage(), - ))->tracer($this->resource, 'test-lib', '1.0.0')); + )->tracer($this->resource, 'test-lib', '1.0.0')); } public function test_uses_default_version_when_not_provided(): void diff --git a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Tracer/VoidTracerProviderTest.php b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Tracer/VoidTracerProviderTest.php index ede5427534..8514002ac5 100644 --- a/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Tracer/VoidTracerProviderTest.php +++ b/src/lib/telemetry/tests/Flow/Telemetry/Tests/Unit/Tracer/VoidTracerProviderTest.php @@ -48,11 +48,11 @@ public function test_processor_flush_returns_true(): void public function test_tracer_creates_functional_tracer(): void { - $tracer = (new TracerProvider( + $tracer = new TracerProvider( new VoidSpanProcessor(), ClockMother::frozen(), new MemoryContextStorage(), - ))->tracer($this->resource, 'my-library', '1.0.0'); + )->tracer($this->resource, 'my-library', '1.0.0'); $span = $tracer->span('test-operation'); static::assertSame('test-operation', $span->name()); @@ -64,11 +64,11 @@ public function test_tracer_creates_functional_tracer(): void public function test_tracer_returns_tracer(): void { - $tracer = (new TracerProvider( + $tracer = new TracerProvider( new VoidSpanProcessor(), ClockMother::frozen(), new MemoryContextStorage(), - ))->tracer($this->resource, 'my-library', '1.0.0'); + )->tracer($this->resource, 'my-library', '1.0.0'); static::assertInstanceOf(Tracer::class, $tracer); static::assertSame('my-library', $tracer->name()); @@ -79,7 +79,7 @@ public function test_tracer_uses_unknown_as_default_version(): void { static::assertSame( 'unknown', - (new TracerProvider(new VoidSpanProcessor(), ClockMother::frozen(), new MemoryContextStorage())) + new TracerProvider(new VoidSpanProcessor(), ClockMother::frozen(), new MemoryContextStorage()) ->tracer($this->resource, 'my-library') ->version(), ); diff --git a/src/lib/types/composer.json b/src/lib/types/composer.json index ff1727f95f..0593896035 100644 --- a/src/lib/types/composer.json +++ b/src/lib/types/composer.json @@ -7,7 +7,7 @@ "types" ], "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "symfony/polyfill-mbstring": "^1.33" }, "config": { diff --git a/src/lib/types/src/Flow/Types/DSL/functions.php b/src/lib/types/src/Flow/Types/DSL/functions.php index 42f0ded13d..e57e864d4d 100644 --- a/src/lib/types/src/Flow/Types/DSL/functions.php +++ b/src/lib/types/src/Flow/Types/DSL/functions.php @@ -162,7 +162,7 @@ function type_from_array(array $data): Type #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] function type_is_nullable(Type $type): bool { - return (new Nullability())->is($type); + return new Nullability()->is($type); } /** @@ -178,7 +178,7 @@ function type_is_nullable(Type $type): bool #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] function type_bare(Type $type): Type { - return (new Nullability())->bare($type); + return new Nullability()->bare($type); } /** @@ -188,7 +188,7 @@ function type_bare(Type $type): Type #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] function type_equals(Type $left, Type $right): bool { - return (new Comparator())->equals($left, $right); + return new Comparator()->equals($left, $right); } /** @@ -424,7 +424,7 @@ function type_html_element(): HTMLElementType #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] function type_is(Type $type, string $typeClass): bool { - return (new Comparator())->is($type, $typeClass); + return new Comparator()->is($type, $typeClass); } /** @@ -437,7 +437,7 @@ function type_is(Type $type, string $typeClass): bool #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] function type_is_any(Type $type, string $typeClass, string ...$typeClasses): bool { - return (new Comparator())->isAny($type, $typeClass, ...$typeClasses); + return new Comparator()->isAny($type, $typeClass, ...$typeClasses); } /** @@ -446,7 +446,7 @@ function type_is_any(Type $type, string $typeClass, string ...$typeClasses): boo #[DocumentationDSL(module: Module::TYPES, type: DSLType::HELPER)] function get_type(mixed $value): Type { - return (new TypeDetector())->detectType($value); + return new TypeDetector()->detectType($value); } /** diff --git a/src/lib/types/src/Flow/Types/Exception/InvalidTypeException.php b/src/lib/types/src/Flow/Types/Exception/InvalidTypeException.php index de116c3000..b38cd3fec6 100644 --- a/src/lib/types/src/Flow/Types/Exception/InvalidTypeException.php +++ b/src/lib/types/src/Flow/Types/Exception/InvalidTypeException.php @@ -43,7 +43,7 @@ public static function value(mixed $value, Type $expectedType): self return new self(sprintf( 'Expected type "%s", got "%s".', $expectedType->toString(), - (new TypeDetector()) + new TypeDetector() ->detectType($value) ->toString(), )); diff --git a/src/lib/types/src/Flow/Types/Type/Comparator.php b/src/lib/types/src/Flow/Types/Type/Comparator.php index 21ecb04088..a431eecc3f 100644 --- a/src/lib/types/src/Flow/Types/Type/Comparator.php +++ b/src/lib/types/src/Flow/Types/Type/Comparator.php @@ -131,7 +131,7 @@ public function equals(Type $left, Type $right): bool if ($left instanceof StructureType && $right instanceof StructureType) { /** @var StructureType> $left */ /** @var StructureType> $right */ - return (new StructureComparison())->identical($left, $right, $this); + return new StructureComparison()->identical($left, $right, $this); } return $left->toString() === $right->toString(); diff --git a/src/lib/types/src/Flow/Types/Type/ContainerUnification.php b/src/lib/types/src/Flow/Types/Type/ContainerUnification.php index 2e60aee931..e01ec5f042 100644 --- a/src/lib/types/src/Flow/Types/Type/ContainerUnification.php +++ b/src/lib/types/src/Flow/Types/Type/ContainerUnification.php @@ -51,7 +51,7 @@ public function unify(Type $left, Type $right, Closure $pairwise, Closure $stric if ($left instanceof MapType && $right instanceof MapType) { $key = $strictPairwise($left->key(), $right->key()); - if ($key === null || (new Nullability())->is($key)) { + if ($key === null || new Nullability()->is($key)) { return null; } diff --git a/src/lib/types/src/Flow/Types/Type/Logical/DateTimeType.php b/src/lib/types/src/Flow/Types/Type/Logical/DateTimeType.php index c6ae2dab79..2fe628f65c 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/DateTimeType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/DateTimeType.php @@ -109,7 +109,7 @@ public function __construct(DateTimeZone|string $zone = 'UTC') self::ABBREVIATION_LINKS[$key], )), array_key_exists($key, $identifiers) => $identifiers[$key], - preg_match('/^[+-](?:[01]\d|2[0-3])(?::?[0-5]\d)?$/', $name) === 1 => (new DateTimeZone($name))->getName(), + preg_match('/^[+-](?:[01]\d|2[0-3])(?::?[0-5]\d)?$/', $name) === 1 => new DateTimeZone($name)->getName(), default => throw new InvalidArgumentException(sprintf( 'Time zone "%s" cannot be a datetime column zone, use an IANA name like "Europe/Warsaw", "UTC" or an offset "+HH:MM"', $name, @@ -178,7 +178,7 @@ public function cast(mixed $value): DateTimeImmutable return new DateTimeImmutable($value, $this->zone); } - return (new DateTimeImmutable($value))->setTimezone($this->zone); + return new DateTimeImmutable($value)->setTimezone($this->zone); } if (StringTemporalParts::isoDate($value)) { @@ -193,7 +193,7 @@ public function cast(mixed $value): DateTimeImmutable throw new CastingException($value, $this, reason: 'value is not a calendar date'); } - return (new DateTimeImmutable($value, $this->zone))->setTimezone($this->zone); + return new DateTimeImmutable($value, $this->zone)->setTimezone($this->zone); } if (NonFiniteFloat::is($value)) { @@ -201,15 +201,15 @@ public function cast(mixed $value): DateTimeImmutable } if (is_numeric($value)) { - return (new DateTimeImmutable('@' . $value))->setTimezone($this->zone); + return new DateTimeImmutable('@' . $value)->setTimezone($this->zone); } if (is_bool($value)) { - return (new DateTimeImmutable('@' . (int) $value))->setTimezone($this->zone); + return new DateTimeImmutable('@' . (int) $value)->setTimezone($this->zone); } if ($value instanceof DateInterval) { - return (new DateTimeImmutable('@0'))->add($value)->setTimezone($this->zone); + return new DateTimeImmutable('@0')->add($value)->setTimezone($this->zone); } } catch (Throwable) { throw new CastingException($value, $this); diff --git a/src/lib/types/src/Flow/Types/Type/Logical/DateType.php b/src/lib/types/src/Flow/Types/Type/Logical/DateType.php index 2960612486..e8c4a0541d 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/DateType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/DateType.php @@ -66,7 +66,7 @@ public function cast(mixed $value): DateTimeInterface throw new CastingException($value, $this, reason: 'value is not a calendar date'); } - return new DateTimeImmutable((new DateTimeImmutable($value))->format('Y-m-d'), $utc); + return new DateTimeImmutable(new DateTimeImmutable($value)->format('Y-m-d'), $utc); } if (NonFiniteFloat::is($value)) { @@ -74,19 +74,19 @@ public function cast(mixed $value): DateTimeInterface } if (is_numeric($value)) { - return (new DateTimeImmutable('@' . $value)) + return new DateTimeImmutable('@' . $value) ->setTimezone($utc) ->setTime(0, 0, 0, 0); } if (is_bool($value)) { - return (new DateTimeImmutable('@' . (int) $value)) + return new DateTimeImmutable('@' . (int) $value) ->setTimezone($utc) ->setTime(0, 0, 0, 0); } if ($value instanceof DateInterval) { - return (new DateTimeImmutable('@0')) + return new DateTimeImmutable('@0') ->add($value) ->setTimezone($utc) ->setTime(0, 0, 0, 0); diff --git a/src/lib/types/src/Flow/Types/Type/Logical/HTMLElementType.php b/src/lib/types/src/Flow/Types/Type/Logical/HTMLElementType.php index b0ec9b9c07..fa50fc0dd7 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/HTMLElementType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/HTMLElementType.php @@ -37,7 +37,6 @@ public function cast(mixed $value): HTMLElement } if (is_string($value)) { - // @mago-expect analysis:unavailable-method $document = HTMLDocument::createFromString($value, LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR); return type_instance_of(HTMLElement::class)->assert($document->documentElement); diff --git a/src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php b/src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php index 5de3ba5615..cf6b6ece49 100644 --- a/src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php +++ b/src/lib/types/src/Flow/Types/Type/Logical/HTMLType.php @@ -9,7 +9,6 @@ use Flow\Types\Exception\InvalidTypeException; use Flow\Types\Type; -use function class_exists; use function is_string; use function preg_match; @@ -45,12 +44,7 @@ public function cast(mixed $value): HTMLDocument return $value; } - if ( - is_string($value) - && class_exists('\Dom\HTMLDocument') - && preg_match(self::HTML_ALIKE_REGEX, $value) === 1 - ) { - // @mago-expect analysis:unavailable-method + if (is_string($value) && preg_match(self::HTML_ALIKE_REGEX, $value) === 1) { return HTMLDocument::createFromString($value, LIBXML_NOERROR); } @@ -59,11 +53,6 @@ public function cast(mixed $value): HTMLDocument public function isValid(mixed $value): bool { - // \Dom\HTMLDocument exist in PHP 8.4+ - if (!class_exists('\Dom\HTMLDocument')) { - return false; - } - return $value instanceof HTMLDocument; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/ArrayType.php b/src/lib/types/src/Flow/Types/Type/Native/ArrayType.php index 31fbc100f9..c6ca39d8bd 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/ArrayType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/ArrayType.php @@ -64,7 +64,7 @@ public function cast(mixed $value): array } if ($value instanceof DOMDocument) { - return (new XMLConverter())->toArray($value); + return new XMLConverter()->toArray($value); } if (is_object($value)) { diff --git a/src/lib/types/src/Flow/Types/Type/Native/String/StringTypeNarrower.php b/src/lib/types/src/Flow/Types/Type/Native/String/StringTypeNarrower.php index bb2e9e3b86..8b8e90cfa4 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/String/StringTypeNarrower.php +++ b/src/lib/types/src/Flow/Types/Type/Native/String/StringTypeNarrower.php @@ -24,7 +24,6 @@ use function array_fill_keys; use function array_key_exists; -use function class_exists; use function Flow\Types\DSL\type_boolean; use function Flow\Types\DSL\type_date; use function Flow\Types\DSL\type_datetime; @@ -183,7 +182,7 @@ private function isFloat(string $value): bool */ private function isHTML(string $value): bool { - if ('<' !== $value[0] || !class_exists('\Dom\HTMLDocument')) { + if ('<' !== $value[0]) { return false; } diff --git a/src/lib/types/src/Flow/Types/Type/Native/StringType.php b/src/lib/types/src/Flow/Types/Type/Native/StringType.php index 36e5341f88..7f98ef9fdf 100644 --- a/src/lib/types/src/Flow/Types/Type/Native/StringType.php +++ b/src/lib/types/src/Flow/Types/Type/Native/StringType.php @@ -88,7 +88,6 @@ public function cast(mixed $value): string } if ($value instanceof HTMLDocument) { - // @mago-expect analysis:unavailable-method return $value->saveHtml(); } diff --git a/src/lib/types/src/Flow/Types/Type/Unifier/PromotingUnifier.php b/src/lib/types/src/Flow/Types/Type/Unifier/PromotingUnifier.php index 424a924382..c40f06886d 100644 --- a/src/lib/types/src/Flow/Types/Type/Unifier/PromotingUnifier.php +++ b/src/lib/types/src/Flow/Types/Type/Unifier/PromotingUnifier.php @@ -43,7 +43,7 @@ public function unify(Type $left, Type $right): ?Type $rightIsContainer = $right instanceof ListType || $right instanceof MapType || $right instanceof StructureType; if ($left instanceof OptionalType || $right instanceof OptionalType || $leftIsContainer && $rightIsContainer) { - return $this->containers->unify($left, $right, $this->unify(...), (new StrictUnifier())->unify(...)); + return $this->containers->unify($left, $right, $this->unify(...), new StrictUnifier()->unify(...)); } // TypeCoercion.scala:112 stringPromotion - any non-container atomic except boolean promotes to string. diff --git a/src/lib/types/src/Flow/Types/Value/Uuid.php b/src/lib/types/src/Flow/Types/Value/Uuid.php index 18fe95cf63..ea21a4afc9 100644 --- a/src/lib/types/src/Flow/Types/Value/Uuid.php +++ b/src/lib/types/src/Flow/Types/Value/Uuid.php @@ -56,7 +56,7 @@ public static function fromBytes(string $bytes): self } $hex = bin2hex($bytes); - $uuid = (new ReflectionClass(self::class))->newInstanceWithoutConstructor(); + $uuid = new ReflectionClass(self::class)->newInstanceWithoutConstructor(); // @mago-ignore analysis:invalid-property-write $uuid->value = sprintf( '%s-%s-%s-%s-%s', diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Exception/MissingElementCastingExceptionTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Exception/MissingElementCastingExceptionTest.php index 7de766fd1e..af3076d325 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Exception/MissingElementCastingExceptionTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Exception/MissingElementCastingExceptionTest.php @@ -33,7 +33,7 @@ public function test_previous_is_chained(): void static::assertSame( $previous, - (new MissingElementCastingException(null, type_string(), 'name', $previous))->getPrevious(), + new MissingElementCastingException(null, type_string(), 'name', $previous)->getPrevious(), ); } diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/ArrayContentDetectorTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/ArrayContentDetectorTest.php index 244ff5c80d..b97ad5d002 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/ArrayContentDetectorTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/ArrayContentDetectorTest.php @@ -466,7 +466,7 @@ public function test_list_data(array $keys, array $values, bool $isList, bool $e { static::assertSame( $expected, - (new ArrayContentDetector(new Types(...$keys), new Types(...$values), $isList))->isList(), + new ArrayContentDetector(new Types(...$keys), new Types(...$values), $isList)->isList(), ); } @@ -479,7 +479,7 @@ public function test_map_data(array $keys, array $values, bool $isList, bool $ex { static::assertSame( $expected, - (new ArrayContentDetector(new Types(...$keys), new Types(...$values), $isList))->isMap(), + new ArrayContentDetector(new Types(...$keys), new Types(...$values), $isList)->isMap(), ); } @@ -492,7 +492,7 @@ public function test_structure_data(array $keys, array $values, bool $isList, bo { static::assertSame( $expected, - (new ArrayContentDetector(new Types(...$keys), new Types(...$values), $isList))->isStructure(), + new ArrayContentDetector(new Types(...$keys), new Types(...$values), $isList)->isStructure(), ); } @@ -500,18 +500,18 @@ public function test_nested_empty_array_unifies_element_wise(): void { static::assertSame( 'list', - (new ArrayContentDetector( + new ArrayContentDetector( new Types(type_integer()), new Types(type_list(type_string()), type_list(type_null())), true, - )) + ) ->valueType() ->toString(), ); static::assertSame( 'list', - (new ArrayContentDetector(new Types(type_integer()), new Types(type_list(type_null())), true)) + new ArrayContentDetector(new Types(type_integer()), new Types(type_list(type_null())), true) ->valueType() ->toString(), ); @@ -533,7 +533,7 @@ public function test_value_type(array $values, string $expected): void { static::assertSame( $expected, - (new ArrayContentDetector(new Types(type_integer()), new Types(...$values), true))->valueType()->toString(), + new ArrayContentDetector(new Types(type_integer()), new Types(...$values), true)->valueType()->toString(), ); } } diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/ComparatorTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/ComparatorTest.php index acf29512e3..750b5bbff4 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/ComparatorTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/ComparatorTest.php @@ -171,15 +171,15 @@ public static function type_comparison_data_provider(): Generator public function test_comparable_follows_declared_field_order(): void { - static::assertFalse((new Comparator())->comparable( + static::assertFalse(new Comparator()->comparable( type_structure(['a' => type_integer(), 'b' => type_string()]), type_structure(['b' => type_string(), 'a' => type_integer()]), )); - static::assertTrue((new Comparator())->comparable( + static::assertTrue(new Comparator()->comparable( type_structure(['a' => type_integer(), 'b' => type_string()]), type_structure(['a' => type_integer(), 'b' => type_string()]), )); - static::assertTrue((new Comparator())->comparable(type_integer(), type_string())); + static::assertTrue(new Comparator()->comparable(type_integer(), type_string())); } public static function type_not_comparable_data_provider(): Generator @@ -220,7 +220,7 @@ public function test_comparing_types(Type $left, Type $right, bool $equals): voi #[DataProvider('type_comparable_data_provider')] public function test_type_comparable(Type $left, Type $right): void { - static::assertTrue((new Comparator())->comparable($left, $right)); + static::assertTrue(new Comparator()->comparable($left, $right)); } public function test_type_is(): void @@ -286,6 +286,6 @@ public function test_type_is_on_union_type(): void #[DataProvider('type_not_comparable_data_provider')] public function test_type_not_comparable(Type $left, Type $right): void { - static::assertFalse((new Comparator())->comparable($left, $right)); + static::assertFalse(new Comparator()->comparable($left, $right)); } } diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Fixtures/TypeNarrowing.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Fixtures/TypeNarrowing.php index 323bb377df..2b3bd2efa8 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Fixtures/TypeNarrowing.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Fixtures/TypeNarrowing.php @@ -644,9 +644,6 @@ public function isValidNarrowsNative( } /** - * Split out of the methods above because `Dom\HTMLDocument` and `Dom\HTMLElement` only exist on PHP >= 8.4; - * keeping them here lets the rest stay executable on 8.3. - * * @return array */ public function narrowsHtml( diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/DateTimeTypeTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/DateTimeTypeTest.php index 61ccd4635a..b70278cc65 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/DateTimeTypeTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/DateTimeTypeTest.php @@ -234,7 +234,7 @@ public function test_a_compact_iso_date_casts(): void public function test_an_iso_date_time_casts_to_the_object_the_constructor_builds(string $value): void { static::assertSame( - serialize((new DateTimeImmutable($value, new DateTimeZone('UTC')))->setTimezone(new DateTimeZone('UTC'))), + serialize(new DateTimeImmutable($value, new DateTimeZone('UTC'))->setTimezone(new DateTimeZone('UTC'))), serialize(type_datetime()->cast($value)), ); } @@ -246,7 +246,7 @@ public function test_cast_into_a_zoned_column(string $value): void $zone = new DateTimeZone($name); static::assertSame( - serialize((new DateTimeImmutable($value, $zone))->setTimezone($zone)), + serialize(new DateTimeImmutable($value, $zone)->setTimezone($zone)), serialize(type_datetime($name)->cast($value)), ); } diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/HTMLElementTypeTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/HTMLElementTypeTest.php index b397aa02ec..e158f27176 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/HTMLElementTypeTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/HTMLElementTypeTest.php @@ -12,7 +12,6 @@ use Flow\Types\Exception\InvalidTypeException; use Generator; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use stdClass; @@ -21,13 +20,11 @@ use function Flow\Types\DSL\type_string; use function preg_replace; -#[RequiresPhp('>= 8.4.0')] final class HTMLElementTypeTest extends TestCase { public static function assert_data_provider(): Generator { yield 'valid HTMLElement' => [ - // @mago-expect analysis:unavailable-method 'value' => HTMLDocument::createFromString( '', )->querySelector('body'), @@ -88,7 +85,6 @@ public static function assert_data_provider(): Generator public static function cast_data_provider(): Generator { yield 'valid HTMLElement' => [ - // @mago-expect analysis:unavailable-method 'value' => HTMLDocument::createFromString( '
1
', )->querySelector('body'), @@ -145,7 +141,6 @@ public static function cast_data_provider(): Generator public static function is_valid_data_provider(): Generator { yield 'valid HTMLDocument' => [ - // @mago-expect analysis:unavailable-method 'value' => HTMLDocument::createFromString( '
1
', )->querySelector('body'), diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/HTMLTypeTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/HTMLTypeTest.php index 6a9a0006d1..29f611fa0f 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/HTMLTypeTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/HTMLTypeTest.php @@ -11,7 +11,6 @@ use Flow\Types\Exception\InvalidTypeException; use Generator; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use stdClass; @@ -20,13 +19,11 @@ use function Flow\Types\DSL\type_string; use function preg_replace; -#[RequiresPhp('>= 8.4.0')] final class HTMLTypeTest extends TestCase { public static function assert_data_provider(): Generator { yield 'valid HTMLDocument' => [ - // @mago-expect analysis:unavailable-method 'value' => HTMLDocument::createFromString(''), 'exceptionClass' => null, ]; @@ -85,7 +82,6 @@ public static function assert_data_provider(): Generator public static function cast_data_provider(): Generator { yield 'valid HTMLDocument' => [ - // @mago-expect analysis:unavailable-method 'value' => HTMLDocument::createFromString( $html = '
1
', ), @@ -144,7 +140,6 @@ public static function cast_data_provider(): Generator public static function is_valid_data_provider(): Generator { yield 'valid HTMLDocument' => [ - // @mago-expect analysis:unavailable-method 'value' => HTMLDocument::createFromString( '
1
', ), @@ -192,7 +187,6 @@ public function test_cast(mixed $value, ?string $expected = null, ?string $excep static::assertNotNull($expected); $result = type_html()->assert(type_html()->cast($value)); - // @mago-expect analysis:unavailable-method $html = type_string()->assert($result->saveHtml()); self::assertHtmlEquals($expected, $html); } diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/StructureTypeTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/StructureTypeTest.php index 68441f428b..c41dd3162a 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/StructureTypeTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Logical/StructureTypeTest.php @@ -658,7 +658,7 @@ public function test_element_lookup_finds_by_name(): void public function test_element_lookup_returns_null_for_unknown_name(): void { - static::assertNull((new StructureType([new StructureElement('id', type_integer())]))->element('name')); + static::assertNull(new StructureType([new StructureElement('id', type_integer())])->element('name')); } public function test_constructor_requires_at_least_one_element(): void @@ -713,9 +713,7 @@ public function test_normalization_with_optional_elements(): void public function test_optional_flag_defaults_to_false(): void { - static::assertFalse((new StructureType([new StructureElement('id', type_integer())]))->element( - 'id', - )?->optional); + static::assertFalse(new StructureType([new StructureElement('id', type_integer())])->element('id')?->optional); } public function test_normalization_round_trip_preserves_interleaved_field_order(): void diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/String/StringTypeNarrowerTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/String/StringTypeNarrowerTest.php index 318883a927..bbfc7af4b9 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/String/StringTypeNarrowerTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/String/StringTypeNarrowerTest.php @@ -8,7 +8,6 @@ use Flow\Types\Type\Logical\OptionalType; use Flow\Types\Type\Native\String\StringTypeNarrower; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use function Flow\Types\DSL\type_boolean; @@ -197,10 +196,9 @@ public function test_compact_iso_still_narrows_to_integer(): void { // StringTemporalParts recognises '20240305' as a date so type_date() can cast it, but the // ladder runs its isInteger rung above the temporal ones and must keep doing so - static::assertEquals(type_integer(), (new StringTypeNarrower())->narrow('20240305')); + static::assertEquals(type_integer(), new StringTypeNarrower()->narrow('20240305')); } - #[RequiresPhp('>= 8.4.0')] public function test_detecting_html(): void { $narrower = new StringTypeNarrower(); @@ -213,20 +211,9 @@ public function test_detecting_html(): void static::assertEquals(type_string(), $narrower->narrow('not html')); } - #[RequiresPhp('< 8.4.0')] - public function test_html_is_not_detected_without_dom_html_document(): void - { - static::assertEquals( - type_string(), - (new StringTypeNarrower([type_html(), type_string()]))->narrow( - '
1
', - ), - ); - } - public function test_form_feed_padded_integer_narrows_to_integer(): void { - static::assertEquals(type_integer(), (new StringTypeNarrower())->narrow("\f1\f")); + static::assertEquals(type_integer(), new StringTypeNarrower()->narrow("\f1\f")); } public function test_detecting_integer(): void @@ -327,13 +314,13 @@ public function test_a_rung_outside_the_emitted_types_is_skipped(): void '
1
', ), ); - static::assertEquals(type_xml(), (new StringTypeNarrower())->narrow('
1')); + static::assertEquals(type_xml(), new StringTypeNarrower()->narrow('1')); } #[DataProvider('fixtureValues')] public function test_narrowing_never_returns_an_optional_type(string $value): void { - static::assertNotInstanceOf(OptionalType::class, (new StringTypeNarrower())->narrow($value)); + static::assertNotInstanceOf(OptionalType::class, new StringTypeNarrower()->narrow($value)); } public function test_time_zone_identifiers_are_matched_after_the_cache_is_warm(): void diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/StringTypeTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/StringTypeTest.php index 29a52d1c74..98aa32fafb 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/StringTypeTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/StringTypeTest.php @@ -17,7 +17,6 @@ use Flow\Types\Type\Native\StringType; use Generator; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\Attributes\TestWith; use PHPUnit\Framework\TestCase; use stdClass; @@ -241,10 +240,8 @@ public function test_cast(mixed $value, mixed $expected, ?string $exceptionClass } } - #[RequiresPhp('>= 8.4.0')] public function test_cast_html_document(): void { - // @mago-expect analysis:unavailable-method $element = HTMLDocument::createFromString('

foobar

', LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR); static::assertSame('

foobar

', type_string()->cast($element)); @@ -257,10 +254,8 @@ public function test_null_is_not_an_empty_string(): void type_string()->cast(null); } - #[RequiresPhp('>= 8.4.0')] public function test_cast_html_element(): void { - // @mago-expect analysis:unavailable-method $element = HTMLDocument::createFromString('

foobar

', LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR); static::assertSame('foobar', type_string()->cast($element->documentElement)); @@ -269,7 +264,7 @@ public function test_cast_html_element(): void #[DataProvider('is_stringable_data_provider')] public function test_is_stringable(mixed $value, bool $expected): void { - static::assertSame($expected, (new StringType())->isStringable($value)); + static::assertSame($expected, new StringType()->isStringable($value)); } #[DataProvider('is_valid_data_provider')] diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/UnionTypeTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/UnionTypeTest.php index 88248bd2dc..04e83df0d4 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/UnionTypeTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/Native/UnionTypeTest.php @@ -210,10 +210,10 @@ public function test_cast_of_clock_time_leaves_a_valid_string_member_untouched() public function test_is_optional_type(): void { - static::assertTrue((new UnionType(type_integer(), type_null()))->isOptionalType()); - static::assertFalse((new UnionType(type_null(), type_null()))->isOptionalType()); + static::assertTrue(new UnionType(type_integer(), type_null())->isOptionalType()); + static::assertFalse(new UnionType(type_null(), type_null())->isOptionalType()); static::assertFalse( - (new UnionType(new UnionType(type_integer(), type_null()), type_optional(type_string())))->isOptionalType(), + new UnionType(new UnionType(type_integer(), type_null()), type_optional(type_string()))->isOptionalType(), ); } @@ -256,26 +256,26 @@ public function test_types(): void { static::assertEquals( types(type_integer(), type_string()), - (new UnionType(type_integer(), type_string()))->types(), + new UnionType(type_integer(), type_string())->types(), ); static::assertEquals( types(type_integer(), type_string(), type_null()), - (new UnionType(new UnionType(type_integer(), type_string()), type_null()))->types(), + new UnionType(new UnionType(type_integer(), type_string()), type_null())->types(), ); static::assertEquals( types(type_integer(), type_string(), type_optional(type_string())), - (new UnionType(new UnionType(type_integer(), type_string()), type_optional(type_string())))->types(), + new UnionType(new UnionType(type_integer(), type_string()), type_optional(type_string()))->types(), ); static::assertEquals( types(type_integer(), type_string(), type_float(), type_boolean()), - (new UnionType( + new UnionType( new UnionType(type_integer(), type_string()), new UnionType(type_float(), type_boolean()), - ))->types(), + )->types(), ); static::assertEquals( types(type_integer(), type_float(), type_boolean()), - (new UnionType(new UnionType(type_integer(), type_integer()), new UnionType(type_float(), type_boolean()))) + new UnionType(new UnionType(type_integer(), type_integer()), new UnionType(type_float(), type_boolean())) ->types() ->deduplicate(), ); diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/NullabilityTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/NullabilityTest.php index 3f3b9c2227..90837749ff 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/NullabilityTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/NullabilityTest.php @@ -63,29 +63,26 @@ public static function both_nullability_spellings_of_every_column_representable_ public function test_any_reads_both_spellings_of_null_and_the_null_type_itself(): void { - static::assertSame('?boolean', (new Nullability())->any(type_boolean(), type_null())->toString()); + static::assertSame('?boolean', new Nullability()->any(type_boolean(), type_null())->toString()); static::assertSame( '?boolean', - (new Nullability())->any(type_boolean(), type_union(type_null(), type_string()))->toString(), + new Nullability()->any(type_boolean(), type_union(type_null(), type_string()))->toString(), ); static::assertSame( '?boolean', - (new Nullability())->any(type_boolean(), type_optional(type_integer()))->toString(), + new Nullability()->any(type_boolean(), type_optional(type_integer()))->toString(), ); - static::assertSame('boolean', (new Nullability())->any(type_boolean(), type_integer())->toString()); + static::assertSame('boolean', new Nullability()->any(type_boolean(), type_integer())->toString()); static::assertSame( 'boolean', - (new Nullability())->any(type_boolean(), type_list(type_optional(type_integer())))->toString(), + new Nullability()->any(type_boolean(), type_list(type_optional(type_integer())))->toString(), ); } public function test_any_wraps_when_an_operand_is_the_null_type_itself(): void { - static::assertSame( - '?boolean', - (new Nullability())->any(type_boolean(), type_null(), type_integer())->toString(), - ); + static::assertSame('?boolean', new Nullability()->any(type_boolean(), type_null(), type_integer())->toString()); } public function test_all_counts_the_null_type_itself_as_nullable(): void @@ -93,22 +90,22 @@ public function test_all_counts_the_null_type_itself_as_nullable(): void // a genuinely null operand must not REMOVE nullability: coalesce(?int, null) can return null static::assertSame( '?integer', - (new Nullability())->all(type_integer(), type_optional(type_integer()), type_null())->toString(), + new Nullability()->all(type_integer(), type_optional(type_integer()), type_null())->toString(), ); static::assertSame( 'integer', - (new Nullability())->all(type_integer(), type_optional(type_integer()), type_string())->toString(), + new Nullability()->all(type_integer(), type_optional(type_integer()), type_string())->toString(), ); } public function test_is_recognises_both_spellings(): void { - static::assertTrue((new Nullability())->is(type_optional(type_integer()))); - static::assertTrue((new Nullability())->is(type_union(type_null(), type_string()))); + static::assertTrue(new Nullability()->is(type_optional(type_integer()))); + static::assertTrue(new Nullability()->is(type_union(type_null(), type_string()))); - static::assertFalse((new Nullability())->is(type_integer())); - static::assertFalse((new Nullability())->is(type_null())); - static::assertFalse((new Nullability())->is(type_list(type_optional(type_integer())))); + static::assertFalse(new Nullability()->is(type_integer())); + static::assertFalse(new Nullability()->is(type_null())); + static::assertFalse(new Nullability()->is(type_list(type_optional(type_integer())))); } /** @@ -117,14 +114,14 @@ public function test_is_recognises_both_spellings(): void #[DataProvider('both_nullability_spellings_of_every_column_representable_type')] public function test_bare_is_the_dual_of_is(Type $type): void { - static::assertFalse((new Nullability())->is((new Nullability())->bare($type))); + static::assertFalse(new Nullability()->is(new Nullability()->bare($type))); } public function test_bare_is_lossless_for_a_multi_member_nullable_union(): void { static::assertTrue(type_equals( type_union(type_integer(), type_string()), - (new Nullability())->bare(type_union(type_null(), type_integer(), type_string())), + new Nullability()->bare(type_union(type_null(), type_integer(), type_string())), )); } @@ -132,14 +129,14 @@ public function test_bare_leaves_a_not_null_type_identical(): void { $type = type_list(type_optional(type_integer())); - static::assertSame($type, (new Nullability())->bare($type)); + static::assertSame($type, new Nullability()->bare($type)); } public function test_any_wraps_when_one_operand_is_nullable(): void { static::assertSame( '?boolean', - (new Nullability())->any(type_boolean(), type_optional(type_integer()), type_string())->toString(), + new Nullability()->any(type_boolean(), type_optional(type_integer()), type_string())->toString(), ); } @@ -147,7 +144,7 @@ public function test_any_leaves_a_not_null_result_bare(): void { static::assertSame( 'boolean', - (new Nullability())->any(type_boolean(), type_integer(), type_string())->toString(), + new Nullability()->any(type_boolean(), type_integer(), type_string())->toString(), ); } @@ -155,7 +152,7 @@ public function test_all_wraps_only_when_every_operand_is_nullable(): void { static::assertSame( '?integer', - (new Nullability())->all( + new Nullability()->all( type_integer(), type_optional(type_integer()), type_optional(type_string()), @@ -164,12 +161,12 @@ public function test_all_wraps_only_when_every_operand_is_nullable(): void static::assertSame( 'integer', - (new Nullability())->all(type_integer(), type_optional(type_integer()), type_string())->toString(), + new Nullability()->all(type_integer(), type_optional(type_integer()), type_string())->toString(), ); } public function test_all_over_zero_operands_is_not_nullable(): void { - static::assertSame('integer', (new Nullability())->all(type_integer())->toString()); + static::assertSame('integer', new Nullability()->all(type_integer())->toString()); } } diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/ScalarUnificationTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/ScalarUnificationTest.php index 6be5d0ac4d..b14f1f75f2 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/ScalarUnificationTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/ScalarUnificationTest.php @@ -54,7 +54,7 @@ public static function pairwise_cases(): Generator #[DataProvider('pairwise_cases')] public function test_pairwise_unification(Type $left, Type $right, ?Type $expected): void { - $result = (new ScalarUnification())->unify($left, $right); + $result = new ScalarUnification()->unify($left, $right); if ($expected === null) { static::assertNull($result); @@ -68,13 +68,13 @@ public function test_date_and_zoned_datetime_keep_the_zone(): void { static::assertSame( 'datetime', - (new ScalarUnification()) + new ScalarUnification() ->unify(type_date(), type_datetime('Europe/Warsaw')) ?->toString(), ); static::assertSame( 'datetime', - (new ScalarUnification()) + new ScalarUnification() ->unify(type_datetime('Europe/Warsaw'), type_date()) ?->toString(), ); @@ -84,7 +84,7 @@ public function test_datetimes_of_different_zones_widen_to_utc(): void { static::assertSame( 'datetime', - (new ScalarUnification()) + new ScalarUnification() ->unify(type_datetime('Europe/Warsaw'), type_datetime('+02:00')) ?->toString(), ); diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/StructureComparisonTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/StructureComparisonTest.php index 8a9fb41d56..cc5b144c3c 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/StructureComparisonTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/StructureComparisonTest.php @@ -34,7 +34,7 @@ public function test_identical_is_positional(): void public function test_identical_includes_the_optional_flag(): void { - static::assertFalse((new StructureComparison())->identical( + static::assertFalse(new StructureComparison()->identical( new StructureType([new StructureElement('a', type_integer())]), new StructureType([new StructureElement('a', type_integer(), optional: true)]), new Comparator(), diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/StructureShapeInferenceTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/StructureShapeInferenceTest.php index 85615918fc..dce28aa025 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/StructureShapeInferenceTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/StructureShapeInferenceTest.php @@ -14,7 +14,6 @@ use Flow\Types\Tests\Unit\Type\Fixtures\StructureShapeInference; use Flow\Types\Value\Json; use Flow\Types\Value\Uuid; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use stdClass; @@ -25,7 +24,7 @@ final class StructureShapeInferenceTest extends TestCase { public function test_container_element_shapes(): void { - $shape = (new StructureShapeInference())->containers([ + $shape = new StructureShapeInference()->containers([ 'list' => ['a', 'b'], 'map' => ['one' => 1], 'nested' => ['inner' => 7], @@ -56,7 +55,7 @@ public function test_marker_element_shapes(): void public function test_container_accessor_shapes(): void { - $shape = (new StructureShapeInference())->containerAccessors(['a'], ['one' => 1], 'element', 'key', 9); + $shape = new StructureShapeInference()->containerAccessors(['a'], ['one' => 1], 'element', 'key', 9); static::assertSame(['a'], $shape['list']); static::assertSame(['one' => 1], $shape['map']); @@ -67,7 +66,7 @@ public function test_container_accessor_shapes(): void public function test_generic_element_shapes(): void { - $shape = (new StructureShapeInference())->generics([ + $shape = new StructureShapeInference()->generics([ 'enum' => SomeEnum::A, 'instance_of' => new DateTimeImmutable('2026-08-07 10:00:00'), 'class_string' => stdClass::class, @@ -82,14 +81,12 @@ public function test_generic_element_shapes(): void static::assertSame(42, $shape['union']); } - #[RequiresPhp('>= 8.4.0')] public function test_html_element_shapes(): void { - // @mago-expect analysis:unavailable-method $document = HTMLDocument::createFromString(''); $element = $document->createElement('p'); - $shape = (new StructureShapeInference())->html(['html' => $document, 'html_element' => $element]); + $shape = new StructureShapeInference()->html(['html' => $document, 'html_element' => $element]); static::assertSame($document, $shape['html']); static::assertSame($element, $shape['html_element']); @@ -100,7 +97,7 @@ public function test_object_element_shapes(): void $document = new DOMDocument(); $dateTime = new DateTimeImmutable('2026-08-07 10:00:00'); - $shape = (new StructureShapeInference())->objects([ + $shape = new StructureShapeInference()->objects([ 'json' => Json::fromString('{"a":1}'), 'uuid' => Uuid::fromString('00000000-0000-0000-0000-000000000000'), 'datetime' => $dateTime, @@ -121,7 +118,7 @@ public function test_scalar_element_shapes(): void $handle = fopen('php://memory', 'rb'); $object = new stdClass(); - $shape = (new StructureShapeInference())->scalars([ + $shape = new StructureShapeInference()->scalars([ 'integer' => 1, 'string' => 'a', 'float' => 1.5, diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeDetectorTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeDetectorTest.php index 07da8bf64e..cc6c976260 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeDetectorTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeDetectorTest.php @@ -35,7 +35,6 @@ use Flow\Types\Value\Uuid; use Generator; use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use stdClass; @@ -668,17 +667,17 @@ public function test_closure_is_rejected(): void $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Closure is not a supported value type.'); - (new TypeDetector())->detectType(static fn(): int => 1); + new TypeDetector()->detectType(static fn(): int => 1); } #[DataProvider('provide_detected_type_law_data')] public function test_detection_is_idempotent_under_its_own_materialization(mixed $data): void { - $type = (new TypeDetector())->detectType($data); + $type = new TypeDetector()->detectType($data); static::assertSame( $type->toString(), - (new TypeDetector()) + new TypeDetector() ->detectType($type->cast($data)) ->toString(), ); @@ -686,36 +685,32 @@ public function test_detection_is_idempotent_under_its_own_materialization(mixed public function test_enum_type(): void { - static::assertInstanceOf(EnumType::class, (new TypeDetector())->detectType(BasicEnum::two)); + static::assertInstanceOf(EnumType::class, new TypeDetector()->detectType(BasicEnum::two)); } public function test_invokable_object_is_still_detected_as_instance_of(): void { static::assertEquals( type_instance_of(InvokableObject::class), - (new TypeDetector())->detectType(new InvokableObject()), + new TypeDetector()->detectType(new InvokableObject()), ); } - #[RequiresPhp('>= 8.4.0')] public function test_logical_html_element_type(): void { - // @mago-expect analysis:unavailable-method $document = HTMLDocument::createFromString( '
1
', ); - $type = (new TypeDetector())->detectType($document->querySelector('body')); + $type = new TypeDetector()->detectType($document->querySelector('body')); static::assertInstanceOf(Type\Logical\HTMLElementType::class, $type); static::assertSame('html_element', $type->toString()); } - #[RequiresPhp('>= 8.4.0')] public function test_logical_html_type(): void { - // @mago-expect analysis:unavailable-method - $type = (new TypeDetector())->detectType(HTMLDocument::createFromString( + $type = new TypeDetector()->detectType(HTMLDocument::createFromString( '
1
', )); @@ -729,7 +724,7 @@ public function test_logical_html_type(): void #[DataProvider('provide_logical_types_data')] public function test_logical_types(mixed $data, string $class, string $description): void { - $type = (new TypeDetector())->detectType($data); + $type = new TypeDetector()->detectType($data); static::assertInstanceOf($class, $type); static::assertSame($description, $type->toString()); @@ -738,7 +733,7 @@ public function test_logical_types(mixed $data, string $class, string $descripti #[DataProvider('provide_object_data')] public function test_object_types(mixed $data): void { - static::assertInstanceOf(InstanceOfType::class, (new TypeDetector())->detectType($data)); + static::assertInstanceOf(InstanceOfType::class, new TypeDetector()->detectType($data)); } /** @@ -747,7 +742,7 @@ public function test_object_types(mixed $data): void #[DataProvider('provide_scalar_data')] public function test_scalar_types(mixed $data, string $description, Type $expectedType): void { - $type = (new TypeDetector())->detectType($data); + $type = new TypeDetector()->detectType($data); static::assertInstanceOf($expectedType::class, $type); static::assertSame($description, $type->toString()); } diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeNarrowingTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeNarrowingTest.php index 6377f0b59b..6708259d8c 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeNarrowingTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeNarrowingTest.php @@ -14,7 +14,6 @@ use Flow\Types\Tests\Unit\Type\Fixtures\TypeNarrowing; use Flow\Types\Value\Json; use Flow\Types\Value\Uuid; -use PHPUnit\Framework\Attributes\RequiresPhp; use PHPUnit\Framework\TestCase; use stdClass; @@ -32,7 +31,7 @@ public function test_assert_narrows_logical_types(): void $timeZone = new DateTimeZone('UTC'); $uuid = Uuid::fromString('00000000-0000-0000-0000-000000000000'); - $narrowed = (new TypeNarrowing())->assertNarrowsLogical( + $narrowed = new TypeNarrowing()->assertNarrowsLogical( stdClass::class, $dateTime, $date, @@ -75,7 +74,7 @@ public function test_assert_narrows_native_types(): void $handle = fopen('php://memory', 'rb'); $object = new stdClass(); - $narrowed = (new TypeNarrowing())->assertNarrowsNative( + $narrowed = new TypeNarrowing()->assertNarrowsNative( [], true, 'strlen', @@ -112,7 +111,7 @@ public function test_cast_narrows_logical_types(): void $dateTime = new DateTimeImmutable('2026-08-07 10:00:00'); $document = new DOMDocument(); - $narrowed = (new TypeNarrowing())->castNarrowsLogical( + $narrowed = new TypeNarrowing()->castNarrowsLogical( stdClass::class, $dateTime, $dateTime, @@ -147,7 +146,7 @@ public function test_cast_narrows_native_types(): void { $handle = fopen('php://memory', 'rb'); - $narrowed = (new TypeNarrowing())->castNarrowsNative( + $narrowed = new TypeNarrowing()->castNarrowsNative( [], true, 'strlen', @@ -179,7 +178,7 @@ public function test_cast_narrows_enum_from_backed_value(): void { $handle = fopen('php://memory', 'rb'); - $narrowed = (new TypeNarrowing())->castNarrowsNative( + $narrowed = new TypeNarrowing()->castNarrowsNative( [], true, 'strlen', @@ -200,14 +199,12 @@ public function test_cast_narrows_enum_from_backed_value(): void fclose($handle); } - #[RequiresPhp('>= 8.4.0')] public function test_html_types_narrow(): void { - // @mago-expect analysis:unavailable-method $document = HTMLDocument::createFromString(''); $element = $document->createElement('p'); - $narrowed = (new TypeNarrowing())->narrowsHtml($document, $element, $document, $element, $document, $element); + $narrowed = new TypeNarrowing()->narrowsHtml($document, $element, $document, $element, $document, $element); static::assertSame($document, $narrowed['asserted_html']); static::assertSame($element, $narrowed['asserted_html_element']); @@ -222,7 +219,7 @@ public function test_is_valid_narrows_logical_types(): void $dateTime = new DateTimeImmutable('2026-08-07 10:00:00'); $document = new DOMDocument(); - $narrowed = (new TypeNarrowing())->isValidNarrowsLogical( + $narrowed = new TypeNarrowing()->isValidNarrowsLogical( stdClass::class, $dateTime, new DateTimeImmutable('2026-08-07 00:00:00'), @@ -274,7 +271,7 @@ public function test_is_valid_narrows_native_types(): void { $handle = fopen('php://memory', 'rb'); - $narrowed = (new TypeNarrowing())->isValidNarrowsNative( + $narrowed = new TypeNarrowing()->isValidNarrowsNative( [], true, 'strlen', @@ -312,7 +309,7 @@ public function test_is_valid_narrows_native_types(): void public function test_is_valid_rejects_mismatched_values(): void { - $narrowed = (new TypeNarrowing())->isValidNarrowsNative( + $narrowed = new TypeNarrowing()->isValidNarrowsNative( 'not-an-array', 'not-a-bool', 'not/a/callable', diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeUnifierTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeUnifierTest.php index b52d38a0ba..c84e251bf5 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeUnifierTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeUnifierTest.php @@ -118,7 +118,7 @@ public static function strict_pairwise_cases(): Generator #[DataProvider('promoting_pairwise_cases')] public function test_promoting_pairwise(Type $left, Type $right, ?Type $expected): void { - $result = (new PromotingUnifier())->unify($left, $right); + $result = new PromotingUnifier()->unify($left, $right); if ($expected === null) { static::assertNull($result); @@ -136,7 +136,7 @@ public function test_promoting_pairwise(Type $left, Type $right, ?Type $expected #[DataProvider('strict_pairwise_cases')] public function test_strict_pairwise(Type $left, Type $right, ?Type $expected): void { - $result = (new StrictUnifier())->unify($left, $right); + $result = new StrictUnifier()->unify($left, $right); if ($expected === null) { static::assertNull($result); @@ -150,13 +150,13 @@ public function test_null_type_is_the_identity(): void { static::assertSame( 'integer', - (new PromotingUnifier()) + new PromotingUnifier() ->unify(type_integer(), type_null()) ?->toString(), ); static::assertSame( 'integer', - (new StrictUnifier()) + new StrictUnifier() ->unify(type_null(), type_integer()) ?->toString(), ); @@ -166,13 +166,13 @@ public function test_unify_all_seeded_with_null_degenerates_to_the_first_concret { static::assertSame( 'string', - (new PromotingUnifier()) + new PromotingUnifier() ->unifyAll(NullabilityRule::ANY, type_string()) ?->toString(), ); static::assertSame( 'string', - (new StrictUnifier()) + new StrictUnifier() ->unifyAll(NullabilityRule::ANY, type_string()) ?->toString(), ); @@ -182,19 +182,19 @@ public function test_containers_recurse_under_the_caller_policy(): void { static::assertSame( 'list', - (new PromotingUnifier()) + new PromotingUnifier() ->unify(type_list(type_integer()), type_list(type_string())) ?->toString(), ); - static::assertNull((new StrictUnifier())->unify(type_list(type_integer()), type_list(type_string()))); + static::assertNull(new StrictUnifier()->unify(type_list(type_integer()), type_list(type_string()))); } public function test_a_nullable_element_survives_the_recursion(): void { static::assertSame( 'list', - (new StrictUnifier()) + new StrictUnifier() ->unify(type_list(type_optional(type_integer())), type_list(type_optional(type_float()))) ?->toString(), ); @@ -209,26 +209,26 @@ public function test_map_key_never_string_promotes(): void static::assertSame( 'map', - (new PromotingUnifier()) + new PromotingUnifier() ->unify(...$intToFloatKey) ?->toString(), ); static::assertSame( 'map', - (new StrictUnifier()) + new StrictUnifier() ->unify(...$intToFloatKey) ?->toString(), ); - static::assertNull((new PromotingUnifier())->unify(...$intToStringKey)); - static::assertNull((new StrictUnifier())->unify(...$intToStringKey)); + static::assertNull(new PromotingUnifier()->unify(...$intToStringKey)); + static::assertNull(new StrictUnifier()->unify(...$intToStringKey)); } public function test_map_key_that_unifies_to_nullable_is_refused(): void { // Deliberately ill-keyed maps: the test proves the unifier refuses a key that unifies nullable. // @mago-expect analysis:template-constraint-violation - static::assertNull((new PromotingUnifier())->unify( + static::assertNull(new PromotingUnifier()->unify( type_map(type_optional(type_integer()), type_string()), type_map(type_optional(type_float()), type_string()), )); @@ -236,7 +236,7 @@ public function test_map_key_that_unifies_to_nullable_is_refused(): void public function test_structures_with_differing_key_sets_have_no_common_type(): void { - static::assertNull((new PromotingUnifier())->unify( + static::assertNull(new PromotingUnifier()->unify( type_structure(['a' => type_integer()]), type_structure(['a' => type_integer(), 'b' => type_string()]), )); @@ -244,7 +244,7 @@ public function test_structures_with_differing_key_sets_have_no_common_type(): v public function test_structures_with_same_fields_in_different_order_have_no_common_type(): void { - static::assertNull((new PromotingUnifier())->unify( + static::assertNull(new PromotingUnifier()->unify( type_structure(['a' => type_integer(), 'b' => type_string()]), type_structure(['b' => type_string(), 'a' => type_integer()]), )); @@ -252,7 +252,7 @@ public function test_structures_with_same_fields_in_different_order_have_no_comm public function test_structures_with_same_fields_in_same_order_unify(): void { - $result = (new PromotingUnifier())->unify( + $result = new PromotingUnifier()->unify( type_structure(['a' => type_integer(), 'b' => type_string()]), type_structure(['a' => type_integer(), 'b' => type_string()]), ); @@ -263,7 +263,7 @@ public function test_structures_with_same_fields_in_same_order_unify(): void public function test_structure_optionality_is_or_ed(): void { - $result = (new PromotingUnifier())->unify( + $result = new PromotingUnifier()->unify( type_structure(['a' => type_integer()]), type_structure(['a' => structure_element('a', type_integer(), optional: true)]), ); @@ -279,24 +279,24 @@ public function test_promoting_unify_all_is_order_independent(): void { static::assertSame( 'string', - (new PromotingUnifier()) + new PromotingUnifier() ->unifyAll(NullabilityRule::ANY, type_datetime(), type_integer(), type_string()) ?->toString(), ); static::assertSame( 'string', - (new PromotingUnifier()) + new PromotingUnifier() ->unifyAll(NullabilityRule::ANY, type_string(), type_integer(), type_datetime()) ?->toString(), ); - static::assertNull((new StrictUnifier())->unifyAll( + static::assertNull(new StrictUnifier()->unifyAll( NullabilityRule::ANY, type_datetime(), type_integer(), type_string(), )); - static::assertNull((new StrictUnifier())->unifyAll( + static::assertNull(new StrictUnifier()->unifyAll( NullabilityRule::ANY, type_string(), type_integer(), @@ -308,14 +308,14 @@ public function test_coalesce_of_a_nullable_and_a_not_null_column_is_not_null(): { static::assertSame( 'integer', - (new PromotingUnifier()) + new PromotingUnifier() ->unifyAll(NullabilityRule::ALL, type_optional(type_integer()), type_integer()) ?->toString(), ); static::assertSame( '?integer', - (new PromotingUnifier()) + new PromotingUnifier() ->unifyAll(NullabilityRule::ANY, type_optional(type_integer()), type_integer()) ?->toString(), ); @@ -325,7 +325,7 @@ public function test_the_root_and_the_element_take_different_rules(): void { static::assertSame( 'list', - (new PromotingUnifier()) + new PromotingUnifier() ->unifyAll( NullabilityRule::ALL, type_optional(type_list(type_optional(type_integer()))), @@ -341,13 +341,13 @@ public function test_unify_all_reads_both_nullability_spellings(): void // it from the unstripped operands, so the two spellings of the same information agree static::assertSame( '?string', - (new PromotingUnifier()) + new PromotingUnifier() ->unifyAll(NullabilityRule::ANY, type_union(type_null(), type_string()), type_integer()) ?->toString(), ); static::assertSame( '?integer', - (new PromotingUnifier()) + new PromotingUnifier() ->unifyAll(NullabilityRule::ANY, type_null(), type_integer()) ?->toString(), ); @@ -357,7 +357,7 @@ public function test_unify_all_under_all_does_not_let_a_null_operand_remove_null { static::assertSame( '?integer', - (new PromotingUnifier()) + new PromotingUnifier() ->unifyAll(NullabilityRule::ALL, type_optional(type_integer()), type_null()) ?->toString(), ); diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeWidenerTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeWidenerTest.php index 2e4977d9f9..cdec8ca118 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeWidenerTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypeWidenerTest.php @@ -397,7 +397,7 @@ public function test_widening_optional_string_with_any_non_null_candidate_type_y ): void { static::assertEquals( type_optional(type_string()), - (new TypeWidener())->widen(type_optional(type_string()), $candidate), + new TypeWidener()->widen(type_optional(type_string()), $candidate), ); } @@ -407,12 +407,12 @@ public function test_widening_optional_string_with_any_non_null_candidate_type_y #[DataProvider('provideNonNullTypes')] public function test_widening_string_with_any_non_null_candidate_type_yields_string(Type $candidate): void { - static::assertEquals(type_string(), (new TypeWidener())->widen(type_string(), $candidate)); + static::assertEquals(type_string(), new TypeWidener()->widen(type_string(), $candidate)); } public function test_widening_string_with_null_yields_optional_string(): void { - static::assertEquals(type_optional(type_string()), (new TypeWidener())->widen(type_string(), type_null())); + static::assertEquals(type_optional(type_string()), new TypeWidener()->widen(type_string(), type_null())); } /** @@ -423,7 +423,7 @@ public function test_widening_string_with_null_yields_optional_string(): void #[DataProvider('provideWidenCases')] public function test_widening_types(Type $left, Type $right, Type $expected): void { - static::assertEquals($expected, (new TypeWidener())->widen($left, $right)); + static::assertEquals($expected, new TypeWidener()->widen($left, $right)); } /** @@ -434,14 +434,14 @@ public function test_widening_types(Type $left, Type $right, Type $expected): vo #[DataProvider('provideStructureCases')] public function test_widening_structures(StructureType $left, StructureType $right, StructureType $expected): void { - static::assertEquals($expected, (new TypeWidener())->widenStructures($left, $right)); + static::assertEquals($expected, new TypeWidener()->widenStructures($left, $right)); } public function test_widening_lists_directly(): void { static::assertEquals( type_list(type_float()), - (new TypeWidener())->widenLists(type_list(type_integer()), type_list(type_float())), + new TypeWidener()->widenLists(type_list(type_integer()), type_list(type_float())), ); } @@ -449,7 +449,7 @@ public function test_widening_maps_directly(): void { static::assertEquals( type_map(type_string(), type_float()), - (new TypeWidener())->widenMaps( + new TypeWidener()->widenMaps( type_map(type_string(), type_integer()), type_map(type_string(), type_float()), ), @@ -462,14 +462,14 @@ public function test_widening_maps_directly(): void #[TestWith(['widenStructures'])] public function test_widening_takes_only_the_two_operands(string $method): void { - static::assertSame(2, (new ReflectionMethod(TypeWidener::class, $method))->getNumberOfParameters()); + static::assertSame(2, new ReflectionMethod(TypeWidener::class, $method)->getNumberOfParameters()); } public function test_structure_key_order_follows_left_then_right(): void { static::assertSame( 'structure{b: string, a?: string, c?: string}', - (new TypeWidener()) + new TypeWidener() ->widen( type_structure(['b' => type_string(), 'a' => type_string()]), type_structure(['c' => type_string(), 'b' => type_string()]), @@ -482,7 +482,7 @@ public function test_structure_widening_keeps_left_declared_order_and_appends_ri { static::assertSame( 'structure{a?: integer, b: integer}', - (new TypeWidener()) + new TypeWidener() ->widen( type_structure(['a' => type_integer(), 'b' => type_integer()]), type_structure(['b' => type_integer()]), @@ -492,7 +492,7 @@ public function test_structure_widening_keeps_left_declared_order_and_appends_ri static::assertSame( 'structure{b: integer, a?: integer}', - (new TypeWidener()) + new TypeWidener() ->widen( type_structure(['b' => type_integer()]), type_structure(['a' => type_integer(), 'b' => type_integer()]), @@ -505,13 +505,13 @@ public function test_date_and_zoned_datetime_keep_the_zone(): void { static::assertSame( 'datetime', - (new TypeWidener()) + new TypeWidener() ->widen(type_date(), type_datetime('Europe/Warsaw')) ->toString(), ); static::assertSame( 'datetime', - (new TypeWidener()) + new TypeWidener() ->widen(type_datetime('Europe/Warsaw'), type_date()) ->toString(), ); @@ -521,7 +521,7 @@ public function test_datetimes_of_different_zones_widen_to_utc(): void { static::assertSame( 'datetime', - (new TypeWidener()) + new TypeWidener() ->widen(type_datetime('Europe/Warsaw'), type_datetime('+02:00')) ->toString(), ); diff --git a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypedValueFormatterTest.php b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypedValueFormatterTest.php index b010e8d15e..ec14a62e13 100644 --- a/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypedValueFormatterTest.php +++ b/src/lib/types/tests/Flow/Types/Tests/Unit/Type/TypedValueFormatterTest.php @@ -114,29 +114,26 @@ public static function format_data_provider(): Generator #[DataProvider('format_data_provider')] public function test_format(Type $type, mixed $value, string $expected): void { - static::assertSame($expected, (new TypedValueFormatter())->format($type, $value)); + static::assertSame($expected, new TypedValueFormatter()->format($type, $value)); } public function test_format_null_is_empty_string(): void { - static::assertSame('', (new TypedValueFormatter())->format(type_float(), null)); - static::assertSame('', (new TypedValueFormatter())->format(type_date(), null)); - static::assertSame('', (new TypedValueFormatter())->format(type_string(), null)); + static::assertSame('', new TypedValueFormatter()->format(type_float(), null)); + static::assertSame('', new TypedValueFormatter()->format(type_date(), null)); + static::assertSame('', new TypedValueFormatter()->format(type_string(), null)); } public function test_format_time_interval(): void { - static::assertSame('25:02:03', (new TypedValueFormatter())->format( - type_time(), - new DateInterval('P1DT1H2M3S'), - )); + static::assertSame('25:02:03', new TypedValueFormatter()->format(type_time(), new DateInterval('P1DT1H2M3S'))); } public function test_format_time_interval_with_microseconds(): void { - static::assertSame('01:02:03.500000', (new TypedValueFormatter())->format( + static::assertSame('01:02:03.500000', new TypedValueFormatter()->format( type_time(), - (new DateTimeImmutable('2024-01-01 00:00:00.000000'))->diff( + new DateTimeImmutable('2024-01-01 00:00:00.000000')->diff( new DateTimeImmutable('2024-01-01 01:02:03.500000'), ), )); @@ -144,7 +141,7 @@ public function test_format_time_interval_with_microseconds(): void public function test_format_union_falls_back_to_string_when_no_member_matches(): void { - static::assertSame('abc', (new TypedValueFormatter())->format(type_union(type_float(), type_integer()), 'abc')); + static::assertSame('abc', new TypedValueFormatter()->format(type_union(type_float(), type_integer()), 'abc')); } public function test_format_union_uses_matching_member(): void diff --git a/src/tools/documentation/src/Flow/Documentation/Docs/DocumentMethodCalls.php b/src/tools/documentation/src/Flow/Documentation/Docs/DocumentMethodCalls.php index 1284a50ff9..f892d7e998 100644 --- a/src/tools/documentation/src/Flow/Documentation/Docs/DocumentMethodCalls.php +++ b/src/tools/documentation/src/Flow/Documentation/Docs/DocumentMethodCalls.php @@ -36,7 +36,7 @@ public function __construct() { - $this->parser = (new ParserFactory())->createForVersion(PhpVersion::fromComponents(8, 3)); + $this->parser = new ParserFactory()->createForVersion(PhpVersion::fromComponents(8, 3)); } /** @@ -136,7 +136,7 @@ private function parse(Fence $fence): ?array $statements = $this->parser->parse($code); // NameResolver throws on a duplicate import, which is itself a defect the fence test reports - return $statements === null ? null : (new NodeTraverser(new NameResolver()))->traverse($statements); + return $statements === null ? null : new NodeTraverser(new NameResolver())->traverse($statements); } catch (Throwable) { return null; } diff --git a/src/tools/documentation/src/Flow/Documentation/Docs/InferredTypes.php b/src/tools/documentation/src/Flow/Documentation/Docs/InferredTypes.php index d4d80f0024..2f15b8c4ee 100644 --- a/src/tools/documentation/src/Flow/Documentation/Docs/InferredTypes.php +++ b/src/tools/documentation/src/Flow/Documentation/Docs/InferredTypes.php @@ -127,7 +127,7 @@ private function returnTypeOfFunction(string $name): ?string return null; } - return $this->named((new ReflectionFunction($name))->getReturnType()); + return $this->named(new ReflectionFunction($name)->getReturnType()); } /** diff --git a/src/tools/documentation/src/Flow/Documentation/FunctionsExtractor.php b/src/tools/documentation/src/Flow/Documentation/FunctionsExtractor.php index 6936d9d2c2..bfe5fcedff 100644 --- a/src/tools/documentation/src/Flow/Documentation/FunctionsExtractor.php +++ b/src/tools/documentation/src/Flow/Documentation/FunctionsExtractor.php @@ -42,7 +42,7 @@ public function extract(array $paths): Generator $repositoryPath = ltrim(str_replace($this->repositoryRootPath, '', (string) realpath($path)), '/'); - foreach ((new SingleFileSourceLocator($path, $this->astLocator))->locateIdentifiersByType( + foreach (new SingleFileSourceLocator($path, $this->astLocator)->locateIdentifiersByType( $this->reflector, new IdentifierType(IdentifierType::IDENTIFIER_FUNCTION), ) as $reflectionFunction) { diff --git a/src/tools/documentation/src/Flow/Documentation/Models/AttributeModel.php b/src/tools/documentation/src/Flow/Documentation/Models/AttributeModel.php index 0a2dc4b3aa..f65acb2c42 100644 --- a/src/tools/documentation/src/Flow/Documentation/Models/AttributeModel.php +++ b/src/tools/documentation/src/Flow/Documentation/Models/AttributeModel.php @@ -56,7 +56,7 @@ public static function fromReflection(ReflectionAttribute $reflectionAttribute): && $argument->name instanceof Identifier && enum_exists($argument->class->toString()) ? constant($argument->class->toString() . '::' . $argument->name->toString()) - : (new Standard())->prettyPrintExpr($argument)); + : new Standard()->prettyPrintExpr($argument)); return new self( substr($reflectionAttribute->getName(), $separator === 0 ? 0 : $separator + 1), diff --git a/src/tools/documentation/src/Flow/Documentation/Models/FunctionModel.php b/src/tools/documentation/src/Flow/Documentation/Models/FunctionModel.php index b0e4ec2ec5..5fd35ca8d6 100644 --- a/src/tools/documentation/src/Flow/Documentation/Models/FunctionModel.php +++ b/src/tools/documentation/src/Flow/Documentation/Models/FunctionModel.php @@ -83,7 +83,7 @@ public static function fromReflection(string $relativePath, ReflectionFunction $ return new self( $relativePath, $reflectionFunction->getStartLine(), - (new AsciiSlugger()) + new AsciiSlugger() ->slug($reflectionFunction->getShortName()) ->lower() ->toString(), diff --git a/src/tools/documentation/src/Flow/Documentation/Models/ParameterModel.php b/src/tools/documentation/src/Flow/Documentation/Models/ParameterModel.php index dc54d29b97..d6fd8b2f23 100644 --- a/src/tools/documentation/src/Flow/Documentation/Models/ParameterModel.php +++ b/src/tools/documentation/src/Flow/Documentation/Models/ParameterModel.php @@ -100,6 +100,6 @@ private static function exportDefaultValue(Expr $defaultValue): string // PHP stubs write constants fully qualified (\null, \PHP_INT_MAX), source code does not. return $defaultValue instanceof ConstFetch ? $defaultValue->name->toString() - : (new Standard())->prettyPrintExpr($defaultValue); + : new Standard()->prettyPrintExpr($defaultValue); } } diff --git a/src/tools/documentation/src/Flow/Documentation/Models/TypeModel.php b/src/tools/documentation/src/Flow/Documentation/Models/TypeModel.php index 44944a28b0..216c4c142f 100644 --- a/src/tools/documentation/src/Flow/Documentation/Models/TypeModel.php +++ b/src/tools/documentation/src/Flow/Documentation/Models/TypeModel.php @@ -67,7 +67,7 @@ public static function fromReflection(ReflectionType $reflectionType): self public function name(): string { if (class_exists($this->name)) { - return (new ReflectionClass($this->name))->getShortName(); + return new ReflectionClass($this->name)->getShortName(); } return $this->name; @@ -76,7 +76,7 @@ public function name(): string public function namespace(): ?string { if (class_exists($this->name)) { - return (new ReflectionClass($this->name))->getNamespaceName(); + return new ReflectionClass($this->name)->getNamespaceName(); } return null; diff --git a/src/tools/documentation/tests/Flow/Documentation/Tests/Context/ExtractedClassesContext.php b/src/tools/documentation/tests/Flow/Documentation/Tests/Context/ExtractedClassesContext.php index e2040d5278..056b7e909f 100644 --- a/src/tools/documentation/tests/Flow/Documentation/Tests/Context/ExtractedClassesContext.php +++ b/src/tools/documentation/tests/Flow/Documentation/Tests/Context/ExtractedClassesContext.php @@ -31,7 +31,7 @@ public function extract(array $roots, array $phpExtensions = []): array $betterReflection = new BetterReflection(); $classes = []; - foreach ((new ClassesExtractor( + foreach (new ClassesExtractor( dirname(__DIR__) . '/', new DefaultReflector(new AggregateSourceLocator([ new AutoloadSourceLocator($betterReflection->astLocator(), $betterReflection->phpParser()), @@ -41,7 +41,7 @@ public function extract(array $roots, array $phpExtensions = []): array ), ])), $phpExtensions, - ))->extract($roots) as $class) { + )->extract($roots) as $class) { $classes[$class->name] = $class; } diff --git a/src/tools/documentation/tests/Flow/Documentation/Tests/Context/FenceContext.php b/src/tools/documentation/tests/Flow/Documentation/Tests/Context/FenceContext.php index 38469dd2a6..67d0253fd5 100644 --- a/src/tools/documentation/tests/Flow/Documentation/Tests/Context/FenceContext.php +++ b/src/tools/documentation/tests/Flow/Documentation/Tests/Context/FenceContext.php @@ -28,7 +28,7 @@ public function unresolvedFunctions(string $code, string ...$declaredByThePage): $declarations[] = $this->php($declaration); } - return (new FenceSymbols())->unresolved( + return new FenceSymbols()->unresolved( $this->php($code), new DefinedFunctions(), new DocumentDeclarations($declarations), diff --git a/src/tools/documentation/tests/Flow/Documentation/Tests/Integration/DocumentationFencesTest.php b/src/tools/documentation/tests/Flow/Documentation/Tests/Integration/DocumentationFencesTest.php index ffe1bb7525..d32ec4cb1f 100644 --- a/src/tools/documentation/tests/Flow/Documentation/Tests/Integration/DocumentationFencesTest.php +++ b/src/tools/documentation/tests/Flow/Documentation/Tests/Integration/DocumentationFencesTest.php @@ -33,7 +33,7 @@ public static function documentation_links(): Generator { $links = new DocumentationLinks(); - foreach ((new MarkdownCorpusContext())->filesIn(['documentation', 'web/landing/content']) as $file) { + foreach (new MarkdownCorpusContext()->filesIn(['documentation', 'web/landing/content']) as $file) { foreach ($links->of($file) as $link) { yield sprintf('%s:%d %s', $link['file'], $link['line'], $link['href']) => [$link['href']]; } @@ -42,7 +42,7 @@ public static function documentation_links(): Generator public static function documentation_pages(): Generator { - foreach ((new MarkdownCorpusContext())->filesIn(['documentation']) as $file) { + foreach (new MarkdownCorpusContext()->filesIn(['documentation']) as $file) { if (fnmatch(self::EXCLUDED, $file)) { continue; } @@ -55,7 +55,7 @@ public static function php_fences(): Generator { $fences = new MarkdownFences(); - foreach ((new MarkdownCorpusContext())->filesIn(['documentation']) as $file) { + foreach (new MarkdownCorpusContext()->filesIn(['documentation']) as $file) { if (fnmatch(self::EXCLUDED, $file)) { continue; } @@ -71,16 +71,16 @@ public static function php_fences(): Generator #[DataProvider('documentation_links')] public function test_a_documentation_link_resolves(string $href): void { - static::assertTrue((new DocumentationLinks())->resolves($href), sprintf('"%s" does not resolve.', $href)); + static::assertTrue(new DocumentationLinks()->resolves($href), sprintf('"%s" does not resolve.', $href)); } #[DataProvider('php_fences')] public function test_a_php_fence_calls_only_functions_that_exist(Fence $fence): void { - $unresolved = (new FenceSymbols())->unresolved( + $unresolved = new FenceSymbols()->unresolved( $fence, new DefinedFunctions(), - new DocumentDeclarations((new MarkdownFences())->of($fence->file)), + new DocumentDeclarations(new MarkdownFences()->of($fence->file)), ); static::assertSame( @@ -94,7 +94,7 @@ public function test_a_php_fence_calls_only_functions_that_exist(Fence $fence): public function test_a_php_fence_tokenizes(Fence $fence): void { static::assertTrue( - (new FenceSymbols())->tokenizes($fence), + new FenceSymbols()->tokenizes($fence), sprintf('%s does not parse. Mark it "```php ignore" if the fragment is deliberate.', $fence->location()), ); } @@ -103,13 +103,13 @@ public function test_a_php_fence_tokenizes(Fence $fence): void public function test_a_page_calls_only_methods_its_receivers_declare(string $file): void { $fences = array_values(array_filter( - (new MarkdownFences())->phpOf($file), + new MarkdownFences()->phpOf($file), static fn(Fence $fence): bool => !$fence->info->isIgnored(), )); $messages = []; - foreach ((new DocumentMethodCalls())->unresolved($fences) as $location => $calls) { + foreach (new DocumentMethodCalls()->unresolved($fences) as $location => $calls) { $messages[] = $location . ': ' . implode(', ', $calls); } diff --git a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Attribute/DocumentationDSLTest.php b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Attribute/DocumentationDSLTest.php index b7d2ee1873..75f79e48c6 100644 --- a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Attribute/DocumentationDSLTest.php +++ b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Attribute/DocumentationDSLTest.php @@ -14,9 +14,9 @@ final class DocumentationDSLTest extends TestCase { public function test_carries_module_and_type(): void { - $dsl = (new ReflectionFunction( + $dsl = new ReflectionFunction( #[DocumentationDSL(module: Module::CORE, type: Type::HELPER)] static fn() => null, - ))->getAttributes(DocumentationDSL::class)[0]->newInstance(); + )->getAttributes(DocumentationDSL::class)[0]->newInstance(); static::assertSame(Module::CORE, $dsl->module); static::assertSame(Type::HELPER, $dsl->type); diff --git a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Attribute/DocumentationExampleTest.php b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Attribute/DocumentationExampleTest.php index c38312aa0f..8f31a73e9b 100644 --- a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Attribute/DocumentationExampleTest.php +++ b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Attribute/DocumentationExampleTest.php @@ -15,8 +15,8 @@ final class DocumentationExampleTest extends TestCase { public function test_is_repeatable_on_a_function(): void { - $examples = (new ReflectionFunction(#[DocumentationExample('reading', 'csv')] - #[DocumentationExample('reading', 'json')] static fn() => null))->getAttributes(DocumentationExample::class); + $examples = new ReflectionFunction(#[DocumentationExample('reading', 'csv')] + #[DocumentationExample('reading', 'json')] static fn() => null)->getAttributes(DocumentationExample::class); static::assertSame( ['csv', 'json'], diff --git a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DefinedFunctionsTest.php b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DefinedFunctionsTest.php index cae4febd90..8ac0172538 100644 --- a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DefinedFunctionsTest.php +++ b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DefinedFunctionsTest.php @@ -11,21 +11,21 @@ final class DefinedFunctionsTest extends TestCase { public function test_a_dsl_function_is_known_by_its_short_name(): void { - static::assertTrue((new DefinedFunctions())->has('from_csv')); + static::assertTrue(new DefinedFunctions()->has('from_csv')); } public function test_a_dsl_function_is_known_by_its_qualified_name(): void { - static::assertTrue((new DefinedFunctions())->has('Flow\ETL\Adapter\CSV\from_csv')); + static::assertTrue(new DefinedFunctions()->has('Flow\ETL\Adapter\CSV\from_csv')); } public function test_lookup_ignores_case(): void { - static::assertTrue((new DefinedFunctions())->has('FROM_CSV')); + static::assertTrue(new DefinedFunctions()->has('FROM_CSV')); } public function test_a_function_this_project_does_not_define_is_unknown(): void { - static::assertFalse((new DefinedFunctions())->has('to_database')); + static::assertFalse(new DefinedFunctions()->has('to_database')); } } diff --git a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DocumentDeclarationsTest.php b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DocumentDeclarationsTest.php index bad1bda40c..8f42ee6294 100644 --- a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DocumentDeclarationsTest.php +++ b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DocumentDeclarationsTest.php @@ -23,26 +23,26 @@ public function test_a_name_declared_in_one_fence_counts_for_the_whole_file(): v public function test_declaration_lookup_ignores_case(): void { - static::assertTrue((new DocumentDeclarations([new Fence( + static::assertTrue(new DocumentDeclarations([new Fence( 'a.md', 1, FenceInfo::parse('php'), 'function Helper(): void {}', - )]))->declares('helper')); + )])->declares('helper')); } public function test_a_name_nothing_declares_is_not_declared(): void { - static::assertFalse((new DocumentDeclarations([]))->declares('helper')); + static::assertFalse(new DocumentDeclarations([])->declares('helper')); } public function test_a_method_declaration_counts_too(): void { - static::assertTrue((new DocumentDeclarations([new Fence( + static::assertTrue(new DocumentDeclarations([new Fence( 'a.md', 1, FenceInfo::parse('php'), 'class A { public function run(): void {} }', - )]))->declares('run')); + )])->declares('run')); } } diff --git a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DocumentMethodCallsTest.php b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DocumentMethodCallsTest.php index a0818676b1..80859eeb33 100644 --- a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DocumentMethodCallsTest.php +++ b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DocumentMethodCallsTest.php @@ -21,7 +21,7 @@ public function test_it_reports_a_method_the_receiver_does_not_declare(): void { static::assertSame( ['a.md:1' => ['Flow\ETL\Values\Schema::thereIsNoSuchMethod()']], - (new DocumentMethodCalls())->unresolved([ + new DocumentMethodCalls()->unresolved([ $this->fences->php("thereIsNoSuchMethod();"), ]), ); @@ -31,7 +31,7 @@ public function test_it_accepts_a_method_the_receiver_declares(): void { static::assertSame( [], - (new DocumentMethodCalls())->unresolved([ + new DocumentMethodCalls()->unresolved([ $this->fences->php("definitions();"), ]), ); @@ -41,7 +41,7 @@ public function test_a_receiver_it_cannot_type_produces_no_verdict(): void { static::assertSame( [], - (new DocumentMethodCalls())->unresolved([ + new DocumentMethodCalls()->unresolved([ $this->fences->php("thereIsNoSuchMethod();"), ]), ); @@ -51,7 +51,7 @@ public function test_a_self_referential_assignment_judges_the_call_before_the_re { static::assertSame( [], - (new DocumentMethodCalls())->unresolved([ + new DocumentMethodCalls()->unresolved([ $this->fences->php("definitions();"), ]), ); @@ -61,7 +61,7 @@ public function test_a_receiver_typed_by_an_earlier_fence_is_not_judged(): void { static::assertSame( [], - (new DocumentMethodCalls())->unresolved([ + new DocumentMethodCalls()->unresolved([ $this->fences->php("fences->php("thereIsNoSuchMethod();"), ]), @@ -72,7 +72,7 @@ public function test_an_unparseable_fence_reports_nothing(): void { static::assertSame( [], - (new DocumentMethodCalls())->unresolved([ + new DocumentMethodCalls()->unresolved([ $this->fences->php('$s = new \\Flow\\ETL\\Values\\Schema(); $s->definitions()'), ]), ); diff --git a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DocumentationLinksTest.php b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DocumentationLinksTest.php index f7c30d48c2..b6e03044f5 100644 --- a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DocumentationLinksTest.php +++ b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/DocumentationLinksTest.php @@ -17,7 +17,7 @@ final class DocumentationLinksTest extends TestCase #[TestWith(['https://flow-php.com/documentation/components/core/dataframe/window-functions', false])] public function test_a_page_link_resolves_against_the_documentation_tree(string $href, bool $resolves): void { - static::assertSame($resolves, (new DocumentationLinks())->resolves($href)); + static::assertSame($resolves, new DocumentationLinks()->resolves($href)); } #[TestWith(['/documentation/api/core'])] @@ -26,7 +26,7 @@ public function test_a_page_link_resolves_against_the_documentation_tree(string #[TestWith(['/documentation'])] public function test_a_generated_route_resolves_without_a_file(string $href): void { - static::assertTrue((new DocumentationLinks())->resolves($href)); + static::assertTrue(new DocumentationLinks()->resolves($href)); } #[TestWith(['/documentation/components/core/partitioning', true])] @@ -35,13 +35,11 @@ public function test_a_generated_route_resolves_without_a_file(string $href): vo #[TestWith(['/src/core/etl/composer.json', false])] public function test_only_documentation_hrefs_are_collected(string $href, bool $isDocumentation): void { - static::assertSame($isDocumentation, (new DocumentationLinks())->isDocumentationHref($href)); + static::assertSame($isDocumentation, new DocumentationLinks()->isDocumentationHref($href)); } public function test_an_anchor_does_not_stop_a_link_resolving(): void { - static::assertTrue((new DocumentationLinks())->resolves( - '/documentation/components/core/partitioning#overwrite', - )); + static::assertTrue(new DocumentationLinks()->resolves('/documentation/components/core/partitioning#overwrite')); } } diff --git a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/FenceSymbolsTest.php b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/FenceSymbolsTest.php index 949ba184bc..6a0568d0de 100644 --- a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/FenceSymbolsTest.php +++ b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/FenceSymbolsTest.php @@ -19,14 +19,12 @@ protected function setUp(): void public function test_a_fragment_without_a_php_tag_still_tokenizes(): void { - static::assertTrue((new FenceSymbols())->tokenizes($this->fences->php('echo from_csv("a.csv");'))); + static::assertTrue(new FenceSymbols()->tokenizes($this->fences->php('echo from_csv("a.csv");'))); } public function test_a_snippet_missing_its_terminator_does_not_tokenize(): void { - static::assertFalse((new FenceSymbols())->tokenizes($this->fences->php( - 'data_frame()->read(from_csv("a.csv"))', - ))); + static::assertFalse(new FenceSymbols()->tokenizes($this->fences->php('data_frame()->read(from_csv("a.csv"))'))); } public function test_it_reports_a_function_this_project_does_not_define(): void diff --git a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/InferredTypesTest.php b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/InferredTypesTest.php index 8df48a3583..1b3ab92cbe 100644 --- a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/InferredTypesTest.php +++ b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/InferredTypesTest.php @@ -21,7 +21,7 @@ public function test_a_receiver_typed_from_a_dsl_function_call_is_judged(): void { static::assertSame( ['a.md:1' => ['Flow\ETL\Flow::thereIsNoSuchMethod()']], - (new DocumentMethodCalls())->unresolved([ + new DocumentMethodCalls()->unresolved([ $this->fences->php( "thereIsNoSuchMethod();", ), @@ -33,7 +33,7 @@ public function test_a_receiver_typed_through_a_fluent_chain_is_judged(): void { static::assertSame( ['a.md:1' => ['Flow\ETL\API\DataFrame::thereIsNoSuchMethod()']], - (new DocumentMethodCalls())->unresolved([ + new DocumentMethodCalls()->unresolved([ $this->fences->php( "read(from_array([]))->thereIsNoSuchMethod();', @@ -46,7 +46,7 @@ public function test_a_receiver_typed_from_a_static_call_is_judged(): void { static::assertSame( ['a.md:1' => ['Flow\Parquet\ParquetFile\Schema::thereIsNoSuchMethod()']], - (new DocumentMethodCalls())->unresolved([ + new DocumentMethodCalls()->unresolved([ $this->fences->php("thereIsNoSuchMethod();"), ]), ); @@ -56,7 +56,7 @@ public function test_a_nullsafe_call_is_judged_like_any_other(): void { static::assertSame( ['a.md:1' => ['Flow\ETL\Flow::thereIsNoSuchMethod()']], - (new DocumentMethodCalls())->unresolved([ + new DocumentMethodCalls()->unresolved([ $this->fences->php( "thereIsNoSuchMethod();", ), @@ -68,7 +68,7 @@ public function test_a_self_return_resolves_to_the_class_declaring_the_method(): { static::assertSame( ['a.md:1' => ['Flow\PostgreSql\QueryBuilder\Schema\CreateTable\CreateTableFinalStep::column()']], - (new DocumentMethodCalls())->unresolved([ + new DocumentMethodCalls()->unresolved([ $this->fences->php("table('t')->ifNotExists()->column(\$c);"), ]), @@ -79,7 +79,7 @@ public function test_a_static_return_resolves_to_the_receiver(): void { static::assertSame( ['a.md:1' => ['Flow\Documentation\Tests\Double\FluentChild::thereIsNoSuchMethod()']], - (new DocumentMethodCalls())->unresolved([ + new DocumentMethodCalls()->unresolved([ $this->fences->php( "fluent()->thereIsNoSuchMethod();', @@ -92,7 +92,7 @@ public function test_a_real_method_on_a_resolved_receiver_is_accepted(): void { static::assertSame( [], - (new DocumentMethodCalls())->unresolved([ + new DocumentMethodCalls()->unresolved([ $this->fences->php("read(\$e);"), ]), ); diff --git a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/MarkdownFencesTest.php b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/MarkdownFencesTest.php index c646375bfd..128b28f47c 100644 --- a/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/MarkdownFencesTest.php +++ b/src/tools/documentation/tests/Flow/Documentation/Tests/Unit/Docs/MarkdownFencesTest.php @@ -24,21 +24,21 @@ protected function tearDown(): void public function test_it_records_the_line_of_the_opening_fence(): void { - $fences = (new MarkdownFences())->of($this->files->withContents("intro\n\n```php\nof($this->files->withContents("intro\n\n```php\nline); } public function test_it_captures_the_body_without_the_fence_lines(): void { - $fences = (new MarkdownFences())->of($this->files->withContents("```php\nof($this->files->withContents("```php\ncode); } public function test_php_fences_are_selected_by_the_first_word_of_the_info_string(): void { - $php = (new MarkdownFences())->phpOf($this->files->withContents( + $php = new MarkdownFences()->phpOf($this->files->withContents( "```php \nphpOf($this->files->withContents("```php ignore\nphpOf($this->files->withContents("```php ignore\ninfo->isIgnored()); } @@ -57,6 +57,6 @@ public function test_location_names_the_file_and_line(): void { $file = $this->files->withContents("```php\nof($file)[0]->location()); + static::assertSame($file . ':1', new MarkdownFences()->of($file)[0]->location()); } } diff --git a/tools/blackfire/composer.json b/tools/blackfire/composer.json index 3e2806b77b..ef963458a5 100644 --- a/tools/blackfire/composer.json +++ b/tools/blackfire/composer.json @@ -2,13 +2,13 @@ "name": "flow-php/flow-tools", "description": "Flow PHP ETL - Tools", "require-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "blackfire/php-sdk": "^3.0" }, "config": { "allow-plugins": false, "platform": { - "php": "8.3.0" + "php": "8.5.0" } } } diff --git a/tools/blackfire/composer.lock b/tools/blackfire/composer.lock index 69848c9112..419926464b 100644 --- a/tools/blackfire/composer.lock +++ b/tools/blackfire/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "67ecf8c8ed5e456c0fa1a91f6036bad6", + "content-hash": "ea77f7fa9766b51c39a7807984f9609f", "packages": [], "packages-dev": [ { @@ -165,10 +165,10 @@ "prefer-lowest": false, "platform": {}, "platform-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "platform-overrides": { - "php": "8.3.0" + "php": "8.5.0" }, "plugin-api-version": "2.11.0" } diff --git a/tools/box/composer.json b/tools/box/composer.json index f53b96451b..1c0ac1cd9b 100644 --- a/tools/box/composer.json +++ b/tools/box/composer.json @@ -2,13 +2,13 @@ "name": "flow-php/flow-tools", "description": "Flow PHP ETL - Tools", "require-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "humbug/box": "^4.4" }, "config": { "allow-plugins": false, "platform": { - "php": "8.3.0" + "php": "8.5.0" } } } diff --git a/tools/box/composer.lock b/tools/box/composer.lock index f757f61799..46e0d03ba5 100644 --- a/tools/box/composer.lock +++ b/tools/box/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "29159be91d47eb638f59ac769b8a0fac", + "content-hash": "fbc54c80e803231d1a34bbf7043ea0f7", "packages": [], "packages-dev": [ { @@ -4262,10 +4262,10 @@ "prefer-lowest": false, "platform": {}, "platform-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "platform-overrides": { - "php": "8.3.0" + "php": "8.5.0" }, "plugin-api-version": "2.11.0" } diff --git a/tools/infection/composer.json b/tools/infection/composer.json index 4bd815e3ee..5ac29dedcf 100644 --- a/tools/infection/composer.json +++ b/tools/infection/composer.json @@ -2,13 +2,13 @@ "name": "flow-php/flow-tools", "description": "Flow PHP ETL - Tools", "require-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "infection/infection": "^0.35" }, "config": { "allow-plugins": false, "platform": { - "php": "8.3.0" + "php": "8.5.0" } } } diff --git a/tools/infection/composer.lock b/tools/infection/composer.lock index 15dc273890..d481cfe5b9 100644 --- a/tools/infection/composer.lock +++ b/tools/infection/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e49ff788dd2079c30719eea1c5d480ba", + "content-hash": "d3427c00fc851e642b6acff2989feb8f", "packages": [], "packages-dev": [ { @@ -2741,10 +2741,10 @@ "prefer-lowest": false, "platform": {}, "platform-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "platform-overrides": { - "php": "8.3.0" + "php": "8.5.0" }, "plugin-api-version": "2.11.0" } diff --git a/tools/mago/composer.json b/tools/mago/composer.json index 0bc9061d89..7d13e81ddf 100644 --- a/tools/mago/composer.json +++ b/tools/mago/composer.json @@ -2,13 +2,13 @@ "name": "flow-php/flow-tools", "description": "Flow PHP ETL - Tools", "require-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "carthage-software/mago": "^1.29" }, "config": { "allow-plugins": false, "platform": { - "php": "8.3.0" + "php": "8.5.0" } } } diff --git a/tools/mago/composer.lock b/tools/mago/composer.lock index f155b31531..3c2c58b1f0 100644 --- a/tools/mago/composer.lock +++ b/tools/mago/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3f1a8c5ac2fe905a1aede99d5d84e3e1", + "content-hash": "ad2e23773d459210ada2c106d77ed445", "packages": [], "packages-dev": [ { @@ -153,10 +153,10 @@ "prefer-lowest": false, "platform": {}, "platform-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "platform-overrides": { - "php": "8.3.0" + "php": "8.5.0" }, "plugin-api-version": "2.11.0" } diff --git a/tools/monorepo/composer.json b/tools/monorepo/composer.json index 2cf3efdcab..714a01ffb6 100644 --- a/tools/monorepo/composer.json +++ b/tools/monorepo/composer.json @@ -4,13 +4,13 @@ "minimum-stability": "dev", "prefer-stable": true, "require-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "symplify/monorepo-builder": "12.7.2" }, "config": { "allow-plugins": false, "platform": { - "php": "8.3.0" + "php": "8.5.0" } } } diff --git a/tools/monorepo/composer.lock b/tools/monorepo/composer.lock index d76bb14d8c..c1f01ae414 100644 --- a/tools/monorepo/composer.lock +++ b/tools/monorepo/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7f0e3274ce5a0653e7d08f394398d4a8", + "content-hash": "cb8ab04a5d3043b1f9a731bd23e1c69d", "packages": [], "packages-dev": [ { @@ -2309,10 +2309,10 @@ "prefer-lowest": false, "platform": {}, "platform-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "platform-overrides": { - "php": "8.3.0" + "php": "8.5.0" }, "plugin-api-version": "2.11.0" } diff --git a/tools/phpbench/composer.json b/tools/phpbench/composer.json index 38fadd6a25..3182ae4d2b 100644 --- a/tools/phpbench/composer.json +++ b/tools/phpbench/composer.json @@ -2,13 +2,13 @@ "name": "flow-php/flow-tools", "description": "Flow PHP ETL - Tools", "require-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "phpbench/phpbench": "^1.7" }, "config": { "allow-plugins": false, "platform": { - "php": "8.3.0" + "php": "8.5.0" } } } diff --git a/tools/phpbench/composer.lock b/tools/phpbench/composer.lock index fe239d0121..c11c2bd3b1 100644 --- a/tools/phpbench/composer.lock +++ b/tools/phpbench/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "69215bb0f4165bb855ea660cddf9efa6", + "content-hash": "e5dd455e55ceac73b2ea00eef5c90f43", "packages": [], "packages-dev": [ { @@ -1559,10 +1559,10 @@ "prefer-lowest": false, "platform": {}, "platform-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "platform-overrides": { - "php": "8.3.0" + "php": "8.5.0" }, "plugin-api-version": "2.11.0" } diff --git a/tools/phpdocumentor/composer.json b/tools/phpdocumentor/composer.json index d64f2230f4..3db31bd937 100644 --- a/tools/phpdocumentor/composer.json +++ b/tools/phpdocumentor/composer.json @@ -6,11 +6,11 @@ "phpdocumentor/shim": true }, "platform": { - "php": "8.3.0" + "php": "8.5.0" } }, "require-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "phpdocumentor/shim": "^3.6" } } diff --git a/tools/phpdocumentor/composer.lock b/tools/phpdocumentor/composer.lock index ffd6dbd7a5..b3548b50bd 100644 --- a/tools/phpdocumentor/composer.lock +++ b/tools/phpdocumentor/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3140e7a6720f1224cb177a67be04bcf4", + "content-hash": "dd6ab40fa3d7a3cdf4b29d182bd9787e", "packages": [], "packages-dev": [ { @@ -270,10 +270,10 @@ "prefer-lowest": false, "platform": {}, "platform-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "platform-overrides": { - "php": "8.3.0" + "php": "8.5.0" }, "plugin-api-version": "2.11.0" } diff --git a/tools/phpunit/composer.json b/tools/phpunit/composer.json index 942ca8cd33..0224c2c5e0 100644 --- a/tools/phpunit/composer.json +++ b/tools/phpunit/composer.json @@ -2,13 +2,13 @@ "name": "flow-php/flow-tools", "description": "Flow PHP ETL - Tools", "require-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "phpunit/phpunit": "^12.5" }, "config": { "allow-plugins": false, "platform": { - "php": "8.3.0" + "php": "8.5.0" } } } diff --git a/tools/phpunit/composer.lock b/tools/phpunit/composer.lock index 69edc2c73b..4ecbedc8b5 100644 --- a/tools/phpunit/composer.lock +++ b/tools/phpunit/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d4d66c2c3909a9a644ba00d2b1e27958", + "content-hash": "391e91fe37d6db2c5c6cc9aca66d788b", "packages": [], "packages-dev": [ { @@ -1757,10 +1757,10 @@ "prefer-lowest": false, "platform": {}, "platform-dev": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "platform-overrides": { - "php": "8.3.0" + "php": "8.5.0" }, "plugin-api-version": "2.11.0" } diff --git a/web/landing/.env b/web/landing/.env index a9cf1afe9a..12e43580aa 100644 --- a/web/landing/.env +++ b/web/landing/.env @@ -2,7 +2,6 @@ APP_ENV=dev APP_SECRET=04f48bdb7d5426b4c5ba6aaf3d00a1fa SCHEME='https' DOMAIN='flow-php.wip' -GITHUB_TOKEN=changeme POSTHOG_KEY=phc_NizmStEm9OhWUs42eHmXaYp6KHW9L3LNwvYiZk5hnbm POSTHOG_API_HOST=https://d.flow-php.com POSTHOG_UI_HOST=https://eu.posthog.com diff --git a/web/landing/.env.test b/web/landing/.env.test index 6e34ff0d7b..5c4852337b 100644 --- a/web/landing/.env.test +++ b/web/landing/.env.test @@ -1,5 +1,4 @@ APP_ENV=test -GITHUB_TOKEN=test_token APP_SECRET=secret SCHEME='https' DOMAIN='flow-php.wip' diff --git a/web/landing/composer.json b/web/landing/composer.json index 19178fb1d0..e4ce21b1ef 100644 --- a/web/landing/composer.json +++ b/web/landing/composer.json @@ -98,7 +98,7 @@ } ], "require": { - "php": "8.3.*", + "php": "8.5.*", "flow-php/etl": "1.x-dev", "flow-php/etl-adapter-http": "1.x-dev", "flow-php/etl-adapter-json": "1.x-dev", @@ -109,37 +109,37 @@ "nyholm/psr7": "^1.8", "php-http/curl-client": "^2.3", "psr/http-client": "^1.0", - "symfony/http-kernel": "^6.4", - "symfony/http-foundation": "^7.2", - "symfony/routing": "^6.4", - "symfony/framework-bundle": "^6.4", - "symfony/config": "^6.4", - "symfony/twig-bundle": "^6.4", - "symfony/asset-mapper": "^6.4", - "symfony/asset": "^6.4", - "symfony/runtime": "^6.4", - "symfony/console": "^6.4", - "symfony/yaml": "^6.4", - "symfony/dotenv": "^6.4", + "symfony/http-kernel": "^8.0", + "symfony/http-foundation": "^8.0", + "symfony/routing": "^8.0", + "symfony/framework-bundle": "^8.0", + "symfony/config": "^8.0", + "symfony/twig-bundle": "^8.0", + "symfony/asset-mapper": "^8.0", + "symfony/asset": "^8.0", + "symfony/runtime": "^8.0", + "symfony/console": "^8.0", + "symfony/yaml": "^8.0", + "symfony/dotenv": "^8.0", "symfony/stimulus-bundle": "^2.14", "monolog/monolog": "^3.5", - "symfony/monolog-bundle": "^3.10", + "symfony/monolog-bundle": "^4.1", "coduo/php-humanizer": "^5.0", "twig/markdown-extra": "^3.11", "twig/extra-bundle": "^3.8", "league/commonmark": "^2.4", "presta/sitemap-bundle": "^4.1", - "symfony/mime": "^7.2", - "symfony/string": "^7.4" + "symfony/mime": "^8.0", + "symfony/string": "^8.0" }, "require-dev": { - "norberttech/static-content-generator-bundle": "1.x-dev", "playwright-php/playwright": "^1.4", "playwright-php/playwright-symfony": "^0.10", - "symfony/css-selector": "^6.4", - "symfony/web-profiler-bundle": "^6.4", - "symfonycasts/tailwind-bundle": "~0.8.0", - "zenstruck/browser": "^1.12" + "symfony/css-selector": "^8.0", + "symfony/web-profiler-bundle": "^8.0", + "symfonycasts/tailwind-bundle": "^1.0", + "zenstruck/browser": "^1.12", + "norberttech/static-content-generator-bundle": "^0.7" }, "autoload": { "psr-4": { @@ -179,6 +179,7 @@ "bin/console tailwind:build" ], "build": [ + "Composer\\Config::disableProcessTimeout", "rm -rf public/assets", "rm -rf build", "APP_ENV=prod bin/console cache:clear", diff --git a/web/landing/composer.lock b/web/landing/composer.lock index a1e17500a1..400aaeaace 100644 --- a/web/landing/composer.lock +++ b/web/landing/composer.lock @@ -4,27 +4,28 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f11495056bd1a0023e38ae1fe14b5007", + "content-hash": "94b6600fb4d07ba251dbed9683d65116", "packages": [ { "name": "brick/math", - "version": "0.17.2", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "8189e751995f9e15729c1aa2f89fa8f166ffe818" + "reference": "2effe05d2177c451b86c6a073196a4034c02f211" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/8189e751995f9e15729c1aa2f89fa8f166ffe818", - "reference": "8189e751995f9e15729c1aa2f89fa8f166ffe818", + "url": "https://api.github.com/repos/brick/math/zipball/2effe05d2177c451b86c6a073196a4034c02f211", + "reference": "2effe05d2177c451b86c6a073196a4034c02f211", "shasum": "" }, "require": { "php": "^8.2" }, "require-dev": { - "phpstan/phpstan": "2.1.22", + "phpstan/phpstan": "2.2.13", + "phpstan/phpstan-phpunit": "2.0.18", "phpunit/phpunit": "^11.5" }, "type": "library", @@ -55,7 +56,7 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.17.2" + "source": "https://github.com/brick/math/tree/1.0.0" }, "funding": [ { @@ -63,7 +64,8 @@ "type": "github" } ], - "time": "2026-05-25T20:34:43+00:00" + "time": "2026-09-12T10:28:18+00:00", + "published-time": "2026-09-12T12:23:30+00:00" }, { "name": "clue/stream-filter", @@ -129,7 +131,8 @@ "type": "github" } ], - "time": "2023-12-20T15:40:13+00:00" + "time": "2023-12-20T15:40:13+00:00", + "published-time": "2023-12-20T15:43:41+00:00" }, { "name": "coduo/php-humanizer", @@ -196,20 +199,21 @@ "type": "github" } ], - "time": "2025-12-11T20:13:52+00:00" + "time": "2025-12-11T20:13:52+00:00", + "published-time": "2025-12-11T21:35:07+00:00" }, { "name": "composer/semver", - "version": "3.4.4", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95" + "reference": "d92543b7ede9c4ec6b59853cefb061e39866d2cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/198166618906cb2de69b95d7d47e5fa8aa1b2b95", - "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95", + "url": "https://api.github.com/repos/composer/semver/zipball/d92543b7ede9c4ec6b59853cefb061e39866d2cf", + "reference": "d92543b7ede9c4ec6b59853cefb061e39866d2cf", "shasum": "" }, "require": { @@ -251,7 +255,7 @@ "homepage": "http://robbast.nl" } ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", + "description": "Version comparison library that offers utilities, version constraint parsing and validation.", "keywords": [ "semantic", "semver", @@ -261,7 +265,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.4.4" + "source": "https://github.com/composer/semver/tree/3.6.0" }, "funding": [ { @@ -273,7 +277,8 @@ "type": "github" } ], - "time": "2025-08-20T19:15:30+00:00" + "time": "2026-10-29T09:13:34+00:00", + "published-time": "2026-10-29T09:14:11+00:00" }, { "name": "dflydev/dot-access-data", @@ -348,7 +353,8 @@ "issues": "https://github.com/dflydev/dflydev-dot-access-data/issues", "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.3" }, - "time": "2024-07-08T12:26:09+00:00" + "time": "2024-07-08T12:26:09+00:00", + "published-time": "2024-07-08T12:27:13+00:00" }, { "name": "flow-php/array-dot", @@ -356,11 +362,11 @@ "dist": { "type": "path", "url": "../../src/lib/array-dot", - "reference": "568809a92e20635bb00d927bbecb3fe30dffe874" + "reference": "c9cb478916a6a84fe01f92f0e6d0c5da33a4b5b6" }, "require": { "flow-php/types": "self.version", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "type": "library", "autoload": { @@ -402,7 +408,7 @@ "dist": { "type": "path", "url": "../../src/core/etl", - "reference": "f00ecf3cbc3aa98a67b9907fde05281b3e7df069" + "reference": "6c24ed7981bf39b1051fc590a8f3602ee26b5b86" }, "require": { "brick/math": "^0.12 || ^0.13 || ^0.14 || ^0.15 || ^0.16 || ^0.17 || ^0.18 || ^1.0", @@ -412,10 +418,10 @@ "flow-php/filesystem": "self.version", "flow-php/telemetry": "self.version", "flow-php/types": "self.version", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "psr/clock": "^1.0", "psr/simple-cache": "^1.0 || ^2.0 || ^3.0", - "symfony/string": "^6.4 || ^7.4 || ^8.0" + "symfony/string": "^7.4 || ^8.0" }, "conflict": { "ext-flow_php": "<0.45" @@ -423,7 +429,7 @@ "require-dev": { "ramsey/uuid": "^4.5", "symfony/polyfill-mbstring": "^1.33", - "symfony/uid": "^6.4 || ^7.4 || ^8.0" + "symfony/uid": "^7.4 || ^8.0" }, "suggest": { "ext-apcu": "Allows using ApcuCache as a pipeline cache implementation", @@ -468,14 +474,14 @@ "dist": { "type": "path", "url": "../../src/adapter/etl-adapter-http", - "reference": "b449a287859e547fdeaadec5ec83ef522e0a304a" + "reference": "44766c2b8f1ccad13c4c02c6f63b00f35fc3cfb0" }, "require": { "ext-dom": "*", "ext-json": "*", "flow-php/array-dot": "self.version", "flow-php/etl": "self.version", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0" }, @@ -521,14 +527,14 @@ "dist": { "type": "path", "url": "../../src/adapter/etl-adapter-json", - "reference": "5348d5628b1872da7aa04f3c0f26d722bbe51387" + "reference": "43806494fd869bb921305f91d27716e4e492a93d" }, "require": { "ext-json": "*", "flow-php/etl": "self.version", "flow-php/filesystem": "self.version", "halaxa/json-machine": "^1.2", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0" }, @@ -574,12 +580,12 @@ "dist": { "type": "path", "url": "../../src/lib/filesystem", - "reference": "20660679991f51082baa48e1c8f7b0f9ec792e2b" + "reference": "03d215746dcb0dd72eac7d47fa8ef99d33e88ff3" }, "require": { "flow-php/telemetry": "self.version", "flow-php/types": "self.version", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "symfony/polyfill-mbstring": "^1.33" }, "type": "library", @@ -623,13 +629,13 @@ "dist": { "type": "path", "url": "../../src/bridge/monolog/telemetry", - "reference": "97d6f564172a4aed850c7aef7be3325516477ab3" + "reference": "cf1038c28ad85a1b9c8691f211f97b4256d2074b" }, "require": { "flow-php/etl": "self.version", "flow-php/telemetry": "self.version", "monolog/monolog": "^3.0", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "type": "library", "autoload": { @@ -669,11 +675,11 @@ "dist": { "type": "path", "url": "../../src/bridge/psr18/telemetry", - "reference": "92ffed7e3b08089ab4e0f507216304dbd19b6220" + "reference": "1c5114b1e57861ece71d7a5986fde316f3d4df0e" }, "require": { "flow-php/telemetry": "self.version", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "psr/http-client": "^1.0", "psr/http-message": "^1.0 || ^2.0" }, @@ -718,11 +724,11 @@ "dist": { "type": "path", "url": "../../src/bridge/psr3/telemetry", - "reference": "6490daed4be1c55716ae9779997775d86285bd54" + "reference": "d65841f973ff543675ab0003d245500b6b8874bc" }, "require": { "flow-php/telemetry": "self.version", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "psr/log": "^2.0 || ^3.0" }, "type": "library", @@ -763,42 +769,42 @@ "dist": { "type": "path", "url": "../../src/bridge/symfony/telemetry-bundle", - "reference": "3fb1f18a01ce96d8a83e37a70d525ca6bbb4c7c1" + "reference": "1f388e3b083e40395b904192f4776cc0295e387a" }, "require": { "flow-php/psr3-telemetry-bridge": "self.version", "flow-php/telemetry": "self.version", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "psr/clock": "^1.0", - "symfony/config": "^6.4 || ^7.4 || ^8.0", - "symfony/console": "^6.4.34 || ^7.4.6 || ^8.0.6", - "symfony/dependency-injection": "^6.4 || ^7.4 || ^8.0", + "symfony/config": "^7.4 || ^8.0", + "symfony/console": "^7.4.6 || ^8.0.6", + "symfony/dependency-injection": "^7.4 || ^8.0", "symfony/http-client-contracts": "^3.0", - "symfony/http-kernel": "^6.4 || ^7.4 || ^8.0", + "symfony/http-kernel": "^7.4 || ^8.0", "symfony/polyfill-mbstring": "^1.33" }, "require-dev": { "composer-runtime-api": "^2.2", "composer/semver": "^3.4", - "doctrine/dbal": "^4.5", + "doctrine/dbal": "^4.6", "flow-php/psr18-telemetry-bridge": "self.version", "flow-php/symfony-http-foundation-telemetry-bridge": "self.version", "flow-php/telemetry-otlp-bridge": "self.version", "nyholm/psr7": "^1.8", - "symfony/framework-bundle": "^6.4 || ^7.4 || ^8.0", - "symfony/http-client": "^6.4 || ^7.4 || ^8.0", - "symfony/messenger": "^6.4 || ^7.4 || ^8.0", - "symfony/routing": "^6.4 || ^7.4 || ^8.0", - "symfony/security-bundle": "^6.4 || ^7.4 || ^8.0", - "symfony/security-core": "^6.4 || ^7.4 || ^8.0", - "symfony/security-http": "^6.4 || ^7.4 || ^8.0", - "symfony/serializer": "^6.4 || ^7.4 || ^8.0", - "symfony/var-dumper": "^6.4 || ^7.4 || ^8.0", - "symfony/web-profiler-bundle": "^6.4 || ^7.4 || ^8.0", + "symfony/framework-bundle": "^7.4 || ^8.0", + "symfony/http-client": "^7.4 || ^8.0", + "symfony/messenger": "^7.4 || ^8.0", + "symfony/routing": "^7.4 || ^8.0", + "symfony/security-bundle": "^7.4 || ^8.0", + "symfony/security-core": "^7.4 || ^8.0", + "symfony/security-http": "^7.4 || ^8.0", + "symfony/serializer": "^7.4 || ^8.0", + "symfony/var-dumper": "^7.4 || ^8.0", + "symfony/web-profiler-bundle": "^7.4 || ^8.0", "twig/twig": "^3.0" }, "suggest": { - "doctrine/dbal": "Required for Doctrine DBAL tracing (^4.5)", + "doctrine/dbal": "Required for Doctrine DBAL tracing (^4.6)", "flow-php/psr18-telemetry-bridge": "Required for PSR-18 HTTP client tracing", "flow-php/symfony-http-foundation-telemetry-bridge": "Required for HTTP trace context propagation (extract incoming / inject outgoing W3C trace headers)", "flow-php/telemetry-otlp-bridge": "Required for OTLP exporter support", @@ -850,11 +856,11 @@ "dist": { "type": "path", "url": "../../src/lib/telemetry", - "reference": "41b75e6c20bca4d5798202ba6d869951c5d04f1f" + "reference": "9e04a534c1c6ed55448171d477bdfa51058506cd" }, "require": { "composer-runtime-api": "^2.2", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "psr/clock": "^1.0", "symfony/polyfill-mbstring": "^1.33" }, @@ -895,11 +901,11 @@ "dist": { "type": "path", "url": "../../src/bridge/telemetry/otlp", - "reference": "d4792497c90e311980bc71044f5ee9a830fd0b3d" + "reference": "49937367a577ec241c58d4e14cc7f8a1581e8d69" }, "require": { "flow-php/telemetry": "self.version", - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" + "php": "~8.5.0 || ~8.6.0" }, "require-dev": { "ext-curl": "*", @@ -908,7 +914,7 @@ "nyholm/psr7": "^1.8", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", - "symfony/http-client": "^6.4 || ^7.4 || ^8.0" + "symfony/http-client": "^7.4 || ^8.0" }, "suggest": { "ext-grpc": "Required for gRPC transport", @@ -958,10 +964,10 @@ "dist": { "type": "path", "url": "../../src/lib/types", - "reference": "56c867a2c33b2e54e07257935d4866755c79a1e3" + "reference": "b049341c1c4f704cff3274cb8f58b358dc5684ea" }, "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0", + "php": "~8.5.0 || ~8.6.0", "symfony/polyfill-mbstring": "^1.33" }, "type": "library", @@ -995,20 +1001,20 @@ }, { "name": "halaxa/json-machine", - "version": "1.2.6", + "version": "1.2.7", "source": { "type": "git", "url": "https://github.com/halaxa/json-machine.git", - "reference": "8bf0b0ff6ff60ab480778eaa5ad7d505b442c2d4" + "reference": "2c53c1f1a028989afb43c5f413c9fedfe564eae4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/halaxa/json-machine/zipball/8bf0b0ff6ff60ab480778eaa5ad7d505b442c2d4", - "reference": "8bf0b0ff6ff60ab480778eaa5ad7d505b442c2d4", + "url": "https://api.github.com/repos/halaxa/json-machine/zipball/2c53c1f1a028989afb43c5f413c9fedfe564eae4", + "reference": "2c53c1f1a028989afb43c5f413c9fedfe564eae4", "shasum": "" }, "require": { - "php": "7.2 - 8.5" + "php": "7.2 - 8.6" }, "require-dev": { "ext-json": "*", @@ -1045,7 +1051,7 @@ "description": "Efficient, easy-to-use and fast JSON pull parser", "support": { "issues": "https://github.com/halaxa/json-machine/issues", - "source": "https://github.com/halaxa/json-machine/tree/1.2.6" + "source": "https://github.com/halaxa/json-machine/tree/1.2.7" }, "funding": [ { @@ -1053,20 +1059,21 @@ "type": "other" } ], - "time": "2025-12-05T14:53:09+00:00" + "time": "2026-11-21T15:26:54+00:00", + "published-time": "2026-11-21T15:27:01+00:00" }, { "name": "league/commonmark", - "version": "2.10.3", + "version": "2.10.11", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "6efbd9c472b91db0a3350fcd601c8332c2382e1f" + "reference": "6b3e51fc89ef73ae5f0178ebe4e426492c230c07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/6efbd9c472b91db0a3350fcd601c8332c2382e1f", - "reference": "6efbd9c472b91db0a3350fcd601c8332c2382e1f", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/6b3e51fc89ef73ae5f0178ebe4e426492c230c07", + "reference": "6b3e51fc89ef73ae5f0178ebe4e426492c230c07", "shasum": "" }, "require": { @@ -1160,7 +1167,8 @@ "type": "tidelift" } ], - "time": "2026-09-21T13:07:34+00:00" + "time": "2026-12-01T12:13:14+00:00", + "published-time": "2026-12-01T12:13:25+00:00" }, { "name": "league/config", @@ -1242,20 +1250,21 @@ "type": "github" } ], - "time": "2022-12-11T20:36:23+00:00" + "time": "2022-12-11T20:36:23+00:00", + "published-time": "2022-12-11T20:36:45+00:00" }, { "name": "monolog/monolog", - "version": "3.10.0", + "version": "3.13.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0" + "reference": "1f5f55bb4a9a230ff6d8a4ceccea31d10b0142ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/b321dd6749f0bf7189444158a3ce785cc16d69b0", - "reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1f5f55bb4a9a230ff6d8a4ceccea31d10b0142ac", + "reference": "1f5f55bb4a9a230ff6d8a4ceccea31d10b0142ac", "shasum": "" }, "require": { @@ -1281,6 +1290,7 @@ "phpstan/phpstan-strict-rules": "^2", "phpunit/phpunit": "^10.5.17 || ^11.0.7", "predis/predis": "^1.1 || ^2", + "psr/clock": "^1.0", "rollbar/rollbar": "^4.0", "ruflin/elastica": "^7 || ^8", "symfony/mailer": "^5.4 || ^6", @@ -1299,6 +1309,7 @@ "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "psr/clock": "Required to pass a clock to the Logger and control the timestamp of log records", "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server" }, @@ -1333,7 +1344,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.10.0" + "source": "https://github.com/Seldaek/monolog/tree/3.13.0" }, "funding": [ { @@ -1345,37 +1356,38 @@ "type": "tidelift" } ], - "time": "2026-01-02T08:56:05+00:00" + "time": "2026-11-16T10:43:05+00:00", + "published-time": "2026-11-16T10:45:37+00:00" }, { "name": "nette/schema", - "version": "v1.3.6", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/nette/schema.git", - "reference": "c54350438cd6914616f790a49cb424605f421562" + "reference": "af9fa8a86bfca9b02b10346220db26e62ef942ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/c54350438cd6914616f790a49cb424605f421562", - "reference": "c54350438cd6914616f790a49cb424605f421562", + "url": "https://api.github.com/repos/nette/schema/zipball/af9fa8a86bfca9b02b10346220db26e62ef942ec", + "reference": "af9fa8a86bfca9b02b10346220db26e62ef942ec", "shasum": "" }, "require": { "nette/utils": "^4.0", - "php": "8.1 - 8.5" + "php": "8.1 - 8.6" }, "require-dev": { - "nette/phpstan-rules": "^1.0", + "nette/phpstan-rules": "^1.0.7", "nette/tester": "^2.6", "phpstan/extension-installer": "^1.4@stable", - "phpstan/phpstan": "^2.1.39@stable", + "phpstan/phpstan": "^2.3@stable", "tracy/tracy": "^2.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -1396,40 +1408,41 @@ { "name": "David Grudl", "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" } ], - "description": "📐 Nette Schema: validating data structures against a given Schema.", - "homepage": "https://nette.org", + "description": "📐 Nette Schema: validates and normalizes data such as configuration or API input against a schema described in a few readable lines of PHP, with precise error messages.", + "homepage": "https://doc.nette.org/schema", "keywords": [ - "config", - "nette" + "configuration", + "data validation", + "nette", + "normalization", + "schema", + "validation" ], "support": { "issues": "https://github.com/nette/schema/issues", - "source": "https://github.com/nette/schema/tree/v1.3.6" + "source": "https://github.com/nette/schema/tree/v1.4.0" }, - "time": "2026-08-16T21:58:41+00:00" + "time": "2026-10-22T02:12:50+00:00", + "published-time": "2026-10-22T02:14:45+00:00" }, { "name": "nette/utils", - "version": "v4.1.5", + "version": "v4.1.6", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "b043439dbdf954e6c28b5ea7e34b0100f83165e0" + "reference": "6bf24518accf32cf845bca305e0b92078700fd01" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/b043439dbdf954e6c28b5ea7e34b0100f83165e0", - "reference": "b043439dbdf954e6c28b5ea7e34b0100f83165e0", + "url": "https://api.github.com/repos/nette/utils/zipball/6bf24518accf32cf845bca305e0b92078700fd01", + "reference": "6bf24518accf32cf845bca305e0b92078700fd01", "shasum": "" }, "require": { - "php": "8.2 - 8.5" + "php": "8.2 - 8.6" }, "conflict": { "nette/finder": "<3", @@ -1501,22 +1514,23 @@ ], "support": { "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v4.1.5" + "source": "https://github.com/nette/utils/tree/v4.1.6" }, - "time": "2026-07-17T23:02:45+00:00" + "time": "2026-10-20T17:07:56+00:00", + "published-time": "2026-10-20T17:48:30+00:00" }, { "name": "nyholm/psr7", - "version": "1.8.2", + "version": "1.8.3", "source": { "type": "git", "url": "https://github.com/Nyholm/psr7.git", - "reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3" + "reference": "26c1581611614447a5ff753a450390a23f3e323e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Nyholm/psr7/zipball/a71f2b11690f4b24d099d6b16690a90ae14fc6f3", - "reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3", + "url": "https://api.github.com/repos/Nyholm/psr7/zipball/26c1581611614447a5ff753a450390a23f3e323e", + "reference": "26c1581611614447a5ff753a450390a23f3e323e", "shasum": "" }, "require": { @@ -1569,7 +1583,7 @@ ], "support": { "issues": "https://github.com/Nyholm/psr7/issues", - "source": "https://github.com/Nyholm/psr7/tree/1.8.2" + "source": "https://github.com/Nyholm/psr7/tree/1.8.3" }, "funding": [ { @@ -1581,7 +1595,8 @@ "type": "github" } ], - "time": "2024-09-09T07:06:30+00:00" + "time": "2026-11-26T08:19:16+00:00", + "published-time": "2026-11-26T08:20:50+00:00" }, { "name": "php-http/curl-client", @@ -1646,20 +1661,21 @@ "issues": "https://github.com/php-http/curl-client/issues", "source": "https://github.com/php-http/curl-client/tree/2.4.0" }, - "time": "2025-12-09T12:02:56+00:00" + "time": "2025-12-09T12:02:56+00:00", + "published-time": "2025-12-09T12:03:28+00:00" }, { "name": "php-http/discovery", - "version": "1.20.0", + "version": "1.21.0", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d" + "reference": "ada129ac8a187eadcd9ebaaa48ff6f989bd179f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d", - "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d", + "url": "https://api.github.com/repos/php-http/discovery/zipball/ada129ac8a187eadcd9ebaaa48ff6f989bd179f6", + "reference": "ada129ac8a187eadcd9ebaaa48ff6f989bd179f6", "shasum": "" }, "require": { @@ -1679,12 +1695,11 @@ }, "require-dev": { "composer/composer": "^1.0.2|^2.0", - "graham-campbell/phpspec-skip-example-extension": "^5.0", "php-http/httplug": "^1.0 || ^2.0", "php-http/message-factory": "^1.0", - "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3 || ^8.0", "sebastian/comparator": "^3.0.5 || ^4.0.8", - "symfony/phpunit-bridge": "^6.4.4 || ^7.0.1" + "symfony/phpunit-bridge": "^6.4.4 || ^7.0.1 || ^8.0" }, "type": "composer-plugin", "extra": { @@ -1723,9 +1738,10 @@ ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.20.0" + "source": "https://github.com/php-http/discovery/tree/1.21.0" }, - "time": "2024-10-02T11:20:13+00:00" + "time": "2026-11-29T13:21:59+00:00", + "published-time": "2026-11-29T13:22:22+00:00" }, { "name": "php-http/httplug", @@ -1782,7 +1798,8 @@ "issues": "https://github.com/php-http/httplug/issues", "source": "https://github.com/php-http/httplug/tree/2.4.1" }, - "time": "2024-09-23T11:39:58+00:00" + "time": "2024-09-23T11:39:58+00:00", + "published-time": "2024-09-23T11:40:47+00:00" }, { "name": "php-http/message", @@ -1851,7 +1868,8 @@ "issues": "https://github.com/php-http/message/issues", "source": "https://github.com/php-http/message/tree/1.16.2" }, - "time": "2024-10-02T11:34:13+00:00" + "time": "2024-10-02T11:34:13+00:00", + "published-time": "2024-10-02T11:35:49+00:00" }, { "name": "php-http/promise", @@ -1903,20 +1921,21 @@ "issues": "https://github.com/php-http/promise/issues", "source": "https://github.com/php-http/promise/tree/1.3.1" }, - "time": "2024-03-15T13:55:21+00:00" + "time": "2024-03-15T13:55:21+00:00", + "published-time": "2024-03-15T13:55:45+00:00" }, { "name": "presta/sitemap-bundle", - "version": "v4.3.0", + "version": "v4.3.1", "source": { "type": "git", "url": "https://github.com/prestaconcept/PrestaSitemapBundle.git", - "reference": "2fc8845e5cc0dfa2911615eb3aec1d4a1bd95eff" + "reference": "d59e8716a5d26098022cb2ccb8ad6892885d7134" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/prestaconcept/PrestaSitemapBundle/zipball/2fc8845e5cc0dfa2911615eb3aec1d4a1bd95eff", - "reference": "2fc8845e5cc0dfa2911615eb3aec1d4a1bd95eff", + "url": "https://api.github.com/repos/prestaconcept/PrestaSitemapBundle/zipball/d59e8716a5d26098022cb2ccb8ad6892885d7134", + "reference": "d59e8716a5d26098022cb2ccb8ad6892885d7134", "shasum": "" }, "require": { @@ -1927,7 +1946,7 @@ }, "require-dev": { "doctrine/annotations": "^1.0", - "phpstan/phpstan": "^1.12", + "phpstan/phpstan": "^2.2", "phpunit/phpunit": "^10.0", "squizlabs/php_codesniffer": "^3.5", "symfony/browser-kit": "^6.4|^7.0|^8.0", @@ -1969,9 +1988,10 @@ ], "support": { "issues": "https://github.com/prestaconcept/PrestaSitemapBundle/issues", - "source": "https://github.com/prestaconcept/PrestaSitemapBundle/tree/v4.3.0" + "source": "https://github.com/prestaconcept/PrestaSitemapBundle/tree/v4.3.1" }, - "time": "2025-12-16T16:40:00+00:00" + "time": "2026-07-15T12:26:35+00:00", + "published-time": "2026-07-15T12:27:59+00:00" }, { "name": "psr/cache", @@ -2069,7 +2089,8 @@ "issues": "https://github.com/php-fig/clock/issues", "source": "https://github.com/php-fig/clock/tree/1.0.0" }, - "time": "2022-11-25T14:36:26+00:00" + "time": "2022-11-25T14:36:26+00:00", + "published-time": "2022-11-25T14:59:22+00:00" }, { "name": "psr/container", @@ -2226,7 +2247,8 @@ "support": { "source": "https://github.com/php-fig/http-client" }, - "time": "2023-09-23T14:17:50+00:00" + "time": "2023-09-23T14:17:50+00:00", + "published-time": "2023-09-23T14:18:12+00:00" }, { "name": "psr/http-factory", @@ -2281,7 +2303,8 @@ "support": { "source": "https://github.com/php-fig/http-factory" }, - "time": "2024-04-15T12:06:14+00:00" + "time": "2024-04-15T12:06:14+00:00", + "published-time": "2024-05-10T07:32:19+00:00" }, { "name": "psr/http-message", @@ -2334,7 +2357,8 @@ "support": { "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2023-04-04T09:54:51+00:00" + "time": "2023-04-04T09:54:51+00:00", + "published-time": "2023-04-04T09:55:35+00:00" }, { "name": "psr/log", @@ -2436,32 +2460,36 @@ "support": { "source": "https://github.com/php-fig/simple-cache/tree/3.0.0" }, - "time": "2021-10-29T13:26:27+00:00" + "time": "2021-10-29T13:26:27+00:00", + "published-time": "2021-10-29T13:27:19+00:00" }, { "name": "symfony/asset", - "version": "v6.4.34", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/asset.git", - "reference": "1bd59aa278691b6310ca56b996cf6e2619a6a347" + "reference": "e0d70806c99139c9931b2c2741cf13d494c81e0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/asset/zipball/1bd59aa278691b6310ca56b996cf6e2619a6a347", - "reference": "1bd59aa278691b6310ca56b996cf6e2619a6a347", + "url": "https://api.github.com/repos/symfony/asset/zipball/e0d70806c99139c9931b2c2741cf13d494c81e0c", + "reference": "e0d70806c99139c9931b2c2741cf13d494c81e0c", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.4.1" }, "conflict": { - "symfony/http-foundation": "<5.4" + "symfony/config": "<8.2", + "symfony/dependency-injection": "<8.2" }, "require-dev": { - "symfony/http-client": "^5.4|^6.0|^7.0", - "symfony/http-foundation": "^5.4|^6.0|^7.0", - "symfony/http-kernel": "^5.4|^6.0|^7.0" + "symfony/config": "^8.2", + "symfony/dependency-injection": "^8.2", + "symfony/http-client": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2489,7 +2517,7 @@ "description": "Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/asset/tree/v6.4.34" + "source": "https://github.com/symfony/asset/tree/v8.2.0" }, "funding": [ { @@ -2509,42 +2537,41 @@ "type": "tidelift" } ], - "time": "2026-02-07T09:15:39+00:00" + "time": "2026-11-24T16:45:40+00:00", + "published-time": "2026-11-28T12:13:04+00:00" }, { "name": "symfony/asset-mapper", - "version": "v6.4.41", + "version": "v8.1.12", "source": { "type": "git", "url": "https://github.com/symfony/asset-mapper.git", - "reference": "e519e2ee3625bcc4706d9e3d571c71714d0270e5" + "reference": "16ee05a5a19196c0fb9df391690086ba55dfa9c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/asset-mapper/zipball/e519e2ee3625bcc4706d9e3d571c71714d0270e5", - "reference": "e519e2ee3625bcc4706d9e3d571c71714d0270e5", + "url": "https://api.github.com/repos/symfony/asset-mapper/zipball/16ee05a5a19196c0fb9df391690086ba55dfa9c6", + "reference": "16ee05a5a19196c0fb9df391690086ba55dfa9c6", "shasum": "" }, "require": { "composer/semver": "^3.0", - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/filesystem": "^5.4|^6.0|^7.0", - "symfony/http-client": "^6.3|^7.0" - }, - "conflict": { - "symfony/framework-bundle": "<6.4" + "php": ">=8.4.1", + "symfony/filesystem": "^7.4|^8.0", + "symfony/http-client": "^7.4|^8.0" }, "require-dev": { - "symfony/asset": "^5.4|^6.0|^7.0", - "symfony/browser-kit": "^5.4|^6.0|^7.0", - "symfony/console": "^5.4|^6.0|^7.0", + "symfony/asset": "^7.4|^8.0", + "symfony/browser-kit": "^7.4|^8.0", + "symfony/console": "^7.4|^8.0", "symfony/event-dispatcher-contracts": "^3.0", - "symfony/finder": "^5.4|^6.0|^7.0", - "symfony/framework-bundle": "^6.4|^7.0", - "symfony/http-foundation": "^5.4|^6.0|^7.0", - "symfony/http-kernel": "^5.4|^6.0|^7.0", - "symfony/web-link": "^5.4|^6.0|^7.0" + "symfony/finder": "^7.4|^8.0", + "symfony/framework-bundle": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/runtime": "^7.4|^8.0", + "symfony/web-link": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2572,7 +2599,7 @@ "description": "Maps directories of assets & makes them available in a public directory with versioned filenames.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/asset-mapper/tree/v6.4.41" + "source": "https://github.com/symfony/asset-mapper/tree/v8.1.12" }, "funding": [ { @@ -2592,37 +2619,34 @@ "type": "tidelift" } ], - "time": "2026-05-20T17:21:07+00:00" + "time": "2026-11-23T09:20:57+00:00", + "published-time": "2026-11-25T09:30:44+00:00" }, { "name": "symfony/cache", - "version": "v7.4.25", + "version": "v8.1.13", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "c0e98fd4826f7edbcca311a28ccefa1fc833e6f2" + "reference": "2e75efef2d6219f77fb3424e566cb36c40eec83c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/c0e98fd4826f7edbcca311a28ccefa1fc833e6f2", - "reference": "c0e98fd4826f7edbcca311a28ccefa1fc833e6f2", + "url": "https://api.github.com/repos/symfony/cache/zipball/2e75efef2d6219f77fb3424e566cb36c40eec83c", + "reference": "2e75efef2d6219f77fb3424e566cb36c40eec83c", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "psr/cache": "^2.0|^3.0", "psr/log": "^1.1|^2|^3", "symfony/cache-contracts": "^3.6", - "symfony/deprecation-contracts": "^2.5|^3", "symfony/service-contracts": "^2.5|^3", - "symfony/var-exporter": "^6.4|^7.0|^8.0" + "symfony/var-exporter": "^8.1.1" }, "conflict": { - "doctrine/dbal": "<3.6", - "ext-relay": "<0.12.1", - "symfony/dependency-injection": "<6.4", - "symfony/http-kernel": "<6.4", - "symfony/var-dumper": "<6.4" + "ext-redis": "<6.1", + "ext-relay": "<0.12.1" }, "provide": { "psr/cache-implementation": "2.0|3.0", @@ -2631,16 +2655,16 @@ }, "require-dev": { "cache/integration-tests": "^1.0.3", - "doctrine/dbal": "^3.6|^4", + "doctrine/dbal": "^4.3", "predis/predis": "^1.1|^2.0", "psr/simple-cache": "^1.0|^2.0|^3.0", - "symfony/clock": "^6.4|^7.0|^8.0", - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/filesystem": "^6.4|^7.0|^8.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/messenger": "^6.4|^7.0|^8.0", - "symfony/var-dumper": "^6.4|^7.0|^8.0" + "symfony/clock": "^7.4|^8.0", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/filesystem": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2675,7 +2699,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v7.4.25" + "source": "https://github.com/symfony/cache/tree/v8.1.13" }, "funding": [ { @@ -2695,8 +2719,8 @@ "type": "tidelift" } ], - "time": "2026-11-27T14:00:49+00:00", - "published-time": "2026-11-27T14:42:36+00:00" + "time": "2026-11-27T14:07:58+00:00", + "published-time": "2026-11-27T14:50:44+00:00" }, { "name": "symfony/cache-contracts", @@ -2781,34 +2805,33 @@ }, { "name": "symfony/config", - "version": "v6.4.51", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "c52ebade4a9b6f18300ec543310044f966ded7d2" + "reference": "f1a8e636c695d52f5dd39ce989375eca3f9024eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/c52ebade4a9b6f18300ec543310044f966ded7d2", - "reference": "c52ebade4a9b6f18300ec543310044f966ded7d2", + "url": "https://api.github.com/repos/symfony/config/zipball/f1a8e636c695d52f5dd39ce989375eca3f9024eb", + "reference": "f1a8e636c695d52f5dd39ce989375eca3f9024eb", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/filesystem": "^5.4|^6.0|^7.0", - "symfony/polyfill-ctype": "~1.8" + "symfony/filesystem": "^7.4|^8.0", + "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/finder": "<5.4", "symfony/service-contracts": "<2.5" }, "require-dev": { - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", - "symfony/finder": "^5.4|^6.0|^7.0", - "symfony/messenger": "^5.4|^6.0|^7.0", + "symfony/event-dispatcher": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", "symfony/service-contracts": "^2.5|^3", - "symfony/yaml": "^5.4|^6.0|^7.0" + "symfony/yaml": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2836,7 +2859,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v6.4.51" + "source": "https://github.com/symfony/config/tree/v8.2.0" }, "funding": [ { @@ -2856,52 +2879,54 @@ "type": "tidelift" } ], - "time": "2026-11-09T11:41:22+00:00", - "published-time": "2026-11-25T09:21:06+00:00" + "time": "2026-11-23T10:37:23+00:00", + "published-time": "2026-11-28T12:12:57+00:00" }, { "name": "symfony/console", - "version": "v6.4.51", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "3176cb05763b4690fd0b9f4073fa452c4c9163bb" + "reference": "ea1860277087a43c75a02591d71a5a217682f494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/3176cb05763b4690fd0b9f4073fa452c4c9163bb", - "reference": "3176cb05763b4690fd0b9f4073fa452c4c9163bb", + "url": "https://api.github.com/repos/symfony/console/zipball/ea1860277087a43c75a02591d71a5a217682f494", + "reference": "ea1860277087a43c75a02591d71a5a217682f494", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php85": "^1.33", "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^5.4|^6.0|^7.0" + "symfony/string": "^7.4.6|^8.0.6" }, "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/dotenv": "<5.4", - "symfony/event-dispatcher": "<5.4", - "symfony/lock": "<5.4", - "symfony/process": "<5.4" + "symfony/dependency-injection": "<8.2", + "symfony/event-dispatcher": "<8.1" }, "provide": { "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", - "symfony/http-foundation": "^6.4|^7.0", - "symfony/http-kernel": "^6.4|^7.0", - "symfony/lock": "^5.4|^6.0|^7.0", - "symfony/messenger": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/var-dumper": "^5.4|^6.0|^7.0" + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^8.2", + "symfony/event-dispatcher": "^8.1", + "symfony/filesystem": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/lock": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/mime": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/uid": "^7.4|^8.0", + "symfony/validator": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -2935,7 +2960,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.51" + "source": "https://github.com/symfony/console/tree/v8.2.0" }, "funding": [ { @@ -2955,44 +2980,44 @@ "type": "tidelift" } ], - "time": "2026-11-06T16:06:30+00:00", - "published-time": "2026-11-25T09:20:03+00:00" + "time": "2026-11-24T16:01:15+00:00", + "published-time": "2026-11-28T12:13:07+00:00" }, { "name": "symfony/dependency-injection", - "version": "v7.4.25", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "54c179c4f6c6571d5af6dd87b6cdb04a01d851eb" + "reference": "52cd089850293e423f640a79a2dea81405ecc710" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/54c179c4f6c6571d5af6dd87b6cdb04a01d851eb", - "reference": "54c179c4f6c6571d5af6dd87b6cdb04a01d851eb", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/52cd089850293e423f640a79a2dea81405ecc710", + "reference": "52cd089850293e423f640a79a2dea81405ecc710", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "psr/container": "^1.1|^2.0", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/service-contracts": "^3.6", - "symfony/var-exporter": "^6.4.20|^7.2.5|^8.0" + "symfony/service-contracts": "^3.8.1", + "symfony/var-exporter": "^8.1" }, "conflict": { "ext-psr": "<1.1|>=2", - "symfony/config": "<6.4", - "symfony/finder": "<6.4", - "symfony/yaml": "<6.4" + "symfony/config": "<8.2", + "symfony/http-kernel": "<8.2" }, "provide": { "psr/container-implementation": "1.1|2.0", "symfony/service-implementation": "1.1|2.0|3.0" }, "require-dev": { - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/yaml": "^6.4|^7.0|^8.0" + "symfony/config": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/routing": "^8.2", + "symfony/yaml": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -3020,7 +3045,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v7.4.25" + "source": "https://github.com/symfony/dependency-injection/tree/v8.2.0" }, "funding": [ { @@ -3040,8 +3065,8 @@ "type": "tidelift" } ], - "time": "2026-11-25T09:12:27+00:00", - "published-time": "2026-11-27T14:43:03+00:00" + "time": "2026-11-26T07:29:52+00:00", + "published-time": "2026-11-28T12:12:17+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3117,28 +3142,27 @@ }, { "name": "symfony/dotenv", - "version": "v6.4.39", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "e25b00497fe75e318c01a72ea24c0a9c2837cd62" + "reference": "1da3ae3c05f4ea227986ad01dcb8d9190b7bafaa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/e25b00497fe75e318c01a72ea24c0a9c2837cd62", - "reference": "e25b00497fe75e318c01a72ea24c0a9c2837cd62", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/1da3ae3c05f4ea227986ad01dcb8d9190b7bafaa", + "reference": "1da3ae3c05f4ea227986ad01dcb8d9190b7bafaa", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.4.1" }, "conflict": { - "symfony/console": "<5.4", - "symfony/process": "<5.4" + "symfony/console": "<8.2" }, "require-dev": { - "symfony/console": "^5.4|^6.0|^7.0", - "symfony/process": "^5.4|^6.0|^7.0" + "symfony/console": "^8.2", + "symfony/process": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -3171,7 +3195,7 @@ "environment" ], "support": { - "source": "https://github.com/symfony/dotenv/tree/v6.4.39" + "source": "https://github.com/symfony/dotenv/tree/v8.2.0" }, "funding": [ { @@ -3191,37 +3215,37 @@ "type": "tidelift" } ], - "time": "2026-05-06T14:07:03+00:00" + "time": "2026-10-22T16:53:57+00:00", + "published-time": "2026-11-28T12:12:28+00:00" }, { "name": "symfony/error-handler", - "version": "v7.4.22", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "545852cfe9c4979c82389155b4d8d05f8864e4f1" + "reference": "ea571e24449e210a6b1f0d292f8374c95f63731f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/545852cfe9c4979c82389155b4d8d05f8864e4f1", - "reference": "545852cfe9c4979c82389155b4d8d05f8864e4f1", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/ea571e24449e210a6b1f0d292f8374c95f63731f", + "reference": "ea571e24449e210a6b1f0d292f8374c95f63731f", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "psr/log": "^1|^2|^3", "symfony/polyfill-php85": "^1.32", - "symfony/var-dumper": "^6.4|^7.0|^8.0" + "symfony/var-dumper": "^8.1" }, "conflict": { - "symfony/deprecation-contracts": "<2.5", - "symfony/http-kernel": "<6.4" + "symfony/deprecation-contracts": "<2.5" }, "require-dev": { - "symfony/console": "^6.4|^7.0|^8.0", + "symfony/console": "^7.4|^8.0", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/serializer": "^6.4|^7.0|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/serializer": "^7.4|^8.0", "symfony/webpack-encore-bundle": "^1.0|^2.0" }, "bin": [ @@ -3253,7 +3277,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v7.4.22" + "source": "https://github.com/symfony/error-handler/tree/v8.2.0" }, "funding": [ { @@ -3273,29 +3297,31 @@ "type": "tidelift" } ], - "time": "2026-10-25T14:40:16+00:00", - "published-time": "2026-10-28T18:20:15+00:00" + "time": "2026-11-27T14:48:42+00:00", + "published-time": "2026-11-28T12:13:29+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v7.4.17", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "d269974ee93c61d03620ffee358355bfdb471d66" + "reference": "b18c4241475a44e262ceee9066eac8927324a64c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d269974ee93c61d03620ffee358355bfdb471d66", - "reference": "d269974ee93c61d03620ffee358355bfdb471d66", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b18c4241475a44e262ceee9066eac8927324a64c", + "reference": "b18c4241475a44e262ceee9066eac8927324a64c", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/event-dispatcher-contracts": "^2.5|^3" + "php": ">=8.4.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/event-dispatcher-contracts": "^3.8.1" }, "conflict": { - "symfony/dependency-injection": "<6.4", + "symfony/dependency-injection": "<8.2", + "symfony/security-http": "<7.4", "symfony/service-contracts": "<2.5" }, "provide": { @@ -3304,14 +3330,15 @@ }, "require-dev": { "psr/log": "^1|^2|^3", - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/error-handler": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/framework-bundle": "^6.4|^7.0|^8.0", - "symfony/http-foundation": "^6.4|^7.0|^8.0", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^8.2", + "symfony/error-handler": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/framework-bundle": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", "symfony/service-contracts": "^2.5|^3", - "symfony/stopwatch": "^6.4|^7.0|^8.0" + "symfony/stopwatch": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -3339,7 +3366,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v7.4.17" + "source": "https://github.com/symfony/event-dispatcher/tree/v8.2.0" }, "funding": [ { @@ -3359,8 +3386,8 @@ "type": "tidelift" } ], - "time": "2026-08-21T17:40:08+00:00", - "published-time": "2026-08-22T13:44:01+00:00" + "time": "2026-11-04T11:35:44+00:00", + "published-time": "2026-11-28T12:11:10+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -3445,25 +3472,26 @@ }, { "name": "symfony/filesystem", - "version": "v7.4.25", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "c6adf2262feb9e08ba64632d2703987c24555e0d" + "reference": "3225b1890286c7f8f1b48aac013e8762b97679e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/c6adf2262feb9e08ba64632d2703987c24555e0d", - "reference": "c6adf2262feb9e08ba64632d2703987c24555e0d", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/3225b1890286c7f8f1b48aac013e8762b97679e7", + "reference": "3225b1890286c7f8f1b48aac013e8762b97679e7", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-mbstring": "~1.8" }, "require-dev": { - "symfony/process": "^6.4|^7.0|^8.0" + "symfony/process": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -3491,7 +3519,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v7.4.25" + "source": "https://github.com/symfony/filesystem/tree/v8.2.0" }, "funding": [ { @@ -3511,28 +3539,28 @@ "type": "tidelift" } ], - "time": "2026-11-27T10:49:08+00:00", - "published-time": "2026-11-27T14:43:03+00:00" + "time": "2026-11-27T13:28:56+00:00", + "published-time": "2026-11-28T12:12:22+00:00" }, { "name": "symfony/finder", - "version": "v7.4.25", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "9e170627d10f300da6854be9efbfe3040f17716e" + "reference": "79610bbc37de349047f9a85676f6aa5ce4308e51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/9e170627d10f300da6854be9efbfe3040f17716e", - "reference": "9e170627d10f300da6854be9efbfe3040f17716e", + "url": "https://api.github.com/repos/symfony/finder/zipball/79610bbc37de349047f9a85676f6aa5ce4308e51", + "reference": "79610bbc37de349047f9a85676f6aa5ce4308e51", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.4.1" }, "require-dev": { - "symfony/filesystem": "^6.4|^7.0|^8.0" + "symfony/filesystem": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -3560,7 +3588,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.4.25" + "source": "https://github.com/symfony/finder/tree/v8.2.0" }, "funding": [ { @@ -3580,113 +3608,103 @@ "type": "tidelift" } ], - "time": "2026-11-27T13:38:24+00:00", - "published-time": "2026-11-27T14:43:29+00:00" + "time": "2026-11-27T14:09:33+00:00", + "published-time": "2026-11-28T12:12:27+00:00" }, { "name": "symfony/framework-bundle", - "version": "v6.4.51", + "version": "v8.1.12", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "ca26ae8c90f66853cb5e2b138a1216997fc40cb0" + "reference": "463fe04b05841bbd22af636bf968df16fd2835ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/ca26ae8c90f66853cb5e2b138a1216997fc40cb0", - "reference": "ca26ae8c90f66853cb5e2b138a1216997fc40cb0", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/463fe04b05841bbd22af636bf968df16fd2835ec", + "reference": "463fe04b05841bbd22af636bf968df16fd2835ec", "shasum": "" }, "require": { "composer-runtime-api": ">=2.1", "ext-xml": "*", - "php": ">=8.1", - "symfony/cache": "^5.4|^6.0|^7.0", - "symfony/config": "^6.1|^7.0", - "symfony/dependency-injection": "^6.4.12|^7.0", + "php": ">=8.4.1", + "symfony/cache": "^7.4|^8.0", + "symfony/config": "^7.4.4|^8.0.4", + "symfony/dependency-injection": "^8.1.8", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/error-handler": "^6.1|^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/http-foundation": "^6.4|^7.0", - "symfony/http-kernel": "^6.4", - "symfony/polyfill-mbstring": "~1.0", - "symfony/routing": "^6.4|^7.0" + "symfony/error-handler": "^7.4|^8.0", + "symfony/event-dispatcher": "^8.1", + "symfony/filesystem": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", + "symfony/http-foundation": "^7.4.23|^8.1.11", + "symfony/http-kernel": "^8.1", + "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-php85": "^1.33", + "symfony/routing": "^7.4|^8.0", + "symfony/service-contracts": "^3.7.1", + "symfony/var-exporter": "^8.1.1" }, "conflict": { - "doctrine/annotations": "<1.13.1", "doctrine/persistence": "<1.3", - "phpdocumentor/reflection-docblock": "<3.2.2", - "phpdocumentor/type-resolver": "<1.4.0", - "symfony/asset": "<5.4", - "symfony/asset-mapper": "<6.4", - "symfony/clock": "<6.3", - "symfony/console": "<6.4.43|>=7.0", - "symfony/dom-crawler": "<6.4", - "symfony/dotenv": "<5.4", - "symfony/form": "<5.4", - "symfony/http-client": "<6.3", - "symfony/lock": "<5.4", - "symfony/mailer": "<6.4.44|>=7.0,<7.4.17|>=8.0,<8.1.5", - "symfony/messenger": "<6.3", - "symfony/mime": "<6.4.37|>=7.0,<7.4.9", - "symfony/property-access": "<5.4", - "symfony/property-info": "<5.4", - "symfony/runtime": "<5.4.45|>=6.0,<6.4.13|>=7.0,<7.1.6", - "symfony/scheduler": "<6.4.4|>=7.0.0,<7.0.4", - "symfony/security-core": "<5.4", - "symfony/security-csrf": "<5.4", - "symfony/serializer": "<6.4", - "symfony/stopwatch": "<5.4", - "symfony/translation": "<6.4", - "symfony/twig-bridge": "<5.4", - "symfony/twig-bundle": "<5.4", - "symfony/validator": "<6.4", - "symfony/web-profiler-bundle": "<6.4", - "symfony/workflow": "<6.4" + "phpdocumentor/reflection-docblock": "<5.2|>=7", + "phpdocumentor/type-resolver": "<1.5.1", + "symfony/console": "<8.1.2", + "symfony/form": "<7.4", + "symfony/json-streamer": "<7.4", + "symfony/mailer": "<7.4.17|>=8.0,<8.1.5", + "symfony/messenger": "<7.4.10|>=8.0,<8.0.10", + "symfony/mime": "<7.4.9|>=8.0,<8.0.9", + "symfony/security-csrf": "<7.4", + "symfony/serializer": "<7.4", + "symfony/translation": "<7.4", + "symfony/webhook": "<7.4", + "symfony/workflow": "<7.4" }, "require-dev": { - "doctrine/annotations": "^1.13.1|^2", - "doctrine/persistence": "^1.3|^2|^3|^4", "dragonmantank/cron-expression": "^3.1", - "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "phpdocumentor/reflection-docblock": "^5.2|^6.0", + "phpstan/phpdoc-parser": "^1.0|^2.0", "seld/jsonlint": "^1.10", - "symfony/asset": "^5.4|^6.0|^7.0", - "symfony/asset-mapper": "^6.4|^7.0", - "symfony/browser-kit": "^5.4|^6.0|^7.0", - "symfony/clock": "^6.2|^7.0", - "symfony/console": "^6.4.43|^7.0", - "symfony/css-selector": "^5.4|^6.0|^7.0", - "symfony/dom-crawler": "^6.4|^7.0", - "symfony/dotenv": "^5.4|^6.0|^7.0", - "symfony/expression-language": "^5.4|^6.0|^7.0", - "symfony/form": "^5.4|^6.0|^7.0", - "symfony/html-sanitizer": "^6.1|^7.0", - "symfony/http-client": "^6.3|^7.0", - "symfony/lock": "^5.4|^6.0|^7.0", - "symfony/mailer": "^5.4|^6.0|^7.0", - "symfony/messenger": "^6.3|^7.0", - "symfony/mime": "^6.4.37|^7.4.9", - "symfony/notifier": "^5.4|^6.0|^7.0", - "symfony/polyfill-intl-icu": "~1.0", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/property-info": "^5.4|^6.0|^7.0", - "symfony/rate-limiter": "^5.4|^6.0|^7.0", - "symfony/scheduler": "^6.4.4|^7.0.4", - "symfony/security-bundle": "^5.4|^6.0|^7.0", - "symfony/semaphore": "^5.4|^6.0|^7.0", - "symfony/serializer": "^6.4|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/string": "^5.4|^6.0|^7.0", - "symfony/translation": "^6.4|^7.0", - "symfony/twig-bundle": "^5.4|^6.0|^7.0", - "symfony/uid": "^5.4|^6.0|^7.0", - "symfony/validator": "^6.4|^7.0", - "symfony/web-link": "^5.4|^6.0|^7.0", - "symfony/workflow": "^6.4|^7.0", - "symfony/yaml": "^5.4|^6.0|^7.0", - "twig/twig": "^2.10|^3.0.4|^4.0" + "symfony/asset": "^7.4|^8.0", + "symfony/asset-mapper": "^7.4|^8.0", + "symfony/browser-kit": "^7.4|^8.0", + "symfony/clock": "^7.4|^8.0", + "symfony/console": "^8.1.2", + "symfony/css-selector": "^7.4|^8.0", + "symfony/dom-crawler": "^7.4|^8.0", + "symfony/dotenv": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/form": "^7.4|^8.0", + "symfony/html-sanitizer": "^7.4|^8.0", + "symfony/http-client": "^7.4.23|^8.1.11", + "symfony/json-streamer": "^7.4|^8.0", + "symfony/lock": "^7.4|^8.0", + "symfony/mailer": "^7.4|^8.0", + "symfony/messenger": "^7.4.10|^8.0.10", + "symfony/mime": "^7.4.9|^8.0.9", + "symfony/notifier": "^7.4|^8.0", + "symfony/object-mapper": "^7.4.9|^8.0.9", + "symfony/polyfill-intl-icu": "^1.0", + "symfony/process": "^7.4|^8.0", + "symfony/property-info": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0", + "symfony/runtime": "^7.4|^8.0", + "symfony/scheduler": "^7.4|^8.0", + "symfony/security-bundle": "^7.4|^8.0", + "symfony/semaphore": "^7.4|^8.0", + "symfony/serializer": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/string": "^7.4|^8.0", + "symfony/translation": "^7.4|^8.0", + "symfony/twig-bundle": "^7.4|^8.0", + "symfony/type-info": "^7.4.1|^8.0.1", + "symfony/uid": "^7.4|^8.0", + "symfony/validator": "^7.4|^8.0", + "symfony/web-link": "^7.4|^8.0", + "symfony/webhook": "^7.4|^8.0", + "symfony/workflow": "^7.4|^8.0", + "symfony/yaml": "^7.4|^8.0" }, "type": "symfony-bundle", "autoload": { @@ -3714,7 +3732,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v6.4.51" + "source": "https://github.com/symfony/framework-bundle/tree/v8.1.12" }, "funding": [ { @@ -3734,36 +3752,35 @@ "type": "tidelift" } ], - "time": "2026-11-24T18:01:43+00:00", - "published-time": "2026-11-25T09:19:39+00:00" + "time": "2026-11-25T08:05:05+00:00", + "published-time": "2026-11-25T09:29:33+00:00" }, { "name": "symfony/http-client", - "version": "v7.4.25", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "fe047cdc68aee54b315b2f142ab4c0e9c705cefc" + "reference": "88dbd3f478bd5ceca3d177e53a428eb80f3f612f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/fe047cdc68aee54b315b2f142ab4c0e9c705cefc", - "reference": "fe047cdc68aee54b315b2f142ab4c0e9c705cefc", + "url": "https://api.github.com/repos/symfony/http-client/zipball/88dbd3f478bd5ceca3d177e53a428eb80f3f612f", + "reference": "88dbd3f478bd5ceca3d177e53a428eb80f3f612f", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "psr/log": "^1|^2|^3", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/http-client-contracts": "~3.4.4|^3.5.2", - "symfony/polyfill-php83": "^1.29", - "symfony/service-contracts": "^2.5|^3" + "symfony/deprecation-contracts": "^2.5|^3.0", + "symfony/http-client-contracts": "^3.7", + "symfony/service-contracts": "^3.8.1" }, "conflict": { - "amphp/amp": "<2.5", - "amphp/socket": "<1.1", + "amphp/amp": "<3.0.1", "php-http/discovery": "<1.15", - "symfony/http-foundation": "<6.4" + "symfony/config": "<8.2", + "symfony/dependency-injection": "<8.2" }, "provide": { "php-http/async-client-implementation": "*", @@ -3772,21 +3789,24 @@ "symfony/http-client-implementation": "3.0" }, "require-dev": { - "amphp/http-client": "^4.2.1|^5.0", - "amphp/http-tunnel": "^1.0|^2.0", - "guzzlehttp/promises": "^1.4|^2.0", + "amphp/dns": "^2.1.2", + "amphp/http-client": "^5.3.2", + "amphp/http-tunnel": "^2.0", + "amphp/socket": "^2.3.1", + "guzzlehttp/guzzle": "^7.10|^8.0", "nyholm/psr7": "^1.0", "php-http/httplug": "^1.0|^2.0", "psr/http-client": "^1.0", - "symfony/amphp-http-client-meta": "^1.0|^2.0", - "symfony/cache": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/http-foundation": "^6.4.50|^7.4.23|^8.1.11", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/messenger": "^6.4|^7.0|^8.0", - "symfony/process": "^6.4|^7.0|^8.0", - "symfony/rate-limiter": "^6.4|^7.0|^8.0", - "symfony/stopwatch": "^6.4|^7.0|^8.0" + "symfony/cache": "^7.4|^8.0", + "symfony/clock": "^7.4|^8.0", + "symfony/config": "^8.2", + "symfony/dependency-injection": "^8.2", + "symfony/http-foundation": "^7.4.23|^8.1.11", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -3817,7 +3837,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.4.25" + "source": "https://github.com/symfony/http-client/tree/v8.2.0" }, "funding": [ { @@ -3837,8 +3857,8 @@ "type": "tidelift" } ], - "time": "2026-11-27T13:02:26+00:00", - "published-time": "2026-11-27T14:42:41+00:00" + "time": "2026-11-28T11:47:39+00:00", + "published-time": "2026-11-28T12:12:56+00:00" }, { "name": "symfony/http-client-contracts", @@ -3925,37 +3945,37 @@ }, { "name": "symfony/http-foundation", - "version": "v7.4.25", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "1ebfef402856383ce114ff009d4fc961bf290743" + "reference": "1685f3e33f16f0114c3232f470da627090d9ce48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/1ebfef402856383ce114ff009d4fc961bf290743", - "reference": "1ebfef402856383ce114ff009d4fc961bf290743", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/1685f3e33f16f0114c3232f470da627090d9ce48", + "reference": "1685f3e33f16f0114c3232f470da627090d9ce48", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-deepclone": "^1.43.1", "symfony/polyfill-mbstring": "^1.1" }, "conflict": { - "doctrine/dbal": "<3.6", - "symfony/cache": "<6.4.12|>=7.0,<7.1.5" + "doctrine/dbal": "<4.3" }, "require-dev": { - "doctrine/dbal": "^3.6|^4", + "doctrine/dbal": "^4.3", "predis/predis": "^1.1|^2.0", - "symfony/cache": "^6.4.12|^7.1.5|^8.0", - "symfony/clock": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/expression-language": "^6.4|^7.0|^8.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/mime": "^6.4|^7.0|^8.0", - "symfony/rate-limiter": "^6.4|^7.0|^8.0" + "symfony/cache": "^7.4|^8.0", + "symfony/clock": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/mime": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -3983,7 +4003,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.4.25" + "source": "https://github.com/symfony/http-foundation/tree/v8.2.0" }, "funding": [ { @@ -4003,78 +4023,80 @@ "type": "tidelift" } ], - "time": "2026-11-27T13:27:53+00:00", - "published-time": "2026-11-27T14:42:01+00:00" + "time": "2026-11-27T14:09:33+00:00", + "published-time": "2026-11-28T12:13:01+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.4.52", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "06fde509bce78400c0a9ba21e04457e29c240342" + "reference": "76872b19c99773485622d973cfa3c0a9bdf5f847" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/06fde509bce78400c0a9ba21e04457e29c240342", - "reference": "06fde509bce78400c0a9ba21e04457e29c240342", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/76872b19c99773485622d973cfa3c0a9bdf5f847", + "reference": "76872b19c99773485622d973cfa3c0a9bdf5f847", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.4.1", "psr/log": "^1|^2|^3", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/error-handler": "^6.4|^7.0", - "symfony/event-dispatcher": "^5.4|^6.0|^7.0", - "symfony/http-foundation": "^6.4.51|^7.4.24", + "symfony/error-handler": "^7.4|^8.0", + "symfony/event-dispatcher": "^8.2", + "symfony/http-foundation": "^8.2", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/browser-kit": "<5.4", - "symfony/cache": "<5.4", - "symfony/config": "<6.1", - "symfony/console": "<5.4", - "symfony/dependency-injection": "<6.4", - "symfony/doctrine-bridge": "<5.4", - "symfony/form": "<5.4", - "symfony/http-client": "<5.4", + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.2", + "symfony/flex": "<2.10", "symfony/http-client-contracts": "<2.5", - "symfony/mailer": "<5.4", - "symfony/messenger": "<5.4", - "symfony/translation": "<5.4", + "symfony/rate-limiter": "<8.2", + "symfony/routing": "<8.2", + "symfony/serializer": "<7.4.15|>=8.0,<8.0.15|>=8.1,<8.1.2", "symfony/translation-contracts": "<2.5", - "symfony/twig-bridge": "<5.4", - "symfony/validator": "<6.4", - "symfony/var-dumper": "<6.3", - "twig/twig": "<2.13" + "symfony/var-dumper": "<8.2", + "symfony/web-profiler-bundle": "<8.1", + "twig/twig": "<3.21" }, "provide": { "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { + "phpstan/phpdoc-parser": "^1.0|^2.0", "psr/cache": "^1.0|^2.0|^3.0", - "symfony/browser-kit": "^5.4|^6.0|^7.0", - "symfony/clock": "^6.2|^7.0", - "symfony/config": "^6.1|^7.0", - "symfony/console": "^5.4|^6.0|^7.0", - "symfony/css-selector": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^6.4.1|^7.0.1", - "symfony/dom-crawler": "^5.4|^6.0|^7.0", - "symfony/expression-language": "^5.4|^6.0|^7.0", - "symfony/finder": "^5.4|^6.0|^7.0", + "symfony/browser-kit": "^7.4|^8.0", + "symfony/cache": "^8.2", + "symfony/clock": "^7.4|^8.0", + "symfony/config": "^7.4|^8.0", + "symfony/console": "^8.2", + "symfony/css-selector": "^7.4|^8.0", + "symfony/dependency-injection": "^8.2", + "symfony/dom-crawler": "^7.4|^8.0", + "symfony/expression-language": "^8.2", + "symfony/finder": "^7.4|^8.0", + "symfony/http-client": "^7.4|^8.0", "symfony/http-client-contracts": "^2.5|^3", - "symfony/process": "^5.4|^6.0|^7.0", - "symfony/property-access": "^5.4.5|^6.0.5|^7.0", - "symfony/routing": "^5.4|^6.0|^7.0", - "symfony/serializer": "^6.4.4|^7.0.4", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/translation": "^5.4|^6.0|^7.0", + "symfony/json-streamer": "^7.4|^8.0", + "symfony/lock": "^7.4|^8.0", + "symfony/object-mapper": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/property-access": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0", + "symfony/routing": "^8.2", + "symfony/serializer": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/translation": "^7.4|^8.0", "symfony/translation-contracts": "^2.5|^3", - "symfony/uid": "^5.4|^6.0|^7.0", - "symfony/validator": "^6.4|^7.0", - "symfony/var-dumper": "^5.4|^6.4|^7.0", - "symfony/var-exporter": "^6.2|^7.0", - "twig/twig": "^2.13|^3.0.4|^4.0" + "symfony/type-info": "^7.4|^8.0", + "symfony/uid": "^7.4|^8.0", + "symfony/validator": "^7.4|^8.0", + "symfony/var-dumper": "^8.2", + "symfony/var-exporter": "^7.4|^8.0", + "twig/twig": "^3.21|^4.0" }, "type": "library", "autoload": { @@ -4102,7 +4124,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.4.52" + "source": "https://github.com/symfony/http-kernel/tree/v8.2.0" }, "funding": [ { @@ -4122,26 +4144,25 @@ "type": "tidelift" } ], - "time": "2026-11-27T14:37:58+00:00", - "published-time": "2026-11-27T14:39:30+00:00" + "time": "2026-11-28T12:09:59+00:00", + "published-time": "2026-11-28T12:13:18+00:00" }, { "name": "symfony/mime", - "version": "v7.4.24", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "de952f839520f9945b337eeab67e49c68b24ea6b" + "reference": "e25af849162db5d5a8cfc54f26c9294546ddef50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/de952f839520f9945b337eeab67e49c68b24ea6b", - "reference": "de952f839520f9945b337eeab67e49c68b24ea6b", + "url": "https://api.github.com/repos/symfony/mime/zipball/e25af849162db5d5a8cfc54f26c9294546ddef50", + "reference": "e25af849162db5d5a8cfc54f26c9294546ddef50", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.4.1", "symfony/polyfill-intl-idn": "^1.10", "symfony/polyfill-mbstring": "^1.0" }, @@ -4149,18 +4170,23 @@ "egulias/email-validator": "~3.0.0", "phpdocumentor/reflection-docblock": "<5.2|>=7", "phpdocumentor/type-resolver": "<1.5.1", - "symfony/mailer": "<6.4", - "symfony/serializer": "<6.4.3|>7.0,<7.0.3" + "symfony/dependency-injection": "<8.1" }, "require-dev": { "egulias/email-validator": "^2.1.10|^3.1|^4", "league/html-to-markdown": "^5.0", "phpdocumentor/reflection-docblock": "^5.2|^6.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/process": "^6.4|^7.0|^8.0", - "symfony/property-access": "^6.4|^7.0|^8.0", - "symfony/property-info": "^6.4|^7.0|^8.0", - "symfony/serializer": "^6.4.44|^7.4.17|^8.1.5" + "symfony/clock": "^7.4|^8.0", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^8.1", + "symfony/filesystem": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/property-access": "^7.4|^8.0", + "symfony/property-info": "^7.4|^8.0", + "symfony/serializer": "^7.4.17|^8.1.5" + }, + "suggest": { + "symfony/process": "For PGP/MIME signing and encryption support" }, "type": "library", "autoload": { @@ -4192,7 +4218,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v7.4.24" + "source": "https://github.com/symfony/mime/tree/v8.2.0" }, "funding": [ { @@ -4212,43 +4238,43 @@ "type": "tidelift" } ], - "time": "2026-11-24T16:26:23+00:00", - "published-time": "2026-11-25T09:24:00+00:00" + "time": "2026-11-27T14:25:25+00:00", + "published-time": "2026-11-28T12:11:31+00:00" }, { "name": "symfony/monolog-bridge", - "version": "v7.4.12", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bridge.git", - "reference": "20bb2345ac7a9dd57724b6b7ada92c6d7d67b4b8" + "reference": "fdf96800133eb901d760532cee80ca7a5f45d71a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/20bb2345ac7a9dd57724b6b7ada92c6d7d67b4b8", - "reference": "20bb2345ac7a9dd57724b6b7ada92c6d7d67b4b8", + "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/fdf96800133eb901d760532cee80ca7a5f45d71a", + "reference": "fdf96800133eb901d760532cee80ca7a5f45d71a", "shasum": "" }, "require": { "monolog/monolog": "^3", - "php": ">=8.2", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/http-kernel": "^6.4|^7.0|^8.0", + "symfony/http-kernel": "^7.4|^8.0", "symfony/service-contracts": "^2.5|^3" }, "conflict": { - "symfony/console": "<6.4", - "symfony/http-foundation": "<6.4", - "symfony/security-core": "<6.4" + "symfony/console": "<8.2", + "symfony/event-dispatcher": "<8.2" }, "require-dev": { - "symfony/console": "^6.4|^7.0|^8.0", - "symfony/http-client": "^6.4|^7.0|^8.0", - "symfony/mailer": "^6.4|^7.0|^8.0", - "symfony/messenger": "^6.4|^7.0|^8.0", - "symfony/mime": "^6.4|^7.0|^8.0", - "symfony/security-core": "^6.4|^7.0|^8.0", - "symfony/var-dumper": "^6.4|^7.0|^8.0" + "symfony/console": "^8.2", + "symfony/http-client": "^7.4|^8.0", + "symfony/mailer": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/mime": "^7.4|^8.0", + "symfony/notifier": "^8.2", + "symfony/security-core": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "symfony-bridge", "autoload": { @@ -4276,7 +4302,7 @@ "description": "Provides integration for Monolog with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/monolog-bridge/tree/v7.4.12" + "source": "https://github.com/symfony/monolog-bridge/tree/v8.2.0" }, "funding": [ { @@ -4296,37 +4322,37 @@ "type": "tidelift" } ], - "time": "2026-05-20T07:20:23+00:00" + "time": "2026-10-22T16:53:57+00:00", + "published-time": "2026-11-28T12:12:33+00:00" }, { "name": "symfony/monolog-bundle", - "version": "v3.11.2", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bundle.git", - "reference": "d87468010570b2ec766152184918ee8d267c7411" + "reference": "a22de65db405738364af77310761fdd0dce7a40e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/d87468010570b2ec766152184918ee8d267c7411", - "reference": "d87468010570b2ec766152184918ee8d267c7411", + "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/a22de65db405738364af77310761fdd0dce7a40e", + "reference": "a22de65db405738364af77310761fdd0dce7a40e", "shasum": "" }, "require": { "composer-runtime-api": "^2.0", - "monolog/monolog": "^1.25.1 || ^2.0 || ^3.0", - "php": ">=8.1", - "symfony/config": "^6.4 || ^7.0", - "symfony/dependency-injection": "^6.4 || ^7.0", - "symfony/deprecation-contracts": "^2.5 || ^3.0", - "symfony/http-kernel": "^6.4 || ^7.0", - "symfony/monolog-bridge": "^6.4 || ^7.0", + "monolog/monolog": "^3.12", + "php": ">=8.2", + "symfony/config": "^7.3 || ^8.0", + "symfony/dependency-injection": "^7.3 || ^8.0", + "symfony/http-kernel": "^7.3 || ^8.0", + "symfony/monolog-bridge": "^7.3 || ^8.0", "symfony/polyfill-php84": "^1.30" }, "require-dev": { - "symfony/console": "^6.4 || ^7.0", - "symfony/phpunit-bridge": "^7.3.3", - "symfony/yaml": "^6.4 || ^7.0" + "phpunit/phpunit": "^11.5.41 || ^12.3", + "symfony/console": "^7.3 || ^8.0", + "symfony/yaml": "^7.3 || ^8.0" }, "type": "symfony-bundle", "autoload": { @@ -4356,7 +4382,7 @@ ], "support": { "issues": "https://github.com/symfony/monolog-bundle/issues", - "source": "https://github.com/symfony/monolog-bundle/tree/v3.11.2" + "source": "https://github.com/symfony/monolog-bundle/tree/v4.1.0" }, "funding": [ { @@ -4376,24 +4402,25 @@ "type": "tidelift" } ], - "time": "2026-04-02T18:23:01+00:00" + "time": "2026-09-10T19:32:07+00:00", + "published-time": "2026-09-12T21:35:28+00:00" }, { "name": "symfony/options-resolver", - "version": "v7.4.8", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "2888fcdc4dc2fd5f7c7397be78631e8af12e02b4" + "reference": "0a2aa769aced59924bbf5a370aa3def83c836a0f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/2888fcdc4dc2fd5f7c7397be78631e8af12e02b4", - "reference": "2888fcdc4dc2fd5f7c7397be78631e8af12e02b4", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/0a2aa769aced59924bbf5a370aa3def83c836a0f", + "reference": "0a2aa769aced59924bbf5a370aa3def83c836a0f", "shasum": "" }, "require": { - "php": ">=8.2", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3" }, "type": "library", @@ -4427,7 +4454,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v7.4.8" + "source": "https://github.com/symfony/options-resolver/tree/v8.2.0" }, "funding": [ { @@ -4447,7 +4474,8 @@ "type": "tidelift" } ], - "time": "2026-03-24T13:12:05+00:00" + "time": "2026-11-06T11:00:24+00:00", + "published-time": "2026-11-28T12:11:55+00:00" }, { "name": "symfony/polyfill-ctype", @@ -4533,18 +4561,106 @@ "time": "2026-04-10T16:19:22+00:00", "published-time": "2026-04-26T14:44:50+00:00" }, + { + "name": "symfony/polyfill-deepclone", + "version": "v1.43.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-deepclone.git", + "reference": "82274308b59f6e96f53a3fb37fc40877d843e5a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-deepclone/zipball/82274308b59f6e96f53a3fb37fc40877d843e5a5", + "reference": "82274308b59f6e96f53a3fb37fc40877d843e5a5", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "provide": { + "ext-deepclone": "*" + }, + "suggest": { + "ext-deepclone": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\DeepClone\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "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 deepclone extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "deepclone", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-deepclone/tree/v1.43.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-10-14T07:17:09+00:00", + "published-time": "2026-10-14T09:42:25+00:00" + }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.38.1", + "version": "v1.43.3", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "e9247d281d694a5120554d9afaf54e070e88a603" + "reference": "5a8f33c87aeecffce24e721b5064fab05f4becf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/e9247d281d694a5120554d9afaf54e070e88a603", - "reference": "e9247d281d694a5120554d9afaf54e070e88a603", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/5a8f33c87aeecffce24e721b5064fab05f4becf8", + "reference": "5a8f33c87aeecffce24e721b5064fab05f4becf8", "shasum": "" }, "require": { @@ -4593,7 +4709,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.38.1" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.43.3" }, "funding": [ { @@ -4613,7 +4729,8 @@ "type": "tidelift" } ], - "time": "2026-05-26T05:58:03+00:00" + "time": "2026-10-15T09:18:53+00:00", + "published-time": "2026-10-28T10:07:44+00:00" }, { "name": "symfony/polyfill-intl-idn", @@ -4960,99 +5077,18 @@ "time": "2026-09-25T15:50:05+00:00", "published-time": "2026-09-30T10:23:35+00:00" }, - { - "name": "symfony/polyfill-php83", - "version": "v1.43.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php83.git", - "reference": "80ccff923a8d61f73ebe9da0aa94e25232f004ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/80ccff923a8d61f73ebe9da0aa94e25232f004ce", - "reference": "80ccff923a8d61f73ebe9da0aa94e25232f004ce", - "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\\Php83\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "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 backporting some PHP 8.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php83/tree/v1.43.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-09-25T15:50:05+00:00", - "published-time": "2026-09-30T10:23:43+00:00" - }, { "name": "symfony/polyfill-php84", - "version": "v1.38.1", + "version": "v1.43.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php84.git", - "reference": "f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa" + "reference": "22c6548499cbe5c5bb072fc0c42312dff062a015" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa", - "reference": "f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/22c6548499cbe5c5bb072fc0c42312dff062a015", + "reference": "22c6548499cbe5c5bb072fc0c42312dff062a015", "shasum": "" }, "require": { @@ -5099,7 +5135,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php84/tree/v1.38.1" + "source": "https://github.com/symfony/polyfill-php84/tree/v1.43.0" }, "funding": [ { @@ -5119,7 +5155,8 @@ "type": "tidelift" } ], - "time": "2026-05-26T12:51:13+00:00" + "time": "2026-09-23T22:01:09+00:00", + "published-time": "2026-09-30T10:23:33+00:00" }, { "name": "symfony/polyfill-php85", @@ -5204,36 +5241,37 @@ }, { "name": "symfony/routing", - "version": "v6.4.51", + "version": "v8.2.0-BETA1", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "238f28b27658bec77e5039e7e31744174bdc58b6" + "reference": "0bdf4daa37f6f39d83ff0d2ee774a32af56dba3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/238f28b27658bec77e5039e7e31744174bdc58b6", - "reference": "238f28b27658bec77e5039e7e31744174bdc58b6", + "url": "https://api.github.com/repos/symfony/routing/zipball/0bdf4daa37f6f39d83ff0d2ee774a32af56dba3e", + "reference": "0bdf4daa37f6f39d83ff0d2ee774a32af56dba3e", "shasum": "" }, "require": { - "php": ">=8.1", + "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3" }, "conflict": { - "doctrine/annotations": "<1.12", - "symfony/config": "<6.2", - "symfony/dependency-injection": "<5.4", - "symfony/yaml": "<5.4" + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.2" }, "require-dev": { - "doctrine/annotations": "^1.12|^2", + "psr/container": "^1.1|^2.0", "psr/log": "^1|^2|^3", - "symfony/config": "^6.2|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/expression-language": "^5.4|^6.0|^7.0", - "symfony/http-foundation": "^5.4|^6.0|^7.0", - "symfony/yaml": "^5.4|^6.0|^7.0" + "symfony/config": "^7.4|^8.0", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^8.2", + "symfony/expression-language": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/yaml": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -5267,7 +5305,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v6.4.51" + "source": "https://github.com/symfony/routing/tree/v8.2.0-BETA1" }, "funding": [ { @@ -5287,36 +5325,37 @@ "type": "tidelift" } ], - "time": "2026-11-24T18:01:43+00:00", - "published-time": "2026-11-25T09:21:12+00:00" + "time": "2026-11-04T08:52:03+00:00", + "published-time": "2026-11-04T12:37:41+00:00" }, { "name": "symfony/runtime", - "version": "v6.4.41", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/runtime.git", - "reference": "4a354e15532ed4f99c6d0fdc5618bfbd3ea05a8a" + "reference": "c4ed440d11fe370e421549e6bd3eb4e96fcad8d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/runtime/zipball/4a354e15532ed4f99c6d0fdc5618bfbd3ea05a8a", - "reference": "4a354e15532ed4f99c6d0fdc5618bfbd3ea05a8a", + "url": "https://api.github.com/repos/symfony/runtime/zipball/c4ed440d11fe370e421549e6bd3eb4e96fcad8d5", + "reference": "c4ed440d11fe370e421549e6bd3eb4e96fcad8d5", "shasum": "" }, "require": { "composer-plugin-api": "^1.0|^2.0", - "php": ">=8.1" + "php": ">=8.4.1" }, "conflict": { - "symfony/dotenv": "<5.4" + "symfony/error-handler": "<7.4" }, "require-dev": { - "composer/composer": "^1.0.2|^2.0", - "symfony/console": "^5.4.9|^6.0.9|^7.0", - "symfony/dotenv": "^5.4|^6.0|^7.0", - "symfony/http-foundation": "^5.4|^6.0|^7.0", - "symfony/http-kernel": "^5.4|^6.0|^7.0" + "composer/composer": "^2.6", + "symfony/console": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/dotenv": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0" }, "type": "composer-plugin", "extra": { @@ -5351,7 +5390,7 @@ "runtime" ], "support": { - "source": "https://github.com/symfony/runtime/tree/v6.4.41" + "source": "https://github.com/symfony/runtime/tree/v8.2.0" }, "funding": [ { @@ -5371,7 +5410,8 @@ "type": "tidelift" } ], - "time": "2026-05-23T14:01:00+00:00" + "time": "2026-11-12T16:19:10+00:00", + "published-time": "2026-11-28T12:13:26+00:00" }, { "name": "symfony/service-contracts", @@ -5463,16 +5503,16 @@ }, { "name": "symfony/stimulus-bundle", - "version": "v2.36.0", + "version": "v2.36.3", "source": { "type": "git", "url": "https://github.com/symfony/stimulus-bundle.git", - "reference": "377a3d1ec5834631a7db53bd275276ff3c5b49df" + "reference": "8b97f10aca6d3c90b4a26f72eac9b1b4936b0820" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stimulus-bundle/zipball/377a3d1ec5834631a7db53bd275276ff3c5b49df", - "reference": "377a3d1ec5834631a7db53bd275276ff3c5b49df", + "url": "https://api.github.com/repos/symfony/stimulus-bundle/zipball/8b97f10aca6d3c90b4a26f72eac9b1b4936b0820", + "reference": "8b97f10aca6d3c90b4a26f72eac9b1b4936b0820", "shasum": "" }, "require": { @@ -5484,6 +5524,9 @@ "symfony/http-kernel": "^5.4|^6.0|^7.0|^8.0", "twig/twig": "^2.15.3|^3.8" }, + "conflict": { + "symfony/asset-mapper": ">=8.2" + }, "require-dev": { "symfony/asset-mapper": "^6.3|^7.0|^8.0", "symfony/framework-bundle": "^5.4|^6.0|^7.0|^8.0", @@ -5512,7 +5555,7 @@ "symfony-ux" ], "support": { - "source": "https://github.com/symfony/stimulus-bundle/tree/v2.36.0" + "source": "https://github.com/symfony/stimulus-bundle/tree/v2.36.3" }, "funding": [ { @@ -5532,39 +5575,39 @@ "type": "tidelift" } ], - "time": "2026-05-06T04:31:36+00:00" + "time": "2026-11-24T07:14:16+00:00", + "published-time": "2026-11-24T07:16:14+00:00" }, { "name": "symfony/string", - "version": "v7.4.13", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "961683010db3b27ec6ebcd7308e6e1ee8fa7ffde" + "reference": "24a5a339853a0742edfc8a456d55e3314d489555" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/961683010db3b27ec6ebcd7308e6e1ee8fa7ffde", - "reference": "961683010db3b27ec6ebcd7308e6e1ee8fa7ffde", + "url": "https://api.github.com/repos/symfony/string/zipball/24a5a339853a0742edfc8a456d55e3314d489555", + "reference": "24a5a339853a0742edfc8a456d55e3314d489555", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3.0", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-intl-grapheme": "~1.33", - "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=8.4.1", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-intl-grapheme": "^1.33", + "symfony/polyfill-intl-normalizer": "^1.0", + "symfony/polyfill-mbstring": "^1.0" }, "conflict": { "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/emoji": "^7.1|^8.0", - "symfony/http-client": "^6.4|^7.0|^8.0", - "symfony/intl": "^6.4|^7.0|^8.0", + "symfony/emoji": "^7.4|^8.0", + "symfony/http-client": "^7.4|^8.0", + "symfony/intl": "^7.4|^8.0", "symfony/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^6.4|^7.0|^8.0" + "symfony/var-exporter": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -5603,7 +5646,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.4.13" + "source": "https://github.com/symfony/string/tree/v8.2.0" }, "funding": [ { @@ -5623,38 +5666,32 @@ "type": "tidelift" } ], - "time": "2026-05-23T15:23:29+00:00" + "time": "2026-11-27T13:28:56+00:00", + "published-time": "2026-11-28T12:12:38+00:00" }, { "name": "symfony/translation", - "version": "v7.4.10", + "version": "v8.1.12", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "ada7578c30dd5feaa8259cff3e885069ea81ddde" + "reference": "413000a518ef8c989696b7c9b0f75cb2c29779af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/ada7578c30dd5feaa8259cff3e885069ea81ddde", - "reference": "ada7578c30dd5feaa8259cff3e885069ea81ddde", + "url": "https://api.github.com/repos/symfony/translation/zipball/413000a518ef8c989696b7c9b0f75cb2c29779af", + "reference": "413000a518ef8c989696b7c9b0f75cb2c29779af", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^2.5.3|^3.3" + "php": ">=8.4.1", + "symfony/polyfill-mbstring": "^1.0", + "symfony/translation-contracts": "^3.6.1" }, "conflict": { "nikic/php-parser": "<5.0", - "symfony/config": "<6.4", - "symfony/console": "<6.4", - "symfony/dependency-injection": "<6.4", "symfony/http-client-contracts": "<2.5", - "symfony/http-kernel": "<6.4", - "symfony/service-contracts": "<2.5", - "symfony/twig-bundle": "<6.4", - "symfony/yaml": "<6.4" + "symfony/service-contracts": "<2.5" }, "provide": { "symfony/translation-implementation": "2.3|3.0" @@ -5662,17 +5699,17 @@ "require-dev": { "nikic/php-parser": "^5.0", "psr/log": "^1|^2|^3", - "symfony/config": "^6.4|^7.0|^8.0", - "symfony/console": "^6.4|^7.0|^8.0", - "symfony/dependency-injection": "^6.4|^7.0|^8.0", - "symfony/finder": "^6.4|^7.0|^8.0", + "symfony/config": "^7.4|^8.0", + "symfony/console": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", "symfony/http-client-contracts": "^2.5|^3.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/intl": "^6.4|^7.0|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/intl": "^7.4|^8.0", "symfony/polyfill-intl-icu": "^1.21", - "symfony/routing": "^6.4|^7.0|^8.0", + "symfony/routing": "^7.4|^8.0", "symfony/service-contracts": "^2.5|^3", - "symfony/yaml": "^6.4|^7.0|^8.0" + "symfony/yaml": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -5703,7 +5740,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v7.4.10" + "source": "https://github.com/symfony/translation/tree/v8.1.12" }, "funding": [ { @@ -5723,20 +5760,21 @@ "type": "tidelift" } ], - "time": "2026-05-06T11:19:24+00:00" + "time": "2026-11-24T16:43:41+00:00", + "published-time": "2026-11-25T09:29:38+00:00" }, { "name": "symfony/translation-contracts", - "version": "v3.7.0", + "version": "v3.8.1", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "0ab302977a952b42fd51475c4ebac81f8da0a95d" + "reference": "0a3ae917402632fcba2aeddae9c98332f3d7dd05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/0ab302977a952b42fd51475c4ebac81f8da0a95d", - "reference": "0ab302977a952b42fd51475c4ebac81f8da0a95d", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/0a3ae917402632fcba2aeddae9c98332f3d7dd05", + "reference": "0a3ae917402632fcba2aeddae9c98332f3d7dd05", "shasum": "" }, "require": { @@ -5749,7 +5787,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.7-dev" + "dev-main": "3.8-dev" } }, "autoload": { @@ -5785,7 +5823,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.7.0" + "source": "https://github.com/symfony/translation-contracts/tree/v3.8.1" }, "funding": [ { @@ -5805,72 +5843,70 @@ "type": "tidelift" } ], - "time": "2026-01-05T13:30:16+00:00" + "time": "2026-10-03T08:17:19+00:00", + "published-time": "2026-11-04T11:25:31+00:00" }, { "name": "symfony/twig-bridge", - "version": "v6.4.40", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "5a68963b44e9a7089415540908c61de976c1ae34" + "reference": "6b5759b35cfc009854c049b19d8b58e04cc86f51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/5a68963b44e9a7089415540908c61de976c1ae34", - "reference": "5a68963b44e9a7089415540908c61de976c1ae34", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/6b5759b35cfc009854c049b19d8b58e04cc86f51", + "reference": "6b5759b35cfc009854c049b19d8b58e04cc86f51", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.4.1", "symfony/translation-contracts": "^2.5|^3", - "twig/twig": "^2.13|^3.0.4" + "twig/twig": "^3.29|^4.0" }, "conflict": { - "phpdocumentor/reflection-docblock": "<3.2.2", - "phpdocumentor/type-resolver": "<1.4.0", - "symfony/console": "<5.4", - "symfony/form": "<6.4.32|>7,<7.3.10|>7.4,<7.4.4", - "symfony/http-foundation": "<5.4", - "symfony/http-kernel": "<6.4", - "symfony/mime": "<6.4.37|>=7.0,<7.4.9", - "symfony/serializer": "<6.4", - "symfony/translation": "<5.4", - "symfony/workflow": "<5.4" + "phpdocumentor/reflection-docblock": "<5.2|>=7", + "phpdocumentor/type-resolver": "<1.5.1", + "symfony/console": "<8.2", + "symfony/form": "<7.4.4|>8.0,<8.0.4", + "symfony/mime": "<7.4.9|>8.0,<8.0.9", + "symfony/security-http": "<8.2" }, "require-dev": { "egulias/email-validator": "^2.1.10|^3|^4", "league/html-to-markdown": "^5.0", - "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", - "symfony/asset": "^5.4|^6.0|^7.0", - "symfony/asset-mapper": "^6.3|^7.0", - "symfony/console": "^5.4|^6.0|^7.0", - "symfony/dependency-injection": "^5.4|^6.0|^7.0", - "symfony/expression-language": "^5.4|^6.0|^7.0", - "symfony/finder": "^5.4|^6.0|^7.0", - "symfony/form": "^6.4.32|~7.3.10|^7.4.4", - "symfony/html-sanitizer": "^6.1|^7.0", - "symfony/http-foundation": "^5.4|^6.0|^7.0", - "symfony/http-kernel": "^6.4|^7.0", - "symfony/intl": "^5.4|^6.0|^7.0", - "symfony/mime": "^6.4.37|^7.4.9", - "symfony/polyfill-intl-icu": "~1.0", - "symfony/property-info": "^5.4|^6.0|^7.0", - "symfony/routing": "^5.4|^6.0|^7.0", + "phpdocumentor/reflection-docblock": "^5.2|^6.0", + "symfony/asset": "^7.4|^8.0", + "symfony/asset-mapper": "^7.4|^8.0", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/emoji": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", + "symfony/form": "^7.4.4|^8.0.4", + "symfony/html-sanitizer": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/intl": "^7.4|^8.0", + "symfony/mime": "^7.4.9|^8.0.9", + "symfony/polyfill-intl-icu": "^1.0", + "symfony/property-info": "^7.4|^8.0", + "symfony/routing": "^7.4|^8.0", "symfony/security-acl": "^2.8|^3.0", - "symfony/security-core": "^5.4|^6.0|^7.0", - "symfony/security-csrf": "^5.4|^6.0|^7.0", - "symfony/security-http": "^5.4|^6.0|^7.0", - "symfony/serializer": "^6.4.3|^7.0.3", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/translation": "^6.1|^7.0", - "symfony/web-link": "^5.4|^6.0|^7.0", - "symfony/workflow": "^5.4|^6.0|^7.0", - "symfony/yaml": "^5.4|^6.0|^7.0", - "twig/cssinliner-extra": "^2.12|^3", - "twig/inky-extra": "^2.12|^3", - "twig/markdown-extra": "^2.12|^3" + "symfony/security-core": "^7.4|^8.0", + "symfony/security-csrf": "^7.4|^8.0", + "symfony/security-http": "^8.2", + "symfony/serializer": "^7.4.17|^8.1.5", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/translation": "^8.2", + "symfony/validator": "^7.4|^8.0", + "symfony/web-link": "^7.4|^8.0", + "symfony/workflow": "^7.4|^8.0", + "symfony/yaml": "^7.4|^8.0", + "twig/cssinliner-extra": "^3", + "twig/inky-extra": "^3", + "twig/markdown-extra": "^3" }, "type": "symfony-bridge", "autoload": { @@ -5898,7 +5934,7 @@ "description": "Provides integration for Twig with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bridge/tree/v6.4.40" + "source": "https://github.com/symfony/twig-bridge/tree/v8.2.0" }, "funding": [ { @@ -5918,47 +5954,44 @@ "type": "tidelift" } ], - "time": "2026-05-11T09:54:00+00:00" + "time": "2026-11-17T17:46:43+00:00", + "published-time": "2026-11-28T12:12:05+00:00" }, { "name": "symfony/twig-bundle", - "version": "v6.4.32", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/twig-bundle.git", - "reference": "a5c8dcc11a5bf9c96320da20070d2e158a4e0b30" + "reference": "127b678d3c8afc3639eea44a212d7db565a45509" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/a5c8dcc11a5bf9c96320da20070d2e158a4e0b30", - "reference": "a5c8dcc11a5bf9c96320da20070d2e158a4e0b30", + "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/127b678d3c8afc3639eea44a212d7db565a45509", + "reference": "127b678d3c8afc3639eea44a212d7db565a45509", "shasum": "" }, "require": { "composer-runtime-api": ">=2.1", - "php": ">=8.1", - "symfony/config": "^6.1|^7.0", - "symfony/dependency-injection": "^6.1|^7.0", - "symfony/http-foundation": "^5.4|^6.0|^7.0", - "symfony/http-kernel": "^6.2", - "symfony/twig-bridge": "^6.4", - "twig/twig": "^2.13|^3.0.4" - }, - "conflict": { - "symfony/framework-bundle": "<5.4", - "symfony/translation": "<5.4" + "php": ">=8.4.1", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/twig-bridge": "^7.4|^8.0" }, "require-dev": { - "symfony/asset": "^5.4|^6.0|^7.0", - "symfony/expression-language": "^5.4|^6.0|^7.0", - "symfony/finder": "^5.4|^6.0|^7.0", - "symfony/form": "^5.4|^6.0|^7.0", - "symfony/framework-bundle": "^5.4|^6.0|^7.0", - "symfony/routing": "^5.4|^6.0|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0", - "symfony/translation": "^5.4|^6.0|^7.0", - "symfony/web-link": "^5.4|^6.0|^7.0", - "symfony/yaml": "^5.4|^6.0|^7.0" + "symfony/asset": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", + "symfony/form": "^7.4|^8.0", + "symfony/framework-bundle": "^7.4|^8.0", + "symfony/routing": "^7.4|^8.0", + "symfony/runtime": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/translation": "^7.4|^8.0", + "symfony/web-link": "^7.4|^8.0", + "symfony/yaml": "^7.4|^8.0" }, "type": "symfony-bundle", "autoload": { @@ -5986,7 +6019,7 @@ "description": "Provides a tight integration of Twig into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bundle/tree/v6.4.32" + "source": "https://github.com/symfony/twig-bundle/tree/v8.1.9" }, "funding": [ { @@ -6006,35 +6039,37 @@ "type": "tidelift" } ], - "time": "2026-01-05T12:44:39+00:00" + "time": "2026-10-09T16:13:24+00:00", + "published-time": "2026-10-14T06:48:49+00:00" }, { "name": "symfony/var-dumper", - "version": "v7.4.24", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "04112d9b77043f1ffb2d70d78aaf09c067c80079" + "reference": "459bfdcf52cdea470ff75ce9a81b91acf6b90964" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/04112d9b77043f1ffb2d70d78aaf09c067c80079", - "reference": "04112d9b77043f1ffb2d70d78aaf09c067c80079", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/459bfdcf52cdea470ff75ce9a81b91acf6b90964", + "reference": "459bfdcf52cdea470ff75ce9a81b91acf6b90964", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=8.4.1", + "symfony/polyfill-mbstring": "^1.0" }, "conflict": { - "symfony/console": "<6.4" + "symfony/console": "<8.2", + "symfony/error-handler": "<7.4" }, "require-dev": { - "symfony/console": "^6.4|^7.0|^8.0", - "symfony/http-kernel": "^6.4|^7.0|^8.0", - "symfony/process": "^6.4|^7.0|^8.0", - "symfony/uid": "^6.4|^7.0|^8.0", + "symfony/console": "^8.2", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/uid": "^7.4|^8.0", "twig/twig": "^3.12|^4.0" }, "bin": [ @@ -6073,7 +6108,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v7.4.24" + "source": "https://github.com/symfony/var-dumper/tree/v8.2.0" }, "funding": [ { @@ -6093,31 +6128,32 @@ "type": "tidelift" } ], - "time": "2026-11-12T10:19:45+00:00", - "published-time": "2026-11-25T09:25:05+00:00" + "time": "2026-11-12T10:33:36+00:00", + "published-time": "2026-11-28T12:12:43+00:00" }, { "name": "symfony/var-exporter", - "version": "v7.4.22", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "6c967db30708068f6eaedb6ed37973bd86de2241" + "reference": "928c131f248af2221532d33c389d06b4575e9b38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/6c967db30708068f6eaedb6ed37973bd86de2241", - "reference": "6c967db30708068f6eaedb6ed37973bd86de2241", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/928c131f248af2221532d33c389d06b4575e9b38", + "reference": "928c131f248af2221532d33c389d06b4575e9b38", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3" + "php": ">=8.4.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-deepclone": "^1.43.1" }, "require-dev": { - "symfony/property-access": "^6.4|^7.0|^8.0", - "symfony/serializer": "^6.4|^7.0|^8.0", - "symfony/var-dumper": "^6.4|^7.0|^8.0" + "symfony/property-access": "^7.4|^8.0", + "symfony/serializer": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -6142,11 +6178,12 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Allows exporting any serializable PHP data structure to plain PHP code", + "description": "Provides tools to export, instantiate, hydrate, clone and lazy-load PHP objects", "homepage": "https://symfony.com", "keywords": [ "clone", "construct", + "deep-clone", "export", "hydrate", "instantiate", @@ -6155,7 +6192,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v7.4.22" + "source": "https://github.com/symfony/var-exporter/tree/v8.2.0" }, "funding": [ { @@ -6175,33 +6212,34 @@ "type": "tidelift" } ], - "time": "2026-10-22T14:50:44+00:00", - "published-time": "2026-10-28T18:20:27+00:00" + "time": "2026-10-22T14:35:59+00:00", + "published-time": "2026-11-28T12:12:42+00:00" }, { "name": "symfony/yaml", - "version": "v6.4.51", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "03b7e09c39210dd687d9091ebc291924944bc43d" + "reference": "f73c6c770da98c69037cccfebc314cead3333599" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/03b7e09c39210dd687d9091ebc291924944bc43d", - "reference": "03b7e09c39210dd687d9091ebc291924944bc43d", + "url": "https://api.github.com/repos/symfony/yaml/zipball/f73c6c770da98c69037cccfebc314cead3333599", + "reference": "f73c6c770da98c69037cccfebc314cead3333599", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", + "php": ">=8.4.1", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<5.4" + "symfony/console": "<8.2" }, "require-dev": { - "symfony/console": "^5.4|^6.0|^7.0" + "opis/json-schema": "^2.6", + "symfony/console": "^8.2", + "yaml/yaml-test-suite": "*" }, "bin": [ "Resources/bin/yaml-lint" @@ -6232,7 +6270,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v6.4.51" + "source": "https://github.com/symfony/yaml/tree/v8.2.0" }, "funding": [ { @@ -6252,21 +6290,21 @@ "type": "tidelift" } ], - "time": "2026-11-10T17:31:22+00:00", - "published-time": "2026-11-25T09:19:55+00:00" + "time": "2026-11-27T13:28:56+00:00", + "published-time": "2026-11-28T12:11:52+00:00" }, { "name": "twig/extra-bundle", - "version": "v3.24.0", + "version": "v3.31.0", "source": { "type": "git", "url": "https://github.com/twigphp/twig-extra-bundle.git", - "reference": "6a621fcb1f28aa9ea7b34a99047ae0cdf5b834c9" + "reference": "c97881570a39593c7aa78bdd6b5e9838fb081fbf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/6a621fcb1f28aa9ea7b34a99047ae0cdf5b834c9", - "reference": "6a621fcb1f28aa9ea7b34a99047ae0cdf5b834c9", + "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/c97881570a39593c7aa78bdd6b5e9838fb081fbf", + "reference": "c97881570a39593c7aa78bdd6b5e9838fb081fbf", "shasum": "" }, "require": { @@ -6277,7 +6315,7 @@ }, "require-dev": { "league/commonmark": "^2.7", - "symfony/phpunit-bridge": "^6.4|^7.0", + "symfony/phpunit-bridge": "^7.4|^8.0", "twig/cache-extra": "^3.0", "twig/cssinliner-extra": "^3.0", "twig/html-extra": "^3.0", @@ -6315,7 +6353,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.24.0" + "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.31.0" }, "funding": [ { @@ -6327,7 +6365,8 @@ "type": "tidelift" } ], - "time": "2026-02-07T08:07:38+00:00" + "time": "2026-11-23T11:36:10+00:00", + "published-time": "2026-11-23T16:31:50+00:00" }, { "name": "twig/markdown-extra", @@ -6486,122 +6525,6 @@ } ], "packages-dev": [ - { - "name": "aeon-php/calendar", - "version": "1.0.12", - "source": { - "type": "git", - "url": "https://github.com/aeon-php/calendar.git", - "reference": "10387ea0944ce9ce071a12d60c398ee852de70b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/aeon-php/calendar/zipball/10387ea0944ce9ce071a12d60c398ee852de70b8", - "reference": "10387ea0944ce9ce071a12d60c398ee852de70b8", - "shasum": "" - }, - "require": { - "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0" - }, - "require-dev": { - "ext-bcmath": "*", - "ext-pcov": "*" - }, - "suggest": { - "ext-bcmath": "Compare time units with high precision" - }, - "type": "library", - "autoload": { - "psr-4": { - "Aeon\\": [ - "src/Aeon" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHP type safe, immutable calendar library", - "keywords": [ - "calendar", - "date", - "datetime", - "immutable", - "time" - ], - "support": { - "issues": "https://github.com/aeon-php/calendar/issues", - "source": "https://github.com/aeon-php/calendar/tree/1.0.12" - }, - "funding": [ - { - "url": "https://flow-php.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/norberttech", - "type": "github" - } - ], - "time": "2025-12-08T14:44:05+00:00" - }, - { - "name": "aeon-php/sleep", - "version": "1.0.12", - "source": { - "type": "git", - "url": "https://github.com/aeon-php/sleep.git", - "reference": "59ae5d2bb34c2495a463aed26f00f24cc36e948a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/aeon-php/sleep/zipball/59ae5d2bb34c2495a463aed26f00f24cc36e948a", - "reference": "59ae5d2bb34c2495a463aed26f00f24cc36e948a", - "shasum": "" - }, - "require": { - "aeon-php/calendar": "~1.0", - "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0" - }, - "type": "library", - "autoload": { - "files": [ - "src/Aeon/Sleep/sleep.php" - ], - "psr-4": { - "Aeon\\": [ - "src/Aeon" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Improved sleep function that uses simple TimeUnit and decides between \\sleep and \\usleep", - "keywords": [ - "calendar", - "holidays", - "immutable", - "sleep" - ], - "support": { - "issues": "https://github.com/aeon-php/sleep/issues", - "source": "https://github.com/aeon-php/sleep/tree/1.0.12" - }, - "funding": [ - { - "url": "https://flow-php.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/norberttech", - "type": "github" - } - ], - "time": "2025-12-08T14:43:58+00:00" - }, { "name": "behat/mink", "version": "v1.13.0", @@ -6667,110 +6590,41 @@ "issues": "https://github.com/minkphp/Mink/issues", "source": "https://github.com/minkphp/Mink/tree/v1.13.0" }, - "time": "2025-11-22T12:18:15+00:00" - }, - { - "name": "masterminds/html5", - "version": "2.10.0", - "source": { - "type": "git", - "url": "https://github.com/Masterminds/html5-php.git", - "reference": "fcf91eb64359852f00d921887b219479b4f21251" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/fcf91eb64359852f00d921887b219479b4f21251", - "reference": "fcf91eb64359852f00d921887b219479b4f21251", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7-dev" - } - }, - "autoload": { - "psr-4": { - "Masterminds\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Matt Butcher", - "email": "technosophos@gmail.com" - }, - { - "name": "Matt Farina", - "email": "matt@mattfarina.com" - }, - { - "name": "Asmir Mustafic", - "email": "goetas@gmail.com" - } - ], - "description": "An HTML5 parser and serializer.", - "homepage": "http://masterminds.github.io/html5-php", - "keywords": [ - "HTML5", - "dom", - "html", - "parser", - "querypath", - "serializer", - "xml" - ], - "support": { - "issues": "https://github.com/Masterminds/html5-php/issues", - "source": "https://github.com/Masterminds/html5-php/tree/2.10.0" - }, - "time": "2025-07-25T09:04:22+00:00" + "time": "2025-11-22T12:18:15+00:00", + "published-time": "2025-11-22T12:18:57+00:00" }, { "name": "norberttech/static-content-generator-bundle", - "version": "1.x-dev", + "version": "0.7.0", "source": { "type": "git", "url": "https://github.com/norberttech/static-content-generator-bundle.git", - "reference": "88e21361dff39218426ee6a11b754f8772e0f949" + "reference": "cebe9e57580b516986c6cda58bf01042448d8238" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/norberttech/static-content-generator-bundle/zipball/88e21361dff39218426ee6a11b754f8772e0f949", - "reference": "88e21361dff39218426ee6a11b754f8772e0f949", + "url": "https://api.github.com/repos/norberttech/static-content-generator-bundle/zipball/cebe9e57580b516986c6cda58bf01042448d8238", + "reference": "cebe9e57580b516986c6cda58bf01042448d8238", "shasum": "" }, "require": { "ext-json": "*", - "flow-php/types": ">=0.23", - "norberttech/symfony-process-executor": "^2.0.4", - "php": "~8.2 || ~8.3 || ~8.4", - "symfony/browser-kit": "^5.4|^6.4|^7.0", - "symfony/dependency-injection": "^5.4|^6.4|^7.0", - "symfony/http-kernel": "^5.4|^6.4|^7.0" + "php": "~8.2 || ~8.3 || ~8.4 || ~8.5 || ~8.6", + "symfony/browser-kit": "^6.4|^7.4|^8.0", + "symfony/dependency-injection": "^6.4|^7.4|^8.0", + "symfony/http-kernel": "^6.4|^7.4|^8.0", + "symfony/process": "^6.4|^7.4|^8.0" }, "require-dev": { "doctrine/annotations": "^1.11.1 || ^2.0.0", - "nikic/php-parser": "^4.18", - "symfony/dotenv": "^5.4|^6.4|^7.0", - "symfony/framework-bundle": "^5.4|^6.4|^7.0", + "symfony/dotenv": "^6.4|^7.4|^8.0", + "symfony/framework-bundle": "^6.4|^7.4|^8.0", "symfony/maker-bundle": "^1.36.4", - "symfony/stopwatch": "^5.4|^6.4|^7.0", + "symfony/stopwatch": "^6.4|^7.4|^8.0", "symfony/twig-pack": "^1.0", - "symfony/web-profiler-bundle": "^5.4|^6.4|^7.0", - "symfony/yaml": "^5.4|^6.4|^7.0" + "symfony/web-profiler-bundle": "^6.4|^7.4|^8.0", + "symfony/yaml": "^6.4|^7.4|^8.0" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -6793,58 +6647,23 @@ ], "support": { "issues": "https://github.com/norberttech/static-content-generator-bundle/issues", - "source": "https://github.com/norberttech/static-content-generator-bundle/tree/1.x" + "source": "https://github.com/norberttech/static-content-generator-bundle/tree/0.7.0" }, - "time": "2025-10-02T18:55:11+00:00" - }, - { - "name": "norberttech/symfony-process-executor", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/norberttech/symfony-process-executor.git", - "reference": "44273563f4ae4a4e2752732d2d47334d2480123b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/norberttech/symfony-process-executor/zipball/44273563f4ae4a4e2752732d2d47334d2480123b", - "reference": "44273563f4ae4a4e2752732d2d47334d2480123b", - "shasum": "" - }, - "require": { - "aeon-php/sleep": "^1.0", - "php": "^8.2", - "symfony/process": "^3.4 || ^4.4 || ^5.0 || ^6.0 || ^7.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "NorbertTech\\SymfonyProcessExecutor\\": "src/NorbertTech/SymfonyProcessExecutor" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Symfony Process Component on steroids, async/sync execution chain.", - "support": { - "issues": "https://github.com/norberttech/symfony-process-executor/issues", - "source": "https://github.com/norberttech/symfony-process-executor/tree/2.2.0" - }, - "time": "2025-05-02T10:00:44+00:00" + "time": "2026-12-03T03:26:47+00:00", + "published-time": "2026-12-03T03:30:15+00:00" }, { "name": "playwright-php/playwright", - "version": "v1.4.0", + "version": "v1.6.0", "source": { "type": "git", "url": "https://github.com/playwright-php/playwright.git", - "reference": "9162aa438cbd519a4498b493c0a9e047c7aec99e" + "reference": "9b98992d064a1b549c029acf2f66576e321adb91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/playwright-php/playwright/zipball/9162aa438cbd519a4498b493c0a9e047c7aec99e", - "reference": "9162aa438cbd519a4498b493c0a9e047c7aec99e", + "url": "https://api.github.com/repos/playwright-php/playwright/zipball/9b98992d064a1b549c029acf2f66576e321adb91", + "reference": "9b98992d064a1b549c029acf2f66576e321adb91", "shasum": "" }, "require": { @@ -6911,7 +6730,7 @@ ], "support": { "issues": "https://github.com/playwright-php/playwright/issues", - "source": "https://github.com/playwright-php/playwright/tree/v1.4.0" + "source": "https://github.com/playwright-php/playwright/tree/v1.6.0" }, "funding": [ { @@ -6919,7 +6738,8 @@ "type": "github" } ], - "time": "2026-08-10T19:39:55+00:00" + "time": "2026-11-07T23:05:13+00:00", + "published-time": "2026-11-07T23:07:15+00:00" }, { "name": "playwright-php/playwright-symfony", @@ -7002,32 +6822,33 @@ "type": "github" } ], - "time": "2026-08-22T23:49:41+00:00" + "time": "2026-08-22T23:49:41+00:00", + "published-time": "2026-08-22T23:53:25+00:00" }, { "name": "symfony/browser-kit", - "version": "v7.4.8", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", - "reference": "41850d8f8ddef9a9cd7314fa9f4902cf48885521" + "reference": "8f252d66dca1bb90f70fe6aef05b1eaae81630bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/41850d8f8ddef9a9cd7314fa9f4902cf48885521", - "reference": "41850d8f8ddef9a9cd7314fa9f4902cf48885521", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/8f252d66dca1bb90f70fe6aef05b1eaae81630bc", + "reference": "8f252d66dca1bb90f70fe6aef05b1eaae81630bc", "shasum": "" }, "require": { - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/dom-crawler": "^6.4|^7.0|^8.0" + "php": ">=8.4.1", + "symfony/dom-crawler": "^7.4|^8.0" }, "require-dev": { - "symfony/css-selector": "^6.4|^7.0|^8.0", - "symfony/http-client": "^6.4|^7.0|^8.0", - "symfony/mime": "^6.4|^7.0|^8.0", - "symfony/process": "^6.4|^7.0|^8.0" + "symfony/css-selector": "^7.4|^8.0", + "symfony/http-client": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/mime": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -7055,7 +6876,7 @@ "description": "Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/browser-kit/tree/v7.4.8" + "source": "https://github.com/symfony/browser-kit/tree/v8.2.0" }, "funding": [ { @@ -7075,24 +6896,25 @@ "type": "tidelift" } ], - "time": "2026-03-24T13:12:05+00:00" + "time": "2026-11-27T14:09:33+00:00", + "published-time": "2026-11-28T12:11:47+00:00" }, { "name": "symfony/css-selector", - "version": "v6.4.34", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "b0314c186f1464de048cce58979ff1625ca88bbb" + "reference": "9cfd588b8b07cf83e3426b030dbafd2291c132d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/b0314c186f1464de048cce58979ff1625ca88bbb", - "reference": "b0314c186f1464de048cce58979ff1625ca88bbb", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/9cfd588b8b07cf83e3426b030dbafd2291c132d9", + "reference": "9cfd588b8b07cf83e3426b030dbafd2291c132d9", "shasum": "" }, "require": { - "php": ">=8.1" + "php": ">=8.4.1" }, "type": "library", "autoload": { @@ -7124,7 +6946,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v6.4.34" + "source": "https://github.com/symfony/css-selector/tree/v8.2.0" }, "funding": [ { @@ -7144,31 +6966,30 @@ "type": "tidelift" } ], - "time": "2026-02-16T08:37:21+00:00" + "time": "2026-10-18T14:56:39+00:00", + "published-time": "2026-11-28T12:11:16+00:00" }, { "name": "symfony/dom-crawler", - "version": "v7.4.12", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "b59b59122690976550fd142c23fab62c84738db6" + "reference": "0bf3e73ed0d98abc2be097896a048cbc1518b98a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/b59b59122690976550fd142c23fab62c84738db6", - "reference": "b59b59122690976550fd142c23fab62c84738db6", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/0bf3e73ed0d98abc2be097896a048cbc1518b98a", + "reference": "0bf3e73ed0d98abc2be097896a048cbc1518b98a", "shasum": "" }, "require": { - "masterminds/html5": "^2.6", - "php": ">=8.2", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=8.4.1", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.0" }, "require-dev": { - "symfony/css-selector": "^6.4|^7.0|^8.0" + "symfony/css-selector": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -7196,7 +7017,7 @@ "description": "Eases DOM navigation for HTML and XML documents", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dom-crawler/tree/v7.4.12" + "source": "https://github.com/symfony/dom-crawler/tree/v8.2.0" }, "funding": [ { @@ -7216,105 +7037,32 @@ "type": "tidelift" } ], - "time": "2026-05-20T07:20:23+00:00" - }, - { - "name": "symfony/polyfill-php81", - "version": "v1.38.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "6bfb9c766cacffbc8e118cb87217d08ed84e5cd7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/6bfb9c766cacffbc8e118cb87217d08ed84e5cd7", - "reference": "6bfb9c766cacffbc8e118cb87217d08ed84e5cd7", - "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\\Php81\\": "" - }, - "classmap": [ - "Resources/stubs" - ] - }, - "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 backporting some PHP 8.1+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.38.1" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-05-26T12:45:58+00:00", - "published-time": "2026-05-26T13:40:34+00:00" + "time": "2026-10-28T08:03:22+00:00", + "published-time": "2026-11-28T12:12:04+00:00" }, { "name": "symfony/process", - "version": "v7.4.24", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "e88ac51768062ad548bf2f900c52231e7e83e475" + "reference": "2c176461fd9614ffa1bb292ca7c95205d0e928c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/e88ac51768062ad548bf2f900c52231e7e83e475", - "reference": "e88ac51768062ad548bf2f900c52231e7e83e475", + "url": "https://api.github.com/repos/symfony/process/zipball/2c176461fd9614ffa1bb292ca7c95205d0e928c9", + "reference": "2c176461fd9614ffa1bb292ca7c95205d0e928c9", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.4.1" + }, + "conflict": { + "symfony/dependency-injection": "<8.1" + }, + "require-dev": { + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^8.1" }, "type": "library", "autoload": { @@ -7342,7 +7090,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.4.24" + "source": "https://github.com/symfony/process/tree/v8.2.0" }, "funding": [ { @@ -7362,43 +7110,45 @@ "type": "tidelift" } ], - "time": "2026-11-23T08:23:51+00:00", - "published-time": "2026-11-25T09:25:48+00:00" + "time": "2026-11-23T09:50:06+00:00", + "published-time": "2026-11-28T12:12:23+00:00" }, { "name": "symfony/web-profiler-bundle", - "version": "v6.4.41", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/web-profiler-bundle.git", - "reference": "2174534e227fa25521175f80c33192eeacb58588" + "reference": "85bbef1ffc0fba0f05b84a58c9705adf09195f04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/2174534e227fa25521175f80c33192eeacb58588", - "reference": "2174534e227fa25521175f80c33192eeacb58588", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/85bbef1ffc0fba0f05b84a58c9705adf09195f04", + "reference": "85bbef1ffc0fba0f05b84a58c9705adf09195f04", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/config": "^5.4|^6.0|^7.0", - "symfony/framework-bundle": "^6.4|^7.0", - "symfony/http-kernel": "^6.4|^7.0", - "symfony/routing": "^5.4|^6.0|^7.0", - "symfony/twig-bundle": "^5.4|^6.0", - "twig/twig": "^2.13|^3.0.4" + "composer-runtime-api": ">=2.1", + "php": ">=8.4.1", + "symfony/config": "^8.2", + "symfony/framework-bundle": "^7.4|^8.0", + "symfony/http-kernel": "^8.1", + "symfony/routing": "^7.4|^8.0", + "symfony/twig-bundle": "^7.4|^8.0" }, "conflict": { - "symfony/form": "<5.4", - "symfony/mailer": "<5.4", - "symfony/messenger": "<5.4", - "symfony/twig-bundle": ">=7.0" + "symfony/dependency-injection": "<8.2", + "symfony/event-dispatcher": "<8.2", + "symfony/http-client": "<8.2", + "symfony/serializer": "<7.4", + "symfony/workflow": "<7.4" }, "require-dev": { - "symfony/browser-kit": "^5.4|^6.0|^7.0", - "symfony/console": "^5.4|^6.0|^7.0", - "symfony/css-selector": "^5.4|^6.0|^7.0", - "symfony/stopwatch": "^5.4|^6.0|^7.0" + "symfony/browser-kit": "^7.4|^8.0", + "symfony/console": "^7.4|^8.0", + "symfony/css-selector": "^7.4|^8.0", + "symfony/runtime": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0" }, "type": "symfony-bundle", "autoload": { @@ -7429,7 +7179,7 @@ "dev" ], "support": { - "source": "https://github.com/symfony/web-profiler-bundle/tree/v6.4.41" + "source": "https://github.com/symfony/web-profiler-bundle/tree/v8.2.0" }, "funding": [ { @@ -7449,36 +7199,37 @@ "type": "tidelift" } ], - "time": "2026-05-20T14:31:08+00:00" + "time": "2026-11-27T15:07:20+00:00", + "published-time": "2026-11-28T12:13:23+00:00" }, { "name": "symfonycasts/tailwind-bundle", - "version": "v0.8.0", + "version": "v1.0.0", "source": { "type": "git", "url": "https://github.com/SymfonyCasts/tailwind-bundle.git", - "reference": "43100c1ad793a1574a675aaf8a1f633fd7fe6e4a" + "reference": "9b0afba9144e5f8fbffe01282c054e835bedd0a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/SymfonyCasts/tailwind-bundle/zipball/43100c1ad793a1574a675aaf8a1f633fd7fe6e4a", - "reference": "43100c1ad793a1574a675aaf8a1f633fd7fe6e4a", + "url": "https://api.github.com/repos/SymfonyCasts/tailwind-bundle/zipball/9b0afba9144e5f8fbffe01282c054e835bedd0a0", + "reference": "9b0afba9144e5f8fbffe01282c054e835bedd0a0", "shasum": "" }, "require": { - "php": ">=8.1", - "symfony/asset-mapper": "^6.3|^7.0", - "symfony/cache": "^6.3|^7.0", - "symfony/console": "^5.4|^6.3|^7.0", - "symfony/deprecation-contracts": "^2.2|^3.0", - "symfony/http-client": "^5.4|^6.3|^7.0", - "symfony/process": "^5.4|^6.3|^7.0" + "php": ">=8.2", + "symfony/asset-mapper": "^6.4|^7.0|^8.0", + "symfony/cache": "^6.4|^7.0|^8.0", + "symfony/console": "^6.4|^7.0|^8.0", + "symfony/http-client": "^6.4|^7.0|^8.0", + "symfony/process": "^6.4|^7.0|^8.0" }, "require-dev": { "phpunit/phpunit": "^9.6", - "symfony/filesystem": "^6.3|^7.0", - "symfony/framework-bundle": "^6.3|^7.0", - "symfony/phpunit-bridge": "^6.3.9|^7.0" + "symfony/filesystem": "^6.4|^7.0|^8.0", + "symfony/framework-bundle": "^6.4|^7.0|^8.0", + "symfony/phpunit-bridge": "^8.1", + "symfony/yaml": "^6.4|^7.0|^8.0" }, "type": "library", "autoload": { @@ -7503,27 +7254,33 @@ ], "support": { "issues": "https://github.com/SymfonyCasts/tailwind-bundle/issues", - "source": "https://github.com/SymfonyCasts/tailwind-bundle/tree/v0.8.0" + "source": "https://github.com/SymfonyCasts/tailwind-bundle/tree/v1.0.0" }, - "time": "2025-03-04T15:35:32+00:00" + "funding": [ + { + "url": "https://symfonycasts.com", + "type": "custom" + } + ], + "time": "2026-07-23T02:04:59+00:00", + "published-time": "2026-07-23T15:48:05+00:00" }, { "name": "zenstruck/assert", - "version": "v1.7.0", + "version": "v1.7.1", "source": { "type": "git", "url": "https://github.com/zenstruck/assert.git", - "reference": "1e32d48847d4e82c345112ca226b21a1a792af0a" + "reference": "cc01f59525c904ae94a613ce047490f5e078abc2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zenstruck/assert/zipball/1e32d48847d4e82c345112ca226b21a1a792af0a", - "reference": "1e32d48847d4e82c345112ca226b21a1a792af0a", + "url": "https://api.github.com/repos/zenstruck/assert/zipball/cc01f59525c904ae94a613ce047490f5e078abc2", + "reference": "cc01f59525c904ae94a613ce047490f5e078abc2", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/polyfill-php81": "^1.23", "symfony/var-exporter": "^5.4|^6.0|^7.0|^8.0" }, "require-dev": { @@ -7556,7 +7313,7 @@ ], "support": { "issues": "https://github.com/zenstruck/assert/issues", - "source": "https://github.com/zenstruck/assert/tree/v1.7.0" + "source": "https://github.com/zenstruck/assert/tree/v1.7.1" }, "funding": [ { @@ -7568,20 +7325,21 @@ "type": "github" } ], - "time": "2025-12-07T01:59:12+00:00" + "time": "2026-11-26T13:31:16+00:00", + "published-time": "2026-11-26T13:31:21+00:00" }, { "name": "zenstruck/browser", - "version": "v1.12.0", + "version": "v1.13.0", "source": { "type": "git", "url": "https://github.com/zenstruck/browser.git", - "reference": "26c1b6d1e052dfdd9a2eef13d4f7134e824da00c" + "reference": "675b4c4a7c8d8bf3cb401105fee0b9fe425c8301" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zenstruck/browser/zipball/26c1b6d1e052dfdd9a2eef13d4f7134e824da00c", - "reference": "26c1b6d1e052dfdd9a2eef13d4f7134e824da00c", + "url": "https://api.github.com/repos/zenstruck/browser/zipball/675b4c4a7c8d8bf3cb401105fee0b9fe425c8301", + "reference": "675b4c4a7c8d8bf3cb401105fee0b9fe425c8301", "shasum": "" }, "require": { @@ -7637,7 +7395,7 @@ ], "support": { "issues": "https://github.com/zenstruck/browser/issues", - "source": "https://github.com/zenstruck/browser/tree/v1.12.0" + "source": "https://github.com/zenstruck/browser/tree/v1.13.0" }, "funding": [ { @@ -7649,7 +7407,8 @@ "type": "github" } ], - "time": "2026-08-24T16:02:16+00:00" + "time": "2026-10-10T20:12:17+00:00", + "published-time": "2026-10-10T20:12:21+00:00" }, { "name": "zenstruck/callback", @@ -7705,7 +7464,8 @@ "type": "github" } ], - "time": "2022-08-31T14:56:15+00:00" + "time": "2022-08-31T14:56:15+00:00", + "published-time": "2022-08-31T14:56:56+00:00" } ], "aliases": [], @@ -7714,13 +7474,12 @@ "flow-php/etl": 20, "flow-php/etl-adapter-http": 20, "flow-php/etl-adapter-json": 20, - "flow-php/symfony-telemetry-bundle": 20, - "norberttech/static-content-generator-bundle": 20 + "flow-php/symfony-telemetry-bundle": 20 }, "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "8.3.*" + "php": "8.5.*" }, "platform-dev": {}, "plugin-api-version": "2.11.0" diff --git a/web/landing/config/packages/framework.yaml b/web/landing/config/packages/framework.yaml index 861645dc75..2ab14e1c3f 100644 --- a/web/landing/config/packages/framework.yaml +++ b/web/landing/config/packages/framework.yaml @@ -1,9 +1,9 @@ # see https://symfony.com/doc/current/reference/configuration/framework.html framework: secret: '%env(APP_SECRET)%' - annotations: false http_method_override: false handle_all_throwables: true + translator: false php_errors: log: true router: diff --git a/web/landing/config/reference.php b/web/landing/config/reference.php new file mode 100644 index 0000000000..014e69d6ee --- /dev/null +++ b/web/landing/config/reference.php @@ -0,0 +1,1669 @@ + [ + * 'App\\' => [ + * 'resource' => '../src/', + * ], + * ], + * ]); + * ``` + * + * @psalm-type ImportsConfig = list + * @psalm-type ParametersConfig = array|Param|null>|Param|null> + * @psalm-type ArgumentsType = list|array + * @psalm-type CallType = array|array{0:string, 1?:ArgumentsType, 2?:bool}|array{method:string, arguments?:ArgumentsType, returns_clone?:bool} + * @psalm-type TagsType = list>> // arrays inside the list must have only one element, with the tag name as the key + * @psalm-type CallbackType = string|array{0:string|ReferenceConfigurator,1:string}|\Closure|ReferenceConfigurator + * @psalm-type DeprecationType = array{package: string, version: string, message?: string} + * @psalm-type DefaultsType = array{ + * public?: bool, + * tags?: TagsType, + * resource_tags?: TagsType, + * autowire?: bool, + * autoconfigure?: bool, + * bind?: array, + * } + * @psalm-type InstanceofType = array{ + * shared?: bool, + * lazy?: bool|string, + * public?: bool, + * factory?: CallbackType, + * properties?: array, + * configurator?: CallbackType, + * calls?: list, + * tags?: TagsType, + * resource_tags?: TagsType, + * autowire?: bool, + * bind?: array, + * constructor?: string, + * } + * @psalm-type DefinitionType = array{ + * class?: string, + * file?: string, + * parent?: string, + * shared?: bool, + * synthetic?: bool, + * lazy?: bool|string, + * public?: bool, + * abstract?: bool, + * deprecated?: DeprecationType, + * factory?: CallbackType, + * configurator?: CallbackType, + * arguments?: ArgumentsType, + * properties?: array, + * calls?: list, + * tags?: TagsType, + * resource_tags?: TagsType, + * decorates?: string, + * decorates_tag?: string, + * decoration_within?: string|list, + * decoration_around?: string|list, + * decoration_inner_name?: string, + * decoration_priority?: int, + * decoration_on_invalid?: 'exception'|'ignore'|null, + * autowire?: bool, + * autoconfigure?: bool, + * bind?: array, + * constructor?: string, + * from_callable?: CallbackType, + * } + * @psalm-type AliasType = string|array{ + * alias: string, + * public?: bool, + * deprecated?: DeprecationType, + * } + * @psalm-type PrototypeType = array{ + * resource: string, + * namespace?: string, + * exclude?: string|list, + * parent?: string, + * shared?: bool, + * lazy?: bool|string, + * public?: bool, + * abstract?: bool, + * deprecated?: DeprecationType, + * factory?: CallbackType, + * arguments?: ArgumentsType, + * properties?: array, + * configurator?: CallbackType, + * calls?: list, + * tags?: TagsType, + * resource_tags?: TagsType, + * autowire?: bool, + * autoconfigure?: bool, + * bind?: array, + * constructor?: string, + * } + * @psalm-type StackType = array{ + * stack: list>, + * public?: bool, + * deprecated?: DeprecationType, + * decorates?: string, + * decorates_tag?: string, + * decoration_within?: string|list, + * decoration_around?: string|list, + * decoration_inner_name?: string, + * decoration_priority?: int, + * decoration_on_invalid?: 'exception'|'ignore'|null, + * } + * @psalm-type ServicesConfig = array{ + * _defaults?: DefaultsType, + * _instanceof?: array, + * ... + * } + * @psalm-type ExtensionType = array|scalar|\UnitEnum|Param|null + * @psalm-type FrameworkConfig = array{ + * secret?: scalar|Param|null, + * http_method_override?: bool|Param, // Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. // Default: false + * allowed_http_method_override?: null|list, + * trust_x_sendfile_type_header?: scalar|Param|null, // Set true to enable support for xsendfile in binary file responses. // Default: "%env(bool:default::SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER)%" + * ide?: scalar|Param|null, // Default: "%env(default::SYMFONY_IDE)%" + * test?: bool|Param, + * default_locale?: scalar|Param|null, // Default: "en" + * set_locale_from_accept_language?: bool|Param, // Whether to use the Accept-Language HTTP header to set the Request locale (only when the "_locale" request attribute is not passed). // Default: false + * set_content_language_from_locale?: bool|Param, // Whether to set the Content-Language HTTP header on the Response using the Request locale. // Default: false + * enabled_locales?: list, + * trusted_hosts?: Param|string|list, + * trusted_proxies?: mixed, // Default: ["%env(default::SYMFONY_TRUSTED_PROXIES)%"] + * trusted_headers?: Param|string|list, + * error_controller?: scalar|Param|null, // Default: "error_controller" + * handle_all_throwables?: bool|Param, // HttpKernel will handle all kinds of \Throwable. // Default: true + * csrf_protection?: bool|array{ + * enabled?: scalar|Param|null, // Default: null + * stateless_token_ids?: list, + * check_header?: scalar|Param|null, // Whether to check the CSRF token in a header in addition to a cookie when using stateless protection. // Default: false + * cookie_name?: scalar|Param|null, // The name of the cookie to use when using stateless protection. // Default: "csrf-token" + * }, + * form?: bool|array{ // Form configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * csrf_protection?: bool|array{ + * enabled?: scalar|Param|null, // Default: null + * token_id?: scalar|Param|null, // Default: null + * field_name?: scalar|Param|null, // Default: "_token" + * field_attr?: array, + * }, + * }, + * http_cache?: bool|array{ // HTTP cache configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * debug?: bool|Param, // Default: "%kernel.debug%" + * trace_level?: "none"|"short"|"full"|Param, + * trace_header?: scalar|Param|null, + * default_ttl?: int|Param, + * private_headers?: list, + * skip_response_headers?: list, + * allow_reload?: bool|Param, + * allow_revalidate?: bool|Param, + * stale_while_revalidate?: int|Param, + * stale_if_error?: int|Param, + * terminate_on_cache_hit?: bool|Param, // Deprecated: Setting the "framework.http_cache.terminate_on_cache_hit.terminate_on_cache_hit" configuration option is deprecated. It will be removed in version 9.0. + * }, + * esi?: bool|array{ // ESI configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * }, + * ssi?: bool|array{ // SSI configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * }, + * fragments?: bool|array{ // Fragments configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * hinclude_default_template?: scalar|Param|null, // Default: null + * path?: scalar|Param|null, // Default: "/_fragment" + * }, + * profiler?: bool|array{ // Profiler configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * collect?: bool|Param, // Default: true + * collect_parameter?: scalar|Param|null, // The name of the parameter to use to enable or disable collection on a per request basis. // Default: null + * only_exceptions?: bool|Param, // Default: false + * only_main_requests?: bool|Param, // Default: false + * dsn?: scalar|Param|null, // Default: "file:%kernel.cache_dir%/profiler" + * collect_serializer_data?: true|Param, // Deprecated: Setting the "framework.profiler.collect_serializer_data.collect_serializer_data" configuration option is deprecated. It will be removed in version 9.0. // Default: true + * }, + * workflows?: bool|array{ + * enabled?: bool|Param, // Resolved at compile time // Default: false + * workflows?: array, + * definition_validators?: list, + * support_strategy?: scalar|Param|null, + * initial_marking?: \BackedEnum|Param|string|list, + * events_to_dispatch?: null|list, + * places?: Param|string|list, + * }>, + * transitions?: list, + * to?: \BackedEnum|Param|string|list, + * weight?: int|Param, // Default: 1 + * metadata?: array, + * }>, + * metadata?: array, + * }>, + * }, + * router?: bool|array{ // Router configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * resource?: scalar|Param|null, + * type?: scalar|Param|null, + * default_uri?: scalar|Param|null, // The default URI used to generate URLs in a non-HTTP context. // Default: null + * http_port?: scalar|Param|null, // Default: 80 + * https_port?: scalar|Param|null, // Default: 443 + * strict_requirements?: scalar|Param|null, // set to true to throw an exception when a parameter does not match the requirements set to false to disable exceptions when a parameter does not match the requirements (and return null instead) set to null to disable parameter checks against requirements 'true' is the preferred configuration in development mode, while 'false' or 'null' might be preferred in production // Default: true + * utf8?: bool|Param, // Default: true + * }, + * session?: bool|array{ // Session configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * storage_factory_id?: scalar|Param|null, // Default: "session.storage.factory.native" + * handler_id?: scalar|Param|null, // Defaults to using the native session handler, or to the native *file* session handler if "save_path" is not null. + * name?: scalar|Param|null, + * cookie_lifetime?: scalar|Param|null, + * cookie_path?: scalar|Param|null, + * cookie_domain?: scalar|Param|null, + * cookie_secure?: true|false|"auto"|Param, // Default: "auto" + * cookie_httponly?: bool|Param, // Default: true + * cookie_samesite?: null|"lax"|"strict"|"none"|Param, // Default: "lax" + * use_cookies?: bool|Param, + * gc_divisor?: scalar|Param|null, + * gc_probability?: scalar|Param|null, + * gc_maxlifetime?: scalar|Param|null, + * save_path?: scalar|Param|null, // Defaults to "%kernel.share_dir%/sessions" if the "handler_id" option is not null. + * metadata_update_threshold?: int|Param, // Seconds to wait between 2 session metadata updates. // Default: 0 + * }, + * request?: bool|array{ // Request configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * formats?: array>, + * }, + * assets?: bool|array{ // Assets configuration + * enabled?: bool|Param, // Resolved at compile time // Default: true + * strict_mode?: bool|Param, // Throw an exception if an entry is missing from the manifest.json. // Default: false + * version_strategy?: scalar|Param|null, // Default: null + * version?: scalar|Param|null, // Default: null + * version_format?: scalar|Param|null, // Default: "%%s?%%s" + * json_manifest_path?: scalar|Param|null, // Default: null + * base_path?: scalar|Param|null, // Default: "" + * base_urls?: Param|string|list, + * packages?: array, + * }>, + * }, + * asset_mapper?: bool|array{ // Asset Mapper configuration + * enabled?: bool|Param, // Resolved at compile time // Default: true + * paths?: Param|string|array, + * excluded_patterns?: list, + * exclude_dotfiles?: bool|Param, // If true, any files starting with "." will be excluded from the asset mapper. // Default: true + * server?: bool|Param, // If true, a "dev server" will return the assets from the public directory (true in "debug" mode only by default). // Default: true + * public_prefix?: scalar|Param|null, // The public path where the assets will be written to (and served from when "server" is true). // Default: "/assets/" + * missing_import_mode?: "strict"|"warn"|"ignore"|Param, // Behavior if an asset cannot be found when imported from JavaScript or CSS files - e.g. "import './non-existent.js'". "strict" means an exception is thrown, "warn" means a warning is logged, "ignore" means the import is left as-is. // Default: "warn" + * extensions?: array, + * importmap_path?: scalar|Param|null, // The path of the importmap.php file. // Default: "%kernel.project_dir%/importmap.php" + * importmap_polyfill?: scalar|Param|null, // The importmap name that will be used to load the polyfill. Set to false to disable. // Default: "es-module-shims" + * importmap_script_attributes?: array, + * vendor_dir?: scalar|Param|null, // The directory to store JavaScript vendors. // Default: "%kernel.project_dir%/assets/vendor" + * precompress?: bool|array{ // Precompress assets with Brotli, Zstandard and gzip. + * enabled?: bool|Param, // Resolved at compile time // Default: false + * formats?: list, + * extensions?: list, + * }, + * }, + * translator?: bool|array{ // Translator configuration + * enabled?: bool|Param, // Resolved at compile time // Default: true + * fallbacks?: Param|string|list, + * logging?: bool|Param, // Default: false + * formatter?: scalar|Param|null, // Default: "translator.formatter.default" + * cache_dir?: scalar|Param|null, // Default: "%kernel.cache_dir%/translations" + * default_path?: scalar|Param|null, // The default path used to load translations. // Default: "%kernel.project_dir%/translations" + * paths?: list, + * pseudo_localization?: bool|array{ + * enabled?: bool|Param, // Resolved at compile time // Default: false + * accents?: bool|Param, // Default: true + * expansion_factor?: float|Param, // Default: 1.0 + * brackets?: bool|Param, // Default: true + * parse_html?: bool|Param, // Default: false + * localizable_html_attributes?: list, + * }, + * providers?: array, + * locales?: list, + * }>, + * globals?: array, + * domain?: string|Param, + * }>, + * }, + * validation?: bool|array{ // Validation configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * enable_attributes?: bool|Param, // Default: true + * static_method?: Param|string|list, + * translation_domain?: scalar|Param|null, // Default: "validators" + * email_validation_mode?: "html5"|"html5-allow-no-tld"|"strict"|Param, // Default: "html5" + * mapping?: array{ + * paths?: list, + * }, + * not_compromised_password?: bool|array{ + * enabled?: bool|Param, // When disabled, compromised passwords will be accepted as valid. // Resolved at compile time // Default: true + * endpoint?: scalar|Param|null, // API endpoint for the NotCompromisedPassword Validator. // Default: null + * }, + * disable_translation?: bool|Param, // Default: false + * property_metadata_existence_check?: bool|Param, // When enabled, validateProperty() and validatePropertyValue() throw an exception if no metadata is found for the given property. // Default: false + * auto_mapping?: array, + * }>, + * }, + * serializer?: bool|array{ // Serializer configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * enable_attributes?: bool|Param, // Default: true + * name_converter?: scalar|Param|null, + * circular_reference_handler?: scalar|Param|null, + * max_depth_handler?: scalar|Param|null, + * mapping?: array{ + * paths?: list, + * }, + * default_context?: array, + * named_serializers?: array, + * include_built_in_normalizers?: bool|Param, // Whether to include the built-in normalizers // Default: true + * include_built_in_encoders?: bool|Param, // Whether to include the built-in encoders // Default: true + * }>, + * }, + * property_access?: bool|array{ // Property access configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * magic_call?: bool|Param, // Default: false + * magic_get?: bool|Param, // Default: true + * magic_set?: bool|Param, // Default: true + * throw_exception_on_invalid_index?: bool|Param, // Default: false + * throw_exception_on_invalid_property_path?: bool|Param, // Default: true + * }, + * type_info?: bool|array{ // Type info configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * aliases?: array, + * }, + * property_info?: bool|array{ // Property info configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * with_constructor_extractor?: bool|Param, // Registers the constructor extractor. // Default: true + * }, + * cache?: array{ // Cache configuration + * prefix_seed?: scalar|Param|null, // Used to namespace cache keys when using several apps with the same shared backend. // Default: "_%kernel.project_dir%.%kernel.container_class%" + * app?: scalar|Param|null, // App related cache pools configuration. // Default: "cache.adapter.filesystem" + * system?: scalar|Param|null, // System related cache pools configuration. // Default: "cache.adapter.system" + * directory?: scalar|Param|null, // Default: "%kernel.share_dir%/pools/app" + * default_psr6_provider?: scalar|Param|null, + * default_redis_provider?: scalar|Param|null, // Default: "redis://localhost" + * default_valkey_provider?: scalar|Param|null, // Default: "valkey://localhost" + * default_memcached_provider?: scalar|Param|null, // Default: "memcached://localhost" + * default_doctrine_dbal_provider?: scalar|Param|null, // Default: "database_connection" + * default_pdo_provider?: scalar|Param|null, // Default: null + * pools?: array, + * tags?: scalar|Param|null, // Default: null + * public?: bool|Param, // Default: false + * default_lifetime?: scalar|Param|null, // Default lifetime of the pool. + * provider?: scalar|Param|null, // Overwrite the setting from the default provider for this adapter. + * early_expiration_message_bus?: scalar|Param|null, + * clearer?: scalar|Param|null, + * marshaller?: scalar|Param|null, // The marshaller service to use for this pool. + * }>, + * }, + * php_errors?: array{ // PHP errors handling configuration + * log?: mixed, // Use the application logger instead of the PHP logger for logging PHP errors. // Default: true + * throw?: bool|Param, // Throw PHP errors as \ErrorException instances. // Default: true + * }, + * exceptions?: array, + * web_link?: bool|array{ // Web links configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * }, + * lock?: Param|bool|string|array{ // Lock configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * resources?: Param|string|array>, + * }, + * semaphore?: Param|bool|string|array{ // Semaphore configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * resources?: Param|string|array, + * }, + * messenger?: bool|array{ // Messenger configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * routing?: array>, + * serializer?: array{ + * default_serializer?: scalar|Param|null, // Service id to use as the default serializer for the transports. // Default: "messenger.transport.native_php_serializer" + * symfony_serializer?: array{ + * format?: scalar|Param|null, // Serialization format for the messenger.transport.symfony_serializer service (which is not the serializer used by default). // Default: "json" + * context?: array, + * }, + * }, + * transports?: array, + * failure_transport?: scalar|Param|null, // Transport name to send failed messages to (after all retries have failed). // Default: null + * retry_strategy?: Param|string|array{ + * service?: scalar|Param|null, // Service id to override the retry strategy entirely. // Default: null + * max_retries?: int|Param, // Default: 3 + * delay?: int|Param, // Time in ms to delay (or the initial value when multiplier is used). // Default: 1000 + * multiplier?: float|Param, // If greater than 1, delay will grow exponentially for each retry: this delay = (delay * (multiple ^ retries)). // Default: 2 + * max_delay?: int|Param, // Max time in ms that a retry should ever be delayed (0 = infinite). // Default: 0 + * jitter?: float|Param, // Randomness to apply to the delay (between 0 and 1). // Default: 0.1 + * }, + * rate_limiter?: scalar|Param|null, // Rate limiter name to use when processing messages. // Default: null + * }>, + * failure_transport?: scalar|Param|null, // Transport name to send failed messages to (after all retries have failed). // Default: null + * stop_worker_on_signals?: Param|int|string|list, + * default_bus?: scalar|Param|null, // Default: null + * buses?: array, + * }>, + * }>, + * }, + * scheduler?: bool|array{ // Scheduler configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * }, + * disallow_search_engine_index?: bool|Param, // Enabled by default when debug is enabled. // Default: true + * http_client?: bool|array{ // HTTP Client configuration + * enabled?: bool|Param, // Resolved at compile time // Default: true + * max_host_connections?: int|Param, // The maximum number of connections to a single host. + * default_options?: array{ + * headers?: array, + * vars?: array, + * max_redirects?: int|Param, // The maximum number of redirects to follow. + * http_version?: scalar|Param|null, // The default HTTP version, typically 1.1 or 2.0, leave to null for the best version. + * resolve?: array, + * proxy?: scalar|Param|null, // The URL of the proxy to pass requests through or null for automatic detection. + * no_proxy?: scalar|Param|null, // A comma separated list of hosts that do not require a proxy to be reached. + * timeout?: float|Param, // The idle timeout, defaults to the "default_socket_timeout" ini parameter. + * max_duration?: float|Param, // The maximum execution time for the request+response as a whole. + * bindto?: scalar|Param|null, // A network interface name, IP address, a host name or a UNIX socket to bind to. + * verify_peer?: bool|Param, // Indicates if the peer should be verified in a TLS context. + * verify_host?: bool|Param, // Indicates if the host should exist as a certificate common name. + * cafile?: scalar|Param|null, // A certificate authority file. + * capath?: scalar|Param|null, // A directory that contains multiple certificate authority files. + * local_cert?: scalar|Param|null, // A PEM formatted certificate file. + * local_pk?: scalar|Param|null, // A private key file. + * passphrase?: scalar|Param|null, // The passphrase used to encrypt the "local_pk" file. + * ciphers?: scalar|Param|null, // A list of TLS ciphers separated by colons, commas or spaces (e.g. "RC3-SHA:TLS13-AES-128-GCM-SHA256"...) + * peer_fingerprint?: array{ // Associative array: hashing algorithm => hash(es). + * sha1?: mixed, + * pin-sha256?: mixed, + * md5?: mixed, + * }, + * crypto_method?: scalar|Param|null, // The minimum version of TLS to accept; must be one of STREAM_CRYPTO_METHOD_TLSv*_CLIENT constants. + * extra?: array, + * rate_limiter?: scalar|Param|null, // Rate limiter name to use for throttling requests. // Default: null + * caching?: bool|array{ // Caching configuration. + * enabled?: bool|Param, // Resolved at compile time // Default: false + * cache_pool?: string|Param, // The taggable cache pool to use for storing the responses. // Default: "cache.http_client" + * shared?: bool|Param, // Indicates whether the cache is shared (public) or private. // Default: true + * max_ttl?: int|Param, // The maximum TTL (in seconds) allowed for cached responses. // Default: 86400 + * }, + * retry_failed?: bool|array{ + * enabled?: bool|Param, // Resolved at compile time // Default: false + * retry_strategy?: scalar|Param|null, // service id to override the retry strategy. // Default: null + * http_codes?: Param|int|string|array, + * }>, + * max_retries?: int|Param, // Default: 3 + * delay?: int|Param, // Time in ms to delay (or the initial value when multiplier is used). // Default: 1000 + * multiplier?: float|Param, // If greater than 1, delay will grow exponentially for each retry: delay * (multiple ^ retries). // Default: 2 + * max_delay?: int|Param, // Max time in ms that a retry should ever be delayed (0 = infinite). // Default: 0 + * jitter?: float|Param, // Randomness in percent (between 0 and 1) to apply to the delay. // Default: 0.1 + * }, + * }, + * mock_response_factory?: scalar|Param|null, // `true` to always return empty 200 responses, or the id of the service to use to generate mock responses - which should be either an invokable or an iterable. + * scoped_clients?: array, + * headers?: array, + * max_redirects?: int|Param, // The maximum number of redirects to follow. + * http_version?: scalar|Param|null, // The default HTTP version, typically 1.1 or 2.0, leave to null for the best version. + * resolve?: array, + * proxy?: scalar|Param|null, // The URL of the proxy to pass requests through or null for automatic detection. + * no_proxy?: scalar|Param|null, // A comma separated list of hosts that do not require a proxy to be reached. + * timeout?: float|Param, // The idle timeout, defaults to the "default_socket_timeout" ini parameter. + * max_duration?: float|Param, // The maximum execution time for the request+response as a whole. + * bindto?: scalar|Param|null, // A network interface name, IP address, a host name or a UNIX socket to bind to. + * verify_peer?: bool|Param, // Indicates if the peer should be verified in a TLS context. + * verify_host?: bool|Param, // Indicates if the host should exist as a certificate common name. + * cafile?: scalar|Param|null, // A certificate authority file. + * capath?: scalar|Param|null, // A directory that contains multiple certificate authority files. + * local_cert?: scalar|Param|null, // A PEM formatted certificate file. + * local_pk?: scalar|Param|null, // A private key file. + * passphrase?: scalar|Param|null, // The passphrase used to encrypt the "local_pk" file. + * ciphers?: scalar|Param|null, // A list of TLS ciphers separated by colons, commas or spaces (e.g. "RC3-SHA:TLS13-AES-128-GCM-SHA256"...). + * peer_fingerprint?: array{ // Associative array: hashing algorithm => hash(es). + * sha1?: mixed, + * pin-sha256?: mixed, + * md5?: mixed, + * }, + * crypto_method?: scalar|Param|null, // The minimum version of TLS to accept; must be one of STREAM_CRYPTO_METHOD_TLSv*_CLIENT constants. + * mock_response_factory?: scalar|Param|null, // `true` to always return empty 200 responses, `false` to disable mocking, or the id of the service to use to generate mock responses (invokable or iterable). + * extra?: array, + * rate_limiter?: scalar|Param|null, // Rate limiter name to use for throttling requests. // Default: null + * caching?: bool|array{ // Caching configuration. + * enabled?: bool|Param, // Resolved at compile time // Default: false + * cache_pool?: string|Param, // The taggable cache pool to use for storing the responses. // Default: "cache.http_client" + * shared?: bool|Param, // Indicates whether the cache is shared (public) or private. // Default: true + * max_ttl?: int|Param, // The maximum TTL (in seconds) allowed for cached responses. // Default: 86400 + * }, + * retry_failed?: bool|array{ + * enabled?: bool|Param, // Resolved at compile time // Default: false + * retry_strategy?: scalar|Param|null, // service id to override the retry strategy. // Default: null + * http_codes?: Param|int|string|array, + * }>, + * max_retries?: int|Param, // Default: 3 + * delay?: int|Param, // Time in ms to delay (or the initial value when multiplier is used). // Default: 1000 + * multiplier?: float|Param, // If greater than 1, delay will grow exponentially for each retry: delay * (multiple ^ retries). // Default: 2 + * max_delay?: int|Param, // Max time in ms that a retry should ever be delayed (0 = infinite). // Default: 0 + * jitter?: float|Param, // Randomness in percent (between 0 and 1) to apply to the delay. // Default: 0.1 + * }, + * }>, + * }, + * mailer?: bool|array{ // Mailer configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * message_bus?: scalar|Param|null, // The message bus to use. Defaults to the default bus if the Messenger component is installed. // Default: null + * dsn?: scalar|Param|null, // Default: null + * transports?: array, + * envelope?: array{ // Mailer Envelope configuration + * sender?: scalar|Param|null, + * recipients?: Param|string|list, + * allowed_recipients?: Param|string|list, + * }, + * headers?: array, + * dkim_signer?: bool|array{ // DKIM signer configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * key?: scalar|Param|null, // Key content, or path to key (in PEM format with the `file://` prefix) // Default: "" + * domain?: scalar|Param|null, // Default: "" + * select?: scalar|Param|null, // Default: "" + * passphrase?: scalar|Param|null, // The private key passphrase // Default: "" + * options?: array, + * }, + * smime_signer?: bool|array{ // S/MIME signer configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * key?: scalar|Param|null, // Path to key (in PEM format) // Default: "" + * certificate?: scalar|Param|null, // Path to certificate (in PEM format without the `file://` prefix) // Default: "" + * passphrase?: scalar|Param|null, // The private key passphrase // Default: null + * extra_certificates?: scalar|Param|null, // Default: null + * sign_options?: int|Param, // Default: null + * }, + * smime_encrypter?: bool|array{ // S/MIME encrypter configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * repository?: scalar|Param|null, // S/MIME certificate repository service. This service shall implement the `Symfony\Component\Mailer\EventListener\SmimeCertificateRepositoryInterface`. // Default: "" + * cipher?: int|Param, // A set of algorithms used to encrypt the message // Default: null + * }, + * }, + * secrets?: bool|array{ + * enabled?: bool|Param, // Resolved at compile time // Default: true + * vault_directory?: scalar|Param|null, // Default: "%kernel.project_dir%/config/secrets/%kernel.runtime_environment%" + * local_dotenv_file?: scalar|Param|null, // Default: "%kernel.project_dir%/.env.%kernel.environment%.local" + * decryption_env_var?: scalar|Param|null, // Default: "base64:default::SYMFONY_DECRYPTION_SECRET" + * }, + * notifier?: bool|array{ // Notifier configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * message_bus?: scalar|Param|null, // The message bus to use. Defaults to the default bus if the Messenger component is installed. // Default: null + * chatter_transports?: array, + * texter_transports?: array, + * notification_on_failed_messages?: bool|Param, // Default: false + * channel_policy?: array>, + * admin_recipients?: list, + * }, + * rate_limiter?: bool|array{ // Rate limiter configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * limiters?: array, + * limit?: int|Param, // The maximum allowed hits in a fixed interval or burst. + * interval?: scalar|Param|null, // Configures the fixed interval if "policy" is set to "fixed_window" or "sliding_window". The value must be a number followed by "second", "minute", "hour", "day", "week" or "month" (or their plural equivalent). + * rate?: array{ // Configures the fill rate if "policy" is set to "token_bucket". + * interval?: scalar|Param|null, // Configures the rate interval. The value must be a number followed by "second", "minute", "hour", "day", "week" or "month" (or their plural equivalent). + * amount?: int|Param, // Amount of tokens to add each interval. // Default: 1 + * }, + * anchor_at?: scalar|Param|null, // Aligns the "fixed_window" policy to a calendar (e.g. "2024-01-05 00:00:00 UTC" combined with `interval: 1 month` resets the counter on the 5th of each month). UTC if not specified. // Default: null + * }>, + * }, + * uid?: bool|array{ // Uid configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * default_uuid_version?: 7|6|4|1|Param, // Default: 7 + * name_based_uuid_version?: 5|3|Param, // Default: 5 + * name_based_uuid_namespace?: scalar|Param|null, + * time_based_uuid_version?: 7|6|1|Param, // Default: 7 + * time_based_uuid_node?: scalar|Param|null, + * uuid47_secret?: scalar|Param|null, // A high-entropy secret used by the "uuid47_transformer" service. Defaults to "kernel.secret". // Default: null + * }, + * html_sanitizer?: bool|array{ // HtmlSanitizer configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * sanitizers?: array, + * block_elements?: Param|string|list, + * drop_elements?: Param|string|list, + * allow_attributes?: array, + * drop_attributes?: array, + * force_attributes?: array>, + * force_https_urls?: bool|Param, // Transforms URLs using the HTTP scheme to use the HTTPS scheme instead. // Default: false + * allowed_link_schemes?: Param|string|list, + * allowed_link_hosts?: Param|null|string|list, + * allow_relative_links?: bool|Param, // Allows relative URLs to be used in links href attributes. // Default: false + * allowed_media_schemes?: Param|string|list, + * allowed_media_hosts?: Param|null|string|list, + * allow_relative_medias?: bool|Param, // Allows relative URLs to be used in media source attributes (img, audio, video, ...). // Default: false + * with_attribute_sanitizers?: Param|string|list, + * without_attribute_sanitizers?: Param|string|list, + * max_input_length?: int|Param, // The maximum length allowed for the sanitized input. // Default: 0 + * }>, + * }, + * webhook?: bool|array{ // Webhook configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * message_bus?: scalar|Param|null, // The message bus to use. // Default: "messenger.default_bus" + * event_header_name?: scalar|Param|null, // Default: "Webhook-Event" + * id_header_name?: scalar|Param|null, // Default: "Webhook-Id" + * signature_header_name?: scalar|Param|null, // Default: "Webhook-Signature" + * signing_algorithm?: scalar|Param|null, // Default: "sha256" + * routing?: array, + * }, + * remote_event?: bool|array{ // RemoteEvent configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * }, + * json_streamer?: bool|array{ // JSON streamer configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * default_options?: array{ + * include_null_properties?: bool|Param, // Encode the properties with null value // Default: false + * ... + * }, + * }, + * } + * @psalm-type TwigConfig = array{ + * form_themes?: list, + * globals?: array + * }>, + * autoescape_service?: scalar|Param|null, // Default: null + * autoescape_service_method?: scalar|Param|null, // Default: null + * cache?: scalar|Param|null, // Default: true + * charset?: scalar|Param|null, // Default: "%kernel.charset%" + * debug?: bool|Param, // Default: "%kernel.debug%" + * strict_variables?: bool|Param, // Default: "%kernel.debug%" + * auto_reload?: scalar|Param|null, + * optimizations?: int|Param, + * default_path?: scalar|Param|null, // The default path used to load templates. // Default: "%kernel.project_dir%/templates" + * file_name_pattern?: Param|string|list, + * paths?: array, + * date?: array{ // The default format options used by the date filter. + * format?: scalar|Param|null, // Default: "F j, Y H:i" + * interval_format?: scalar|Param|null, // Default: "%d days" + * timezone?: scalar|Param|null, // The timezone used when formatting dates, when set to null, the timezone returned by date_default_timezone_get() is used. // Default: null + * }, + * number_format?: array{ // The default format options for the number_format filter. + * decimals?: int|Param, // Default: 0 + * decimal_point?: scalar|Param|null, // Default: "." + * thousands_separator?: scalar|Param|null, // Default: "," + * }, + * mailer?: array{ + * html_to_text_converter?: scalar|Param|null, // A service implementing the "Symfony\Component\Mime\HtmlToTextConverter\HtmlToTextConverterInterface". // Default: null + * }, + * } + * @psalm-type WebProfilerConfig = array{ + * toolbar?: bool|array{ // Profiler toolbar configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * ajax_replace?: bool|Param, // Replace toolbar on AJAX requests // Default: false + * }, + * intercept_redirects?: bool|Param, // Resolved at compile time // Default: false + * excluded_ajax_paths?: scalar|Param|null, // Default: "^/((index|app(_[\\w]+)?)\\.php/)?_wdt" + * } + * @psalm-type SymfonycastsTailwindConfig = array{ + * input_css?: list, + * config_file?: scalar|Param|null, // Path to the tailwind.config.js file // Default: "%kernel.project_dir%/tailwind.config.js" + * binary?: scalar|Param|null, // The tailwind binary to use instead of downloading a new one // Default: null + * binary_version?: scalar|Param|null, // Tailwind CLI version to download - required unless "binary" is set (run "tailwind:init" to configure) // Default: null + * binary_platform?: "auto"|"linux-arm64"|"linux-arm64-musl"|"linux-x64"|"linux-x64-musl"|"macos-arm64"|"macos-x64"|"windows-x64"|Param, // Tailwind CLI platform to download - "auto" will try to detect the platform automatically // Default: "auto" + * postcss_config_file?: scalar|Param|null, // Path to PostCSS config file which is passed to the Tailwind CLI // Default: null + * strict_mode?: bool|Param|null, // When enabled, an exception will be thrown if there are no built assets (default: false in `test` env, true otherwise) // Default: null + * process_timeout?: int|Param, // Timeout in seconds for the Tailwind build process - use "0" to disable // Default: 60 + * } + * @psalm-type StaticContentGeneratorConfig = array{ + * output_directory?: scalar|Param|null, // Default: "%kernel.project_dir%/output" + * } + * @psalm-type StimulusConfig = array{ + * controller_paths?: list, + * controllers_json?: scalar|Param|null, // Default: "%kernel.project_dir%/assets/controllers.json" + * } + * @psalm-type MonologConfig = array{ + * use_microseconds?: scalar|Param|null, // Default: true + * timezone?: string|Param, // The timezone used for the timestamp of every log record (e.g. "UTC" or "Europe/Paris"). Defaults to the PHP default timezone. // Default: null + * channels?: list, + * handlers?: array + * }, + * path?: scalar|Param|null, // Default: "%kernel.logs_dir%/%kernel.environment%.log" + * file_permission?: scalar|Param|null, // Default: null + * use_locking?: bool|Param, // Default: false + * filename_format?: scalar|Param|null, // Default: "{filename}-{date}" + * date_format?: scalar|Param|null, // Default: "Y-m-d" + * ident?: scalar|Param|null, // Default: "php" + * logopts?: scalar|Param|null, // Default: 1 + * facility?: scalar|Param|null, // Default: "user" + * max_files?: scalar|Param|null, // Default: 0 + * action_level?: scalar|Param|null, // Default: "WARNING" + * activation_strategy?: scalar|Param|null, // Default: null + * stop_buffering?: bool|Param, // Default: true + * passthru_level?: scalar|Param|null, // Default: null + * excluded_http_codes?: list, + * }>, + * accepted_levels?: list, + * min_level?: scalar|Param|null, // Default: "DEBUG" + * max_level?: scalar|Param|null, // Default: "EMERGENCY" + * buffer_size?: scalar|Param|null, // Default: 0 + * flush_on_overflow?: bool|Param, // Default: false + * handler?: scalar|Param|null, + * url?: scalar|Param|null, + * exchange?: scalar|Param|null, + * exchange_name?: scalar|Param|null, // Default: "log" + * channel?: scalar|Param|null, // Default: null + * bot_name?: scalar|Param|null, // Default: "Monolog" + * use_attachment?: scalar|Param|null, // Default: true + * use_short_attachment?: scalar|Param|null, // Default: false + * include_extra?: scalar|Param|null, // Default: false + * icon_emoji?: scalar|Param|null, // Default: null + * webhook_url?: scalar|Param|null, + * exclude_fields?: list, + * token?: scalar|Param|null, + * region?: scalar|Param|null, + * source?: scalar|Param|null, + * use_ssl?: bool|Param, // Default: true + * user?: mixed, + * title?: scalar|Param|null, // Default: null + * host?: scalar|Param|null, // Default: null + * port?: scalar|Param|null, // Default: 514 + * rfc?: scalar|Param|null, // Default: 1 + * config?: list, + * members?: list, + * connection_string?: scalar|Param|null, + * timeout?: scalar|Param|null, + * time?: scalar|Param|null, // Default: 60 + * deduplication_level?: scalar|Param|null, // Default: 400 + * store?: scalar|Param|null, // Default: null + * connection_timeout?: scalar|Param|null, + * persistent?: bool|Param, + * message_type?: scalar|Param|null, // Default: 0 + * expand_newlines?: bool|Param, // Default: false + * parse_mode?: scalar|Param|null, // Default: null + * disable_webpage_preview?: bool|Param|null, // Default: null + * disable_notification?: bool|Param|null, // Default: null + * split_long_messages?: bool|Param, // Default: false + * delay_between_messages?: bool|Param, // Default: false + * topic?: int|Param, // Default: null + * factor?: int|Param, // Default: 1 + * tags?: Param|string|list, + * console_formatter_options?: mixed, // Default: [] + * formatter?: scalar|Param|null, + * nested?: bool|Param, // Default: false + * publisher?: Param|string|array{ + * id?: scalar|Param|null, + * hostname?: scalar|Param|null, + * port?: scalar|Param|null, // Default: 12201 + * chunk_size?: scalar|Param|null, // Default: 1420 + * encoder?: "json"|"compressed_json"|Param, + * }, + * mongodb?: Param|string|array{ + * id?: scalar|Param|null, // ID of a MongoDB\Client service + * uri?: scalar|Param|null, + * username?: scalar|Param|null, + * password?: scalar|Param|null, + * database?: scalar|Param|null, // Default: "monolog" + * collection?: scalar|Param|null, // Default: "logs" + * }, + * elasticsearch?: Param|string|array{ + * id?: scalar|Param|null, + * hosts?: list, + * host?: scalar|Param|null, + * port?: scalar|Param|null, // Default: 9200 + * transport?: scalar|Param|null, // Default: "Http" + * user?: scalar|Param|null, // Default: null + * password?: scalar|Param|null, // Default: null + * }, + * index?: scalar|Param|null, // Default: "monolog" + * document_type?: scalar|Param|null, // Default: "logs" + * ignore_error?: scalar|Param|null, // Default: false + * redis?: Param|string|array{ + * id?: scalar|Param|null, + * host?: scalar|Param|null, + * password?: scalar|Param|null, // Default: null + * port?: scalar|Param|null, // Default: 6379 + * database?: scalar|Param|null, // Default: 0 + * key_name?: scalar|Param|null, // Default: "monolog_redis" + * }, + * predis?: Param|string|array{ // Deprecated: The "predis" option is deprecated and ignored, use the "redis" option to configure the Predis client. + * id?: scalar|Param|null, + * host?: scalar|Param|null, + * }, + * from_email?: scalar|Param|null, + * to_email?: Param|string|list, + * subject?: scalar|Param|null, + * content_type?: scalar|Param|null, // Default: null + * headers?: list, + * parameters?: list, + * mailer?: scalar|Param|null, // Default: null + * email_prototype?: Param|string|array{ + * id?: scalar|Param|null, + * method?: scalar|Param|null, // Default: null + * }, + * verbosity_levels?: array{ + * VERBOSITY_QUIET?: scalar|Param|null, // Default: "ERROR" + * VERBOSITY_NORMAL?: scalar|Param|null, // Default: "WARNING" + * VERBOSITY_VERBOSE?: scalar|Param|null, // Default: "NOTICE" + * VERBOSITY_VERY_VERBOSE?: scalar|Param|null, // Default: "INFO" + * VERBOSITY_DEBUG?: scalar|Param|null, // Default: "DEBUG" + * }, + * channels?: Param|string|array{ + * type?: scalar|Param|null, + * elements?: list, + * ... + * }, + * }>, + * } + * @psalm-type TwigExtraConfig = array{ + * cache?: bool|array{ + * enabled?: bool|Param, // Resolved at compile time // Default: false + * }, + * html?: bool|array{ + * enabled?: bool|Param, // Resolved at compile time // Default: false + * }, + * markdown?: bool|array{ + * enabled?: bool|Param, // Resolved at compile time // Default: true + * }, + * intl?: bool|array{ + * enabled?: bool|Param, // Resolved at compile time // Default: false + * }, + * cssinliner?: bool|array{ + * enabled?: bool|Param, // Resolved at compile time // Default: false + * }, + * inky?: bool|array{ + * enabled?: bool|Param, // Resolved at compile time // Default: false + * }, + * string?: bool|array{ + * enabled?: bool|Param, // Resolved at compile time // Default: false + * }, + * commonmark?: array{ + * renderer?: array{ // Array of options for rendering HTML. + * block_separator?: scalar|Param|null, + * inner_separator?: scalar|Param|null, + * soft_break?: scalar|Param|null, + * }, + * html_input?: "strip"|"allow"|"escape"|Param, // How to handle HTML input. + * allow_unsafe_links?: bool|Param, // Remove risky link and image URLs by setting this to false. // Default: true + * max_nesting_level?: int|Param, // The maximum nesting level for blocks. // Default: 9223372036854775807 + * max_delimiters_per_line?: int|Param, // The maximum number of strong/emphasis delimiters per line. // Default: 9223372036854775807 + * slug_normalizer?: array{ // Array of options for configuring how URL-safe slugs are created. + * instance?: mixed, + * max_length?: int|Param, // Default: 255 + * unique?: mixed, + * }, + * commonmark?: array{ // Array of options for configuring the CommonMark core extension. + * enable_em?: bool|Param, // Default: true + * enable_strong?: bool|Param, // Default: true + * use_asterisk?: bool|Param, // Default: true + * use_underscore?: bool|Param, // Default: true + * unordered_list_markers?: list, + * }, + * ... + * }, + * } + * @psalm-type PrestaSitemapConfig = array{ + * generator?: scalar|Param|null, // Default: "presta_sitemap.generator_default" + * dumper?: scalar|Param|null, // Default: "presta_sitemap.dumper_default" + * timetolive?: int|Param, // Default: 3600 + * sitemap_file_prefix?: scalar|Param|null, // Sets sitemap filename prefix defaults to "sitemap" -> sitemap.xml (for index); sitemap.
.xml(.gz) (for sitemaps) // Default: "sitemap" + * items_by_set?: int|Param, // The maximum number of items allowed in single sitemap. // Default: 50000 + * route_annotation_listener?: scalar|Param|null, // Default: true + * dump_directory?: scalar|Param|null, // The directory to which the sitemap will be dumped. It can be either absolute, or relative (to the place where the command will be triggered). Default to Symfony's public dir. // Default: "%kernel.project_dir%/public" + * defaults?: array{ + * priority?: scalar|Param|null, // Default: 0.5 + * changefreq?: scalar|Param|null, // Default: "daily" + * lastmod?: scalar|Param|null, // Default: "now" + * }, + * default_section?: scalar|Param|null, // The default section in which static routes are registered. // Default: "default" + * alternate?: bool|array{ // Automatically generate alternate (hreflang) urls with static routes. Requires route_annotation_listener config to be enabled. + * enabled?: bool|Param, // Resolved at compile time // Default: false + * default_locale?: scalar|Param|null, // The default locale of your routes. // Default: "en" + * locales?: Param|string|list, + * i18n?: "symfony"|"jms"|Param, // Strategy used to create your i18n routes. // Default: "symfony" + * }, + * } + * @psalm-type FlowTelemetryConfig = array{ + * enabled?: bool|Param, // Enable the bundle. When false no flow.telemetry.* service is registered (default: true) // Default: true + * resource?: array{ // OpenTelemetry Resource configuration with automatic detection (https://opentelemetry.io/docs/specs/semconv/resource/) + * detectors?: array{ // Resource detector configuration for automatic attribute detection + * enabled?: bool|Param, // Enable resource detectors (default: true) // Default: true + * static?: array{ // Static detectors - values that do not change while a process runs + * cache?: array{ // File cache for the two detections that cost something. os and host are stored in sys_get_temp_dir()/flow_telemetry_resource_host.cache: they are the same for every application on a host. git is stored in %kernel.cache_dir%/flow_telemetry_resource_git.cache, which a release replaces. Every other attribute is read in every process. + * enabled?: bool|Param, // Cache the os, host and git resource attributes // Default: true + * }, + * os?: array{ // OS detector - detects os.type, os.name, os.version, os.description + * enabled?: bool|Param, // Default: true + * }, + * host?: array{ // Host detector - detects host.name, host.arch, host.id + * enabled?: bool|Param, // Default: true + * }, + * service?: array{ // Service detector - detects service.name and service.version from composer.json + * enabled?: bool|Param, // Default: true + * }, + * deployment?: array{ // Deployment detector - detects deployment.environment.name from Symfony kernel environment + * enabled?: bool|Param, // Default: true + * }, + * git?: array{ // Git detector - detects vcs.ref.head.* and vcs.repository.url.full by invoking the git binary. Disabled by default; the remote URL is reported with any embedded credentials stripped. + * enabled?: bool|Param, // Enable the git detector (default: false) // Default: false + * binary?: scalar|Param|null, // Path to the git binary (default: "git", resolved from $PATH) // Default: "git" + * working_directory?: scalar|Param|null, // Directory to run git in (default: %kernel.project_dir%) // Default: null + * }, + * environment?: array{ // Environment detector - reads OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES + * enabled?: bool|Param, // Default: true + * }, + * }, + * dynamic?: array{ // Dynamic detectors - values that may change between requests/commands (never cached) + * process?: array{ // Process detector - detects process.pid, process.runtime.*, process.executable.* + * enabled?: bool|Param, // Default: true + * }, + * }, + * }, + * custom?: array, + * }, + * clock_service_id?: scalar|Param|null, // Custom PSR-20 clock service ID. If not provided, uses built-in SystemClock. // Default: null + * framework_logger?: scalar|Param|null, // Name of the logger (matching a key under "loggers", or "default") whose PSR-3 wrapper will be aliased to Symfony's "logger" service. Leave null to auto-replace only when Symfony's default HttpKernel Logger is currently bound. // Default: null + * capture_framework_channels?: bool|Param, // Reroute services Symfony tags "monolog.logger" to per-channel Flow telemetry loggers. Disabled by default to avoid colliding with MonologBundle, which claims the same tag. // Default: false + * channel_attribute_target?: "scope"|"signal"|"both"|Param, // Where the "flow.log.channel" attribute of a synthesized channel logger is placed: "scope" (instrumentation scope), "signal" (every emitted record), or "both" (default). Applies to framework-captured and #[WithTelemetryChannel] channels alike. // Default: "both" + * context_storage?: array{ // Context storage configuration + * type?: "memory"|"service"|Param, // Default: "memory" + * service_id?: scalar|Param|null, // Custom context storage service ID (only for type: service) // Default: null + * }, + * propagator?: array{ // Context propagator configuration for distributed tracing + * type?: "w3c"|"tracecontext"|"baggage"|"service"|Param, // Propagator type: 'w3c' (W3C TraceContext + Baggage), 'tracecontext' (W3C TraceContext only), 'baggage' (W3C Baggage only), 'service' (custom) // Default: "w3c" + * service_id?: scalar|Param|null, // Custom propagator service ID (only for type: service) // Default: null + * }, + * error_handlers?: array, + * service_id?: scalar|Param|null, // Custom error handler service ID (only for type: service) // Default: null + * }>, + * exporters?: array, + * connect_timeout_ms?: int|Param, // Connection-establishment deadline in milliseconds (curl/async_curl only; curl default 250ms, async_curl default 1500ms). + * pump_timeout_ms?: int|Param, // Per-tick() bounded pump budget in milliseconds (async_curl only). 0 = single non-blocking exec round. Default 100ms. + * shutdown_timeout_ms?: int|Param, // Wall-clock budget in milliseconds for draining pending requests at shutdown (curl/grpc). Default 5000ms. + * compression?: bool|Param, // Enable automatic response decompression (curl only) // Default: false + * follow_redirects?: bool|Param, // Follow HTTP redirects (curl only) // Default: true + * max_redirects?: int|Param, // Maximum number of redirects to follow (curl only) // Default: 3 + * proxy?: scalar|Param|null, // Proxy server URL (curl only) // Default: null + * ssl_verify_peer?: bool|Param, // Verify SSL peer certificate (curl only) // Default: true + * ssl_verify_host?: bool|Param, // Verify SSL host name (curl only) // Default: true + * ssl_cert_path?: scalar|Param|null, // Path to SSL client certificate (curl only) // Default: null + * ssl_key_path?: scalar|Param|null, // Path to SSL client private key (curl only) // Default: null + * ca_info_path?: scalar|Param|null, // Path to CA certificate bundle (curl only) // Default: null + * insecure?: bool|Param, // Allow insecure connections (grpc only) // Default: true + * service_id?: scalar|Param|null, // Custom transport service ID (only for type: service) // Default: null + * encoding?: "json"|"protobuf"|Param, // OTLP wire encoding (curl only); JSON or Protobuf as defined by the OTLP/HTTP spec // Default: "json" + * failover?: array{ // Optional failover transport receiving prior batches when the primary transport fails (curl/grpc primaries only). + * type?: "curl"|"async_curl"|"grpc"|"stream"|"service"|Param, // Transport type: 'curl' (synchronous), 'async_curl' (curl_multi, requires pumping), 'grpc', 'stream', 'service' // Default: "curl" + * endpoint?: scalar|Param|null, // OTLP endpoint URL for curl/grpc, or destination file path / php:// stream wrapper URI for stream (required unless type: service) // Default: null + * file_permissions?: int|Param, // Permissions applied when creating new files (stream only; ignored for php:// destinations) // Default: 420 + * create_directories?: bool|Param, // Create parent directories of the destination path if they do not exist (stream only; ignored for php:// destinations) // Default: true + * timeout_ms?: int|Param, // Per-request deadline in milliseconds (curl: total request, default 10000ms; async_curl: default 5000ms; grpc: default 250ms). + * headers?: array, + * connect_timeout_ms?: int|Param, // Connection-establishment deadline in milliseconds (curl/async_curl only; curl default 250ms, async_curl default 1500ms). + * pump_timeout_ms?: int|Param, // Per-tick() bounded pump budget in milliseconds (async_curl only). 0 = single non-blocking exec round. Default 100ms. + * shutdown_timeout_ms?: int|Param, // Wall-clock budget in milliseconds for draining pending requests at shutdown (curl/grpc). Default 5000ms. + * compression?: bool|Param, // Enable automatic response decompression (curl only) // Default: false + * follow_redirects?: bool|Param, // Follow HTTP redirects (curl only) // Default: true + * max_redirects?: int|Param, // Maximum number of redirects to follow (curl only) // Default: 3 + * proxy?: scalar|Param|null, // Proxy server URL (curl only) // Default: null + * ssl_verify_peer?: bool|Param, // Verify SSL peer certificate (curl only) // Default: true + * ssl_verify_host?: bool|Param, // Verify SSL host name (curl only) // Default: true + * ssl_cert_path?: scalar|Param|null, // Path to SSL client certificate (curl only) // Default: null + * ssl_key_path?: scalar|Param|null, // Path to SSL client private key (curl only) // Default: null + * ca_info_path?: scalar|Param|null, // Path to CA certificate bundle (curl only) // Default: null + * insecure?: bool|Param, // Allow insecure connections (grpc only) // Default: true + * service_id?: scalar|Param|null, // Custom transport service ID (only for type: service) // Default: null + * encoding?: "json"|"protobuf"|Param, // OTLP wire encoding (curl only); JSON or Protobuf as defined by the OTLP/HTTP spec // Default: "json" + * ... + * }, + * ... + * }, + * }, + * service?: array{ // Aliases an existing Symfony service implementing Flow\Telemetry\Exporter\Exporter + * id?: scalar|Param|null, // Service id of the user-provided exporter (required) + * }, + * console?: array, + * memory?: array, + * void?: array, + * }>, + * tracer_provider?: array{ // TracerProvider configuration. Defaults to void if omitted. + * error_handler?: scalar|Param|null, // Name of an error_handler entry forwarded to the TracerProvider // Default: "default" + * sampler?: array{ // Trace sampler configuration + * type?: "always_on"|"always_off"|"trace_id_ratio"|"parent_based"|"attribute_matching"|"service"|Param, // Default: "parent_based" + * ratio?: float|Param, // Sampling ratio for trace_id_ratio type (0.0 to 1.0) // Default: 1.0 + * service_id?: scalar|Param|null, // Custom sampler service ID (only for type: service) // Default: null + * exclude?: bool|Param, // attribute_matching: when true (default) a match drops the span; when false only matching spans are sampled // Default: true + * sources?: list<"signal"|"resource"|"scope"|Param>, + * cache_dir?: scalar|Param|null, // attribute_matching: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters // Default: null + * cache_dir_permissions?: int|Param, // attribute_matching: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750) // Default: 448 + * matcher?: mixed, // attribute_matching: the matcher tree (all/any/not or a leaf rule { path, mode, value, case_sensitive? }); nestable to any depth // Default: null + * root?: array{ // parent_based: sampler used for root spans that have no parent (default: always_on). Set to always_off to trace only requests that arrive with a sampled traceparent. + * type?: "always_on"|"always_off"|"trace_id_ratio"|Param, // Default: "always_on" + * ratio?: float|Param, // Default: 1.0 + * }, + * delegate?: array{ // attribute_matching: sampler that decides spans which do not match (default: always_on) + * type?: "always_on"|"always_off"|"trace_id_ratio"|Param, // Default: "always_on" + * ratio?: float|Param, // Default: 1.0 + * }, + * }, + * processor?: array{ // Span processor configuration + * type?: "composite"|"memory"|"batching"|"passthrough"|"void"|"service"|"attribute_filtering"|Param, // Default: "void" + * batch_size?: int|Param, // Batch size for batching processor // Default: 512 + * max_batch_age?: float|Param, // Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled) // Default: null + * exporter?: scalar|Param|null, // Name of a top-level exporter referenced by this processor // Default: null + * service_id?: scalar|Param|null, // Custom processor service ID (only for type: service) // Default: null + * minimum_severity?: "trace"|"debug"|"info"|"warn"|"error"|"fatal"|Param, // Minimum severity level for severity_filtering processor (only for log processors) // Default: "info" + * error_handler?: scalar|Param|null, // Name of an error_handler entry forwarded to this processor // Default: "default" + * exclude?: bool|Param, // attribute_filtering: when true (default) a match drops the signal; when false only matching signals are kept // Default: true + * sources?: list<"signal"|"resource"|"scope"|Param>, + * cache_dir?: scalar|Param|null, // attribute_filtering: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters // Default: null + * cache_dir_permissions?: int|Param, // attribute_filtering: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750) // Default: 448 + * matcher?: mixed, // attribute_filtering: the matcher tree. A node is exactly one of: "all"/"any" (a list of child matchers), "not" (a single child matcher), or a leaf rule { path, mode, value, case_sensitive? }. Nestable to any depth. // Default: null + * processors?: list, + * cache_dir?: scalar|Param|null, // Default: null + * cache_dir_permissions?: int|Param, // Default: 448 + * matcher?: mixed, // Default: null + * inner_processor?: array{ // Inner (wrapped) processor for severity_filtering / attribute_filtering + * type?: "memory"|"batching"|"passthrough"|"void"|"service"|Param, + * batch_size?: int|Param, // Batch size for batching processor // Default: 512 + * max_batch_age?: float|Param, // Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled) // Default: null + * exporter?: scalar|Param|null, // Name of a top-level exporter referenced by this processor // Default: null + * service_id?: scalar|Param|null, // Custom processor service ID (only for type: service) // Default: null + * error_handler?: scalar|Param|null, // Name of an error_handler entry forwarded to the inner processor // Default: "default" + * }, + * }>, + * inner_processor?: array{ // Inner (wrapped) processor for severity_filtering / attribute_filtering + * type?: "memory"|"batching"|"passthrough"|"void"|"service"|Param, + * batch_size?: int|Param, // Batch size for batching processor // Default: 512 + * max_batch_age?: float|Param, // Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled) // Default: null + * exporter?: scalar|Param|null, // Name of a top-level exporter referenced by this processor // Default: null + * service_id?: scalar|Param|null, // Custom processor service ID (only for type: service) // Default: null + * error_handler?: scalar|Param|null, // Name of an error_handler entry forwarded to the inner processor // Default: "default" + * }, + * middleware?: list, + * minimum_severity?: "trace"|"debug"|"info"|"warn"|"error"|"fatal"|Param, // severity_filtering: minimum severity level // Default: "info" + * exclude?: bool|Param, // attribute_filtering: when true (default) a match drops the entry; when false only matching entries are kept // Default: true + * sources?: list<"signal"|"resource"|"scope"|Param>, + * cache_dir?: scalar|Param|null, // attribute_filtering: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters // Default: null + * cache_dir_permissions?: int|Param, // attribute_filtering: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750) // Default: 448 + * matcher?: mixed, // attribute_filtering: the matcher tree (all/any/not or a leaf rule { path, mode, value, case_sensitive? }); nestable to any depth // Default: null + * }>, + * sink?: array{ // Terminal processor for the pipeline (only for type: pipeline) + * type?: "composite"|"memory"|"batching"|"passthrough"|"void"|"service"|Param, + * batch_size?: int|Param, // Default: 512 + * max_batch_age?: float|Param, // Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled) // Default: null + * exporter?: scalar|Param|null, // Default: null + * service_id?: scalar|Param|null, // Default: null + * error_handler?: scalar|Param|null, // Default: "default" + * processors?: list, + * }, + * }, + * }, + * meter_provider?: array{ // MeterProvider configuration. Defaults to void if omitted. + * error_handler?: scalar|Param|null, // Name of an error_handler entry forwarded to the MeterProvider // Default: "default" + * temporality?: "cumulative"|"delta"|Param, // Aggregation temporality // Default: "cumulative" + * processor?: array{ // Metric processor configuration + * type?: "composite"|"memory"|"batching"|"passthrough"|"void"|"service"|"attribute_filtering"|Param, // Default: "void" + * batch_size?: int|Param, // Batch size for batching processor // Default: 512 + * max_batch_age?: float|Param, // Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled) // Default: null + * exporter?: scalar|Param|null, // Name of a top-level exporter referenced by this processor // Default: null + * service_id?: scalar|Param|null, // Custom processor service ID (only for type: service) // Default: null + * minimum_severity?: "trace"|"debug"|"info"|"warn"|"error"|"fatal"|Param, // Minimum severity level for severity_filtering processor (only for log processors) // Default: "info" + * error_handler?: scalar|Param|null, // Name of an error_handler entry forwarded to this processor // Default: "default" + * exclude?: bool|Param, // attribute_filtering: when true (default) a match drops the signal; when false only matching signals are kept // Default: true + * sources?: list<"signal"|"resource"|"scope"|Param>, + * cache_dir?: scalar|Param|null, // attribute_filtering: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters // Default: null + * cache_dir_permissions?: int|Param, // attribute_filtering: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750) // Default: 448 + * matcher?: mixed, // attribute_filtering: the matcher tree. A node is exactly one of: "all"/"any" (a list of child matchers), "not" (a single child matcher), or a leaf rule { path, mode, value, case_sensitive? }. Nestable to any depth. // Default: null + * processors?: list, + * cache_dir?: scalar|Param|null, // Default: null + * cache_dir_permissions?: int|Param, // Default: 448 + * matcher?: mixed, // Default: null + * inner_processor?: array{ // Inner (wrapped) processor for severity_filtering / attribute_filtering + * type?: "memory"|"batching"|"passthrough"|"void"|"service"|Param, + * batch_size?: int|Param, // Batch size for batching processor // Default: 512 + * max_batch_age?: float|Param, // Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled) // Default: null + * exporter?: scalar|Param|null, // Name of a top-level exporter referenced by this processor // Default: null + * service_id?: scalar|Param|null, // Custom processor service ID (only for type: service) // Default: null + * error_handler?: scalar|Param|null, // Name of an error_handler entry forwarded to the inner processor // Default: "default" + * }, + * }>, + * inner_processor?: array{ // Inner (wrapped) processor for severity_filtering / attribute_filtering + * type?: "memory"|"batching"|"passthrough"|"void"|"service"|Param, + * batch_size?: int|Param, // Batch size for batching processor // Default: 512 + * max_batch_age?: float|Param, // Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled) // Default: null + * exporter?: scalar|Param|null, // Name of a top-level exporter referenced by this processor // Default: null + * service_id?: scalar|Param|null, // Custom processor service ID (only for type: service) // Default: null + * error_handler?: scalar|Param|null, // Name of an error_handler entry forwarded to the inner processor // Default: "default" + * }, + * middleware?: list, + * minimum_severity?: "trace"|"debug"|"info"|"warn"|"error"|"fatal"|Param, // severity_filtering: minimum severity level // Default: "info" + * exclude?: bool|Param, // attribute_filtering: when true (default) a match drops the entry; when false only matching entries are kept // Default: true + * sources?: list<"signal"|"resource"|"scope"|Param>, + * cache_dir?: scalar|Param|null, // attribute_filtering: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters // Default: null + * cache_dir_permissions?: int|Param, // attribute_filtering: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750) // Default: 448 + * matcher?: mixed, // attribute_filtering: the matcher tree (all/any/not or a leaf rule { path, mode, value, case_sensitive? }); nestable to any depth // Default: null + * }>, + * sink?: array{ // Terminal processor for the pipeline (only for type: pipeline) + * type?: "composite"|"memory"|"batching"|"passthrough"|"void"|"service"|Param, + * batch_size?: int|Param, // Default: 512 + * max_batch_age?: float|Param, // Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled) // Default: null + * exporter?: scalar|Param|null, // Default: null + * service_id?: scalar|Param|null, // Default: null + * error_handler?: scalar|Param|null, // Default: "default" + * processors?: list, + * }, + * }, + * }, + * logger_provider?: array{ // LoggerProvider configuration. Defaults to void if omitted. + * error_handler?: scalar|Param|null, // Name of an error_handler entry forwarded to the LoggerProvider // Default: "default" + * console_output?: bool|array{ // Tee emitted log records to the running console command output, filtered by CLI verbosity (-v/-vv/-vvv). The Flow equivalent of Symfony's Monolog ConsoleHandler; display only, exporters are unaffected. Off by default. + * enabled?: bool|Param, // Resolved at compile time // Default: false + * verbosity_levels?: array, + * }, + * processor?: array{ // Log processor configuration + * type?: "composite"|"memory"|"batching"|"passthrough"|"void"|"service"|"pipeline"|Param, // Default: "void" + * batch_size?: int|Param, // Batch size for batching processor // Default: 512 + * max_batch_age?: float|Param, // Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled) // Default: null + * exporter?: scalar|Param|null, // Name of a top-level exporter referenced by this processor // Default: null + * service_id?: scalar|Param|null, // Custom processor service ID (only for type: service) // Default: null + * minimum_severity?: "trace"|"debug"|"info"|"warn"|"error"|"fatal"|Param, // Minimum severity level for severity_filtering processor (only for log processors) // Default: "info" + * error_handler?: scalar|Param|null, // Name of an error_handler entry forwarded to this processor // Default: "default" + * exclude?: bool|Param, // attribute_filtering: when true (default) a match drops the signal; when false only matching signals are kept // Default: true + * sources?: list<"signal"|"resource"|"scope"|Param>, + * cache_dir?: scalar|Param|null, // attribute_filtering: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters // Default: null + * cache_dir_permissions?: int|Param, // attribute_filtering: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750) // Default: 448 + * matcher?: mixed, // attribute_filtering: the matcher tree. A node is exactly one of: "all"/"any" (a list of child matchers), "not" (a single child matcher), or a leaf rule { path, mode, value, case_sensitive? }. Nestable to any depth. // Default: null + * processors?: list, + * cache_dir?: scalar|Param|null, // Default: null + * cache_dir_permissions?: int|Param, // Default: 448 + * matcher?: mixed, // Default: null + * inner_processor?: array{ // Inner (wrapped) processor for severity_filtering / attribute_filtering + * type?: "memory"|"batching"|"passthrough"|"void"|"service"|Param, + * batch_size?: int|Param, // Batch size for batching processor // Default: 512 + * max_batch_age?: float|Param, // Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled) // Default: null + * exporter?: scalar|Param|null, // Name of a top-level exporter referenced by this processor // Default: null + * service_id?: scalar|Param|null, // Custom processor service ID (only for type: service) // Default: null + * error_handler?: scalar|Param|null, // Name of an error_handler entry forwarded to the inner processor // Default: "default" + * }, + * }>, + * inner_processor?: array{ // Inner (wrapped) processor for severity_filtering / attribute_filtering + * type?: "memory"|"batching"|"passthrough"|"void"|"service"|Param, + * batch_size?: int|Param, // Batch size for batching processor // Default: 512 + * max_batch_age?: float|Param, // Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled) // Default: null + * exporter?: scalar|Param|null, // Name of a top-level exporter referenced by this processor // Default: null + * service_id?: scalar|Param|null, // Custom processor service ID (only for type: service) // Default: null + * error_handler?: scalar|Param|null, // Name of an error_handler entry forwarded to the inner processor // Default: "default" + * }, + * middleware?: list, + * minimum_severity?: "trace"|"debug"|"info"|"warn"|"error"|"fatal"|Param, // severity_filtering: minimum severity level // Default: "info" + * exclude?: bool|Param, // attribute_filtering: when true (default) a match drops the entry; when false only matching entries are kept // Default: true + * sources?: list<"signal"|"resource"|"scope"|Param>, + * cache_dir?: scalar|Param|null, // attribute_filtering: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters // Default: null + * cache_dir_permissions?: int|Param, // attribute_filtering: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750) // Default: 448 + * matcher?: mixed, // attribute_filtering: the matcher tree (all/any/not or a leaf rule { path, mode, value, case_sensitive? }); nestable to any depth // Default: null + * }>, + * sink?: array{ // Terminal processor for the pipeline (only for type: pipeline) + * type?: "composite"|"memory"|"batching"|"passthrough"|"void"|"service"|Param, + * batch_size?: int|Param, // Default: 512 + * max_batch_age?: float|Param, // Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled) // Default: null + * exporter?: scalar|Param|null, // Default: null + * service_id?: scalar|Param|null, // Default: null + * error_handler?: scalar|Param|null, // Default: "default" + * processors?: list, + * }, + * }, + * }, + * instrumentation?: array{ // Auto-instrumentation configuration + * sanitization?: array{ // Sanitization of sensitive data in instrumentation attributes (OpenTelemetry semconv "instrumentation general sanitization") + * url?: array{ // URL sanitization for url.full / url.query of http_kernel, http_client and psr18_client spans + * sensitive_query_parameters?: list, + * }, + * }, + * http_kernel?: bool|array{ // HTTP kernel request tracing configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * exclude_paths?: list, + * context_propagation?: bool|Param, // Extract trace context from incoming request headers and inject it into outgoing response headers (requires flow-php/symfony-http-foundation-telemetry-bridge; silently disabled when absent) // Default: true + * context_propagation_query?: bool|Param, // Also extract trace context from the URL query string (for links / full-page navigations that cannot send headers); headers take precedence. Security: lets callers inject a traceparent, so keep off unless needed. Requires context_propagation. // Default: false + * require_trace_context?: bool|Param, // Only trace requests that arrive with a trace context (traceparent header, or query string when context_propagation_query is on). Requests without one are suppressed entirely, including their DBAL/cache spans. Scoped to HTTP only - console commands and messenger workers are unaffected. Requires context_propagation. // Default: false + * route_naming?: "path"|"name"|Param, // What routed request spans use for their name and the http.route attribute: "path" (route path template, e.g. /orders/{id}; OTEL semconv default) or "name" (Symfony route name). Sub-requests fall back to the controller; unrouted requests use the method only. // Default: "path" + * trace_controller?: bool|Param, // Trace controller body execution as a child of the request span (span name = resolved controller) // Default: true + * trace_controller_resolution?: bool|Param, // Trace controller resolution (controller.get_callable span); opt-in, finer detail // Default: false + * trace_controller_arguments?: bool|Param, // Trace argument resolution as a single aggregate span (controller.get_arguments); opt-in // Default: false + * trace_controller_argument_resolvers?: bool|Param, // Trace each argument value resolver individually (controller.argument_value_resolver span); opt-in, higher cardinality // Default: false + * }, + * console?: bool|array{ // Console command tracing configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * exclude_commands?: list, + * }, + * messenger?: bool|array{ // Messenger tracing configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * context_propagation?: bool|Param, // Enable context propagation across message boundaries (requires propagator) // Default: true + * trace?: bool|Param, // Emit a per-message span for each consumed/produced message. When false, the worker is fully suppressed and only metrics are emitted (if metrics are enabled). // Default: true + * metrics?: bool|Param, // Emit OTEL messaging metrics for consumed/sent messages (messaging.client.consumed.messages, messaging.client.sent.messages) and processing duration (messaging.process.duration) // Default: true + * span_naming?: "transport"|"message_name"|"message_fqcn"|Param, // What messenger spans use for the part of their name after the operation: "transport" (OTEL semconv destination, e.g. "process async"; unknown on dispatch, so producer spans are named after the operation alone; default), "message_name" (message short class name, e.g. "send CreateOrderMessage") or "message_fqcn" (fully qualified class name). The transport stays on the messaging.destination.name attribute regardless. // Default: "transport" + * }, + * twig?: bool|array{ // Twig template tracing configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * trace_templates?: bool|Param, // Trace template rendering // Default: true + * trace_blocks?: bool|Param, // Trace block rendering // Default: false + * trace_macros?: bool|Param, // Trace macro execution // Default: false + * exclude_templates?: list, + * }, + * security?: bool|array{ // Decorate the request span with the authenticated user (requires symfony/security-core; login capture requires symfony/security-http) + * enabled?: bool|Param, // Resolved at compile time // Default: false + * fields?: array{ + * id?: array{ // User identifier (TokenInterface::getUserIdentifier()) + * enabled?: bool|Param, // Default: true + * attribute?: scalar|Param|null, // Span attribute key // Default: "user.id" + * }, + * roles?: array{ // Token role names (TokenInterface::getRoleNames()) + * enabled?: bool|Param, // Default: false + * attribute?: scalar|Param|null, // Span attribute key // Default: "user.roles" + * }, + * email?: array{ // User email, read from a getter on the user object + * enabled?: bool|Param, // Default: false + * attribute?: scalar|Param|null, // Span attribute key // Default: "user.email" + * getter?: scalar|Param|null, // User method to read the email from // Default: "getEmail" + * }, + * }, + * }, + * http_client?: bool|array{ // HTTP client request tracing configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * exclude_clients?: list, + * }, + * psr18_client?: bool|array{ // PSR-18 HTTP client request tracing configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * exclude_clients?: list, + * }, + * dbal?: bool|array{ // Doctrine DBAL query tracing configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * max_sql_length?: int|Param, // Maximum SQL length in span attributes (0 = no limit) // Default: 1000 + * collect_metrics?: bool|Param, // Record the db.client.operation.duration histogram // Default: true + * include_parameters?: bool|Param, // Include bound statement parameters in span attributes (security consideration) // Default: false + * max_parameters?: int|Param, // Maximum number of parameters to include when include_parameters is enabled // Default: 10 + * max_parameter_length?: int|Param, // Maximum length for each included parameter value // Default: 100 + * transaction_spans?: "grouped"|"per_operation"|"off"|Param, // How transactions are traced: "grouped" (one BEGIN TRANSACTION span holding the queries), "per_operation" (a short span per BEGIN/COMMIT/ROLLBACK), or "off" (no transaction spans) // Default: "grouped" + * exclude_connections?: list, + * exclude_tables?: list, + * }, + * cache?: bool|array{ // Symfony Cache tracing configuration + * enabled?: bool|Param, // Resolved at compile time // Default: false + * exclude_pools?: list, + * flush_deferred?: bool|Param, // Commit deferred cache writes on request/command termination and after each consumed message, inside one "cache.flush" span, so a Doctrine DBAL pool's deferred writes group under a single trace instead of orphaning at process shutdown // Default: false + * }, + * }, + * profiler?: array{ // Symfony Web Profiler integration (dev only; requires symfony/web-profiler-bundle) + * enabled?: mixed, // null (default) = auto-enable iff WebProfilerBundle is present; true/false to force on/off // Default: null + * capture_logs?: bool|Param, // Also tee logs into the profiler store (Symfony already has a Logs panel; off by default) // Default: false + * }, + * tracers?: array, + * signal?: array, + * }, + * }>, + * meters?: array, + * signal?: array, + * }, + * }>, + * loggers?: array, + * signal?: array, + * }, + * }>, + * } + * @psalm-type PlaywrightConfig = array{ + * enabled?: bool|Param, // Enable Playwright Symfony integration // Default: true + * intercepted_hosts?: list, + * debug?: bool|Param, // Enable debug mode for Playwright integration // Default: "%kernel.debug%" + * node_path?: scalar|Param|null, // Path to the Node.js executable running the Playwright server (auto-detected when null, can be overridden per browser) // Default: null + * default_browser?: scalar|Param|null, // Name of the default Playwright browser to autowire // Default: "default" + * base_url?: scalar|Param|null, // Base URL used when Playwright builds absolute URLs during tests (defaults to the PLAYWRIGHT_BASE_URL env var when defined, http://localhost otherwise) // Default: "%env(default::PLAYWRIGHT_BASE_URL)%" + * debug_logging?: bool|Param, // Enable verbose Playwright logging without requiring environment variables // Default: false + * browsers?: array, + * env?: array, + * node_path?: scalar|Param|null, // Override global node_path for this browser // Default: null + * min_node_version?: scalar|Param|null, // Minimum Node.js version required to launch the server // Default: "20.0.0" + * channel?: scalar|Param|null, // Browser distribution channel, e.g. chrome-beta or msedge // Default: null + * screenshot_dir?: scalar|Param|null, // Default directory where page screenshots are saved // Default: null + * downloads_dir?: scalar|Param|null, // Directory where downloads are stored // Default: null + * videos_dir?: scalar|Param|null, // Directory where context videos are recorded // Default: null + * tracing?: array{ // Record a Playwright trace for contexts created from this configuration + * enabled?: bool|Param, // Default: false + * dir?: scalar|Param|null, // Default: null + * screenshots?: bool|Param, // Default: false + * snapshots?: bool|Param, // Default: false + * }, + * proxy?: array{ // Proxy applied to the browser + * server?: scalar|Param|null, // Proxy server, e.g. http://host:port + * username?: scalar|Param|null, // Default: null + * password?: scalar|Param|null, // Default: null + * bypass?: scalar|Param|null, // Comma-separated hosts to bypass // Default: null + * }, + * }>, + * assets?: array{ // Asset handling configuration used by the in-process dev server bridge + * public_roots?: list, + * prefixes?: list, + * disable_cache?: bool|Param, // Disable HTTP caching of assets served via the bridge (useful for tests) // Default: true + * }, + * } + * @psalm-type ConfigType = array{ + * imports?: ImportsConfig, + * parameters?: ParametersConfig, + * services?: ServicesConfig, + * framework?: FrameworkConfig, + * twig?: TwigConfig, + * symfonycasts_tailwind?: SymfonycastsTailwindConfig, + * static_content_generator?: StaticContentGeneratorConfig, + * stimulus?: StimulusConfig, + * monolog?: MonologConfig, + * twig_extra?: TwigExtraConfig, + * presta_sitemap?: PrestaSitemapConfig, + * flow_telemetry?: FlowTelemetryConfig, + * "when@dev"?: array{ + * imports?: ImportsConfig, + * parameters?: ParametersConfig, + * services?: ServicesConfig, + * framework?: FrameworkConfig, + * twig?: TwigConfig, + * web_profiler?: WebProfilerConfig, + * symfonycasts_tailwind?: SymfonycastsTailwindConfig, + * static_content_generator?: StaticContentGeneratorConfig, + * stimulus?: StimulusConfig, + * monolog?: MonologConfig, + * twig_extra?: TwigExtraConfig, + * presta_sitemap?: PrestaSitemapConfig, + * flow_telemetry?: FlowTelemetryConfig, + * }, + * "when@prod"?: array{ + * imports?: ImportsConfig, + * parameters?: ParametersConfig, + * services?: ServicesConfig, + * framework?: FrameworkConfig, + * twig?: TwigConfig, + * symfonycasts_tailwind?: SymfonycastsTailwindConfig, + * static_content_generator?: StaticContentGeneratorConfig, + * stimulus?: StimulusConfig, + * monolog?: MonologConfig, + * twig_extra?: TwigExtraConfig, + * presta_sitemap?: PrestaSitemapConfig, + * flow_telemetry?: FlowTelemetryConfig, + * }, + * "when@test"?: array{ + * imports?: ImportsConfig, + * parameters?: ParametersConfig, + * services?: ServicesConfig, + * framework?: FrameworkConfig, + * twig?: TwigConfig, + * web_profiler?: WebProfilerConfig, + * symfonycasts_tailwind?: SymfonycastsTailwindConfig, + * static_content_generator?: StaticContentGeneratorConfig, + * stimulus?: StimulusConfig, + * monolog?: MonologConfig, + * twig_extra?: TwigExtraConfig, + * presta_sitemap?: PrestaSitemapConfig, + * flow_telemetry?: FlowTelemetryConfig, + * playwright?: PlaywrightConfig, + * }, + * ..., + * }> + * } + */ +final class App +{ + /** + * @param ConfigType $config + * + * @psalm-return ConfigType + */ + public static function config(array $config): array + { + /** @var ConfigType $config */ + $config = AppReference::config($config); + + return $config; + } +} + +namespace Symfony\Component\Routing\Loader\Configurator; + +/** + * This class provides array-shapes for configuring the routes of an application. + * + * Example: + * + * ```php + * // config/routes.php + * namespace Symfony\Component\Routing\Loader\Configurator; + * + * return Routes::config([ + * 'controllers' => [ + * 'resource' => 'routing.controllers', + * ], + * ]); + * ``` + * + * @psalm-type RouteConfig = array{ + * path: string|array, + * controller?: string, + * template?: string, + * redirect_to_route?: string, + * redirect_to?: string, + * methods?: string|list, + * requirements?: array, + * defaults?: array, + * options?: array, + * host?: string|array, + * schemes?: string|list, + * condition?: string, + * add_condition?: string, + * locale?: string, + * format?: string, + * utf8?: bool, + * stateless?: bool, + * firewall?: string, + * } + * @psalm-type ImportConfig = array{ + * resource: string, + * type?: string, + * exclude?: string|list, + * prefix?: string|array, + * name_prefix?: string, + * trailing_slash_on_root?: bool, + * controller?: string, + * methods?: string|list, + * requirements?: array, + * defaults?: array, + * options?: array, + * host?: string|array, + * schemes?: string|list, + * condition?: string, + * add_condition?: string, + * locale?: string, + * format?: string, + * utf8?: bool, + * stateless?: bool, + * firewall?: string, + * } + * @psalm-type AliasConfig = array{ + * alias: string, + * deprecated?: array{package:string, version:string, message?:string}, + * } + * @psalm-type RoutesConfig = array{ + * "when@dev"?: array, + * "when@prod"?: array, + * "when@test"?: array, + * ... + * } + */ +final class Routes +{ + /** + * @param RoutesConfig $config + * + * @psalm-return RoutesConfig + */ + public static function config(array $config): array + { + return $config; + } +} diff --git a/web/landing/config/routes/framework.yaml b/web/landing/config/routes/framework.yaml index 0fc74bbac4..bc1feace13 100644 --- a/web/landing/config/routes/framework.yaml +++ b/web/landing/config/routes/framework.yaml @@ -1,4 +1,4 @@ when@dev: _errors: - resource: '@FrameworkBundle/Resources/config/routing/errors.xml' + resource: '@FrameworkBundle/Resources/config/routing/errors.php' prefix: /_error diff --git a/web/landing/config/routes/web_profiler.yaml b/web/landing/config/routes/web_profiler.yaml index 8d85319fd8..b3b7b4b0e0 100644 --- a/web/landing/config/routes/web_profiler.yaml +++ b/web/landing/config/routes/web_profiler.yaml @@ -1,8 +1,8 @@ when@dev: web_profiler_wdt: - resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' + resource: '@WebProfilerBundle/Resources/config/routing/wdt.php' prefix: /_wdt web_profiler_profiler: - resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' + resource: '@WebProfilerBundle/Resources/config/routing/profiler.php' prefix: /_profiler diff --git a/web/landing/config/schema.json b/web/landing/config/schema.json new file mode 100644 index 0000000000..c1a810ca37 --- /dev/null +++ b/web/landing/config/schema.json @@ -0,0 +1,10885 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$comment": "This file is auto-generated and is for apps only. Bundles SHOULD NOT rely on its content.", + "$defs": { + "types": { + "array": { + "type": "array" + }, + "array_null": { + "type": [ + "array", + "null" + ] + }, + "boolean": { + "anyOf": [ + { + "type": "boolean" + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "boolean_null": { + "anyOf": [ + { + "type": [ + "boolean", + "null" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "integer": { + "anyOf": [ + { + "type": "integer" + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "integer_null": { + "anyOf": [ + { + "type": [ + "integer", + "null" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "number": { + "anyOf": [ + { + "type": "number" + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "number_null": { + "anyOf": [ + { + "type": [ + "number", + "null" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "object": { + "type": [ + "object", + "array" + ], + "maxItems": 0 + }, + "object_null": { + "type": [ + "object", + "array", + "null" + ], + "maxItems": 0 + }, + "param": { + "type": "string", + "pattern": "^%[^%]+%$" + }, + "scalar": { + "type": [ + "boolean", + "null", + "number", + "string" + ] + }, + "string": { + "anyOf": [ + { + "type": "string" + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "string_null": { + "anyOf": [ + { + "type": [ + "string", + "null" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "variable": { + "type": [ + "array", + "boolean", + "null", + "number", + "object", + "string" + ] + } + }, + "nodes": { + "flow_telemetry": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Enable the bundle. When false no flow.telemetry.* service is registered (default: true)" + }, + "resource": { + "$ref": "#/$defs/types/object_null", + "properties": { + "detectors": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Enable resource detectors (default: true)" + }, + "static": { + "$ref": "#/$defs/types/object_null", + "properties": { + "cache": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Cache the os, host and git resource attributes" + } + }, + "additionalProperties": false, + "default": { + "enabled": true + }, + "description": "File cache for the two detections that cost something. os and host are stored in sys_get_temp_dir()/flow_telemetry_resource_host.cache: they are the same for every application on a host. git is stored in %kernel.cache_dir%/flow_telemetry_resource_git.cache, which a release replaces. Every other attribute is read in every process." + }, + "os": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + } + }, + "additionalProperties": false, + "default": { + "enabled": true + }, + "description": "OS detector - detects os.type, os.name, os.version, os.description" + }, + "host": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + } + }, + "additionalProperties": false, + "default": { + "enabled": true + }, + "description": "Host detector - detects host.name, host.arch, host.id" + }, + "service": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + } + }, + "additionalProperties": false, + "default": { + "enabled": true + }, + "description": "Service detector - detects service.name and service.version from composer.json" + }, + "deployment": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + } + }, + "additionalProperties": false, + "default": { + "enabled": true + }, + "description": "Deployment detector - detects deployment.environment.name from Symfony kernel environment" + }, + "git": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Enable the git detector (default: false)" + }, + "binary": { + "$ref": "#/$defs/types/scalar", + "default": "git", + "description": "Path to the git binary (default: \"git\", resolved from $PATH)" + }, + "working_directory": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Directory to run git in (default: %kernel.project_dir%)" + } + }, + "additionalProperties": false, + "default": { + "enabled": false, + "binary": "git", + "working_directory": null + }, + "description": "Git detector - detects vcs.ref.head.* and vcs.repository.url.full by invoking the git binary. Disabled by default; the remote URL is reported with any embedded credentials stripped." + }, + "environment": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + } + }, + "additionalProperties": false, + "default": { + "enabled": true + }, + "description": "Environment detector - reads OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES" + } + }, + "additionalProperties": false, + "default": { + "cache": { + "enabled": true + }, + "os": { + "enabled": true + }, + "host": { + "enabled": true + }, + "service": { + "enabled": true + }, + "deployment": { + "enabled": true + }, + "git": { + "enabled": false, + "binary": "git", + "working_directory": null + }, + "environment": { + "enabled": true + } + }, + "description": "Static detectors - values that do not change while a process runs" + }, + "dynamic": { + "$ref": "#/$defs/types/object_null", + "properties": { + "process": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + } + }, + "additionalProperties": false, + "default": { + "enabled": true + }, + "description": "Process detector - detects process.pid, process.runtime.*, process.executable.*" + } + }, + "additionalProperties": false, + "default": { + "process": { + "enabled": true + } + }, + "description": "Dynamic detectors - values that may change between requests/commands (never cached)" + } + }, + "additionalProperties": false, + "default": { + "enabled": true, + "static": { + "cache": { + "enabled": true + }, + "os": { + "enabled": true + }, + "host": { + "enabled": true + }, + "service": { + "enabled": true + }, + "deployment": { + "enabled": true + }, + "git": { + "enabled": false, + "binary": "git", + "working_directory": null + }, + "environment": { + "enabled": true + } + }, + "dynamic": { + "process": { + "enabled": true + } + } + }, + "description": "Resource detector configuration for automatic attribute detection" + }, + "custom": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Custom resource attributes that override auto-detected values" + } + }, + "additionalProperties": false, + "default": { + "detectors": { + "enabled": true, + "static": { + "cache": { + "enabled": true + }, + "os": { + "enabled": true + }, + "host": { + "enabled": true + }, + "service": { + "enabled": true + }, + "deployment": { + "enabled": true + }, + "git": { + "enabled": false, + "binary": "git", + "working_directory": null + }, + "environment": { + "enabled": true + } + }, + "dynamic": { + "process": { + "enabled": true + } + } + }, + "custom": [] + }, + "description": "OpenTelemetry Resource configuration with automatic detection (https://opentelemetry.io/docs/specs/semconv/resource/)" + }, + "clock_service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom PSR-20 clock service ID. If not provided, uses built-in SystemClock." + }, + "framework_logger": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Name of the logger (matching a key under \"loggers\", or \"default\") whose PSR-3 wrapper will be aliased to Symfony's \"logger\" service. Leave null to auto-replace only when Symfony's default HttpKernel Logger is currently bound." + }, + "capture_framework_channels": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Reroute services Symfony tags \"monolog.logger\" to per-channel Flow telemetry loggers. Disabled by default to avoid colliding with MonologBundle, which claims the same tag." + }, + "channel_attribute_target": { + "anyOf": [ + { + "enum": [ + "scope", + "signal", + "both" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "both", + "description": "Where the \"flow.log.channel\" attribute of a synthesized channel logger is placed: \"scope\" (instrumentation scope), \"signal\" (every emitted record), or \"both\" (default). Applies to framework-captured and #[WithTelemetryChannel] channels alike." + }, + "context_storage": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "memory", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "memory" + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom context storage service ID (only for type: service)" + } + }, + "additionalProperties": false, + "default": { + "type": "memory", + "service_id": null + }, + "description": "Context storage configuration" + }, + "propagator": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "w3c", + "tracecontext", + "baggage", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "w3c", + "description": "Propagator type: 'w3c' (W3C TraceContext + Baggage), 'tracecontext' (W3C TraceContext only), 'baggage' (W3C Baggage only), 'service' (custom)" + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom propagator service ID (only for type: service)" + } + }, + "additionalProperties": false, + "default": { + "type": "w3c", + "service_id": null + }, + "description": "Context propagator configuration for distributed tracing" + }, + "error_handlers": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "error_log", + "stream", + "syslog", + "udp_syslog", + "composite", + "noop", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "error_log" + }, + "message_type": { + "anyOf": [ + { + "enum": [ + "operating_system", + "email", + "file", + "sapi" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "operating_system", + "description": "error_log message type (only for type: error_log)" + }, + "expand_newlines": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Emit one error_log() call per line (only for type: error_log)" + }, + "message_prefix": { + "$ref": "#/$defs/types/scalar", + "default": "[flow-telemetry]", + "description": "Prefix prepended to each formatted Throwable (error_log + stream)" + }, + "destination": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "File path or php:// stream URI (required for type: stream)" + }, + "file_permissions": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "maximum": 511, + "default": 420, + "description": "Permissions applied when creating new files (only for type: stream)" + }, + "create_directories": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Create parent directories of the destination if they do not exist (only for type: stream)" + }, + "ident": { + "$ref": "#/$defs/types/scalar", + "default": "flow-telemetry", + "description": "Syslog identity tag (syslog + udp_syslog)" + }, + "facility": { + "anyOf": [ + { + "enum": [ + "auth", + "cron", + "daemon", + "kernel", + "local0", + "local1", + "local2", + "local3", + "local4", + "local5", + "local6", + "local7", + "lpr", + "mail", + "news", + "syslog", + "user", + "uucp" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "user", + "description": "Syslog facility (syslog + udp_syslog)" + }, + "log_opts": { + "$ref": "#/$defs/types/integer", + "default": 1, + "description": "Bitmask of LOG_* options passed to openlog() (only for type: syslog)" + }, + "severity": { + "anyOf": [ + { + "enum": [ + "alert", + "critical", + "debug", + "emergency", + "error", + "info", + "notice", + "warning" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "error", + "description": "Syslog severity (syslog + udp_syslog)" + }, + "host": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Remote syslog host (required for type: udp_syslog)" + }, + "port": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "maximum": 65535, + "default": 514, + "description": "Remote syslog port (only for type: udp_syslog)" + }, + "handlers": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Named error_handler entries fanned-out to (only for type: composite)" + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom error handler service ID (only for type: service)" + } + }, + "additionalProperties": false + }, + "description": "Named error handler definitions referenced by providers, processors, and OTLP exporters via \"error_handler:\" fields. If \"default\" is omitted it is auto-created with type: error_log." + }, + "exporters": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "When false, this exporter is replaced by a no-op (void) exporter: nothing is exported to its backend, while profiler capture and every other exporter keep working. Set it per environment to keep telemetry in the profiler without shipping it to a collector. Defaults to true." + }, + "otlp": { + "$ref": "#/$defs/types/object_null", + "properties": { + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to the OTLP exporter" + }, + "transport": { + "$ref": "#/$defs/types/variable", + "description": "Transport configuration (required when exporter type is \"otlp\")" + } + }, + "additionalProperties": false, + "description": "OTLP exporter — embeds its transport configuration inline" + }, + "service": { + "$ref": "#/$defs/types/object_null", + "properties": { + "id": { + "$ref": "#/$defs/types/scalar", + "description": "Service id of the user-provided exporter (required)" + } + }, + "additionalProperties": false, + "description": "Aliases an existing Symfony service implementing Flow\\Telemetry\\Exporter\\Exporter" + }, + "console": { + "$ref": "#/$defs/types/object_null", + "description": "Console exporter (no options)" + }, + "memory": { + "$ref": "#/$defs/types/object_null", + "description": "Memory exporter (no options)" + }, + "void": { + "$ref": "#/$defs/types/object_null", + "description": "Void/no-op exporter (no options)" + } + }, + "additionalProperties": false + }, + "description": "Named exporter definitions referenced from per-signal processor blocks. The sub-block under each name selects the exporter implementation; \"otlp\" carries an embedded transport, \"service\" aliases an external service id." + }, + "tracer_provider": { + "$ref": "#/$defs/types/object_null", + "properties": { + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to the TracerProvider" + }, + "sampler": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "always_on", + "always_off", + "trace_id_ratio", + "parent_based", + "attribute_matching", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "parent_based" + }, + "ratio": { + "$ref": "#/$defs/types/number", + "minimum": 0, + "maximum": 1, + "default": 1, + "description": "Sampling ratio for trace_id_ratio type (0.0 to 1.0)" + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom sampler service ID (only for type: service)" + }, + "exclude": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "attribute_matching: when true (default) a match drops the span; when false only matching spans are sampled" + }, + "sources": { + "$ref": "#/$defs/types/array_null", + "items": { + "anyOf": [ + { + "enum": [ + "signal", + "resource", + "scope" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "default": [ + "signal" + ], + "description": "attribute_matching: which attribute sets to inspect - any of signal (default), resource, scope" + }, + "cache_dir": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "attribute_matching: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters" + }, + "cache_dir_permissions": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "maximum": 511, + "default": 448, + "description": "attribute_matching: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750)" + }, + "matcher": { + "$ref": "#/$defs/types/variable", + "default": null, + "description": "attribute_matching: the matcher tree (all/any/not or a leaf rule { path, mode, value, case_sensitive? }); nestable to any depth" + }, + "root": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "always_on", + "always_off", + "trace_id_ratio" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "always_on" + }, + "ratio": { + "$ref": "#/$defs/types/number", + "minimum": 0, + "maximum": 1, + "default": 1 + } + }, + "additionalProperties": false, + "default": { + "type": "always_on", + "ratio": 1 + }, + "description": "parent_based: sampler used for root spans that have no parent (default: always_on). Set to always_off to trace only requests that arrive with a sampled traceparent." + }, + "delegate": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "always_on", + "always_off", + "trace_id_ratio" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "always_on" + }, + "ratio": { + "$ref": "#/$defs/types/number", + "minimum": 0, + "maximum": 1, + "default": 1 + } + }, + "additionalProperties": false, + "default": { + "type": "always_on", + "ratio": 1 + }, + "description": "attribute_matching: sampler that decides spans which do not match (default: always_on)" + } + }, + "additionalProperties": false, + "default": { + "type": "parent_based", + "ratio": 1, + "service_id": null, + "exclude": true, + "sources": [ + "signal" + ], + "cache_dir": null, + "cache_dir_permissions": 448, + "matcher": null, + "root": { + "type": "always_on", + "ratio": 1 + }, + "delegate": { + "type": "always_on", + "ratio": 1 + } + }, + "description": "Trace sampler configuration" + }, + "processor": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "composite", + "memory", + "batching", + "passthrough", + "void", + "service", + "attribute_filtering" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "void" + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512, + "description": "Batch size for batching processor" + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Name of a top-level exporter referenced by this processor" + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom processor service ID (only for type: service)" + }, + "minimum_severity": { + "anyOf": [ + { + "enum": [ + "trace", + "debug", + "info", + "warn", + "error", + "fatal" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "info", + "description": "Minimum severity level for severity_filtering processor (only for log processors)" + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to this processor" + }, + "exclude": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "attribute_filtering: when true (default) a match drops the signal; when false only matching signals are kept" + }, + "sources": { + "$ref": "#/$defs/types/array_null", + "items": { + "anyOf": [ + { + "enum": [ + "signal", + "resource", + "scope" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "default": [ + "signal" + ], + "description": "attribute_filtering: which attribute sets to inspect - any of signal (default), resource, scope. A signal matches if the matcher matches in ANY listed source." + }, + "cache_dir": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "attribute_filtering: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters" + }, + "cache_dir_permissions": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "maximum": 511, + "default": 448, + "description": "attribute_filtering: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750)" + }, + "matcher": { + "$ref": "#/$defs/types/variable", + "default": null, + "description": "attribute_filtering: the matcher tree. A node is exactly one of: \"all\"/\"any\" (a list of child matchers), \"not\" (a single child matcher), or a leaf rule { path, mode, value, case_sensitive? }. Nestable to any depth." + }, + "processors": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "memory", + "batching", + "passthrough", + "void", + "service", + "attribute_filtering" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512 + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "minimum_severity": { + "anyOf": [ + { + "enum": [ + "trace", + "debug", + "info", + "warn", + "error", + "fatal" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "info" + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to this child processor" + }, + "exclude": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "sources": { + "$ref": "#/$defs/types/array_null", + "items": { + "anyOf": [ + { + "enum": [ + "signal", + "resource", + "scope" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "default": [ + "signal" + ] + }, + "cache_dir": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "cache_dir_permissions": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "maximum": 511, + "default": 448 + }, + "matcher": { + "$ref": "#/$defs/types/variable", + "default": null + }, + "inner_processor": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "memory", + "batching", + "passthrough", + "void", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512, + "description": "Batch size for batching processor" + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Name of a top-level exporter referenced by this processor" + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom processor service ID (only for type: service)" + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to the inner processor" + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Inner (wrapped) processor for severity_filtering / attribute_filtering" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "description": "Array of processor configurations (only for type: composite)" + }, + "inner_processor": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "memory", + "batching", + "passthrough", + "void", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512, + "description": "Batch size for batching processor" + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Name of a top-level exporter referenced by this processor" + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom processor service ID (only for type: service)" + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to the inner processor" + } + }, + "additionalProperties": false, + "description": "Inner (wrapped) processor for severity_filtering / attribute_filtering" + }, + "middleware": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "enriching", + "attribute_filtering", + "severity_filtering" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "attributes": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "enriching: default attributes merged into every record (call-site values win)" + }, + "minimum_severity": { + "anyOf": [ + { + "enum": [ + "trace", + "debug", + "info", + "warn", + "error", + "fatal" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "info", + "description": "severity_filtering: minimum severity level" + }, + "exclude": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "attribute_filtering: when true (default) a match drops the entry; when false only matching entries are kept" + }, + "sources": { + "$ref": "#/$defs/types/array_null", + "items": { + "anyOf": [ + { + "enum": [ + "signal", + "resource", + "scope" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "default": [ + "signal" + ], + "description": "attribute_filtering: which attribute sets to inspect - any of signal (default), resource, scope" + }, + "cache_dir": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "attribute_filtering: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters" + }, + "cache_dir_permissions": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "maximum": 511, + "default": 448, + "description": "attribute_filtering: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750)" + }, + "matcher": { + "$ref": "#/$defs/types/variable", + "default": null, + "description": "attribute_filtering: the matcher tree (all/any/not or a leaf rule { path, mode, value, case_sensitive? }); nestable to any depth" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "description": "Ordered log middleware (only for type: pipeline)" + }, + "sink": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "composite", + "memory", + "batching", + "passthrough", + "void", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512 + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default" + }, + "processors": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "memory", + "batching", + "passthrough", + "void", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512 + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "description": "Child processors (only for sink type: composite)" + } + }, + "additionalProperties": false, + "description": "Terminal processor for the pipeline (only for type: pipeline)" + } + }, + "additionalProperties": false, + "default": { + "type": "void", + "batch_size": 512, + "max_batch_age": null, + "exporter": null, + "service_id": null, + "minimum_severity": "info", + "error_handler": "default", + "exclude": true, + "sources": [ + "signal" + ], + "cache_dir": null, + "cache_dir_permissions": 448, + "matcher": null, + "processors": [], + "middleware": [] + }, + "description": "Span processor configuration" + } + }, + "additionalProperties": false, + "default": { + "error_handler": "default", + "sampler": { + "type": "parent_based", + "ratio": 1, + "service_id": null, + "exclude": true, + "sources": [ + "signal" + ], + "cache_dir": null, + "cache_dir_permissions": 448, + "matcher": null, + "root": { + "type": "always_on", + "ratio": 1 + }, + "delegate": { + "type": "always_on", + "ratio": 1 + } + }, + "processor": { + "type": "void", + "batch_size": 512, + "max_batch_age": null, + "exporter": null, + "service_id": null, + "minimum_severity": "info", + "error_handler": "default", + "exclude": true, + "sources": [ + "signal" + ], + "cache_dir": null, + "cache_dir_permissions": 448, + "matcher": null, + "processors": [], + "middleware": [] + } + }, + "description": "TracerProvider configuration. Defaults to void if omitted." + }, + "meter_provider": { + "$ref": "#/$defs/types/object_null", + "properties": { + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to the MeterProvider" + }, + "temporality": { + "anyOf": [ + { + "enum": [ + "cumulative", + "delta" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "cumulative", + "description": "Aggregation temporality" + }, + "processor": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "composite", + "memory", + "batching", + "passthrough", + "void", + "service", + "attribute_filtering" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "void" + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512, + "description": "Batch size for batching processor" + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Name of a top-level exporter referenced by this processor" + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom processor service ID (only for type: service)" + }, + "minimum_severity": { + "anyOf": [ + { + "enum": [ + "trace", + "debug", + "info", + "warn", + "error", + "fatal" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "info", + "description": "Minimum severity level for severity_filtering processor (only for log processors)" + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to this processor" + }, + "exclude": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "attribute_filtering: when true (default) a match drops the signal; when false only matching signals are kept" + }, + "sources": { + "$ref": "#/$defs/types/array_null", + "items": { + "anyOf": [ + { + "enum": [ + "signal", + "resource", + "scope" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "default": [ + "signal" + ], + "description": "attribute_filtering: which attribute sets to inspect - any of signal (default), resource, scope. A signal matches if the matcher matches in ANY listed source." + }, + "cache_dir": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "attribute_filtering: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters" + }, + "cache_dir_permissions": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "maximum": 511, + "default": 448, + "description": "attribute_filtering: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750)" + }, + "matcher": { + "$ref": "#/$defs/types/variable", + "default": null, + "description": "attribute_filtering: the matcher tree. A node is exactly one of: \"all\"/\"any\" (a list of child matchers), \"not\" (a single child matcher), or a leaf rule { path, mode, value, case_sensitive? }. Nestable to any depth." + }, + "processors": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "memory", + "batching", + "passthrough", + "void", + "service", + "attribute_filtering" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512 + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "minimum_severity": { + "anyOf": [ + { + "enum": [ + "trace", + "debug", + "info", + "warn", + "error", + "fatal" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "info" + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to this child processor" + }, + "exclude": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "sources": { + "$ref": "#/$defs/types/array_null", + "items": { + "anyOf": [ + { + "enum": [ + "signal", + "resource", + "scope" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "default": [ + "signal" + ] + }, + "cache_dir": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "cache_dir_permissions": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "maximum": 511, + "default": 448 + }, + "matcher": { + "$ref": "#/$defs/types/variable", + "default": null + }, + "inner_processor": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "memory", + "batching", + "passthrough", + "void", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512, + "description": "Batch size for batching processor" + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Name of a top-level exporter referenced by this processor" + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom processor service ID (only for type: service)" + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to the inner processor" + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Inner (wrapped) processor for severity_filtering / attribute_filtering" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "description": "Array of processor configurations (only for type: composite)" + }, + "inner_processor": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "memory", + "batching", + "passthrough", + "void", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512, + "description": "Batch size for batching processor" + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Name of a top-level exporter referenced by this processor" + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom processor service ID (only for type: service)" + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to the inner processor" + } + }, + "additionalProperties": false, + "description": "Inner (wrapped) processor for severity_filtering / attribute_filtering" + }, + "middleware": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "enriching", + "attribute_filtering", + "severity_filtering" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "attributes": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "enriching: default attributes merged into every record (call-site values win)" + }, + "minimum_severity": { + "anyOf": [ + { + "enum": [ + "trace", + "debug", + "info", + "warn", + "error", + "fatal" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "info", + "description": "severity_filtering: minimum severity level" + }, + "exclude": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "attribute_filtering: when true (default) a match drops the entry; when false only matching entries are kept" + }, + "sources": { + "$ref": "#/$defs/types/array_null", + "items": { + "anyOf": [ + { + "enum": [ + "signal", + "resource", + "scope" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "default": [ + "signal" + ], + "description": "attribute_filtering: which attribute sets to inspect - any of signal (default), resource, scope" + }, + "cache_dir": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "attribute_filtering: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters" + }, + "cache_dir_permissions": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "maximum": 511, + "default": 448, + "description": "attribute_filtering: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750)" + }, + "matcher": { + "$ref": "#/$defs/types/variable", + "default": null, + "description": "attribute_filtering: the matcher tree (all/any/not or a leaf rule { path, mode, value, case_sensitive? }); nestable to any depth" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "description": "Ordered log middleware (only for type: pipeline)" + }, + "sink": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "composite", + "memory", + "batching", + "passthrough", + "void", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512 + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default" + }, + "processors": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "memory", + "batching", + "passthrough", + "void", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512 + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "description": "Child processors (only for sink type: composite)" + } + }, + "additionalProperties": false, + "description": "Terminal processor for the pipeline (only for type: pipeline)" + } + }, + "additionalProperties": false, + "default": { + "type": "void", + "batch_size": 512, + "max_batch_age": null, + "exporter": null, + "service_id": null, + "minimum_severity": "info", + "error_handler": "default", + "exclude": true, + "sources": [ + "signal" + ], + "cache_dir": null, + "cache_dir_permissions": 448, + "matcher": null, + "processors": [], + "middleware": [] + }, + "description": "Metric processor configuration" + } + }, + "additionalProperties": false, + "default": { + "error_handler": "default", + "temporality": "cumulative", + "processor": { + "type": "void", + "batch_size": 512, + "max_batch_age": null, + "exporter": null, + "service_id": null, + "minimum_severity": "info", + "error_handler": "default", + "exclude": true, + "sources": [ + "signal" + ], + "cache_dir": null, + "cache_dir_permissions": 448, + "matcher": null, + "processors": [], + "middleware": [] + } + }, + "description": "MeterProvider configuration. Defaults to void if omitted." + }, + "logger_provider": { + "$ref": "#/$defs/types/object_null", + "properties": { + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to the LoggerProvider" + }, + "console_output": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "verbosity_levels": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "anyOf": [ + { + "enum": [ + "TRACE", + "DEBUG", + "INFO", + "WARN", + "ERROR", + "FATAL" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "description": "Override the verbosity->minimum-severity thresholds. Keys: VERBOSITY_QUIET, VERBOSITY_NORMAL, VERBOSITY_VERBOSE, VERBOSITY_VERY_VERBOSE, VERBOSITY_DEBUG. Values: TRACE, DEBUG, INFO, WARN, ERROR, FATAL. Defaults: QUIET=ERROR, NORMAL=WARN, VERBOSE=INFO, VERY_VERBOSE=DEBUG, DEBUG=TRACE." + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "verbosity_levels": [] + }, + "description": "Tee emitted log records to the running console command output, filtered by CLI verbosity (-v/-vv/-vvv). The Flow equivalent of Symfony's Monolog ConsoleHandler; display only, exporters are unaffected. Off by default." + }, + "processor": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "composite", + "memory", + "batching", + "passthrough", + "void", + "service", + "pipeline" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "void" + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512, + "description": "Batch size for batching processor" + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Name of a top-level exporter referenced by this processor" + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom processor service ID (only for type: service)" + }, + "minimum_severity": { + "anyOf": [ + { + "enum": [ + "trace", + "debug", + "info", + "warn", + "error", + "fatal" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "info", + "description": "Minimum severity level for severity_filtering processor (only for log processors)" + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to this processor" + }, + "exclude": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "attribute_filtering: when true (default) a match drops the signal; when false only matching signals are kept" + }, + "sources": { + "$ref": "#/$defs/types/array_null", + "items": { + "anyOf": [ + { + "enum": [ + "signal", + "resource", + "scope" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "default": [ + "signal" + ], + "description": "attribute_filtering: which attribute sets to inspect - any of signal (default), resource, scope. A signal matches if the matcher matches in ANY listed source." + }, + "cache_dir": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "attribute_filtering: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters" + }, + "cache_dir_permissions": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "maximum": 511, + "default": 448, + "description": "attribute_filtering: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750)" + }, + "matcher": { + "$ref": "#/$defs/types/variable", + "default": null, + "description": "attribute_filtering: the matcher tree. A node is exactly one of: \"all\"/\"any\" (a list of child matchers), \"not\" (a single child matcher), or a leaf rule { path, mode, value, case_sensitive? }. Nestable to any depth." + }, + "processors": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "memory", + "batching", + "passthrough", + "void", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512 + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "minimum_severity": { + "anyOf": [ + { + "enum": [ + "trace", + "debug", + "info", + "warn", + "error", + "fatal" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "info" + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to this child processor" + }, + "exclude": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "sources": { + "$ref": "#/$defs/types/array_null", + "items": { + "anyOf": [ + { + "enum": [ + "signal", + "resource", + "scope" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "default": [ + "signal" + ] + }, + "cache_dir": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "cache_dir_permissions": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "maximum": 511, + "default": 448 + }, + "matcher": { + "$ref": "#/$defs/types/variable", + "default": null + }, + "inner_processor": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "memory", + "batching", + "passthrough", + "void", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512, + "description": "Batch size for batching processor" + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Name of a top-level exporter referenced by this processor" + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom processor service ID (only for type: service)" + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to the inner processor" + } + }, + "required": [ + "type" + ], + "additionalProperties": false, + "description": "Inner (wrapped) processor for severity_filtering / attribute_filtering" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "description": "Array of processor configurations (only for type: composite)" + }, + "inner_processor": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "memory", + "batching", + "passthrough", + "void", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512, + "description": "Batch size for batching processor" + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Name of a top-level exporter referenced by this processor" + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Custom processor service ID (only for type: service)" + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of an error_handler entry forwarded to the inner processor" + } + }, + "additionalProperties": false, + "description": "Inner (wrapped) processor for severity_filtering / attribute_filtering" + }, + "middleware": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "enriching", + "attribute_filtering", + "severity_filtering" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "attributes": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "enriching: default attributes merged into every record (call-site values win)" + }, + "minimum_severity": { + "anyOf": [ + { + "enum": [ + "trace", + "debug", + "info", + "warn", + "error", + "fatal" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "info", + "description": "severity_filtering: minimum severity level" + }, + "exclude": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "attribute_filtering: when true (default) a match drops the entry; when false only matching entries are kept" + }, + "sources": { + "$ref": "#/$defs/types/array_null", + "items": { + "anyOf": [ + { + "enum": [ + "signal", + "resource", + "scope" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "default": [ + "signal" + ], + "description": "attribute_filtering: which attribute sets to inspect - any of signal (default), resource, scope" + }, + "cache_dir": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "attribute_filtering: directory for the generated matcher cache. Defaults to %kernel.cache_dir%/flow_telemetry_filters" + }, + "cache_dir_permissions": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "maximum": 511, + "default": 448, + "description": "attribute_filtering: octal mode applied when the matcher cache directory is created (default 0o700, owner-only; write it as a YAML octal literal e.g. 0o750)" + }, + "matcher": { + "$ref": "#/$defs/types/variable", + "default": null, + "description": "attribute_filtering: the matcher tree (all/any/not or a leaf rule { path, mode, value, case_sensitive? }); nestable to any depth" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "description": "Ordered log middleware (only for type: pipeline)" + }, + "sink": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "composite", + "memory", + "batching", + "passthrough", + "void", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512 + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default" + }, + "processors": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "memory", + "batching", + "passthrough", + "void", + "service" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "batch_size": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 512 + }, + "max_batch_age": { + "$ref": "#/$defs/types/number_null", + "minimum": 0, + "default": null, + "description": "Max batch age in seconds for batching processor; export at least this often in long-running processes (null = disabled)" + }, + "exporter": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "service_id": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "error_handler": { + "$ref": "#/$defs/types/scalar", + "default": "default" + } + }, + "required": [ + "type" + ], + "additionalProperties": false + }, + "description": "Child processors (only for sink type: composite)" + } + }, + "additionalProperties": false, + "description": "Terminal processor for the pipeline (only for type: pipeline)" + } + }, + "additionalProperties": false, + "default": { + "type": "void", + "batch_size": 512, + "max_batch_age": null, + "exporter": null, + "service_id": null, + "minimum_severity": "info", + "error_handler": "default", + "exclude": true, + "sources": [ + "signal" + ], + "cache_dir": null, + "cache_dir_permissions": 448, + "matcher": null, + "processors": [], + "middleware": [] + }, + "description": "Log processor configuration" + } + }, + "additionalProperties": false, + "default": { + "error_handler": "default", + "console_output": { + "enabled": false, + "verbosity_levels": [] + }, + "processor": { + "type": "void", + "batch_size": 512, + "max_batch_age": null, + "exporter": null, + "service_id": null, + "minimum_severity": "info", + "error_handler": "default", + "exclude": true, + "sources": [ + "signal" + ], + "cache_dir": null, + "cache_dir_permissions": 448, + "matcher": null, + "processors": [], + "middleware": [] + } + }, + "description": "LoggerProvider configuration. Defaults to void if omitted." + }, + "instrumentation": { + "$ref": "#/$defs/types/object_null", + "properties": { + "sanitization": { + "$ref": "#/$defs/types/object_null", + "properties": { + "url": { + "$ref": "#/$defs/types/object_null", + "properties": { + "sensitive_query_parameters": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "default": [ + "AWSAccessKeyId", + "Signature", + "sig", + "X-Amz-Signature", + "X-Amz-Credential", + "X-Amz-Security-Token", + "X-Goog-Signature", + "access_token", + "refresh_token", + "id_token", + "id_token_hint", + "logout_token", + "client_secret", + "client_assertion", + "assertion", + "code", + "code_verifier", + "device_code", + "subject_token", + "actor_token", + "token", + "api_key", + "apikey", + "api-key", + "key", + "access_key", + "secret_key", + "private_key", + "secret", + "signature", + "password", + "passwd", + "pwd", + "auth", + "jwt", + "session", + "sessionid", + "PHPSESSID" + ], + "description": "Query parameter keys whose values are replaced with REDACTED. Case-sensitive. Replaces the OpenTelemetry semantic-convention default list, it does not extend it." + } + }, + "additionalProperties": false, + "default": { + "sensitive_query_parameters": [ + "AWSAccessKeyId", + "Signature", + "sig", + "X-Amz-Signature", + "X-Amz-Credential", + "X-Amz-Security-Token", + "X-Goog-Signature", + "access_token", + "refresh_token", + "id_token", + "id_token_hint", + "logout_token", + "client_secret", + "client_assertion", + "assertion", + "code", + "code_verifier", + "device_code", + "subject_token", + "actor_token", + "token", + "api_key", + "apikey", + "api-key", + "key", + "access_key", + "secret_key", + "private_key", + "secret", + "signature", + "password", + "passwd", + "pwd", + "auth", + "jwt", + "session", + "sessionid", + "PHPSESSID" + ] + }, + "description": "URL sanitization for url.full / url.query of http_kernel, http_client and psr18_client spans" + } + }, + "additionalProperties": false, + "default": { + "url": { + "sensitive_query_parameters": [ + "AWSAccessKeyId", + "Signature", + "sig", + "X-Amz-Signature", + "X-Amz-Credential", + "X-Amz-Security-Token", + "X-Goog-Signature", + "access_token", + "refresh_token", + "id_token", + "id_token_hint", + "logout_token", + "client_secret", + "client_assertion", + "assertion", + "code", + "code_verifier", + "device_code", + "subject_token", + "actor_token", + "token", + "api_key", + "apikey", + "api-key", + "key", + "access_key", + "secret_key", + "private_key", + "secret", + "signature", + "password", + "passwd", + "pwd", + "auth", + "jwt", + "session", + "sessionid", + "PHPSESSID" + ] + } + }, + "description": "Sanitization of sensitive data in instrumentation attributes (OpenTelemetry semconv \"instrumentation general sanitization\")" + }, + "http_kernel": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "exclude_paths": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "path": { + "$ref": "#/$defs/types/scalar", + "description": "Path pattern (exact or regex with / delimiters)" + }, + "method": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "HTTP method (omit for all methods)" + } + }, + "required": [ + "path" + ], + "additionalProperties": false + }, + "description": "URL paths to exclude from tracing (checked before route resolution)" + }, + "context_propagation": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Extract trace context from incoming request headers and inject it into outgoing response headers (requires flow-php/symfony-http-foundation-telemetry-bridge; silently disabled when absent)" + }, + "context_propagation_query": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Also extract trace context from the URL query string (for links / full-page navigations that cannot send headers); headers take precedence. Security: lets callers inject a traceparent, so keep off unless needed. Requires context_propagation." + }, + "require_trace_context": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Only trace requests that arrive with a trace context (traceparent header, or query string when context_propagation_query is on). Requests without one are suppressed entirely, including their DBAL/cache spans. Scoped to HTTP only - console commands and messenger workers are unaffected. Requires context_propagation." + }, + "route_naming": { + "anyOf": [ + { + "enum": [ + "path", + "name" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "path", + "description": "What routed request spans use for their name and the http.route attribute: \"path\" (route path template, e.g. /orders/{id}; OTEL semconv default) or \"name\" (Symfony route name). Sub-requests fall back to the controller; unrouted requests use the method only." + }, + "trace_controller": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Trace controller body execution as a child of the request span (span name = resolved controller)" + }, + "trace_controller_resolution": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Trace controller resolution (controller.get_callable span); opt-in, finer detail" + }, + "trace_controller_arguments": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Trace argument resolution as a single aggregate span (controller.get_arguments); opt-in" + }, + "trace_controller_argument_resolvers": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Trace each argument value resolver individually (controller.argument_value_resolver span); opt-in, higher cardinality" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "exclude_paths": [], + "context_propagation": true, + "context_propagation_query": false, + "require_trace_context": false, + "route_naming": "path", + "trace_controller": true, + "trace_controller_resolution": false, + "trace_controller_arguments": false, + "trace_controller_argument_resolvers": false + }, + "description": "HTTP kernel request tracing configuration" + }, + "console": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "exclude_commands": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "default": [ + "messenger:consume" + ], + "description": "Command names whose tracing is fully suppressed: the command and every span nested under it are dropped (supports regex with / delimiters). Instrumentation that starts its own root trace — e.g. messenger per-message handlers — is unaffected. Honored regardless of whether console spans are enabled. Set to [] to trace everything (including messenger:consume)." + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "exclude_commands": [ + "messenger:consume" + ] + }, + "description": "Console command tracing configuration" + }, + "messenger": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "context_propagation": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Enable context propagation across message boundaries (requires propagator)" + }, + "trace": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Emit a per-message span for each consumed/produced message. When false, the worker is fully suppressed and only metrics are emitted (if metrics are enabled)." + }, + "metrics": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Emit OTEL messaging metrics for consumed/sent messages (messaging.client.consumed.messages, messaging.client.sent.messages) and processing duration (messaging.process.duration)" + }, + "span_naming": { + "anyOf": [ + { + "enum": [ + "transport", + "message_name", + "message_fqcn" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "transport", + "description": "What messenger spans use for the part of their name after the operation: \"transport\" (OTEL semconv destination, e.g. \"process async\"; unknown on dispatch, so producer spans are named after the operation alone; default), \"message_name\" (message short class name, e.g. \"send CreateOrderMessage\") or \"message_fqcn\" (fully qualified class name). The transport stays on the messaging.destination.name attribute regardless." + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "context_propagation": true, + "trace": true, + "metrics": true, + "span_naming": "transport" + }, + "description": "Messenger tracing configuration" + }, + "twig": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "trace_templates": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Trace template rendering" + }, + "trace_blocks": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Trace block rendering" + }, + "trace_macros": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Trace macro execution" + }, + "exclude_templates": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Template paths to exclude from tracing (supports regex with / delimiters)" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "trace_templates": true, + "trace_blocks": false, + "trace_macros": false, + "exclude_templates": [] + }, + "description": "Twig template tracing configuration" + }, + "security": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "fields": { + "$ref": "#/$defs/types/object_null", + "properties": { + "id": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "attribute": { + "$ref": "#/$defs/types/scalar", + "default": "user.id", + "description": "Span attribute key" + } + }, + "additionalProperties": false, + "default": { + "enabled": true, + "attribute": "user.id" + }, + "description": "User identifier (TokenInterface::getUserIdentifier())" + }, + "roles": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "attribute": { + "$ref": "#/$defs/types/scalar", + "default": "user.roles", + "description": "Span attribute key" + } + }, + "additionalProperties": false, + "default": { + "enabled": false, + "attribute": "user.roles" + }, + "description": "Token role names (TokenInterface::getRoleNames())" + }, + "email": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "attribute": { + "$ref": "#/$defs/types/scalar", + "default": "user.email", + "description": "Span attribute key" + }, + "getter": { + "$ref": "#/$defs/types/scalar", + "default": "getEmail", + "description": "User method to read the email from" + } + }, + "additionalProperties": false, + "default": { + "enabled": false, + "attribute": "user.email", + "getter": "getEmail" + }, + "description": "User email, read from a getter on the user object" + } + }, + "additionalProperties": false, + "default": { + "id": { + "enabled": true, + "attribute": "user.id" + }, + "roles": { + "enabled": false, + "attribute": "user.roles" + }, + "email": { + "enabled": false, + "attribute": "user.email", + "getter": "getEmail" + } + } + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "fields": { + "id": { + "enabled": true, + "attribute": "user.id" + }, + "roles": { + "enabled": false, + "attribute": "user.roles" + }, + "email": { + "enabled": false, + "attribute": "user.email", + "getter": "getEmail" + } + } + }, + "description": "Decorate the request span with the authenticated user (requires symfony/security-core; login capture requires symfony/security-http)" + }, + "http_client": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "exclude_clients": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "HTTP client service IDs to exclude from tracing (supports regex with / delimiters)" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "exclude_clients": [] + }, + "description": "HTTP client request tracing configuration" + }, + "psr18_client": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "exclude_clients": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "PSR-18 client service IDs to exclude from tracing (supports regex with / delimiters)" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "exclude_clients": [] + }, + "description": "PSR-18 HTTP client request tracing configuration" + }, + "dbal": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "max_sql_length": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 1000, + "description": "Maximum SQL length in span attributes (0 = no limit)" + }, + "collect_metrics": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Record the db.client.operation.duration histogram" + }, + "include_parameters": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Include bound statement parameters in span attributes (security consideration)" + }, + "max_parameters": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 10, + "description": "Maximum number of parameters to include when include_parameters is enabled" + }, + "max_parameter_length": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 100, + "description": "Maximum length for each included parameter value" + }, + "transaction_spans": { + "anyOf": [ + { + "enum": [ + "grouped", + "per_operation", + "off" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "grouped", + "description": "How transactions are traced: \"grouped\" (one BEGIN TRANSACTION span holding the queries), \"per_operation\" (a short span per BEGIN/COMMIT/ROLLBACK), or \"off\" (no transaction spans)" + }, + "exclude_connections": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Connection names to exclude from tracing (supports regex with / delimiters)" + }, + "exclude_tables": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Table names whose queries are not traced (e.g. \"cache_items\" behind a Doctrine DBAL cache pool); matched case-insensitively on whole words in the SQL" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "max_sql_length": 1000, + "collect_metrics": true, + "include_parameters": false, + "max_parameters": 10, + "max_parameter_length": 100, + "transaction_spans": "grouped", + "exclude_connections": [], + "exclude_tables": [] + }, + "description": "Doctrine DBAL query tracing configuration" + }, + "cache": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "exclude_pools": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Cache pool service IDs to exclude from tracing (supports regex with / delimiters)" + }, + "flush_deferred": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Commit deferred cache writes on request/command termination and after each consumed message, inside one \"cache.flush\" span, so a Doctrine DBAL pool's deferred writes group under a single trace instead of orphaning at process shutdown" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "exclude_pools": [], + "flush_deferred": false + }, + "description": "Symfony Cache tracing configuration" + } + }, + "additionalProperties": false, + "default": { + "sanitization": { + "url": { + "sensitive_query_parameters": [ + "AWSAccessKeyId", + "Signature", + "sig", + "X-Amz-Signature", + "X-Amz-Credential", + "X-Amz-Security-Token", + "X-Goog-Signature", + "access_token", + "refresh_token", + "id_token", + "id_token_hint", + "logout_token", + "client_secret", + "client_assertion", + "assertion", + "code", + "code_verifier", + "device_code", + "subject_token", + "actor_token", + "token", + "api_key", + "apikey", + "api-key", + "key", + "access_key", + "secret_key", + "private_key", + "secret", + "signature", + "password", + "passwd", + "pwd", + "auth", + "jwt", + "session", + "sessionid", + "PHPSESSID" + ] + } + }, + "http_kernel": { + "enabled": false, + "exclude_paths": [], + "context_propagation": true, + "context_propagation_query": false, + "require_trace_context": false, + "route_naming": "path", + "trace_controller": true, + "trace_controller_resolution": false, + "trace_controller_arguments": false, + "trace_controller_argument_resolvers": false + }, + "console": { + "enabled": false, + "exclude_commands": [ + "messenger:consume" + ] + }, + "messenger": { + "enabled": false, + "context_propagation": true, + "trace": true, + "metrics": true, + "span_naming": "transport" + }, + "twig": { + "enabled": false, + "trace_templates": true, + "trace_blocks": false, + "trace_macros": false, + "exclude_templates": [] + }, + "security": { + "enabled": false, + "fields": { + "id": { + "enabled": true, + "attribute": "user.id" + }, + "roles": { + "enabled": false, + "attribute": "user.roles" + }, + "email": { + "enabled": false, + "attribute": "user.email", + "getter": "getEmail" + } + } + }, + "http_client": { + "enabled": false, + "exclude_clients": [] + }, + "psr18_client": { + "enabled": false, + "exclude_clients": [] + }, + "dbal": { + "enabled": false, + "max_sql_length": 1000, + "collect_metrics": true, + "include_parameters": false, + "max_parameters": 10, + "max_parameter_length": 100, + "transaction_spans": "grouped", + "exclude_connections": [], + "exclude_tables": [] + }, + "cache": { + "enabled": false, + "exclude_pools": [], + "flush_deferred": false + } + }, + "description": "Auto-instrumentation configuration" + }, + "profiler": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/variable", + "default": null, + "description": "null (default) = auto-enable iff WebProfilerBundle is present; true/false to force on/off" + }, + "capture_logs": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Also tee logs into the profiler store (Symfony already has a Logs panel; off by default)" + } + }, + "additionalProperties": false, + "default": { + "enabled": null, + "capture_logs": false + }, + "description": "Symfony Web Profiler integration (dev only; requires symfony/web-profiler-bundle)" + }, + "tracers": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "version": { + "$ref": "#/$defs/types/scalar", + "default": "unknown", + "description": "Instrumentation scope version" + }, + "schema_url": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Schema URL for semantic conventions" + }, + "attributes": { + "$ref": "#/$defs/types/object_null", + "properties": { + "scope": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Attributes attached to the instrumentation scope" + }, + "signal": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Default attributes merged into every emitted signal (per-call values win)" + } + }, + "additionalProperties": false, + "description": "Scope and signal attribute defaults for this instrumentation scope" + } + }, + "additionalProperties": false + }, + "description": "Named tracer configurations" + }, + "meters": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "version": { + "$ref": "#/$defs/types/scalar", + "default": "unknown", + "description": "Instrumentation scope version" + }, + "schema_url": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Schema URL for semantic conventions" + }, + "attributes": { + "$ref": "#/$defs/types/object_null", + "properties": { + "scope": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Attributes attached to the instrumentation scope" + }, + "signal": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Default attributes merged into every emitted signal (per-call values win)" + } + }, + "additionalProperties": false, + "description": "Scope and signal attribute defaults for this instrumentation scope" + } + }, + "additionalProperties": false + }, + "description": "Named meter configurations" + }, + "loggers": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "version": { + "$ref": "#/$defs/types/scalar", + "default": "unknown", + "description": "Instrumentation scope version" + }, + "schema_url": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Schema URL for semantic conventions" + }, + "attributes": { + "$ref": "#/$defs/types/object_null", + "properties": { + "scope": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Attributes attached to the instrumentation scope" + }, + "signal": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Default attributes merged into every emitted signal (per-call values win)" + } + }, + "additionalProperties": false, + "description": "Scope and signal attribute defaults for this instrumentation scope" + } + }, + "additionalProperties": false + }, + "description": "Named logger configurations" + } + }, + "additionalProperties": false + }, + "framework": { + "$ref": "#/$defs/types/object_null", + "properties": { + "secret": { + "$ref": "#/$defs/types/scalar" + }, + "http_method_override": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests." + }, + "allowed_http_method_override": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + }, + "default": null, + "description": "Sets the list of HTTP methods that can be overridden. Set to null to allow all methods to be overridden (default). Set to an empty array to disallow overrides entirely. Otherwise, provide the list of uppercased method names that are allowed." + }, + "trust_x_sendfile_type_header": { + "$ref": "#/$defs/types/scalar", + "default": "%env(bool:default::SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER)%", + "description": "Set true to enable support for xsendfile in binary file responses." + }, + "ide": { + "$ref": "#/$defs/types/scalar", + "default": "%env(default::SYMFONY_IDE)%" + }, + "test": { + "$ref": "#/$defs/types/boolean" + }, + "default_locale": { + "$ref": "#/$defs/types/scalar", + "default": "en" + }, + "set_locale_from_accept_language": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Whether to use the Accept-Language HTTP header to set the Request locale (only when the \"_locale\" request attribute is not passed)." + }, + "set_content_language_from_locale": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Whether to set the Content-Language HTTP header on the Response using the Request locale." + }, + "enabled_locales": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Defines the possible locales for the application. This list is used for generating translations files, but also to restrict which locales are allowed when it is set from Accept-Language header (using \"set_locale_from_accept_language\")." + }, + "trusted_hosts": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "default": [ + "%env(default::SYMFONY_TRUSTED_HOSTS)%" + ] + }, + "trusted_proxies": { + "$ref": "#/$defs/types/variable", + "default": [ + "%env(default::SYMFONY_TRUSTED_PROXIES)%" + ] + }, + "trusted_headers": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "default": [ + "%env(default::SYMFONY_TRUSTED_HEADERS)%" + ] + }, + "error_controller": { + "$ref": "#/$defs/types/scalar", + "default": "error_controller" + }, + "handle_all_throwables": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "HttpKernel will handle all kinds of \\Throwable." + }, + "csrf_protection": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "stateless_token_ids": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Enable headers/cookies-based CSRF validation for the listed token ids." + }, + "check_header": { + "$ref": "#/$defs/types/scalar", + "default": false, + "description": "Whether to check the CSRF token in a header in addition to a cookie when using stateless protection." + }, + "cookie_name": { + "$ref": "#/$defs/types/scalar", + "default": "csrf-token", + "description": "The name of the cookie to use when using stateless protection." + } + }, + "patternProperties": { + "^stateless_token_id$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Enable headers/cookies-based CSRF validation for the listed token ids." + } + ] + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": null, + "stateless_token_ids": [], + "check_header": false, + "cookie_name": "csrf-token" + } + }, + "form": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "csrf_protection": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "token_id": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "field_name": { + "$ref": "#/$defs/types/scalar", + "default": "_token" + }, + "field_attr": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + }, + "default": { + "data-controller": "csrf-protection" + } + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": null, + "token_id": null, + "field_name": "_token", + "field_attr": { + "data-controller": "csrf-protection" + } + } + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "csrf_protection": { + "enabled": null, + "token_id": null, + "field_name": "_token", + "field_attr": { + "data-controller": "csrf-protection" + } + } + }, + "description": "Form configuration" + }, + "http_cache": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "debug": { + "$ref": "#/$defs/types/boolean", + "default": "%kernel.debug%" + }, + "trace_level": { + "anyOf": [ + { + "enum": [ + "none", + "short", + "full" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "trace_header": { + "$ref": "#/$defs/types/scalar" + }, + "default_ttl": { + "$ref": "#/$defs/types/integer" + }, + "private_headers": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + "skip_response_headers": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + "allow_reload": { + "$ref": "#/$defs/types/boolean" + }, + "allow_revalidate": { + "$ref": "#/$defs/types/boolean" + }, + "stale_while_revalidate": { + "$ref": "#/$defs/types/integer" + }, + "stale_if_error": { + "$ref": "#/$defs/types/integer" + }, + "terminate_on_cache_hit": { + "$ref": "#/$defs/types/boolean", + "deprecated": true, + "description": "Deprecated since symfony/framework-bundle 8.1: Setting the \"framework.http_cache.terminate_on_cache_hit.terminate_on_cache_hit\" configuration option is deprecated. It will be removed in version 9.0." + } + }, + "patternProperties": { + "^private_header$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ] + }, + "^skip_response_header$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ] + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "debug": "%kernel.debug%", + "private_headers": [], + "skip_response_headers": [] + }, + "description": "HTTP cache configuration" + }, + "esi": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false + }, + "description": "ESI configuration" + }, + "ssi": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false + }, + "description": "SSI configuration" + }, + "fragments": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "hinclude_default_template": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "path": { + "$ref": "#/$defs/types/scalar", + "default": "/_fragment" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "hinclude_default_template": null, + "path": "/_fragment" + }, + "description": "Fragments configuration" + }, + "profiler": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "collect": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "collect_parameter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "The name of the parameter to use to enable or disable collection on a per request basis." + }, + "only_exceptions": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "only_main_requests": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "dsn": { + "$ref": "#/$defs/types/scalar", + "default": "file:%kernel.cache_dir%/profiler" + }, + "collect_serializer_data": { + "anyOf": [ + { + "enum": [ + true + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": true, + "deprecated": true, + "description": "Deprecated since symfony/framework-bundle 8.1: Setting the \"framework.profiler.collect_serializer_data.collect_serializer_data\" configuration option is deprecated. It will be removed in version 9.0." + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "collect": true, + "collect_parameter": null, + "only_exceptions": false, + "only_main_requests": false, + "dsn": "file:%kernel.cache_dir%/profiler", + "collect_serializer_data": true + }, + "description": "Profiler configuration" + }, + "workflows": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "workflows": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "audit_trail": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false + } + }, + "type": { + "anyOf": [ + { + "enum": [ + "workflow", + "state_machine" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "state_machine" + }, + "marking_store": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "method" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + }, + "property": { + "$ref": "#/$defs/types/scalar" + }, + "service": { + "$ref": "#/$defs/types/scalar" + } + }, + "additionalProperties": false + }, + "supports": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ] + }, + "definition_validators": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + "support_strategy": { + "$ref": "#/$defs/types/scalar" + }, + "initial_marking": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ] + }, + "events_to_dispatch": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + }, + "default": null, + "description": "Select which Transition events should be dispatched for this Workflow.", + "examples": [ + [ + "workflow.enter", + "workflow.transition" + ] + ] + }, + "places": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "name": { + "$ref": "#/$defs/types/scalar" + }, + "metadata": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "examples": [ + { + "color": "blue", + "description": "Workflow to manage article." + } + ] + } + }, + "required": [ + "name" + ], + "additionalProperties": false + } + }, + { + "type": [ + "string" + ] + } + ] + }, + "transitions": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "name": { + "$ref": "#/$defs/types/string_null" + }, + "guard": { + "$ref": "#/$defs/types/string_null", + "description": "An expression to block the transition.", + "examples": [ + "is_fully_authenticated() and is_granted('ROLE_JOURNALIST') and subject.getTitle() == 'My first article'" + ] + }, + "from": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "place": { + "$ref": "#/$defs/types/string_null" + }, + "weight": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 1 + } + }, + "required": [ + "place" + ], + "additionalProperties": false + }, + "minItems": 1 + }, + { + "type": [ + "string" + ] + } + ] + }, + "to": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "place": { + "$ref": "#/$defs/types/string_null" + }, + "weight": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 1 + } + }, + "required": [ + "place" + ], + "additionalProperties": false + }, + "minItems": 1 + }, + { + "type": [ + "string" + ] + } + ] + }, + "weight": { + "$ref": "#/$defs/types/integer", + "default": 1 + }, + "metadata": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "examples": [ + { + "color": "blue", + "description": "Workflow to manage article." + } + ] + } + }, + "required": [ + "name" + ], + "additionalProperties": false + }, + "minItems": 1 + }, + "metadata": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "examples": [ + { + "color": "blue", + "description": "Workflow to manage article." + } + ] + } + }, + "patternProperties": { + "^support$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ] + } + ] + }, + "^definition_validator$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ] + }, + "^event_to_dispatch$": { + "anyOf": [ + { + "$ref": "#/$defs/types/string_null" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + }, + "default": null, + "description": "Select which Transition events should be dispatched for this Workflow.", + "examples": [ + [ + "workflow.enter", + "workflow.transition" + ] + ] + } + ] + }, + "^place$": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "name": { + "$ref": "#/$defs/types/scalar" + }, + "metadata": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "examples": [ + { + "color": "blue", + "description": "Workflow to manage article." + } + ] + } + }, + "required": [ + "name" + ], + "additionalProperties": false + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "name": { + "$ref": "#/$defs/types/scalar" + }, + "metadata": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "examples": [ + { + "color": "blue", + "description": "Workflow to manage article." + } + ] + } + }, + "required": [ + "name" + ], + "additionalProperties": false + } + }, + { + "type": [ + "string" + ] + } + ] + } + ] + }, + "^transition$": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "name": { + "$ref": "#/$defs/types/string_null" + }, + "guard": { + "$ref": "#/$defs/types/string_null", + "description": "An expression to block the transition.", + "examples": [ + "is_fully_authenticated() and is_granted('ROLE_JOURNALIST') and subject.getTitle() == 'My first article'" + ] + }, + "from": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "place": { + "$ref": "#/$defs/types/string_null" + }, + "weight": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 1 + } + }, + "required": [ + "place" + ], + "additionalProperties": false + }, + "minItems": 1 + }, + { + "type": [ + "string" + ] + } + ] + }, + "to": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "place": { + "$ref": "#/$defs/types/string_null" + }, + "weight": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 1 + } + }, + "required": [ + "place" + ], + "additionalProperties": false + }, + "minItems": 1 + }, + { + "type": [ + "string" + ] + } + ] + }, + "weight": { + "$ref": "#/$defs/types/integer", + "default": 1 + }, + "metadata": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "examples": [ + { + "color": "blue", + "description": "Workflow to manage article." + } + ] + } + }, + "required": [ + "name" + ], + "additionalProperties": false + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "name": { + "$ref": "#/$defs/types/string_null" + }, + "guard": { + "$ref": "#/$defs/types/string_null", + "description": "An expression to block the transition.", + "examples": [ + "is_fully_authenticated() and is_granted('ROLE_JOURNALIST') and subject.getTitle() == 'My first article'" + ] + }, + "from": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "place": { + "$ref": "#/$defs/types/string_null" + }, + "weight": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 1 + } + }, + "required": [ + "place" + ], + "additionalProperties": false + }, + "minItems": 1 + }, + { + "type": [ + "string" + ] + } + ] + }, + "to": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "place": { + "$ref": "#/$defs/types/string_null" + }, + "weight": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 1 + } + }, + "required": [ + "place" + ], + "additionalProperties": false + }, + "minItems": 1 + }, + { + "type": [ + "string" + ] + } + ] + }, + "weight": { + "$ref": "#/$defs/types/integer", + "default": 1 + }, + "metadata": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "examples": [ + { + "color": "blue", + "description": "Workflow to manage article." + } + ] + } + }, + "required": [ + "name" + ], + "additionalProperties": false + }, + "minItems": 1 + } + ] + } + }, + "additionalProperties": false + } + } + }, + "patternProperties": { + "^workflow$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "workflows": [] + } + }, + "router": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "resource": { + "$ref": "#/$defs/types/scalar" + }, + "type": { + "$ref": "#/$defs/types/scalar" + }, + "default_uri": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "The default URI used to generate URLs in a non-HTTP context." + }, + "http_port": { + "$ref": "#/$defs/types/scalar", + "default": 80 + }, + "https_port": { + "$ref": "#/$defs/types/scalar", + "default": 443 + }, + "strict_requirements": { + "$ref": "#/$defs/types/scalar", + "default": true, + "description": "set to true to throw an exception when a parameter does not match the requirements\nset to false to disable exceptions when a parameter does not match the requirements (and return null instead)\nset to null to disable parameter checks against requirements\n'true' is the preferred configuration in development mode, while 'false' or 'null' might be preferred in production" + }, + "utf8": { + "$ref": "#/$defs/types/boolean", + "default": true + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "default_uri": null, + "http_port": 80, + "https_port": 443, + "strict_requirements": true, + "utf8": true + }, + "description": "Router configuration" + }, + "session": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "storage_factory_id": { + "$ref": "#/$defs/types/scalar", + "default": "session.storage.factory.native" + }, + "handler_id": { + "$ref": "#/$defs/types/scalar", + "description": "Defaults to using the native session handler, or to the native *file* session handler if \"save_path\" is not null." + }, + "name": { + "$ref": "#/$defs/types/scalar" + }, + "cookie_lifetime": { + "$ref": "#/$defs/types/scalar" + }, + "cookie_path": { + "$ref": "#/$defs/types/scalar" + }, + "cookie_domain": { + "$ref": "#/$defs/types/scalar" + }, + "cookie_secure": { + "anyOf": [ + { + "enum": [ + true, + false, + "auto" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "auto" + }, + "cookie_httponly": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "cookie_samesite": { + "anyOf": [ + { + "enum": [ + null, + "lax", + "strict", + "none" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "lax" + }, + "use_cookies": { + "$ref": "#/$defs/types/boolean" + }, + "gc_divisor": { + "$ref": "#/$defs/types/scalar" + }, + "gc_probability": { + "$ref": "#/$defs/types/scalar" + }, + "gc_maxlifetime": { + "$ref": "#/$defs/types/scalar" + }, + "save_path": { + "$ref": "#/$defs/types/scalar", + "description": "Defaults to \"%kernel.share_dir%/sessions\" if the \"handler_id\" option is not null." + }, + "metadata_update_threshold": { + "$ref": "#/$defs/types/integer", + "default": 0, + "description": "Seconds to wait between 2 session metadata updates." + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "storage_factory_id": "session.storage.factory.native", + "cookie_secure": "auto", + "cookie_httponly": true, + "cookie_samesite": "lax", + "metadata_update_threshold": 0 + }, + "description": "Session configuration" + }, + "request": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "formats": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ] + } + } + }, + "patternProperties": { + "^format$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "formats": [] + }, + "description": "Request configuration" + }, + "assets": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "strict_mode": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Throw an exception if an entry is missing from the manifest.json." + }, + "version_strategy": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "version": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "version_format": { + "$ref": "#/$defs/types/scalar", + "default": "%%s?%%s" + }, + "json_manifest_path": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "base_path": { + "$ref": "#/$defs/types/scalar", + "default": "" + }, + "base_urls": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "minItems": 1 + }, + { + "type": [ + "string" + ] + } + ] + }, + "packages": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "strict_mode": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Throw an exception if an entry is missing from the manifest.json." + }, + "version_strategy": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "version": { + "$ref": "#/$defs/types/scalar" + }, + "version_format": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "json_manifest_path": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "base_path": { + "$ref": "#/$defs/types/scalar", + "default": "" + }, + "base_urls": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "minItems": 1 + }, + { + "type": [ + "string" + ] + } + ] + } + }, + "patternProperties": { + "^base_url$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "minItems": 1 + }, + { + "type": [ + "string" + ] + } + ] + } + ] + } + }, + "additionalProperties": false + } + } + }, + "patternProperties": { + "^base_url$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "minItems": 1 + }, + { + "type": [ + "string" + ] + } + ] + } + ] + }, + "^package$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": true, + "strict_mode": false, + "version_strategy": null, + "version": null, + "version_format": "%%s?%%s", + "json_manifest_path": null, + "base_path": "", + "base_urls": [], + "packages": [] + }, + "description": "Assets configuration" + }, + "asset_mapper": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "paths": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Directories that hold assets that should be in the mapper. Can be a simple array of an array of [\"path/to/assets\": \"namespace\"].", + "examples": [ + [ + "assets/" + ] + ] + }, + "excluded_patterns": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Array of glob patterns of asset file paths that should not be in the asset mapper.", + "examples": [ + [ + "*/assets/build/*", + "*/*_.scss" + ] + ] + }, + "exclude_dotfiles": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "If true, any files starting with \".\" will be excluded from the asset mapper." + }, + "server": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "If true, a \"dev server\" will return the assets from the public directory (true in \"debug\" mode only by default)." + }, + "public_prefix": { + "$ref": "#/$defs/types/scalar", + "default": "/assets/", + "description": "The public path where the assets will be written to (and served from when \"server\" is true)." + }, + "missing_import_mode": { + "anyOf": [ + { + "enum": [ + "strict", + "warn", + "ignore" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "warn", + "description": "Behavior if an asset cannot be found when imported from JavaScript or CSS files - e.g. \"import './non-existent.js'\". \"strict\" means an exception is thrown, \"warn\" means a warning is logged, \"ignore\" means the import is left as-is." + }, + "extensions": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Key-value pair of file extensions set to their mime type.", + "examples": [ + { + ".zip": "application/zip" + } + ] + }, + "importmap_path": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.project_dir%/importmap.php", + "description": "The path of the importmap.php file." + }, + "importmap_polyfill": { + "$ref": "#/$defs/types/scalar", + "default": "es-module-shims", + "description": "The importmap name that will be used to load the polyfill. Set to false to disable." + }, + "importmap_script_attributes": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Key-value pair of attributes to add to script tags output for the importmap.", + "examples": [ + { + "data-turbo-track": "reload" + } + ] + }, + "vendor_dir": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.project_dir%/assets/vendor", + "description": "The directory to store JavaScript vendors." + }, + "precompress": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "formats": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Array of formats to enable. \"brotli\", \"zstandard\" and \"gzip\" are supported. Defaults to all formats supported by the system. The entire list must be provided." + }, + "extensions": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "default": [ + "css", + "cur", + "eot", + "html", + "js", + "json", + "md", + "otc", + "otf", + "proto", + "rss", + "rtf", + "svg", + "ttc", + "ttf", + "txt", + "wasm", + "xml" + ], + "description": "Array of extensions to compress. The entire list must be provided, no merging occurs." + } + }, + "patternProperties": { + "^format$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Array of formats to enable. \"brotli\", \"zstandard\" and \"gzip\" are supported. Defaults to all formats supported by the system. The entire list must be provided." + } + ] + }, + "^extension$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "default": [ + "css", + "cur", + "eot", + "html", + "js", + "json", + "md", + "otc", + "otf", + "proto", + "rss", + "rtf", + "svg", + "ttc", + "ttf", + "txt", + "wasm", + "xml" + ], + "description": "Array of extensions to compress. The entire list must be provided, no merging occurs." + } + ] + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "formats": [], + "extensions": [ + "css", + "cur", + "eot", + "html", + "js", + "json", + "md", + "otc", + "otf", + "proto", + "rss", + "rtf", + "svg", + "ttc", + "ttf", + "txt", + "wasm", + "xml" + ] + }, + "description": "Precompress assets with Brotli, Zstandard and gzip." + } + }, + "patternProperties": { + "^path$": { + "$ref": "#/$defs/types/variable" + }, + "^excluded_pattern$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Array of glob patterns of asset file paths that should not be in the asset mapper.", + "examples": [ + [ + "*/assets/build/*", + "*/*_.scss" + ] + ] + } + ] + }, + "^extension$": { + "$ref": "#/$defs/types/variable" + }, + "^importmap_script_attribute$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": true, + "paths": [], + "excluded_patterns": [], + "exclude_dotfiles": true, + "server": true, + "public_prefix": "/assets/", + "missing_import_mode": "warn", + "extensions": [], + "importmap_path": "%kernel.project_dir%/importmap.php", + "importmap_polyfill": "es-module-shims", + "importmap_script_attributes": [], + "vendor_dir": "%kernel.project_dir%/assets/vendor", + "precompress": { + "enabled": false, + "formats": [], + "extensions": [ + "css", + "cur", + "eot", + "html", + "js", + "json", + "md", + "otc", + "otf", + "proto", + "rss", + "rtf", + "svg", + "ttc", + "ttf", + "txt", + "wasm", + "xml" + ] + } + }, + "description": "Asset Mapper configuration" + }, + "translator": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "fallbacks": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Defaults to the value of \"default_locale\"." + }, + "logging": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "formatter": { + "$ref": "#/$defs/types/scalar", + "default": "translator.formatter.default" + }, + "cache_dir": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.cache_dir%/translations" + }, + "default_path": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.project_dir%/translations", + "description": "The default path used to load translations." + }, + "paths": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + "pseudo_localization": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "accents": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "expansion_factor": { + "$ref": "#/$defs/types/number", + "minimum": 1, + "default": 1 + }, + "brackets": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "parse_html": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "localizable_html_attributes": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + }, + "patternProperties": { + "^localizable_html_attribute$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ] + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "accents": true, + "expansion_factor": 1, + "brackets": true, + "parse_html": false, + "localizable_html_attributes": [] + } + }, + "providers": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "dsn": { + "$ref": "#/$defs/types/scalar" + }, + "domains": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + "locales": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "If not set, all locales listed under framework.enabled_locales are used." + } + }, + "patternProperties": { + "^domain$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ] + }, + "^locale$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "If not set, all locales listed under framework.enabled_locales are used." + } + ] + } + }, + "additionalProperties": false + }, + "description": "Translation providers you can read/write your translations from." + }, + "globals": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "value": { + "$ref": "#/$defs/types/variable" + }, + "message": { + "$ref": "#/$defs/types/string_null" + }, + "parameters": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + } + }, + "domain": { + "$ref": "#/$defs/types/string_null" + } + }, + "patternProperties": { + "^parameter$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "string" + ] + } + ] + }, + "description": "Global parameters.", + "examples": [ + { + "app_version": 3.14 + } + ] + } + }, + "patternProperties": { + "^fallback$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Defaults to the value of \"default_locale\"." + } + ] + }, + "^path$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ] + }, + "^provider$": { + "$ref": "#/$defs/types/variable" + }, + "^global$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": true, + "fallbacks": [], + "logging": false, + "formatter": "translator.formatter.default", + "cache_dir": "%kernel.cache_dir%/translations", + "default_path": "%kernel.project_dir%/translations", + "paths": [], + "pseudo_localization": { + "enabled": false, + "accents": true, + "expansion_factor": 1, + "brackets": true, + "parse_html": false, + "localizable_html_attributes": [] + }, + "providers": [], + "globals": [] + }, + "description": "Translator configuration" + }, + "validation": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "enable_attributes": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "static_method": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "default": [ + "loadValidatorMetadata" + ] + }, + "translation_domain": { + "$ref": "#/$defs/types/scalar", + "default": "validators" + }, + "email_validation_mode": { + "anyOf": [ + { + "enum": [ + "html5", + "html5-allow-no-tld", + "strict" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "html5" + }, + "mapping": { + "$ref": "#/$defs/types/object_null", + "properties": { + "paths": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + }, + "patternProperties": { + "^path$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ] + } + }, + "additionalProperties": false, + "default": { + "paths": [] + } + }, + "not_compromised_password": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "When disabled, compromised passwords will be accepted as valid." + }, + "endpoint": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "API endpoint for the NotCompromisedPassword Validator." + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": true, + "endpoint": null + } + }, + "disable_translation": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "property_metadata_existence_check": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "When enabled, validateProperty() and validatePropertyValue() throw an exception if no metadata is found for the given property." + }, + "auto_mapping": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "services": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + }, + "patternProperties": { + "^service$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ] + } + }, + "additionalProperties": false + }, + "description": "A collection of namespaces for which auto-mapping will be enabled by default, or null to opt-in with the EnableAutoMapping constraint.", + "examples": [ + { + "App\\Entity\\": [], + "App\\WithSpecificLoaders\\": [ + "validator.property_info_loader" + ] + } + ] + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "enable_attributes": true, + "static_method": [ + "loadValidatorMetadata" + ], + "translation_domain": "validators", + "email_validation_mode": "html5", + "mapping": { + "paths": [] + }, + "not_compromised_password": { + "enabled": true, + "endpoint": null + }, + "disable_translation": false, + "property_metadata_existence_check": false, + "auto_mapping": [] + }, + "description": "Validation configuration" + }, + "serializer": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "enable_attributes": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "name_converter": { + "$ref": "#/$defs/types/scalar" + }, + "circular_reference_handler": { + "$ref": "#/$defs/types/scalar" + }, + "max_depth_handler": { + "$ref": "#/$defs/types/scalar" + }, + "mapping": { + "$ref": "#/$defs/types/object_null", + "properties": { + "paths": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + }, + "patternProperties": { + "^path$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ] + } + }, + "additionalProperties": false, + "default": { + "paths": [] + } + }, + "default_context": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + } + }, + "named_serializers": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "name_converter": { + "$ref": "#/$defs/types/scalar" + }, + "default_context": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + } + }, + "include_built_in_normalizers": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Whether to include the built-in normalizers" + }, + "include_built_in_encoders": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Whether to include the built-in encoders" + } + }, + "additionalProperties": false + } + } + }, + "patternProperties": { + "^named_serializer$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "enable_attributes": true, + "mapping": { + "paths": [] + }, + "default_context": [], + "named_serializers": [] + }, + "description": "Serializer configuration" + }, + "property_access": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "magic_call": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "magic_get": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "magic_set": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "throw_exception_on_invalid_index": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "throw_exception_on_invalid_property_path": { + "$ref": "#/$defs/types/boolean", + "default": true + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "magic_call": false, + "magic_get": true, + "magic_set": true, + "throw_exception_on_invalid_index": false, + "throw_exception_on_invalid_property_path": true + }, + "description": "Property access configuration" + }, + "type_info": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "aliases": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Additional type aliases to be used during type context creation." + } + }, + "patternProperties": { + "^alias$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "aliases": [] + }, + "description": "Type info configuration" + }, + "property_info": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "with_constructor_extractor": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Registers the constructor extractor." + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "with_constructor_extractor": true + }, + "description": "Property info configuration" + }, + "cache": { + "$ref": "#/$defs/types/object_null", + "properties": { + "prefix_seed": { + "$ref": "#/$defs/types/scalar", + "default": "_%kernel.project_dir%.%kernel.container_class%", + "description": "Used to namespace cache keys when using several apps with the same shared backend.", + "examples": [ + "my-application-name/%kernel.environment%" + ] + }, + "app": { + "$ref": "#/$defs/types/scalar", + "default": "cache.adapter.filesystem", + "description": "App related cache pools configuration." + }, + "system": { + "$ref": "#/$defs/types/scalar", + "default": "cache.adapter.system", + "description": "System related cache pools configuration." + }, + "directory": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.share_dir%/pools/app" + }, + "default_psr6_provider": { + "$ref": "#/$defs/types/scalar" + }, + "default_redis_provider": { + "$ref": "#/$defs/types/scalar", + "default": "redis://localhost" + }, + "default_valkey_provider": { + "$ref": "#/$defs/types/scalar", + "default": "valkey://localhost" + }, + "default_memcached_provider": { + "$ref": "#/$defs/types/scalar", + "default": "memcached://localhost" + }, + "default_doctrine_dbal_provider": { + "$ref": "#/$defs/types/scalar", + "default": "database_connection" + }, + "default_pdo_provider": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "pools": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "adapters": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "One or more adapters to chain for creating the pool, defaults to \"cache.app\"." + }, + "tags": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "public": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "default_lifetime": { + "$ref": "#/$defs/types/scalar", + "description": "Default lifetime of the pool.", + "examples": [ + "\"300\" for 5 minutes expressed in seconds, \"PT5M\" for five minutes expressed as ISO 8601 time interval, or \"5 minutes\" as a date expression" + ] + }, + "provider": { + "$ref": "#/$defs/types/scalar", + "description": "Overwrite the setting from the default provider for this adapter." + }, + "early_expiration_message_bus": { + "$ref": "#/$defs/types/scalar", + "examples": [ + "\"messenger.default_bus\" to send early expiration events to the default Messenger bus." + ] + }, + "clearer": { + "$ref": "#/$defs/types/scalar" + }, + "marshaller": { + "$ref": "#/$defs/types/scalar", + "description": "The marshaller service to use for this pool." + } + }, + "patternProperties": { + "^adapter$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "One or more adapters to chain for creating the pool, defaults to \"cache.app\"." + } + ] + } + }, + "additionalProperties": false + } + } + }, + "patternProperties": { + "^pool$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false, + "default": { + "prefix_seed": "_%kernel.project_dir%.%kernel.container_class%", + "app": "cache.adapter.filesystem", + "system": "cache.adapter.system", + "directory": "%kernel.share_dir%/pools/app", + "default_redis_provider": "redis://localhost", + "default_valkey_provider": "valkey://localhost", + "default_memcached_provider": "memcached://localhost", + "default_doctrine_dbal_provider": "database_connection", + "default_pdo_provider": null, + "pools": [] + }, + "description": "Cache configuration" + }, + "php_errors": { + "$ref": "#/$defs/types/object_null", + "properties": { + "log": { + "$ref": "#/$defs/types/variable", + "default": true, + "description": "Use the application logger instead of the PHP logger for logging PHP errors.", + "examples": [ + "\"true\" to use the default configuration: log all errors. \"false\" to disable. An integer bit field of E_* constants, or an array mapping E_* constants to log levels." + ] + }, + "throw": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Throw PHP errors as \\ErrorException instances." + } + }, + "additionalProperties": false, + "default": { + "log": true, + "throw": true + }, + "description": "PHP errors handling configuration" + }, + "exceptions": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "log_level": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "The level of log message. Null to let Symfony decide." + }, + "status_code": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "The status code of the response. Null or 0 to let Symfony decide." + }, + "log_channel": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "The channel of log message. Null to let Symfony decide." + } + }, + "additionalProperties": false + }, + "description": "Exception handling configuration" + }, + "web_link": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false + }, + "description": "Web links configuration" + }, + "lock": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "resources": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ] + } + }, + { + "type": [ + "string" + ] + } + ], + "default": { + "default": [ + "flock" + ] + } + } + }, + "patternProperties": { + "^resource$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "string", + "boolean" + ] + } + ], + "default": { + "enabled": false, + "resources": { + "default": [ + "flock" + ] + } + }, + "description": "Lock configuration" + }, + "semaphore": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "resources": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + }, + "minProperties": 1, + "minItems": 1 + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "minItems": 1 + }, + { + "type": [ + "string" + ] + } + ] + } + }, + "patternProperties": { + "^resource$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "string", + "boolean" + ] + } + ], + "default": { + "enabled": false, + "resources": [] + }, + "description": "Semaphore configuration" + }, + "messenger": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "routing": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "minItems": 1 + }, + { + "type": [ + "string" + ] + } + ] + } + }, + "serializer": { + "$ref": "#/$defs/types/object_null", + "properties": { + "default_serializer": { + "$ref": "#/$defs/types/scalar", + "default": "messenger.transport.native_php_serializer", + "description": "Service id to use as the default serializer for the transports." + }, + "symfony_serializer": { + "$ref": "#/$defs/types/object_null", + "properties": { + "format": { + "$ref": "#/$defs/types/scalar", + "default": "json", + "description": "Serialization format for the messenger.transport.symfony_serializer service (which is not the serializer used by default)." + }, + "context": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Context array for the messenger.transport.symfony_serializer service (which is not the serializer used by default)." + } + }, + "additionalProperties": false, + "default": { + "format": "json", + "context": [] + } + } + }, + "additionalProperties": false, + "default": { + "default_serializer": "messenger.transport.native_php_serializer", + "symfony_serializer": { + "format": "json", + "context": [] + } + } + }, + "transports": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "dsn": { + "$ref": "#/$defs/types/scalar" + }, + "serializer": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Service id of a custom serializer to use." + }, + "options": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + } + }, + "failure_transport": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Transport name to send failed messages to (after all retries have failed)." + }, + "retry_strategy": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "service": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Service id to override the retry strategy entirely." + }, + "max_retries": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 3 + }, + "delay": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 1000, + "description": "Time in ms to delay (or the initial value when multiplier is used)." + }, + "multiplier": { + "$ref": "#/$defs/types/number", + "minimum": 1, + "default": 2, + "description": "If greater than 1, delay will grow exponentially for each retry: this delay = (delay * (multiple ^ retries))." + }, + "max_delay": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 0, + "description": "Max time in ms that a retry should ever be delayed (0 = infinite)." + }, + "jitter": { + "$ref": "#/$defs/types/number", + "minimum": 0, + "maximum": 1, + "default": 0.1, + "description": "Randomness to apply to the delay (between 0 and 1)." + } + }, + "additionalProperties": false + }, + { + "type": [ + "string" + ] + } + ], + "default": { + "service": null, + "max_retries": 3, + "delay": 1000, + "multiplier": 2, + "max_delay": 0, + "jitter": 0.1 + } + }, + "rate_limiter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Rate limiter name to use when processing messages." + } + }, + "patternProperties": { + "^option$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "string" + ] + } + ] + } + }, + "failure_transport": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Transport name to send failed messages to (after all retries have failed)." + }, + "stop_worker_on_signals": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "integer", + "string" + ] + } + ], + "description": "A list of signals that should stop the worker; defaults to SIGTERM and SIGINT." + }, + "default_bus": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "buses": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "default_middleware": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "allow_no_handlers": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "allow_no_senders": { + "$ref": "#/$defs/types/boolean", + "default": true + } + }, + "additionalProperties": false + }, + { + "type": [ + "string", + "boolean" + ] + } + ], + "default": { + "enabled": true, + "allow_no_handlers": false, + "allow_no_senders": true + } + }, + "middleware": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "id": { + "$ref": "#/$defs/types/scalar" + }, + "arguments": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/variable" + } + } + }, + "required": [ + "id" + ], + "patternProperties": { + "^argument$": { + "anyOf": [ + { + "$ref": "#/$defs/types/variable" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/variable" + } + } + ] + } + }, + "additionalProperties": false + }, + { + "type": [ + "string" + ] + } + ] + } + }, + { + "type": [ + "string" + ] + } + ] + } + }, + "additionalProperties": false, + "default": { + "default_middleware": { + "enabled": true, + "allow_no_handlers": false, + "allow_no_senders": true + }, + "middleware": [] + } + }, + "default": { + "messenger.bus.default": { + "default_middleware": { + "enabled": true, + "allow_no_handlers": false, + "allow_no_senders": true + }, + "middleware": [] + } + } + } + }, + "patternProperties": { + "^transport$": { + "$ref": "#/$defs/types/variable" + }, + "^stop_worker_on_signal$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "integer", + "string" + ] + } + ], + "description": "A list of signals that should stop the worker; defaults to SIGTERM and SIGINT." + } + ] + }, + "^bus$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "routing": [], + "serializer": { + "default_serializer": "messenger.transport.native_php_serializer", + "symfony_serializer": { + "format": "json", + "context": [] + } + }, + "transports": [], + "failure_transport": null, + "stop_worker_on_signals": [], + "default_bus": null, + "buses": { + "messenger.bus.default": { + "default_middleware": { + "enabled": true, + "allow_no_handlers": false, + "allow_no_senders": true + }, + "middleware": [] + } + } + }, + "description": "Messenger configuration" + }, + "scheduler": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false + }, + "description": "Scheduler configuration" + }, + "disallow_search_engine_index": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Enabled by default when debug is enabled." + }, + "http_client": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "max_host_connections": { + "$ref": "#/$defs/types/integer", + "description": "The maximum number of connections to a single host." + }, + "default_options": { + "$ref": "#/$defs/types/object_null", + "properties": { + "headers": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Associative array: header => value(s)." + }, + "vars": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Associative array: the default vars used to expand the templated URI." + }, + "max_redirects": { + "$ref": "#/$defs/types/integer", + "description": "The maximum number of redirects to follow." + }, + "http_version": { + "$ref": "#/$defs/types/scalar", + "description": "The default HTTP version, typically 1.1 or 2.0, leave to null for the best version." + }, + "resolve": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ], + "description": "Associative array: domain => IP." + }, + "proxy": { + "$ref": "#/$defs/types/scalar", + "description": "The URL of the proxy to pass requests through or null for automatic detection." + }, + "no_proxy": { + "$ref": "#/$defs/types/scalar", + "description": "A comma separated list of hosts that do not require a proxy to be reached." + }, + "timeout": { + "$ref": "#/$defs/types/number", + "description": "The idle timeout, defaults to the \"default_socket_timeout\" ini parameter." + }, + "max_duration": { + "$ref": "#/$defs/types/number", + "description": "The maximum execution time for the request+response as a whole." + }, + "bindto": { + "$ref": "#/$defs/types/scalar", + "description": "A network interface name, IP address, a host name or a UNIX socket to bind to." + }, + "verify_peer": { + "$ref": "#/$defs/types/boolean", + "description": "Indicates if the peer should be verified in a TLS context." + }, + "verify_host": { + "$ref": "#/$defs/types/boolean", + "description": "Indicates if the host should exist as a certificate common name." + }, + "cafile": { + "$ref": "#/$defs/types/scalar", + "description": "A certificate authority file." + }, + "capath": { + "$ref": "#/$defs/types/scalar", + "description": "A directory that contains multiple certificate authority files." + }, + "local_cert": { + "$ref": "#/$defs/types/scalar", + "description": "A PEM formatted certificate file." + }, + "local_pk": { + "$ref": "#/$defs/types/scalar", + "description": "A private key file." + }, + "passphrase": { + "$ref": "#/$defs/types/scalar", + "description": "The passphrase used to encrypt the \"local_pk\" file." + }, + "ciphers": { + "$ref": "#/$defs/types/scalar", + "description": "A list of TLS ciphers separated by colons, commas or spaces (e.g. \"RC3-SHA:TLS13-AES-128-GCM-SHA256\"...)" + }, + "peer_fingerprint": { + "$ref": "#/$defs/types/object_null", + "properties": { + "sha1": { + "$ref": "#/$defs/types/variable" + }, + "pin-sha256": { + "$ref": "#/$defs/types/variable" + }, + "md5": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false, + "description": "Associative array: hashing algorithm => hash(es)." + }, + "crypto_method": { + "$ref": "#/$defs/types/scalar", + "description": "The minimum version of TLS to accept; must be one of STREAM_CRYPTO_METHOD_TLSv*_CLIENT constants." + }, + "extra": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Extra options for specific HTTP client." + }, + "rate_limiter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Rate limiter name to use for throttling requests." + }, + "caching": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "cache_pool": { + "$ref": "#/$defs/types/string_null", + "default": "cache.http_client", + "description": "The taggable cache pool to use for storing the responses." + }, + "shared": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Indicates whether the cache is shared (public) or private." + }, + "max_ttl": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 86400, + "description": "The maximum TTL (in seconds) allowed for cached responses." + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "cache_pool": "cache.http_client", + "shared": true, + "max_ttl": 86400 + }, + "description": "Caching configuration." + }, + "retry_failed": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "retry_strategy": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "service id to override the retry strategy." + }, + "http_codes": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "code": { + "$ref": "#/$defs/types/integer" + }, + "methods": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "A list of HTTP methods that triggers a retry for this status code. When empty, all methods are retried." + } + }, + "patternProperties": { + "^method$": { + "anyOf": [ + { + "$ref": "#/$defs/types/string_null" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "A list of HTTP methods that triggers a retry for this status code. When empty, all methods are retried." + } + ] + } + }, + "additionalProperties": false + } + }, + { + "type": [ + "integer", + "string" + ] + } + ], + "description": "A list of HTTP status code that triggers a retry." + }, + "max_retries": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 3 + }, + "delay": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 1000, + "description": "Time in ms to delay (or the initial value when multiplier is used)." + }, + "multiplier": { + "$ref": "#/$defs/types/number", + "minimum": 1, + "default": 2, + "description": "If greater than 1, delay will grow exponentially for each retry: delay * (multiple ^ retries)." + }, + "max_delay": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 0, + "description": "Max time in ms that a retry should ever be delayed (0 = infinite)." + }, + "jitter": { + "$ref": "#/$defs/types/number", + "minimum": 0, + "maximum": 1, + "default": 0.1, + "description": "Randomness in percent (between 0 and 1) to apply to the delay." + } + }, + "patternProperties": { + "^http_code$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "retry_strategy": null, + "http_codes": [], + "max_retries": 3, + "delay": 1000, + "multiplier": 2, + "max_delay": 0, + "jitter": 0.1 + } + } + }, + "patternProperties": { + "^header$": { + "$ref": "#/$defs/types/variable" + }, + "^var$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + "mock_response_factory": { + "$ref": "#/$defs/types/scalar", + "description": "`true` to always return empty 200 responses, or the id of the service to use to generate mock responses - which should be either an invokable or an iterable." + }, + "scoped_clients": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "scope": { + "$ref": "#/$defs/types/scalar", + "description": "The regular expression that the request URL must match before adding the other options. When none is provided, the base URI is used instead. The regular expression should end with a \"/\", for example \"https://api\\.github\\.com/\", so that it doesn't match other hosts." + }, + "base_uri": { + "$ref": "#/$defs/types/scalar", + "description": "The URI to resolve relative URLs, following rules in RFC 3985, section 2." + }, + "auth_basic": { + "$ref": "#/$defs/types/scalar", + "description": "An HTTP Basic authentication \"username:password\"." + }, + "auth_bearer": { + "$ref": "#/$defs/types/scalar", + "description": "A token enabling HTTP Bearer authorization." + }, + "auth_ntlm": { + "$ref": "#/$defs/types/scalar", + "description": "A \"username:password\" pair to use Microsoft NTLM authentication (requires the cURL extension)." + }, + "query": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ], + "description": "Associative array of query string values merged with the base URI." + }, + "headers": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Associative array: header => value(s)." + }, + "max_redirects": { + "$ref": "#/$defs/types/integer", + "description": "The maximum number of redirects to follow." + }, + "http_version": { + "$ref": "#/$defs/types/scalar", + "description": "The default HTTP version, typically 1.1 or 2.0, leave to null for the best version." + }, + "resolve": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ], + "description": "Associative array: domain => IP." + }, + "proxy": { + "$ref": "#/$defs/types/scalar", + "description": "The URL of the proxy to pass requests through or null for automatic detection." + }, + "no_proxy": { + "$ref": "#/$defs/types/scalar", + "description": "A comma separated list of hosts that do not require a proxy to be reached." + }, + "timeout": { + "$ref": "#/$defs/types/number", + "description": "The idle timeout, defaults to the \"default_socket_timeout\" ini parameter." + }, + "max_duration": { + "$ref": "#/$defs/types/number", + "description": "The maximum execution time for the request+response as a whole." + }, + "bindto": { + "$ref": "#/$defs/types/scalar", + "description": "A network interface name, IP address, a host name or a UNIX socket to bind to." + }, + "verify_peer": { + "$ref": "#/$defs/types/boolean", + "description": "Indicates if the peer should be verified in a TLS context." + }, + "verify_host": { + "$ref": "#/$defs/types/boolean", + "description": "Indicates if the host should exist as a certificate common name." + }, + "cafile": { + "$ref": "#/$defs/types/scalar", + "description": "A certificate authority file." + }, + "capath": { + "$ref": "#/$defs/types/scalar", + "description": "A directory that contains multiple certificate authority files." + }, + "local_cert": { + "$ref": "#/$defs/types/scalar", + "description": "A PEM formatted certificate file." + }, + "local_pk": { + "$ref": "#/$defs/types/scalar", + "description": "A private key file." + }, + "passphrase": { + "$ref": "#/$defs/types/scalar", + "description": "The passphrase used to encrypt the \"local_pk\" file." + }, + "ciphers": { + "$ref": "#/$defs/types/scalar", + "description": "A list of TLS ciphers separated by colons, commas or spaces (e.g. \"RC3-SHA:TLS13-AES-128-GCM-SHA256\"...)." + }, + "peer_fingerprint": { + "$ref": "#/$defs/types/object_null", + "properties": { + "sha1": { + "$ref": "#/$defs/types/variable" + }, + "pin-sha256": { + "$ref": "#/$defs/types/variable" + }, + "md5": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false, + "description": "Associative array: hashing algorithm => hash(es)." + }, + "crypto_method": { + "$ref": "#/$defs/types/scalar", + "description": "The minimum version of TLS to accept; must be one of STREAM_CRYPTO_METHOD_TLSv*_CLIENT constants." + }, + "mock_response_factory": { + "$ref": "#/$defs/types/scalar", + "description": "`true` to always return empty 200 responses, `false` to disable mocking, or the id of the service to use to generate mock responses (invokable or iterable)." + }, + "extra": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Extra options for specific HTTP client." + }, + "rate_limiter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Rate limiter name to use for throttling requests." + }, + "caching": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "cache_pool": { + "$ref": "#/$defs/types/string_null", + "default": "cache.http_client", + "description": "The taggable cache pool to use for storing the responses." + }, + "shared": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Indicates whether the cache is shared (public) or private." + }, + "max_ttl": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 86400, + "description": "The maximum TTL (in seconds) allowed for cached responses." + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "cache_pool": "cache.http_client", + "shared": true, + "max_ttl": 86400 + }, + "description": "Caching configuration." + }, + "retry_failed": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "retry_strategy": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "service id to override the retry strategy." + }, + "http_codes": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "code": { + "$ref": "#/$defs/types/integer" + }, + "methods": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "A list of HTTP methods that triggers a retry for this status code. When empty, all methods are retried." + } + }, + "patternProperties": { + "^method$": { + "anyOf": [ + { + "$ref": "#/$defs/types/string_null" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "A list of HTTP methods that triggers a retry for this status code. When empty, all methods are retried." + } + ] + } + }, + "additionalProperties": false + } + }, + { + "type": [ + "integer", + "string" + ] + } + ], + "description": "A list of HTTP status code that triggers a retry." + }, + "max_retries": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 3 + }, + "delay": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 1000, + "description": "Time in ms to delay (or the initial value when multiplier is used)." + }, + "multiplier": { + "$ref": "#/$defs/types/number", + "minimum": 1, + "default": 2, + "description": "If greater than 1, delay will grow exponentially for each retry: delay * (multiple ^ retries)." + }, + "max_delay": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 0, + "description": "Max time in ms that a retry should ever be delayed (0 = infinite)." + }, + "jitter": { + "$ref": "#/$defs/types/number", + "minimum": 0, + "maximum": 1, + "default": 0.1, + "description": "Randomness in percent (between 0 and 1) to apply to the delay." + } + }, + "patternProperties": { + "^http_code$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "retry_strategy": null, + "http_codes": [], + "max_retries": 3, + "delay": 1000, + "multiplier": 2, + "max_delay": 0, + "jitter": 0.1 + } + } + }, + "patternProperties": { + "^header$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "string" + ] + } + ] + } + } + }, + "patternProperties": { + "^scoped_client$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": true, + "scoped_clients": [] + }, + "description": "HTTP Client configuration" + }, + "mailer": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "message_bus": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "The message bus to use. Defaults to the default bus if the Messenger component is installed." + }, + "dsn": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "transports": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + } + }, + "envelope": { + "$ref": "#/$defs/types/object_null", + "properties": { + "sender": { + "$ref": "#/$defs/types/scalar" + }, + "recipients": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ] + }, + "allowed_recipients": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "A list of regular expressions that allow recipients when \"recipients\" option is defined.", + "examples": [ + [ + ".*@example\\.com" + ] + ] + } + }, + "patternProperties": { + "^recipient$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ] + } + ] + }, + "^allowed_recipient$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "A list of regular expressions that allow recipients when \"recipients\" option is defined.", + "examples": [ + [ + ".*@example\\.com" + ] + ] + } + ] + } + }, + "additionalProperties": false, + "description": "Mailer Envelope configuration" + }, + "headers": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "value": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "string" + ] + } + ] + } + }, + "dkim_signer": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "key": { + "$ref": "#/$defs/types/scalar", + "default": "", + "description": "Key content, or path to key (in PEM format with the `file://` prefix)" + }, + "domain": { + "$ref": "#/$defs/types/scalar", + "default": "" + }, + "select": { + "$ref": "#/$defs/types/scalar", + "default": "" + }, + "passphrase": { + "$ref": "#/$defs/types/scalar", + "default": "", + "description": "The private key passphrase" + }, + "options": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + } + } + }, + "patternProperties": { + "^option$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "key": "", + "domain": "", + "select": "", + "passphrase": "", + "options": [] + }, + "description": "DKIM signer configuration" + }, + "smime_signer": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "key": { + "$ref": "#/$defs/types/scalar", + "default": "", + "description": "Path to key (in PEM format)" + }, + "certificate": { + "$ref": "#/$defs/types/scalar", + "default": "", + "description": "Path to certificate (in PEM format without the `file://` prefix)" + }, + "passphrase": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "The private key passphrase" + }, + "extra_certificates": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "sign_options": { + "$ref": "#/$defs/types/integer_null", + "default": null + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "key": "", + "certificate": "", + "passphrase": null, + "extra_certificates": null, + "sign_options": null + }, + "description": "S/MIME signer configuration" + }, + "smime_encrypter": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "repository": { + "$ref": "#/$defs/types/scalar", + "default": "", + "description": "S/MIME certificate repository service. This service shall implement the `Symfony\\Component\\Mailer\\EventListener\\SmimeCertificateRepositoryInterface`." + }, + "cipher": { + "$ref": "#/$defs/types/integer_null", + "default": null, + "description": "A set of algorithms used to encrypt the message" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "repository": "", + "cipher": null + }, + "description": "S/MIME encrypter configuration" + } + }, + "patternProperties": { + "^transport$": { + "$ref": "#/$defs/types/variable" + }, + "^header$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "message_bus": null, + "dsn": null, + "transports": [], + "headers": [], + "dkim_signer": { + "enabled": false, + "key": "", + "domain": "", + "select": "", + "passphrase": "", + "options": [] + }, + "smime_signer": { + "enabled": false, + "key": "", + "certificate": "", + "passphrase": null, + "extra_certificates": null, + "sign_options": null + }, + "smime_encrypter": { + "enabled": false, + "repository": "", + "cipher": null + } + }, + "description": "Mailer configuration" + }, + "secrets": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "vault_directory": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.project_dir%/config/secrets/%kernel.runtime_environment%" + }, + "local_dotenv_file": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.project_dir%/.env.%kernel.environment%.local" + }, + "decryption_env_var": { + "$ref": "#/$defs/types/scalar", + "default": "base64:default::SYMFONY_DECRYPTION_SECRET" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": true, + "vault_directory": "%kernel.project_dir%/config/secrets/%kernel.runtime_environment%", + "local_dotenv_file": "%kernel.project_dir%/.env.%kernel.environment%.local", + "decryption_env_var": "base64:default::SYMFONY_DECRYPTION_SECRET" + } + }, + "notifier": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "message_bus": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "The message bus to use. Defaults to the default bus if the Messenger component is installed." + }, + "chatter_transports": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + } + }, + "texter_transports": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + } + }, + "notification_on_failed_messages": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "channel_policy": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ] + } + }, + "admin_recipients": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "email": { + "$ref": "#/$defs/types/scalar" + }, + "phone": { + "$ref": "#/$defs/types/scalar", + "default": "" + } + }, + "additionalProperties": false + } + } + }, + "patternProperties": { + "^chatter_transport$": { + "$ref": "#/$defs/types/variable" + }, + "^texter_transport$": { + "$ref": "#/$defs/types/variable" + }, + "^admin_recipient$": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "email": { + "$ref": "#/$defs/types/scalar" + }, + "phone": { + "$ref": "#/$defs/types/scalar", + "default": "" + } + }, + "additionalProperties": false + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/object_null", + "properties": { + "email": { + "$ref": "#/$defs/types/scalar" + }, + "phone": { + "$ref": "#/$defs/types/scalar", + "default": "" + } + }, + "additionalProperties": false + } + } + ] + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "message_bus": null, + "chatter_transports": [], + "texter_transports": [], + "notification_on_failed_messages": false, + "channel_policy": [], + "admin_recipients": [] + }, + "description": "Notifier configuration" + }, + "rate_limiter": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "limiters": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "lock_factory": { + "$ref": "#/$defs/types/scalar", + "default": "auto", + "description": "The service ID of the lock factory used by this limiter (or null to disable locking)." + }, + "cache_pool": { + "$ref": "#/$defs/types/scalar", + "default": "cache.rate_limiter", + "description": "The cache pool to use for storing the current limiter state." + }, + "storage_service": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "The service ID of a custom storage implementation, this precedes any configured \"cache_pool\"." + }, + "policy": { + "anyOf": [ + { + "enum": [ + "fixed_window", + "token_bucket", + "sliding_window", + "compound", + "no_limit" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "description": "The algorithm to be used by this limiter." + }, + "limiters": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "The limiter names to use when using the \"compound\" policy." + }, + "limit": { + "$ref": "#/$defs/types/integer", + "description": "The maximum allowed hits in a fixed interval or burst." + }, + "interval": { + "$ref": "#/$defs/types/scalar", + "description": "Configures the fixed interval if \"policy\" is set to \"fixed_window\" or \"sliding_window\". The value must be a number followed by \"second\", \"minute\", \"hour\", \"day\", \"week\" or \"month\" (or their plural equivalent)." + }, + "rate": { + "$ref": "#/$defs/types/object_null", + "properties": { + "interval": { + "$ref": "#/$defs/types/scalar", + "description": "Configures the rate interval. The value must be a number followed by \"second\", \"minute\", \"hour\", \"day\", \"week\" or \"month\" (or their plural equivalent)." + }, + "amount": { + "$ref": "#/$defs/types/integer", + "default": 1, + "description": "Amount of tokens to add each interval." + } + }, + "additionalProperties": false, + "description": "Configures the fill rate if \"policy\" is set to \"token_bucket\"." + }, + "anchor_at": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Aligns the \"fixed_window\" policy to a calendar (e.g. \"2024-01-05 00:00:00 UTC\" combined with `interval: 1 month` resets the counter on the 5th of each month). UTC if not specified." + } + }, + "patternProperties": { + "^limiter$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "The limiter names to use when using the \"compound\" policy." + } + ] + } + }, + "additionalProperties": false + } + } + }, + "patternProperties": { + "^limiter$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "limiters": [] + }, + "description": "Rate limiter configuration" + }, + "uid": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "default_uuid_version": { + "anyOf": [ + { + "enum": [ + 7, + 6, + 4, + 1 + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": 7 + }, + "name_based_uuid_version": { + "anyOf": [ + { + "enum": [ + 5, + 3 + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": 5 + }, + "name_based_uuid_namespace": { + "$ref": "#/$defs/types/scalar" + }, + "time_based_uuid_version": { + "anyOf": [ + { + "enum": [ + 7, + 6, + 1 + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": 7 + }, + "time_based_uuid_node": { + "$ref": "#/$defs/types/scalar" + }, + "uuid47_secret": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "A high-entropy secret used by the \"uuid47_transformer\" service. Defaults to \"kernel.secret\"." + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "default_uuid_version": 7, + "name_based_uuid_version": 5, + "time_based_uuid_version": 7, + "uuid47_secret": null + }, + "description": "Uid configuration" + }, + "html_sanitizer": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "sanitizers": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "default_action": { + "anyOf": [ + { + "enum": [ + "drop", + "block", + "allow" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "description": "Defines how the sanitizer must behave by default." + }, + "allow_safe_elements": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Allows \"safe\" elements and attributes." + }, + "allow_static_elements": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Allows all static elements and attributes from the W3C Sanitizer API standard." + }, + "allow_elements": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Configures the elements that the sanitizer should retain from the input. The element name is the key, the value is either a list of allowed attributes for this element or \"*\" to allow the default set of attributes (https://wicg.github.io/sanitizer-api/#default-configuration).", + "examples": [ + { + "i": "*", + "a": [ + "title" + ], + "span": "class" + } + ] + }, + "block_elements": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Configures elements as blocked. Blocked elements are elements the sanitizer should remove from the input, but retain their children." + }, + "drop_elements": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Configures elements as dropped. Dropped elements are elements the sanitizer should remove from the input, including their children." + }, + "allow_attributes": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Configures attributes as allowed. Allowed attributes are attributes the sanitizer should retain from the input." + }, + "drop_attributes": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "description": "Configures attributes as dropped. Dropped attributes are attributes the sanitizer should remove from the input." + }, + "force_attributes": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/string_null" + } + }, + "description": "Forcefully set the values of certain attributes on certain elements." + }, + "force_https_urls": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Transforms URLs using the HTTP scheme to use the HTTPS scheme instead." + }, + "allowed_link_schemes": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Allows only a given list of schemes to be used in links href attributes." + }, + "allowed_link_hosts": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "default": null, + "description": "Allows only a given list of hosts to be used in links href attributes." + }, + "allow_relative_links": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Allows relative URLs to be used in links href attributes." + }, + "allowed_media_schemes": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Allows only a given list of schemes to be used in media source attributes (img, audio, video, ...)." + }, + "allowed_media_hosts": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "default": null, + "description": "Allows only a given list of hosts to be used in media source attributes (img, audio, video, ...)." + }, + "allow_relative_medias": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Allows relative URLs to be used in media source attributes (img, audio, video, ...)." + }, + "with_attribute_sanitizers": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Registers custom attribute sanitizers." + }, + "without_attribute_sanitizers": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Unregisters custom attribute sanitizers." + }, + "max_input_length": { + "$ref": "#/$defs/types/integer", + "default": 0, + "description": "The maximum length allowed for the sanitized input." + } + }, + "patternProperties": { + "^allow_element$": { + "$ref": "#/$defs/types/variable" + }, + "^block_element$": { + "anyOf": [ + { + "$ref": "#/$defs/types/string_null" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Configures elements as blocked. Blocked elements are elements the sanitizer should remove from the input, but retain their children." + } + ] + }, + "^drop_element$": { + "anyOf": [ + { + "$ref": "#/$defs/types/string_null" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Configures elements as dropped. Dropped elements are elements the sanitizer should remove from the input, including their children." + } + ] + }, + "^allow_attribute$": { + "$ref": "#/$defs/types/variable" + }, + "^drop_attribute$": { + "$ref": "#/$defs/types/variable" + }, + "^force_attribute$": { + "$ref": "#/$defs/types/variable" + }, + "^allowed_link_scheme$": { + "anyOf": [ + { + "$ref": "#/$defs/types/string_null" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Allows only a given list of schemes to be used in links href attributes." + } + ] + }, + "^allowed_link_host$": { + "anyOf": [ + { + "$ref": "#/$defs/types/string_null" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "default": null, + "description": "Allows only a given list of hosts to be used in links href attributes." + } + ] + }, + "^allowed_media_scheme$": { + "anyOf": [ + { + "$ref": "#/$defs/types/string_null" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Allows only a given list of schemes to be used in media source attributes (img, audio, video, ...)." + } + ] + }, + "^allowed_media_host$": { + "anyOf": [ + { + "$ref": "#/$defs/types/string_null" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "default": null, + "description": "Allows only a given list of hosts to be used in media source attributes (img, audio, video, ...)." + } + ] + }, + "^with_attribute_sanitizer$": { + "anyOf": [ + { + "$ref": "#/$defs/types/string_null" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Registers custom attribute sanitizers." + } + ] + }, + "^without_attribute_sanitizer$": { + "anyOf": [ + { + "$ref": "#/$defs/types/string_null" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/string_null" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Unregisters custom attribute sanitizers." + } + ] + } + }, + "additionalProperties": false + } + } + }, + "patternProperties": { + "^sanitizer$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "sanitizers": [] + }, + "description": "HtmlSanitizer configuration" + }, + "webhook": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "message_bus": { + "$ref": "#/$defs/types/scalar", + "default": "messenger.default_bus", + "description": "The message bus to use." + }, + "event_header_name": { + "$ref": "#/$defs/types/scalar", + "default": "Webhook-Event" + }, + "id_header_name": { + "$ref": "#/$defs/types/scalar", + "default": "Webhook-Id" + }, + "signature_header_name": { + "$ref": "#/$defs/types/scalar", + "default": "Webhook-Signature" + }, + "signing_algorithm": { + "$ref": "#/$defs/types/scalar", + "default": "sha256" + }, + "routing": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "service": { + "$ref": "#/$defs/types/scalar" + }, + "secret": { + "$ref": "#/$defs/types/scalar", + "default": "", + "description": "The secret used to verify incoming request signatures. It must be set in production: with an empty value, depending on the parser, requests from any sender are accepted or every request is rejected." + } + }, + "additionalProperties": false + } + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "message_bus": "messenger.default_bus", + "event_header_name": "Webhook-Event", + "id_header_name": "Webhook-Id", + "signature_header_name": "Webhook-Signature", + "signing_algorithm": "sha256", + "routing": [] + }, + "description": "Webhook configuration" + }, + "remote_event": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false + }, + "description": "RemoteEvent configuration" + }, + "json_streamer": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "default_options": { + "$ref": "#/$defs/types/object_null", + "properties": { + "include_null_properties": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Encode the properties with null value" + } + }, + "additionalProperties": true, + "default": { + "include_null_properties": false + } + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "default_options": { + "include_null_properties": false + } + }, + "description": "JSON streamer configuration" + } + }, + "patternProperties": { + "^enabled_locale$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Defines the possible locales for the application. This list is used for generating translations files, but also to restrict which locales are allowed when it is set from Accept-Language header (using \"set_locale_from_accept_language\")." + } + ] + }, + "^trusted_header$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "default": [ + "%env(default::SYMFONY_TRUSTED_HEADERS)%" + ] + } + ] + }, + "^workflow$": { + "$ref": "#/$defs/types/variable" + }, + "^exception$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + "monolog": { + "$ref": "#/$defs/types/object_null", + "properties": { + "use_microseconds": { + "$ref": "#/$defs/types/scalar", + "default": true + }, + "timezone": { + "$ref": "#/$defs/types/string_null", + "default": null, + "description": "The timezone used for the timestamp of every log record (e.g. \"UTC\" or \"Europe/Paris\"). Defaults to the PHP default timezone." + }, + "channels": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "List of additional channels to create. The \"app\" channel is already created by default. Channels are also automatically created for services using the \"monolog.logger\" DI tag with a custom channel attribute." + }, + "handlers": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "$ref": "#/$defs/types/scalar" + }, + "id": { + "$ref": "#/$defs/types/scalar" + }, + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "priority": { + "$ref": "#/$defs/types/scalar", + "default": 0 + }, + "level": { + "$ref": "#/$defs/types/scalar", + "default": "DEBUG" + }, + "bubble": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "interactive_only": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "app_name": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "include_stacktraces": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "base_path": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "process_psr_3_messages": { + "$ref": "#/$defs/types/variable", + "default": { + "enabled": null + } + }, + "path": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.logs_dir%/%kernel.environment%.log" + }, + "file_permission": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "use_locking": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "filename_format": { + "$ref": "#/$defs/types/scalar", + "default": "{filename}-{date}" + }, + "date_format": { + "$ref": "#/$defs/types/scalar", + "default": "Y-m-d" + }, + "ident": { + "$ref": "#/$defs/types/scalar", + "default": "php" + }, + "logopts": { + "$ref": "#/$defs/types/scalar", + "default": 1 + }, + "facility": { + "$ref": "#/$defs/types/scalar", + "default": "user" + }, + "max_files": { + "$ref": "#/$defs/types/scalar", + "default": 0 + }, + "action_level": { + "$ref": "#/$defs/types/scalar", + "default": "WARNING" + }, + "activation_strategy": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "stop_buffering": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "passthru_level": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "excluded_http_codes": { + "$ref": "#/$defs/types/variable", + "description": "Only for \"fingers_crossed\" handler type", + "examples": [ + [ + 403, + 404, + { + "400": [ + "^/foo", + "^/bar" + ] + } + ] + ] + }, + "accepted_levels": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + "min_level": { + "$ref": "#/$defs/types/scalar", + "default": "DEBUG" + }, + "max_level": { + "$ref": "#/$defs/types/scalar", + "default": "EMERGENCY" + }, + "buffer_size": { + "$ref": "#/$defs/types/scalar", + "default": 0 + }, + "flush_on_overflow": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "handler": { + "$ref": "#/$defs/types/scalar" + }, + "url": { + "$ref": "#/$defs/types/scalar" + }, + "exchange": { + "$ref": "#/$defs/types/scalar" + }, + "exchange_name": { + "$ref": "#/$defs/types/scalar", + "default": "log" + }, + "channel": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "bot_name": { + "$ref": "#/$defs/types/scalar", + "default": "Monolog" + }, + "use_attachment": { + "$ref": "#/$defs/types/scalar", + "default": true + }, + "use_short_attachment": { + "$ref": "#/$defs/types/scalar", + "default": false + }, + "include_extra": { + "$ref": "#/$defs/types/scalar", + "default": false + }, + "icon_emoji": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "webhook_url": { + "$ref": "#/$defs/types/scalar" + }, + "exclude_fields": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + "token": { + "$ref": "#/$defs/types/scalar" + }, + "region": { + "$ref": "#/$defs/types/scalar" + }, + "source": { + "$ref": "#/$defs/types/scalar" + }, + "use_ssl": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "user": { + "$ref": "#/$defs/types/variable" + }, + "title": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "host": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "port": { + "$ref": "#/$defs/types/scalar", + "default": 514 + }, + "rfc": { + "$ref": "#/$defs/types/scalar", + "default": 1 + }, + "config": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + "members": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + "connection_string": { + "$ref": "#/$defs/types/scalar" + }, + "timeout": { + "$ref": "#/$defs/types/scalar" + }, + "time": { + "$ref": "#/$defs/types/scalar", + "default": 60 + }, + "deduplication_level": { + "$ref": "#/$defs/types/scalar", + "default": 400 + }, + "store": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "connection_timeout": { + "$ref": "#/$defs/types/scalar" + }, + "persistent": { + "$ref": "#/$defs/types/boolean" + }, + "message_type": { + "$ref": "#/$defs/types/scalar", + "default": 0 + }, + "expand_newlines": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "parse_mode": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "disable_webpage_preview": { + "$ref": "#/$defs/types/boolean_null", + "default": null + }, + "disable_notification": { + "$ref": "#/$defs/types/boolean_null", + "default": null + }, + "split_long_messages": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "delay_between_messages": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "topic": { + "$ref": "#/$defs/types/integer_null", + "default": null + }, + "factor": { + "$ref": "#/$defs/types/integer", + "minimum": 1, + "default": 1 + }, + "tags": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ] + }, + "console_formatter_options": { + "$ref": "#/$defs/types/variable", + "default": [] + }, + "formatter": { + "$ref": "#/$defs/types/scalar" + }, + "nested": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "publisher": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "id": { + "$ref": "#/$defs/types/scalar" + }, + "hostname": { + "$ref": "#/$defs/types/scalar" + }, + "port": { + "$ref": "#/$defs/types/scalar", + "default": 12201 + }, + "chunk_size": { + "$ref": "#/$defs/types/scalar", + "default": 1420 + }, + "encoder": { + "anyOf": [ + { + "enum": [ + "json", + "compressed_json" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ] + } + }, + "additionalProperties": false + }, + { + "type": [ + "string" + ] + } + ] + }, + "mongodb": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "id": { + "$ref": "#/$defs/types/scalar", + "description": "ID of a MongoDB\\Client service", + "examples": [ + "doctrine_mongodb.odm.logs_connection" + ] + }, + "uri": { + "$ref": "#/$defs/types/scalar" + }, + "username": { + "$ref": "#/$defs/types/scalar" + }, + "password": { + "$ref": "#/$defs/types/scalar" + }, + "database": { + "$ref": "#/$defs/types/scalar", + "default": "monolog" + }, + "collection": { + "$ref": "#/$defs/types/scalar", + "default": "logs" + } + }, + "additionalProperties": false + }, + { + "type": [ + "string" + ] + } + ] + }, + "elasticsearch": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "id": { + "$ref": "#/$defs/types/scalar" + }, + "hosts": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + "host": { + "$ref": "#/$defs/types/scalar" + }, + "port": { + "$ref": "#/$defs/types/scalar", + "default": 9200 + }, + "transport": { + "$ref": "#/$defs/types/scalar", + "default": "Http" + }, + "user": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "password": { + "$ref": "#/$defs/types/scalar", + "default": null + } + }, + "additionalProperties": false + }, + { + "type": [ + "string" + ] + } + ] + }, + "index": { + "$ref": "#/$defs/types/scalar", + "default": "monolog" + }, + "document_type": { + "$ref": "#/$defs/types/scalar", + "default": "logs" + }, + "ignore_error": { + "$ref": "#/$defs/types/scalar", + "default": false + }, + "redis": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "id": { + "$ref": "#/$defs/types/scalar" + }, + "host": { + "$ref": "#/$defs/types/scalar" + }, + "password": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "port": { + "$ref": "#/$defs/types/scalar", + "default": 6379 + }, + "database": { + "$ref": "#/$defs/types/scalar", + "default": 0 + }, + "key_name": { + "$ref": "#/$defs/types/scalar", + "default": "monolog_redis" + } + }, + "additionalProperties": false + }, + { + "type": [ + "string" + ] + } + ] + }, + "predis": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "id": { + "$ref": "#/$defs/types/scalar" + }, + "host": { + "$ref": "#/$defs/types/scalar" + } + }, + "additionalProperties": false + }, + { + "type": [ + "string" + ] + } + ], + "deprecated": true, + "description": "Deprecated since symfony/monolog-bundle 4.1: The \"predis\" option is deprecated and ignored, use the \"redis\" option to configure the Predis client." + }, + "from_email": { + "$ref": "#/$defs/types/scalar" + }, + "to_email": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ] + }, + "subject": { + "$ref": "#/$defs/types/scalar" + }, + "content_type": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "headers": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + "parameters": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + "mailer": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "email_prototype": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "id": { + "$ref": "#/$defs/types/scalar" + }, + "method": { + "$ref": "#/$defs/types/scalar", + "default": null + } + }, + "additionalProperties": false + }, + { + "type": [ + "string" + ] + } + ] + }, + "verbosity_levels": { + "$ref": "#/$defs/types/object_null", + "properties": { + "VERBOSITY_QUIET": { + "$ref": "#/$defs/types/scalar", + "default": "ERROR" + }, + "VERBOSITY_NORMAL": { + "$ref": "#/$defs/types/scalar", + "default": "WARNING" + }, + "VERBOSITY_VERBOSE": { + "$ref": "#/$defs/types/scalar", + "default": "NOTICE" + }, + "VERBOSITY_VERY_VERBOSE": { + "$ref": "#/$defs/types/scalar", + "default": "INFO" + }, + "VERBOSITY_DEBUG": { + "$ref": "#/$defs/types/scalar", + "default": "DEBUG" + } + }, + "additionalProperties": false + }, + "channels": { + "$ref": "#/$defs/types/variable" + } + }, + "patternProperties": { + "^member$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ] + }, + "^excluded_http_code$": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "code": { + "$ref": "#/$defs/types/scalar" + }, + "urls": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + }, + "additionalProperties": false + }, + { + "$ref": "#/$defs/types/variable", + "description": "Only for \"fingers_crossed\" handler type", + "examples": [ + [ + 403, + 404, + { + "400": [ + "^/foo", + "^/bar" + ] + } + ] + ] + } + ] + }, + "^tag$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ] + } + ] + }, + "^accepted_level$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ] + }, + "^header$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ] + }, + "^parameter$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + } + ] + } + }, + "additionalProperties": false + }, + "examples": [ + { + "syslog": { + "type": "stream", + "path": "/var/log/symfony.log", + "level": "ERROR", + "bubble": "false", + "formatter": "my_formatter" + }, + "main": { + "type": "fingers_crossed", + "action_level": "WARNING", + "buffer_size": 30, + "handler": "custom" + }, + "custom": { + "type": "service", + "id": "my_handler" + } + } + ] + } + }, + "patternProperties": { + "^channel$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "List of additional channels to create. The \"app\" channel is already created by default. Channels are also automatically created for services using the \"monolog.logger\" DI tag with a custom channel attribute." + } + ] + }, + "^handler$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + "playwright": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Enable Playwright Symfony integration" + }, + "intercepted_hosts": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "default": [ + "localhost", + "127.0.0.1", + "testapp.local" + ], + "description": "List of hosts to intercept for in-process handling" + }, + "debug": { + "$ref": "#/$defs/types/boolean", + "default": "%kernel.debug%", + "description": "Enable debug mode for Playwright integration" + }, + "node_path": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Path to the Node.js executable running the Playwright server (auto-detected when null, can be overridden per browser)" + }, + "default_browser": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "Name of the default Playwright browser to autowire" + }, + "base_url": { + "$ref": "#/$defs/types/scalar", + "default": "%env(default::PLAYWRIGHT_BASE_URL)%", + "description": "Base URL used when Playwright builds absolute URLs during tests (defaults to the PLAYWRIGHT_BASE_URL env var when defined, http://localhost otherwise)" + }, + "debug_logging": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Enable verbose Playwright logging without requiring environment variables" + }, + "browsers": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/object_null", + "properties": { + "type": { + "anyOf": [ + { + "enum": [ + "chromium", + "firefox", + "webkit" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "chromium", + "description": "Browser engine type" + }, + "headless": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "timeout_ms": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 30000, + "description": "Timeout in milliseconds for Playwright operations" + }, + "slowmo_ms": { + "$ref": "#/$defs/types/integer", + "minimum": 0, + "default": 0, + "description": "Slow down every operation by the given milliseconds" + }, + "args": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Browser launch arguments" + }, + "env": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/scalar" + }, + "description": "Environment variables for the Playwright Node.js server process" + }, + "node_path": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Override global node_path for this browser" + }, + "min_node_version": { + "$ref": "#/$defs/types/scalar", + "default": "20.0.0", + "description": "Minimum Node.js version required to launch the server" + }, + "channel": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Browser distribution channel, e.g. chrome-beta or msedge" + }, + "screenshot_dir": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Default directory where page screenshots are saved" + }, + "downloads_dir": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Directory where downloads are stored" + }, + "videos_dir": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Directory where context videos are recorded" + }, + "tracing": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "dir": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "screenshots": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "snapshots": { + "$ref": "#/$defs/types/boolean", + "default": false + } + }, + "additionalProperties": false, + "description": "Record a Playwright trace for contexts created from this configuration" + }, + "proxy": { + "$ref": "#/$defs/types/object_null", + "properties": { + "server": { + "$ref": "#/$defs/types/scalar", + "description": "Proxy server, e.g. http://host:port" + }, + "username": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "password": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "bypass": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Comma-separated hosts to bypass" + } + }, + "additionalProperties": false, + "description": "Proxy applied to the browser" + } + }, + "additionalProperties": false + }, + "default": { + "default": { + "type": "chromium", + "headless": true, + "timeout_ms": 30000, + "slowmo_ms": 0, + "args": [], + "env": [] + } + }, + "description": "Named Playwright browsers with per-browser configuration" + }, + "assets": { + "$ref": "#/$defs/types/object_null", + "properties": { + "public_roots": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "default": [ + "%kernel.project_dir%/public" + ], + "description": "Filesystem roots that expose publicly accessible assets" + }, + "prefixes": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "default": [ + "/assets", + "/build", + "/_framework/ux" + ], + "description": "URL prefixes that should be served directly by the asset bridge" + }, + "disable_cache": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Disable HTTP caching of assets served via the bridge (useful for tests)" + } + }, + "additionalProperties": false, + "default": { + "public_roots": [ + "%kernel.project_dir%/public" + ], + "prefixes": [ + "/assets", + "/build", + "/_framework/ux" + ], + "disable_cache": true + }, + "description": "Asset handling configuration used by the in-process dev server bridge" + } + }, + "additionalProperties": false + }, + "presta_sitemap": { + "$ref": "#/$defs/types/object_null", + "properties": { + "generator": { + "$ref": "#/$defs/types/scalar", + "default": "presta_sitemap.generator_default" + }, + "dumper": { + "$ref": "#/$defs/types/scalar", + "default": "presta_sitemap.dumper_default" + }, + "timetolive": { + "$ref": "#/$defs/types/integer", + "default": 3600 + }, + "sitemap_file_prefix": { + "$ref": "#/$defs/types/scalar", + "default": "sitemap", + "description": "Sets sitemap filename prefix defaults to \"sitemap\" -> sitemap.xml (for index); sitemap.
.xml(.gz) (for sitemaps)" + }, + "items_by_set": { + "$ref": "#/$defs/types/integer", + "default": 50000, + "description": "The maximum number of items allowed in single sitemap." + }, + "route_annotation_listener": { + "$ref": "#/$defs/types/scalar", + "default": true + }, + "dump_directory": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.project_dir%/public", + "description": "The directory to which the sitemap will be dumped. It can be either absolute, or relative (to the place where the command will be triggered). Default to Symfony's public dir." + }, + "defaults": { + "$ref": "#/$defs/types/object_null", + "properties": { + "priority": { + "$ref": "#/$defs/types/scalar", + "default": 0.5 + }, + "changefreq": { + "$ref": "#/$defs/types/scalar", + "default": "daily" + }, + "lastmod": { + "$ref": "#/$defs/types/scalar", + "default": "now" + } + }, + "additionalProperties": false, + "default": { + "priority": 0.5, + "changefreq": "daily", + "lastmod": "now" + } + }, + "default_section": { + "$ref": "#/$defs/types/scalar", + "default": "default", + "description": "The default section in which static routes are registered." + }, + "alternate": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "default_locale": { + "$ref": "#/$defs/types/scalar", + "default": "en", + "description": "The default locale of your routes." + }, + "locales": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "default": [ + "en" + ], + "description": "List of supported locales of your routes." + }, + "i18n": { + "anyOf": [ + { + "enum": [ + "symfony", + "jms" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "symfony", + "description": "Strategy used to create your i18n routes." + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "default_locale": "en", + "locales": [ + "en" + ], + "i18n": "symfony" + }, + "description": "Automatically generate alternate (hreflang) urls with static routes. Requires route_annotation_listener config to be enabled." + } + }, + "additionalProperties": false + }, + "static_content_generator": { + "$ref": "#/$defs/types/object_null", + "properties": { + "output_directory": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.project_dir%/output" + } + }, + "additionalProperties": false + }, + "stimulus": { + "$ref": "#/$defs/types/object_null", + "properties": { + "controller_paths": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "default": [ + "%kernel.project_dir%/assets/controllers" + ] + }, + "controllers_json": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.project_dir%/assets/controllers.json" + } + }, + "additionalProperties": false + }, + "symfonycasts_tailwind": { + "$ref": "#/$defs/types/object_null", + "properties": { + "input_css": { + "$ref": "#/$defs/types/variable", + "default": [ + "%kernel.project_dir%/assets/styles/app.css" + ], + "description": "Paths to CSS files to process through Tailwind" + }, + "config_file": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.project_dir%/tailwind.config.js", + "description": "Path to the tailwind.config.js file" + }, + "binary": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "The tailwind binary to use instead of downloading a new one" + }, + "binary_version": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Tailwind CLI version to download - required unless \"binary\" is set (run \"tailwind:init\" to configure)" + }, + "binary_platform": { + "anyOf": [ + { + "enum": [ + "auto", + "linux-arm64", + "linux-arm64-musl", + "linux-x64", + "linux-x64-musl", + "macos-arm64", + "macos-x64", + "windows-x64" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "default": "auto", + "description": "Tailwind CLI platform to download - \"auto\" will try to detect the platform automatically" + }, + "postcss_config_file": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "Path to PostCSS config file which is passed to the Tailwind CLI" + }, + "strict_mode": { + "$ref": "#/$defs/types/boolean_null", + "default": null, + "description": "When enabled, an exception will be thrown if there are no built assets (default: false in `test` env, true otherwise)" + }, + "process_timeout": { + "$ref": "#/$defs/types/integer", + "default": 60, + "description": "Timeout in seconds for the Tailwind build process - use \"0\" to disable" + } + }, + "additionalProperties": false + }, + "twig": { + "$ref": "#/$defs/types/object_null", + "properties": { + "form_themes": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar", + "default": "form_div_layout.html.twig" + }, + "default": [ + "form_div_layout.html.twig" + ], + "examples": [ + [ + "@My/form.html.twig" + ] + ] + }, + "globals": { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + }, + "examples": [ + { + "foo": "@bar", + "pi": 3.14 + } + ] + }, + "autoescape_service": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "autoescape_service_method": { + "$ref": "#/$defs/types/scalar", + "default": null + }, + "cache": { + "$ref": "#/$defs/types/scalar", + "default": true + }, + "charset": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.charset%" + }, + "debug": { + "$ref": "#/$defs/types/boolean", + "default": "%kernel.debug%" + }, + "strict_variables": { + "$ref": "#/$defs/types/boolean", + "default": "%kernel.debug%" + }, + "auto_reload": { + "$ref": "#/$defs/types/scalar" + }, + "optimizations": { + "$ref": "#/$defs/types/integer", + "minimum": -1 + }, + "default_path": { + "$ref": "#/$defs/types/scalar", + "default": "%kernel.project_dir%/templates", + "description": "The default path used to load templates." + }, + "file_name_pattern": { + "anyOf": [ + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + } + }, + { + "type": [ + "string" + ] + } + ], + "description": "Pattern of file name used for cache warmer and linter.", + "examples": [ + "*.twig" + ] + }, + "paths": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "additionalProperties": { + "$ref": "#/$defs/types/variable" + } + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/variable" + } + } + ] + }, + "date": { + "$ref": "#/$defs/types/object_null", + "properties": { + "format": { + "$ref": "#/$defs/types/scalar", + "default": "F j, Y H:i" + }, + "interval_format": { + "$ref": "#/$defs/types/scalar", + "default": "%d days" + }, + "timezone": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "The timezone used when formatting dates, when set to null, the timezone returned by date_default_timezone_get() is used." + } + }, + "additionalProperties": false, + "default": { + "format": "F j, Y H:i", + "interval_format": "%d days", + "timezone": null + }, + "description": "The default format options used by the date filter." + }, + "number_format": { + "$ref": "#/$defs/types/object_null", + "properties": { + "decimals": { + "$ref": "#/$defs/types/integer", + "default": 0 + }, + "decimal_point": { + "$ref": "#/$defs/types/scalar", + "default": "." + }, + "thousands_separator": { + "$ref": "#/$defs/types/scalar", + "default": "," + } + }, + "additionalProperties": false, + "default": { + "decimals": 0, + "decimal_point": ".", + "thousands_separator": "," + }, + "description": "The default format options for the number_format filter." + }, + "mailer": { + "$ref": "#/$defs/types/object_null", + "properties": { + "html_to_text_converter": { + "$ref": "#/$defs/types/scalar", + "default": null, + "description": "A service implementing the \"Symfony\\Component\\Mime\\HtmlToTextConverter\\HtmlToTextConverterInterface\"." + } + }, + "additionalProperties": false + } + }, + "patternProperties": { + "^form_theme$": { + "anyOf": [ + { + "$ref": "#/$defs/types/scalar", + "default": "form_div_layout.html.twig" + }, + { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar", + "default": "form_div_layout.html.twig" + }, + "default": [ + "form_div_layout.html.twig" + ], + "examples": [ + [ + "@My/form.html.twig" + ] + ] + } + ] + }, + "^global$": { + "$ref": "#/$defs/types/variable" + }, + "^path$": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false + }, + "twig_extra": { + "$ref": "#/$defs/types/object_null", + "properties": { + "cache": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false + } + }, + "html": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false + } + }, + "markdown": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": true + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": true + } + }, + "intl": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false + } + }, + "cssinliner": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false + } + }, + "inky": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false + } + }, + "string": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false + } + }, + "commonmark": { + "$ref": "#/$defs/types/object_null", + "properties": { + "renderer": { + "$ref": "#/$defs/types/object_null", + "properties": { + "block_separator": { + "$ref": "#/$defs/types/scalar" + }, + "inner_separator": { + "$ref": "#/$defs/types/scalar" + }, + "soft_break": { + "$ref": "#/$defs/types/scalar" + } + }, + "additionalProperties": false, + "description": "Array of options for rendering HTML." + }, + "html_input": { + "anyOf": [ + { + "enum": [ + "strip", + "allow", + "escape" + ] + }, + { + "$ref": "#/$defs/types/param" + } + ], + "description": "How to handle HTML input." + }, + "allow_unsafe_links": { + "$ref": "#/$defs/types/boolean", + "default": true, + "description": "Remove risky link and image URLs by setting this to false." + }, + "max_nesting_level": { + "$ref": "#/$defs/types/integer", + "default": 9223372036854775807, + "description": "The maximum nesting level for blocks." + }, + "max_delimiters_per_line": { + "$ref": "#/$defs/types/integer", + "default": 9223372036854775807, + "description": "The maximum number of strong/emphasis delimiters per line." + }, + "slug_normalizer": { + "$ref": "#/$defs/types/object_null", + "properties": { + "instance": { + "$ref": "#/$defs/types/variable" + }, + "max_length": { + "$ref": "#/$defs/types/integer", + "default": 255 + }, + "unique": { + "$ref": "#/$defs/types/variable" + } + }, + "additionalProperties": false, + "description": "Array of options for configuring how URL-safe slugs are created." + }, + "commonmark": { + "$ref": "#/$defs/types/object_null", + "properties": { + "enable_em": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "enable_strong": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "use_asterisk": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "use_underscore": { + "$ref": "#/$defs/types/boolean", + "default": true + }, + "unordered_list_markers": { + "$ref": "#/$defs/types/array_null", + "items": { + "$ref": "#/$defs/types/scalar" + }, + "default": [ + [ + "-", + "*", + "+" + ] + ] + } + }, + "additionalProperties": false, + "description": "Array of options for configuring the CommonMark core extension." + } + }, + "additionalProperties": true + } + }, + "additionalProperties": false + }, + "web_profiler": { + "$ref": "#/$defs/types/object_null", + "properties": { + "toolbar": { + "anyOf": [ + { + "$ref": "#/$defs/types/object_null", + "properties": { + "enabled": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "ajax_replace": { + "$ref": "#/$defs/types/boolean", + "default": false, + "description": "Replace toolbar on AJAX requests" + } + }, + "additionalProperties": false + }, + { + "type": [ + "boolean" + ] + } + ], + "default": { + "enabled": false, + "ajax_replace": false + }, + "description": "Profiler toolbar configuration" + }, + "intercept_redirects": { + "$ref": "#/$defs/types/boolean", + "default": false + }, + "excluded_ajax_paths": { + "$ref": "#/$defs/types/scalar", + "default": "^/((index|app(_[\\w]+)?)\\.php/)?_wdt" + } + }, + "additionalProperties": false + } + } + }, + "type": "object", + "properties": { + "flow_telemetry": { + "$ref": "#/$defs/nodes/flow_telemetry" + }, + "framework": { + "$ref": "#/$defs/nodes/framework" + }, + "monolog": { + "$ref": "#/$defs/nodes/monolog" + }, + "presta_sitemap": { + "$ref": "#/$defs/nodes/presta_sitemap" + }, + "static_content_generator": { + "$ref": "#/$defs/nodes/static_content_generator" + }, + "stimulus": { + "$ref": "#/$defs/nodes/stimulus" + }, + "symfonycasts_tailwind": { + "$ref": "#/$defs/nodes/symfonycasts_tailwind" + }, + "twig": { + "$ref": "#/$defs/nodes/twig" + }, + "twig_extra": { + "$ref": "#/$defs/nodes/twig_extra" + }, + "when@dev": { + "$ref": "#/$defs/types/object_null", + "properties": { + "flow_telemetry": { + "$ref": "#/$defs/nodes/flow_telemetry" + }, + "framework": { + "$ref": "#/$defs/nodes/framework" + }, + "imports": true, + "monolog": { + "$ref": "#/$defs/nodes/monolog" + }, + "parameters": true, + "presta_sitemap": { + "$ref": "#/$defs/nodes/presta_sitemap" + }, + "services": true, + "static_content_generator": { + "$ref": "#/$defs/nodes/static_content_generator" + }, + "stimulus": { + "$ref": "#/$defs/nodes/stimulus" + }, + "symfonycasts_tailwind": { + "$ref": "#/$defs/nodes/symfonycasts_tailwind" + }, + "twig": { + "$ref": "#/$defs/nodes/twig" + }, + "twig_extra": { + "$ref": "#/$defs/nodes/twig_extra" + }, + "web_profiler": { + "$ref": "#/$defs/nodes/web_profiler" + } + }, + "additionalProperties": false + }, + "when@test": { + "$ref": "#/$defs/types/object_null", + "properties": { + "flow_telemetry": { + "$ref": "#/$defs/nodes/flow_telemetry" + }, + "framework": { + "$ref": "#/$defs/nodes/framework" + }, + "imports": true, + "monolog": { + "$ref": "#/$defs/nodes/monolog" + }, + "parameters": true, + "playwright": { + "$ref": "#/$defs/nodes/playwright" + }, + "presta_sitemap": { + "$ref": "#/$defs/nodes/presta_sitemap" + }, + "services": true, + "static_content_generator": { + "$ref": "#/$defs/nodes/static_content_generator" + }, + "stimulus": { + "$ref": "#/$defs/nodes/stimulus" + }, + "symfonycasts_tailwind": { + "$ref": "#/$defs/nodes/symfonycasts_tailwind" + }, + "twig": { + "$ref": "#/$defs/nodes/twig" + }, + "twig_extra": { + "$ref": "#/$defs/nodes/twig_extra" + }, + "web_profiler": { + "$ref": "#/$defs/nodes/web_profiler" + } + }, + "additionalProperties": false + } + }, + "patternProperties": { + "^when@[a-zA-Z0-9]+$": { + "$ref": "#/$defs/types/object_null", + "properties": { + "flow_telemetry": { + "$ref": "#/$defs/nodes/flow_telemetry" + }, + "framework": { + "$ref": "#/$defs/nodes/framework" + }, + "monolog": { + "$ref": "#/$defs/nodes/monolog" + }, + "presta_sitemap": { + "$ref": "#/$defs/nodes/presta_sitemap" + }, + "static_content_generator": { + "$ref": "#/$defs/nodes/static_content_generator" + }, + "stimulus": { + "$ref": "#/$defs/nodes/stimulus" + }, + "symfonycasts_tailwind": { + "$ref": "#/$defs/nodes/symfonycasts_tailwind" + }, + "twig": { + "$ref": "#/$defs/nodes/twig" + }, + "twig_extra": { + "$ref": "#/$defs/nodes/twig_extra" + } + } + } + } +} diff --git a/web/landing/config/services.yaml b/web/landing/config/services.yaml index 11e387e3a8..d5cab65fae 100644 --- a/web/landing/config/services.yaml +++ b/web/landing/config/services.yaml @@ -35,10 +35,6 @@ services: arguments: $checkoutLinks: '%work_shop_checkout_links%' - Flow\Website\Factory\Github\ContributorsRequestFactory: - arguments: - $githubToken: '%env(GITHUB_TOKEN)%' - # curl-based clients segfault in php-fpm on macOS (system proxy lookup via # fork-unsafe Network.framework), so avatar fetching uses the stream-based client. social_card.http_client: diff --git a/web/landing/content/examples/topics/reading/dbal/key_set/code.php b/web/landing/content/examples/topics/reading/dbal/key_set/code.php index 90a5e57876..18181b8faf 100644 --- a/web/landing/content/examples/topics/reading/dbal/key_set/code.php +++ b/web/landing/content/examples/topics/reading/dbal/key_set/code.php @@ -10,7 +10,7 @@ use function Flow\ETL\DSL\{data_frame, to_output}; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Schema\{Column, Table}; -use Doctrine\DBAL\Types\{Type, Types}; +use Doctrine\DBAL\Types\Types; require __DIR__ . '/vendor/autoload.php'; @@ -22,9 +22,9 @@ $connection = DriverManager::getConnection(['memory' => true, 'driver' => 'pdo_sqlite']); $connection->createSchemaManager()->createTable(new Table('orders', [ - new Column('order_id', Type::getType(Types::GUID), ['notnull' => true]), - new Column('created_at', Type::getType(Types::DATETIME_IMMUTABLE), ['notnull' => true]), - new Column('customer', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('order_id', Types::GUID, ['notnull' => true]), + new Column('created_at', Types::DATETIME_IMMUTABLE, ['notnull' => true]), + new Column('customer', Types::STRING, ['notnull' => true, 'length' => 255]), ])); data_frame() diff --git a/web/landing/content/examples/topics/reading/dbal/limit_offset/code.php b/web/landing/content/examples/topics/reading/dbal/limit_offset/code.php index a00913bcf2..e898e08755 100644 --- a/web/landing/content/examples/topics/reading/dbal/limit_offset/code.php +++ b/web/landing/content/examples/topics/reading/dbal/limit_offset/code.php @@ -7,7 +7,7 @@ use function Flow\ETL\DSL\{data_frame, to_output}; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Schema\{Column, Table}; -use Doctrine\DBAL\Types\{Type, Types}; +use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\IO\Extractor\Order; use Flow\ETL\Adapter\Doctrine\IO\Extractor\OrderBy; @@ -33,10 +33,10 @@ $schemaManager->createTable(new Table( 'orders', [ - new Column('order_id', Type::getType(Types::GUID), ['notnull' => true]), - new Column('created_at', Type::getType(Types::DATETIME_IMMUTABLE), ['notnull' => true]), - new Column('email', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('customer', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('order_id', Types::GUID, ['notnull' => true]), + new Column('created_at', Types::DATETIME_IMMUTABLE, ['notnull' => true]), + new Column('email', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('customer', Types::STRING, ['notnull' => true, 'length' => 255]), ], )); diff --git a/web/landing/content/examples/topics/reading/dbal/queries/code.php b/web/landing/content/examples/topics/reading/dbal/queries/code.php index 821de743d2..0c6cac8f69 100644 --- a/web/landing/content/examples/topics/reading/dbal/queries/code.php +++ b/web/landing/content/examples/topics/reading/dbal/queries/code.php @@ -7,7 +7,7 @@ use function Flow\ETL\DSL\{data_frame, to_output}; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Schema\{Column, Table}; -use Doctrine\DBAL\Types\{Type, Types}; +use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\IO\Extractor\ParametersSet; require __DIR__ . '/vendor/autoload.php'; @@ -20,9 +20,9 @@ $connection = DriverManager::getConnection(['memory' => true, 'driver' => 'pdo_sqlite']); $connection->createSchemaManager()->createTable(new Table('orders', [ - new Column('order_id', Type::getType(Types::GUID), ['notnull' => true]), - new Column('created_at', Type::getType(Types::DATETIME_IMMUTABLE), ['notnull' => true]), - new Column('customer', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), + new Column('order_id', Types::GUID, ['notnull' => true]), + new Column('created_at', Types::DATETIME_IMMUTABLE, ['notnull' => true]), + new Column('customer', Types::STRING, ['notnull' => true, 'length' => 255]), ])); data_frame() diff --git a/web/landing/content/examples/topics/reading/dbal/query/code.php b/web/landing/content/examples/topics/reading/dbal/query/code.php index 4695eed815..4cb6e8d87b 100644 --- a/web/landing/content/examples/topics/reading/dbal/query/code.php +++ b/web/landing/content/examples/topics/reading/dbal/query/code.php @@ -7,7 +7,7 @@ use function Flow\ETL\DSL\{data_frame, to_output}; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Schema\{Column, Table}; -use Doctrine\DBAL\Types\{Type, Types}; +use Doctrine\DBAL\Types\Types; use Flow\ETL\Adapter\Doctrine\IO\Extractor\ParametersSet; require __DIR__ . '/vendor/autoload.php'; @@ -20,10 +20,10 @@ $connection = DriverManager::getConnection(['memory' => true, 'driver' => 'pdo_sqlite']); $connection->createSchemaManager()->createTable(new Table('orders', [ - new Column('order_id', Type::getType(Types::GUID), ['notnull' => true]), - new Column('created_at', Type::getType(Types::DATETIME_IMMUTABLE), ['notnull' => true]), - new Column('customer', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('discount', Type::getType(Types::FLOAT), ['notnull' => false]), + new Column('order_id', Types::GUID, ['notnull' => true]), + new Column('created_at', Types::DATETIME_IMMUTABLE, ['notnull' => true]), + new Column('customer', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('discount', Types::FLOAT, ['notnull' => false]), ])); data_frame() diff --git a/web/landing/content/examples/topics/writing/dbal/delete/code.php b/web/landing/content/examples/topics/writing/dbal/delete/code.php index 80052b9c66..62eea60e81 100644 --- a/web/landing/content/examples/topics/writing/dbal/delete/code.php +++ b/web/landing/content/examples/topics/writing/dbal/delete/code.php @@ -10,7 +10,7 @@ use function Flow\ETL\DSL\{data_frame, from_array}; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Schema\{Column, Table, UniqueConstraint}; -use Doctrine\DBAL\Types\{Type, Types}; +use Doctrine\DBAL\Types\Types; require __DIR__ . '/vendor/autoload.php'; @@ -31,15 +31,15 @@ $schemaManager->createTable(new Table( $table = 'orders', [ - new Column('order_id', Type::getType(Types::GUID), ['notnull' => true]), - new Column('created_at', Type::getType(Types::DATETIME_IMMUTABLE), ['notnull' => true]), - new Column('updated_at', Type::getType(Types::DATETIME_IMMUTABLE), ['notnull' => false]), - new Column('discount', Type::getType(Types::FLOAT), ['notnull' => false]), - new Column('email', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('customer', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('address', Type::getType(Types::JSON), ['notnull' => true]), - new Column('notes', Type::getType(Types::JSON), ['notnull' => true]), - new Column('items', Type::getType(Types::JSON), ['notnull' => true]), + new Column('order_id', Types::GUID, ['notnull' => true]), + new Column('created_at', Types::DATETIME_IMMUTABLE, ['notnull' => true]), + new Column('updated_at', Types::DATETIME_IMMUTABLE, ['notnull' => false]), + new Column('discount', Types::FLOAT, ['notnull' => false]), + new Column('email', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('customer', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('address', Types::JSON, ['notnull' => true]), + new Column('notes', Types::JSON, ['notnull' => true]), + new Column('items', Types::JSON, ['notnull' => true]), ], uniqueConstraints: [ new UniqueConstraint('orders_order_id', ['order_id']), diff --git a/web/landing/content/examples/topics/writing/dbal/insert/code.php b/web/landing/content/examples/topics/writing/dbal/insert/code.php index c75cc4a053..2206224419 100644 --- a/web/landing/content/examples/topics/writing/dbal/insert/code.php +++ b/web/landing/content/examples/topics/writing/dbal/insert/code.php @@ -7,7 +7,7 @@ use function Flow\ETL\DSL\{data_frame, overwrite, to_output}; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Schema\{Column, Table}; -use Doctrine\DBAL\Types\{Type, Types}; +use Doctrine\DBAL\Types\Types; require __DIR__ . '/vendor/autoload.php'; @@ -31,15 +31,15 @@ $schemaManager->createTable(new Table( $table = 'orders', [ - new Column('order_id', Type::getType(Types::GUID), ['notnull' => true]), - new Column('created_at', Type::getType(Types::DATETIME_IMMUTABLE), ['notnull' => true]), - new Column('updated_at', Type::getType(Types::DATETIME_IMMUTABLE), ['notnull' => false]), - new Column('discount', Type::getType(Types::FLOAT), ['notnull' => false]), - new Column('email', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('customer', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('address', Type::getType(Types::JSON), ['notnull' => true]), - new Column('notes', Type::getType(Types::JSON), ['notnull' => true]), - new Column('items', Type::getType(Types::JSON), ['notnull' => true]), + new Column('order_id', Types::GUID, ['notnull' => true]), + new Column('created_at', Types::DATETIME_IMMUTABLE, ['notnull' => true]), + new Column('updated_at', Types::DATETIME_IMMUTABLE, ['notnull' => false]), + new Column('discount', Types::FLOAT, ['notnull' => false]), + new Column('email', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('customer', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('address', Types::JSON, ['notnull' => true]), + new Column('notes', Types::JSON, ['notnull' => true]), + new Column('items', Types::JSON, ['notnull' => true]), ], )); diff --git a/web/landing/content/examples/topics/writing/dbal/upsert/code.php b/web/landing/content/examples/topics/writing/dbal/upsert/code.php index 71633ac9c3..a81ccb355e 100644 --- a/web/landing/content/examples/topics/writing/dbal/upsert/code.php +++ b/web/landing/content/examples/topics/writing/dbal/upsert/code.php @@ -9,7 +9,7 @@ use function Flow\ETL\DSL\{data_frame, to_output}; use Doctrine\DBAL\DriverManager; use Doctrine\DBAL\Schema\{Column, Table, UniqueConstraint}; -use Doctrine\DBAL\Types\{Type, Types}; +use Doctrine\DBAL\Types\Types; require __DIR__ . '/vendor/autoload.php'; @@ -30,15 +30,15 @@ $schemaManager->createTable(new Table( $table = 'orders', [ - new Column('order_id', Type::getType(Types::GUID), ['notnull' => true]), - new Column('created_at', Type::getType(Types::DATETIME_IMMUTABLE), ['notnull' => true]), - new Column('updated_at', Type::getType(Types::DATETIME_IMMUTABLE), ['notnull' => false]), - new Column('discount', Type::getType(Types::FLOAT), ['notnull' => false]), - new Column('email', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('customer', Type::getType(Types::STRING), ['notnull' => true, 'length' => 255]), - new Column('address', Type::getType(Types::JSON), ['notnull' => true]), - new Column('notes', Type::getType(Types::JSON), ['notnull' => true]), - new Column('items', Type::getType(Types::JSON), ['notnull' => true]), + new Column('order_id', Types::GUID, ['notnull' => true]), + new Column('created_at', Types::DATETIME_IMMUTABLE, ['notnull' => true]), + new Column('updated_at', Types::DATETIME_IMMUTABLE, ['notnull' => false]), + new Column('discount', Types::FLOAT, ['notnull' => false]), + new Column('email', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('customer', Types::STRING, ['notnull' => true, 'length' => 255]), + new Column('address', Types::JSON, ['notnull' => true]), + new Column('notes', Types::JSON, ['notnull' => true]), + new Column('items', Types::JSON, ['notnull' => true]), ], uniqueConstraints: [ new UniqueConstraint('orders_order_id', ['order_id']), diff --git a/web/landing/content/guides/distributed-tracing-in-php.md b/web/landing/content/guides/distributed-tracing-in-php.md index eb00139d71..95ebb3824b 100644 --- a/web/landing/content/guides/distributed-tracing-in-php.md +++ b/web/landing/content/guides/distributed-tracing-in-php.md @@ -80,7 +80,7 @@ It has four parts: a version, the trace id, the id of the span that makes the ca ## Pass the trace context with traceparent -flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP. It needs PHP 8.3 or newer, no extension, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). +flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP. It needs PHP 8.5 or newer, no extension, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). ```bash composer require flow-php/telemetry flow-php/etl diff --git a/web/landing/content/guides/export-database-to-excel-in-php.md b/web/landing/content/guides/export-database-to-excel-in-php.md index 1bb35e6452..f3bb2b965a 100644 --- a/web/landing/content/guides/export-database-to-excel-in-php.md +++ b/web/landing/content/guides/export-database-to-excel-in-php.md @@ -102,7 +102,7 @@ We could raise `memory_limit`, but for our million orders that means 3663Mb and ## The same export with Flow -Flow needs PHP 8.3 or newer. +Flow needs PHP 8.5 or newer. ```bash composer require flow-php/etl flow-php/etl-adapter-doctrine flow-php/etl-adapter-excel diff --git a/web/landing/content/guides/find-slow-doctrine-queries-in-symfony.md b/web/landing/content/guides/find-slow-doctrine-queries-in-symfony.md index b94034331b..361560742b 100644 --- a/web/landing/content/guides/find-slow-doctrine-queries-in-symfony.md +++ b/web/landing/content/guides/find-slow-doctrine-queries-in-symfony.md @@ -60,7 +60,7 @@ We want every query measured, without touching the code that runs it, and connec ## Trace every Doctrine query in Symfony flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). -The bundle needs PHP 8.3 or newer, Symfony 6.4, 7.4 or 8.0 and DoctrineBundle. The only PHP extension it needs is curl. +The bundle needs PHP 8.5 or newer, Symfony 7.4 or 8.0 and DoctrineBundle. The only PHP extension it needs is curl. ```bash composer require flow-php/symfony-telemetry-bundle flow-php/telemetry-otlp-bridge diff --git a/web/landing/content/guides/find-slow-phpunit-tests.md b/web/landing/content/guides/find-slow-phpunit-tests.md index ee7c9a6ab1..0f5fbd5957 100644 --- a/web/landing/content/guides/find-slow-phpunit-tests.md +++ b/web/landing/content/guides/find-slow-phpunit-tests.md @@ -48,7 +48,7 @@ We want the same numbers sent to a place that keeps them, from every run, with n ## Send every PHPUnit test as a span flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). -The bridge needs PHP 8.3 or newer, PHPUnit and the curl extension. +The bridge needs PHP 8.5 or newer, PHPUnit and the curl extension. ```bash composer require --dev flow-php/phpunit-telemetry-bridge diff --git a/web/landing/content/guides/import-csv-file-into-mysql-or-postgresql-in-php.md b/web/landing/content/guides/import-csv-file-into-mysql-or-postgresql-in-php.md index 2dee540115..f5eb60ddbc 100644 --- a/web/landing/content/guides/import-csv-file-into-mysql-or-postgresql-in-php.md +++ b/web/landing/content/guides/import-csv-file-into-mysql-or-postgresql-in-php.md @@ -171,7 +171,7 @@ The SQL for that is different in every database. It's `ON DUPLICATE KEY UPDATE` ## Import and upsert a CSV file with Flow -Flow needs PHP 8.3 or newer. +Flow needs PHP 8.5 or newer. ```bash tab="Doctrine MySQL" composer require flow-php/etl flow-php/etl-adapter-csv flow-php/etl-adapter-doctrine diff --git a/web/landing/content/guides/import-data-from-rest-api-in-php.md b/web/landing/content/guides/import-data-from-rest-api-in-php.md index f6bb886d89..14449b0481 100644 --- a/web/landing/content/guides/import-data-from-rest-api-in-php.md +++ b/web/landing/content/guides/import-data-from-rest-api-in-php.md @@ -99,7 +99,7 @@ And the loop itself has to change for every API, because every API paginates in ## Consume the API with Flow -Flow needs PHP 8.3 or newer. +Flow needs PHP 8.5 or newer. ```bash composer require flow-php/etl flow-php/etl-adapter-http flow-php/etl-adapter-json flow-php/etl-adapter-doctrine symfony/http-client nyholm/psr7 diff --git a/web/landing/content/guides/import-large-excel-file-in-php.md b/web/landing/content/guides/import-large-excel-file-in-php.md index 91bea3f57d..105d7fee4e 100644 --- a/web/landing/content/guides/import-large-excel-file-in-php.md +++ b/web/landing/content/guides/import-large-excel-file-in-php.md @@ -108,7 +108,7 @@ Laravel Excel (`maatwebsite/excel`) is built on PhpSpreadsheet, so the same read ## Read a large Excel file with Flow -Flow needs PHP 8.3 or newer. +Flow needs PHP 8.5 or newer. ```bash composer require flow-php/etl flow-php/etl-adapter-excel diff --git a/web/landing/content/guides/index-database-table-in-elasticsearch-with-php.md b/web/landing/content/guides/index-database-table-in-elasticsearch-with-php.md index 3e752ad5af..e960cad96b 100644 --- a/web/landing/content/guides/index-database-table-in-elasticsearch-with-php.md +++ b/web/landing/content/guides/index-database-table-in-elasticsearch-with-php.md @@ -180,7 +180,7 @@ That's what a search engine is for. But a search engine has its own copy of the ## Index a database table in Elasticsearch with Flow -Flow needs PHP 8.3 or newer. It talks to search engines through [SEAL](https://php-cmsig.github.io/search/), a library with one API for Elasticsearch, OpenSearch, Meilisearch, Algolia, Solr, Typesense and a few more. +Flow needs PHP 8.5 or newer. It talks to search engines through [SEAL](https://php-cmsig.github.io/search/), a library with one API for Elasticsearch, OpenSearch, Meilisearch, Algolia, Solr, Typesense and a few more. It reads the table through Doctrine DBAL, or for PostgreSQL through [flow-php/postgresql](/documentation/components/libs/postgresql), Flow's own client with a query builder. diff --git a/web/landing/content/guides/opentelemetry-collector-for-php.md b/web/landing/content/guides/opentelemetry-collector-for-php.md index d44b154879..c641e54397 100644 --- a/web/landing/content/guides/opentelemetry-collector-for-php.md +++ b/web/landing/content/guides/opentelemetry-collector-for-php.md @@ -45,7 +45,7 @@ An OpenTelemetry Collector is a small program that runs next to PHP and never en ## Send everything from PHP to a collector on the same host -flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP. It needs PHP 8.3 or newer and the curl extension, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). +flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP. It needs PHP 8.5 or newer and the curl extension, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). ```bash composer require flow-php/telemetry flow-php/telemetry-otlp-bridge flow-php/etl diff --git a/web/landing/content/guides/parse-sql-query-in-php.md b/web/landing/content/guides/parse-sql-query-in-php.md index 6a10efecc6..cfbfc14a54 100644 --- a/web/landing/content/guides/parse-sql-query-in-php.md +++ b/web/landing/content/guides/parse-sql-query-in-php.md @@ -80,7 +80,7 @@ SQL needs a parser, and PostgreSQL already has one. ## Parse SQL in PHP with libpg_query -The parser needs PHP 8.3 or newer and the `pg_query` extension, which we install with [PIE](https://github.com/php/pie). +The parser needs PHP 8.5 or newer and the `pg_query` extension, which we install with [PIE](https://github.com/php/pie). ```bash pie install flow-php/pg-query-ext diff --git a/web/landing/content/guides/php-logs-with-trace-id.md b/web/landing/content/guides/php-logs-with-trace-id.md index fd332eab87..8bae605084 100644 --- a/web/landing/content/guides/php-logs-with-trace-id.md +++ b/web/landing/content/guides/php-logs-with-trace-id.md @@ -53,7 +53,7 @@ What we want is an id for one piece of work, given to every line that is written ## Write PHP logs with a trace id -flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP. It needs PHP 8.3 or newer, no extension, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). +flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP. It needs PHP 8.5 or newer, no extension, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). ```bash composer require flow-php/telemetry flow-php/etl diff --git a/web/landing/content/guides/php-metrics-with-opentelemetry.md b/web/landing/content/guides/php-metrics-with-opentelemetry.md index 8c4b1a4bbe..9ab782c539 100644 --- a/web/landing/content/guides/php-metrics-with-opentelemetry.md +++ b/web/landing/content/guides/php-metrics-with-opentelemetry.md @@ -63,7 +63,7 @@ OpenTelemetry has four kinds of them: ## Count and time things with OpenTelemetry metrics -flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP. It needs PHP 8.3 or newer, no extension, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). +flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP. It needs PHP 8.5 or newer, no extension, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). ```bash composer require flow-php/telemetry flow-php/etl diff --git a/web/landing/content/guides/read-and-write-parquet-files-in-php.md b/web/landing/content/guides/read-and-write-parquet-files-in-php.md index ac31c7cd4a..a497ffb679 100644 --- a/web/landing/content/guides/read-and-write-parquet-files-in-php.md +++ b/web/landing/content/guides/read-and-write-parquet-files-in-php.md @@ -57,7 +57,7 @@ orders.csv: 1000 rows ## Write a Parquet file in PHP PHP has no function that writes Parquet, so we need a library. -flow-php/parquet is written in PHP, there is nothing to compile. It needs PHP 8.3 or newer. +flow-php/parquet is written in PHP, there is nothing to compile. It needs PHP 8.5 or newer. ```bash composer require flow-php/parquet @@ -308,7 +308,7 @@ This script takes the same time for a thousand orders and for a million. ## The same thing with Flow -Flow needs PHP 8.3 or newer. +Flow needs PHP 8.5 or newer. ```bash composer require flow-php/etl flow-php/etl-adapter-csv flow-php/etl-adapter-parquet diff --git a/web/landing/content/guides/read-large-csv-file-in-php.md b/web/landing/content/guides/read-large-csv-file-in-php.md index 781cbf492b..2f290e1216 100644 --- a/web/landing/content/guides/read-large-csv-file-in-php.md +++ b/web/landing/content/guides/read-large-csv-file-in-php.md @@ -157,7 +157,7 @@ To do it right we would have to cut the file into sorted chunks on disk and merg ## The same thing with Flow -Flow needs PHP 8.3 or newer. +Flow needs PHP 8.5 or newer. ```bash composer require flow-php/etl flow-php/etl-adapter-csv diff --git a/web/landing/content/guides/read-large-file-from-s3-in-php.md b/web/landing/content/guides/read-large-file-from-s3-in-php.md index dac57d69a8..7f8cb922f7 100644 --- a/web/landing/content/guides/read-large-file-from-s3-in-php.md +++ b/web/landing/content/guides/read-large-file-from-s3-in-php.md @@ -86,7 +86,7 @@ We could raise `memory_limit`, but that only moves the problem to the next, bigg ## Read a large file from S3 line by line -Flow reads the file in pieces and hands us one line at a time. It needs PHP 8.3 or newer. +Flow reads the file in pieces and hands us one line at a time. It needs PHP 8.5 or newer. Its S3 filesystem uses [AsyncAws](https://async-aws.com/), so the AWS SDK is not needed. The same code works with Azure Blob Storage and with an SFTP server, so every example has a tab for each of them. diff --git a/web/landing/content/guides/read-large-json-file-in-php.md b/web/landing/content/guides/read-large-json-file-in-php.md index db4a316437..6cb577824e 100644 --- a/web/landing/content/guides/read-large-json-file-in-php.md +++ b/web/landing/content/guides/read-large-json-file-in-php.md @@ -100,7 +100,7 @@ PHP has no function that reads a JSON file one element at a time, so we would ha ## Read a large JSON file with Flow -Flow needs PHP 8.3 or newer. +Flow needs PHP 8.5 or newer. ```bash composer require flow-php/etl flow-php/etl-adapter-json diff --git a/web/landing/content/guides/send-php-traces-over-otlp.md b/web/landing/content/guides/send-php-traces-over-otlp.md index 87f6af8da1..6352426051 100644 --- a/web/landing/content/guides/send-php-traces-over-otlp.md +++ b/web/landing/content/guides/send-php-traces-over-otlp.md @@ -29,7 +29,7 @@ Over HTTP every kind of data has its own path: `/v1/traces`, `/v1/metrics` and ` ## Send traces from PHP over OTLP/HTTP -flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP. It needs PHP 8.3 or newer and the curl extension, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). +flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP. It needs PHP 8.5 or newer and the curl extension, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). ```bash composer require flow-php/telemetry flow-php/telemetry-otlp-bridge flow-php/etl diff --git a/web/landing/content/guides/stream-large-csv-download-in-symfony.md b/web/landing/content/guides/stream-large-csv-download-in-symfony.md index ed0ac025ba..05d6ba44c3 100644 --- a/web/landing/content/guides/stream-large-csv-download-in-symfony.md +++ b/web/landing/content/guides/stream-large-csv-download-in-symfony.md @@ -93,7 +93,7 @@ And both of them still read the whole query result first, so they take the same ## Export and stream the download with Flow -Flow needs PHP 8.3 or newer. +Flow needs PHP 8.5 or newer. ```bash composer require flow-php/etl flow-php/etl-adapter-doctrine flow-php/symfony-http-foundation-bridge diff --git a/web/landing/content/guides/symfony-logs-with-trace-id.md b/web/landing/content/guides/symfony-logs-with-trace-id.md index 06393d41af..5f0ab56c4a 100644 --- a/web/landing/content/guides/symfony-logs-with-trace-id.md +++ b/web/landing/content/guides/symfony-logs-with-trace-id.md @@ -68,7 +68,7 @@ Tracing already has an id for one piece of work, and it travels to workers and t ## Send Monolog records to OpenTelemetry flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). -The bundle needs PHP 8.3 or newer and Symfony 6.4, 7.4 or 8.0. The only PHP extension it needs is curl. +The bundle needs PHP 8.5 or newer and Symfony 7.4 or 8.0. The only PHP extension it needs is curl. ```bash composer require flow-php/symfony-telemetry-bundle flow-php/telemetry-otlp-bridge flow-php/monolog-telemetry-bridge diff --git a/web/landing/content/guides/symfony-messenger-monitoring.md b/web/landing/content/guides/symfony-messenger-monitoring.md index 31dad3c829..30cd582c32 100644 --- a/web/landing/content/guides/symfony-messenger-monitoring.md +++ b/web/landing/content/guides/symfony-messenger-monitoring.md @@ -61,7 +61,7 @@ We want Messenger itself to tell us, for every message: who sent it, when it was ## Trace Symfony Messenger with OpenTelemetry flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). -The bundle needs PHP 8.3 or newer and Symfony 6.4, 7.4 or 8.0. The only PHP extension it needs is curl. +The bundle needs PHP 8.5 or newer and Symfony 7.4 or 8.0. The only PHP extension it needs is curl. ```bash composer require flow-php/symfony-telemetry-bundle flow-php/telemetry-otlp-bridge diff --git a/web/landing/content/guides/symfony-monitoring-with-opentelemetry.md b/web/landing/content/guides/symfony-monitoring-with-opentelemetry.md index d90bd572de..150648b092 100644 --- a/web/landing/content/guides/symfony-monitoring-with-opentelemetry.md +++ b/web/landing/content/guides/symfony-monitoring-with-opentelemetry.md @@ -46,7 +46,7 @@ That record is a trace, and the standard for it is OpenTelemetry. Every monitori ## Add OpenTelemetry to a Symfony application flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). -The bundle needs PHP 8.3 or newer and Symfony 6.4, 7.4 or 8.0. The only PHP extension it needs is curl. +The bundle needs PHP 8.5 or newer and Symfony 7.4 or 8.0. The only PHP extension it needs is curl. ```bash composer require flow-php/symfony-telemetry-bundle flow-php/telemetry-otlp-bridge diff --git a/web/landing/content/guides/trace-php-script-with-opentelemetry.md b/web/landing/content/guides/trace-php-script-with-opentelemetry.md index 1a0546e1f9..1931dadb26 100644 --- a/web/landing/content/guides/trace-php-script-with-opentelemetry.md +++ b/web/landing/content/guides/trace-php-script-with-opentelemetry.md @@ -76,7 +76,7 @@ OpenTelemetry is the standard for both, and every monitoring tool reads it. ## Trace a PHP script with OpenTelemetry -flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP. It needs PHP 8.3 or newer, no extension, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). +flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP. It needs PHP 8.5 or newer, no extension, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). ```bash composer require flow-php/telemetry flow-php/etl diff --git a/web/landing/content/guides/trace-sql-queries-in-php.md b/web/landing/content/guides/trace-sql-queries-in-php.md index 3a611458aa..a2d0d505aa 100644 --- a/web/landing/content/guides/trace-sql-queries-in-php.md +++ b/web/landing/content/guides/trace-sql-queries-in-php.md @@ -53,7 +53,7 @@ We want every query measured in the place where all of them pass: the database c ## Trace every query of the PostgreSQL client flow-php/telemetry is an independent implementation of OpenTelemetry, written in PHP, and it is [not a wrapper around the official SDK](/documentation/components/libs/telemetry/opentelemetry-sdk). -The client needs PHP 8.3 or newer and the `pgsql` extension. +The client needs PHP 8.5 or newer and the `pgsql` extension. ```bash composer require flow-php/postgresql flow-php/telemetry flow-php/etl diff --git a/web/landing/content/guides/upload-large-file-to-s3-in-php.md b/web/landing/content/guides/upload-large-file-to-s3-in-php.md index ec49f352d6..d5328f067c 100644 --- a/web/landing/content/guides/upload-large-file-to-s3-in-php.md +++ b/web/landing/content/guides/upload-large-file-to-s3-in-php.md @@ -103,7 +103,7 @@ We also have to cut the file and keep the number of every part. ## Upload a large file to S3 with Flow -Flow does all of that for us. It needs PHP 8.3 or newer. +Flow does all of that for us. It needs PHP 8.5 or newer. Its S3 filesystem uses [AsyncAws](https://async-aws.com/), so the AWS SDK is not needed. The same code works with Azure Blob Storage and with an SFTP server, so from here every example has a tab for each of them. diff --git a/web/landing/docs/playground.md b/web/landing/docs/playground.md index 37922d2199..3b7204103c 100644 --- a/web/landing/docs/playground.md +++ b/web/landing/docs/playground.md @@ -276,7 +276,7 @@ code-editor:code-changed event ## External Dependencies - **CodeMirror 6** - Code editor with PHP support -- **PHP WASM** - PHP 8.3 compiled to WebAssembly +- **PHP WASM** - PHP 8.5 compiled to WebAssembly - **Cloudflare Turnstile** - Bot protection - **Cloudflare R2** - Snippet storage (S3-compatible) - **Stimulus** - JavaScript framework diff --git a/web/landing/mago.toml b/web/landing/mago.toml index 8582d12b7a..5cd317a623 100644 --- a/web/landing/mago.toml +++ b/web/landing/mago.toml @@ -1,4 +1,4 @@ -php-version = "8.3" +php-version = "8.5" [source] paths = [ diff --git a/web/landing/src/Flow/Website/Command/WarmGithubCacheCommand.php b/web/landing/src/Flow/Website/Command/WarmGithubCacheCommand.php deleted file mode 100644 index abed0ab8f9..0000000000 --- a/web/landing/src/Flow/Website/Command/WarmGithubCacheCommand.php +++ /dev/null @@ -1,36 +0,0 @@ -github->contributors(); - - $io->success(sprintf('Fetched %d contributors', count($contributors))); - - return Command::SUCCESS; - } -} diff --git a/web/landing/src/Flow/Website/Controller/BlogController.php b/web/landing/src/Flow/Website/Controller/BlogController.php index 3fb1f8c38d..ecd9ac78c4 100644 --- a/web/landing/src/Flow/Website/Controller/BlogController.php +++ b/web/landing/src/Flow/Website/Controller/BlogController.php @@ -15,7 +15,7 @@ final class BlogController extends AbstractController #[Route('/blog/{date}/{slug}/', name: 'blog_post')] public function post(string $date, string $slug, CardGenerator $socialCards): Response { - $post = (new Posts())->findByDateAndSlug($date, $slug); + $post = new Posts()->findByDateAndSlug($date, $slug); return $this->render('blog/posts/' . $date . '/' . $slug . '/post.html.twig', [ 'template_folder' => 'blog/posts/' . $date . '/' . $slug, @@ -30,7 +30,7 @@ public function post(string $date, string $slug, CardGenerator $socialCards): Re public function posts(): Response { return $this->render('blog/posts.html.twig', [ - 'posts' => (new Posts())->all(), + 'posts' => new Posts()->all(), ]); } @@ -38,7 +38,7 @@ public function posts(): Response public function rss(): Response { $response = $this->render('blog/rss.xml.twig', [ - 'posts' => (new Posts())->all(), + 'posts' => new Posts()->all(), ]); $response->headers->set('Content-Type', 'application/rss+xml; charset=UTF-8'); diff --git a/web/landing/src/Flow/Website/Controller/LayoutController.php b/web/landing/src/Flow/Website/Controller/LayoutController.php index d1eaea05d0..694d124a4c 100644 --- a/web/landing/src/Flow/Website/Controller/LayoutController.php +++ b/web/landing/src/Flow/Website/Controller/LayoutController.php @@ -4,23 +4,11 @@ namespace Flow\Website\Controller; -use Flow\Website\Service\Github; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; final class LayoutController extends AbstractController { - public function __construct( - private readonly Github $github, - ) {} - - public function contributors(): Response - { - return $this->render('main/_contributors.html.twig', [ - 'contributors' => $this->github->contributors(), - ]); - } - public function hero(): Response { return $this->render('main/_hero.html.twig'); diff --git a/web/landing/src/Flow/Website/Controller/WorkShopController.php b/web/landing/src/Flow/Website/Controller/WorkShopController.php index 78bedeee95..0d37d79f57 100644 --- a/web/landing/src/Flow/Website/Controller/WorkShopController.php +++ b/web/landing/src/Flow/Website/Controller/WorkShopController.php @@ -26,7 +26,7 @@ public function __construct( public function index(): Response { return $this->render('work-shop/index.html.twig', [ - 'categories' => (new Listings())->all(), + 'categories' => new Listings()->all(), ]); } @@ -37,7 +37,7 @@ public function blueprintSymfony(CardGenerator $socialCards): Response { return $this->render('work-shop/blueprints/symfony-backoffice/index.html.twig', [ 'listing_checkout_url' => $this->checkoutLinks['symfony_backoffice'] ?? null, - 'social_image' => $socialCards->generate((new Listings())->findBySlug('symfony-backoffice')), + 'social_image' => $socialCards->generate(new Listings()->findBySlug('symfony-backoffice')), ]); } @@ -58,7 +58,7 @@ public function aiClaudeSkills(CardGenerator $socialCards): Response { return $this->render('work-shop/ai/claude-skills/index.html.twig', [ 'listing_checkout_url' => $this->checkoutLinks['claude_skills'] ?? null, - 'social_image' => $socialCards->generate((new Listings())->findBySlug('claude-skills')), + 'social_image' => $socialCards->generate(new Listings()->findBySlug('claude-skills')), ]); } @@ -77,7 +77,7 @@ public function sponsoring1Month(CardGenerator $socialCards): Response { return $this->render('work-shop/sponsoring/1-month/index.html.twig', [ 'listing_checkout_url' => $this->checkoutLinks['sponsoring_1m'] ?? null, - 'social_image' => $socialCards->generate((new Listings())->findBySlug('sponsoring-1-month')), + 'social_image' => $socialCards->generate(new Listings()->findBySlug('sponsoring-1-month')), ]); } @@ -88,7 +88,7 @@ public function sponsoring6Months(CardGenerator $socialCards): Response { return $this->render('work-shop/sponsoring/6-months/index.html.twig', [ 'listing_checkout_url' => $this->checkoutLinks['sponsoring_6m'] ?? null, - 'social_image' => $socialCards->generate((new Listings())->findBySlug('sponsoring-6-months')), + 'social_image' => $socialCards->generate(new Listings()->findBySlug('sponsoring-6-months')), ]); } @@ -99,7 +99,7 @@ public function sponsoring12Months(CardGenerator $socialCards): Response { return $this->render('work-shop/sponsoring/12-months/index.html.twig', [ 'listing_checkout_url' => $this->checkoutLinks['sponsoring_12m'] ?? null, - 'social_image' => $socialCards->generate((new Listings())->findBySlug('sponsoring-12-months')), + 'social_image' => $socialCards->generate(new Listings()->findBySlug('sponsoring-12-months')), ]); } @@ -113,7 +113,7 @@ public function success(): Response public function consulting(CardGenerator $socialCards): Response { return $this->render('work-shop/consulting/index.html.twig', [ - 'social_image' => $socialCards->generate((new Listings())->findBySlug('consulting')), + 'social_image' => $socialCards->generate(new Listings()->findBySlug('consulting')), ]); } diff --git a/web/landing/src/Flow/Website/EventListener/SitemapSubscriber.php b/web/landing/src/Flow/Website/EventListener/SitemapSubscriber.php index 2c44e20136..4249c98d9f 100644 --- a/web/landing/src/Flow/Website/EventListener/SitemapSubscriber.php +++ b/web/landing/src/Flow/Website/EventListener/SitemapSubscriber.php @@ -28,7 +28,7 @@ public function __construct( private Pages $guides, ) {} - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ SitemapPopulateEvent::class => 'populate', diff --git a/web/landing/src/Flow/Website/Factory/Github/ContributorsRequestFactory.php b/web/landing/src/Flow/Website/Factory/Github/ContributorsRequestFactory.php deleted file mode 100644 index f28d5be450..0000000000 --- a/web/landing/src/Flow/Website/Factory/Github/ContributorsRequestFactory.php +++ /dev/null @@ -1,37 +0,0 @@ -factory - ->createRequest( - 'GET', - 'https://api.github.com/repos/flow-php/flow/contributors?q=contributions&order=desc&per_page=50', - ) - ->withHeader('Accept', 'application/vnd.github+json') - ->withHeader('Authorization', 'Bearer ' . $this->githubToken) - ->withHeader('X-GitHub-Api-Version', '2022-11-28') - ->withHeader('User-Agent', 'flow-website-fetch'); - } -} diff --git a/web/landing/src/Flow/Website/Model/Documentation/Page.php b/web/landing/src/Flow/Website/Model/Documentation/Page.php index fd0ac043ed..1b8087b0a9 100644 --- a/web/landing/src/Flow/Website/Model/Documentation/Page.php +++ b/web/landing/src/Flow/Website/Model/Documentation/Page.php @@ -96,7 +96,7 @@ public function updated(): string private function frontMatter(): array { $frontMatter = type_union(type_map(type_string(), type_mixed()), type_null())->assert( - (new FrontMatterParser(new SymfonyYamlFrontMatterParser())) + new FrontMatterParser(new SymfonyYamlFrontMatterParser()) ->parse($this->content) ->getFrontMatter(), ); diff --git a/web/landing/src/Flow/Website/Service/FlowConfigFactory.php b/web/landing/src/Flow/Website/Service/FlowConfigFactory.php index b6c8b95822..abc102ec7e 100644 --- a/web/landing/src/Flow/Website/Service/FlowConfigFactory.php +++ b/web/landing/src/Flow/Website/Service/FlowConfigFactory.php @@ -5,15 +5,9 @@ namespace Flow\Website\Service; use Flow\ETL\API\Config\ConfigBuilder; -use Flow\ETL\Storage\Floe\FloeSerializer; -use Flow\ETL\Storage\PsrRowsStorage; -use Flow\ETL\Values\Column\AdaptiveBackend; use Flow\Filesystem\Filesystem; use Flow\Telemetry\Provider\Clock\SystemClock; use Flow\Telemetry\Telemetry; -use Symfony\Component\Cache\Adapter\FilesystemAdapter; -use Symfony\Component\Cache\Psr16Cache; -use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface; use function Flow\ETL\DSL\config_builder; use function Flow\ETL\DSL\telemetry_options; @@ -21,14 +15,11 @@ use function Flow\Filesystem\DSL\filesystem_telemetry_options; use function Flow\Filesystem\DSL\native_local_filesystem; use function Flow\Filesystem\DSL\traceable_filesystem; -use function Flow\Types\DSL\type_string; -use function ltrim; final readonly class FlowConfigFactory { public function __construct( private Telemetry $telemetry, - private ContainerBagInterface $parameters, ) {} /** @@ -44,16 +35,6 @@ public function configBuilder(string $name): ConfigBuilder ); } - /** - * Create a ConfigBuilder with telemetry and cache pre-configured. - * - * @param int $ttl Cache TTL in seconds (default: 24 hours) - */ - public function configBuilderWithCache(string $name, int $ttl = 86400): ConfigBuilder - { - return $this->configBuilder($name)->cache($this->cache($name, $ttl)); - } - public function filesystem(): Filesystem { return traceable_filesystem(native_local_filesystem(), filesystem_telemetry_config( @@ -67,19 +48,4 @@ public function telemetry(): Telemetry { return $this->telemetry; } - - private function cache(string $directoryName, int $ttl): PsrRowsStorage - { - return new PsrRowsStorage( - new Psr16Cache( - new FilesystemAdapter( - 'flow-contributors', - $ttl, - directory: type_string()->assert($this->parameters->get('kernel.cache_dir')) . '/' - . ltrim($directoryName, '/'), - ), - ), - new FloeSerializer(new AdaptiveBackend()), - ); - } } diff --git a/web/landing/src/Flow/Website/Service/Github.php b/web/landing/src/Flow/Website/Service/Github.php deleted file mode 100644 index 472e02d2c2..0000000000 --- a/web/landing/src/Flow/Website/Service/Github.php +++ /dev/null @@ -1,79 +0,0 @@ -parameters->get('kernel.environment'), ['test', 'dev'], true)) { - return [ - [ - 'login' => 'norberttech', - 'avatar_url' => 'https://avatars.githubusercontent.com/u/1921950?v=4&s=128', - 'html_url' => 'https://github.com/norberttech', - ], - ]; - } - - $factory = new Psr17Factory(); - - $from_github = from_dynamic_http_requests( - new PSR18TraceableClient(new Client($factory, $factory), $this->configFactory->telemetry()), - $this->requestFactory, - ); - - try { - df($this->configFactory->configBuilderWithCache('github_contributors')) - ->read(from_cache('flow_github_contributors', $from_github)) - ->cache('flow_github_contributors') - ->withColumn('unpacked', ref('response_body')->jsonDecode()) - ->select('unpacked') - ->withColumn('data', ref('unpacked')->expand()) - ->withColumn( - 'data', - ref('data')->unpack(schema(str_schema('login'), str_schema('avatar_url'), str_schema('html_url'))), - ) - ->renameEach(rename_replace('data.', '')) - ->drop('unpacked', 'data') - ->filter(not(ref('login')->endsWith(lit('[bot]')))) - ->filter(not(ref('login')->equals(lit('aeon-automation')))) - ->filter(not(ref('login')->equals(lit('norbertmwk')))) - ->withColumn('avatar_url', ref('avatar_url')->concat(lit('&s=128'))) - ->limit(24) - ->write(to_memory($memory = new ArrayMemory())) - ->run(); - - return $memory->dump(); - } catch (Throwable) { - return []; - } - } -} diff --git a/web/landing/src/Flow/Website/SocialCard/CardPainter.php b/web/landing/src/Flow/Website/SocialCard/CardPainter.php index 02911d4b68..f11d644b16 100644 --- a/web/landing/src/Flow/Website/SocialCard/CardPainter.php +++ b/web/landing/src/Flow/Website/SocialCard/CardPainter.php @@ -104,7 +104,7 @@ public function drawDescription(GdImage $canvas, string $description, int $basel { $font = $this->resourcesDir . '/fonts/Cabin-Regular.ttf'; - foreach ((new TextWrapper($font))->wrap( + foreach (new TextWrapper($font)->wrap( $description, fontSize: 19, maxWidth: self::CONTENT_WIDTH, @@ -165,7 +165,7 @@ public function drawEyebrow(GdImage $canvas, string $section): void text: $eyebrow, ); - $eyebrowWidth = (new TextWrapper($fontBold))->width($eyebrow, fontSize: 18); + $eyebrowWidth = new TextWrapper($fontBold)->width($eyebrow, fontSize: 18); imagettftext( $canvas, size: 18, @@ -193,10 +193,7 @@ public function drawFooter( $x = self::MARGIN; - if ( - $avatarPath !== null - && (new CircleAvatar())->draw($canvas, $avatarPath, x: self::MARGIN, y: 523, size: 64) - ) { + if ($avatarPath !== null && new CircleAvatar()->draw($canvas, $avatarPath, x: self::MARGIN, y: 523, size: 64)) { $x += 64 + 18; } @@ -215,7 +212,7 @@ public function drawFooter( return; } - $primaryWidth = (new TextWrapper($fontBold))->width($primary, fontSize: 17); + $primaryWidth = new TextWrapper($fontBold)->width($primary, fontSize: 17); imagettftext( $canvas, size: 17, diff --git a/web/landing/src/Flow/Website/StaticSourceProvider/BlogPostsProvider.php b/web/landing/src/Flow/Website/StaticSourceProvider/BlogPostsProvider.php index 0959c0633b..530e9a1bd0 100644 --- a/web/landing/src/Flow/Website/StaticSourceProvider/BlogPostsProvider.php +++ b/web/landing/src/Flow/Website/StaticSourceProvider/BlogPostsProvider.php @@ -16,7 +16,7 @@ public function all(): array { $sources = []; - foreach ((new Posts())->all() as $post) { + foreach (new Posts()->all() as $post) { $sources[] = new Source('blog_post', ['date' => $post->date->format('Y-m-d'), 'slug' => $post->slug]); } diff --git a/web/landing/src/Flow/Website/Twig/SlugifyExtension.php b/web/landing/src/Flow/Website/Twig/SlugifyExtension.php index 397c7f4a9d..92ad0528da 100644 --- a/web/landing/src/Flow/Website/Twig/SlugifyExtension.php +++ b/web/landing/src/Flow/Website/Twig/SlugifyExtension.php @@ -21,7 +21,7 @@ public function getFilters(): array public function slugify(string $text): string { - return (new AsciiSlugger()) + return new AsciiSlugger() ->slug($text) ->lower() ->toString(); diff --git a/web/landing/templates/base.html.twig b/web/landing/templates/base.html.twig index 57e13a6455..3895d51dba 100644 --- a/web/landing/templates/base.html.twig +++ b/web/landing/templates/base.html.twig @@ -107,10 +107,6 @@ {% endblock %} {% block main %}{% endblock %} - - {% block contributors %} - {{ render(controller('Flow\\Website\\Controller\\LayoutController::contributors')) }} - {% endblock %}
  • {{ nav.nav_link('/documentation/', 'Introduction', currentPath) }}
  • {{ nav.nav_link('/documentation/installation/', 'Installation', currentPath) }}
  • +
  • {{ nav.nav_link('/documentation/installation/php-versions/', 'PHP Versions', currentPath) }}
  • {{ nav.nav_link('/documentation/quick-start/', 'Quick Start', currentPath) }}
  • {{ nav.nav_link('/documentation/architecture/', 'Architecture', currentPath) }}
  • {{ nav.nav_link('/documentation/dsl/core/#dsl-functions', 'DSL References', currentPath) }}
  • diff --git a/web/landing/templates/guides/guide.html.twig b/web/landing/templates/guides/guide.html.twig index af2de8ebe0..c5cf5b3eed 100644 --- a/web/landing/templates/guides/guide.html.twig +++ b/web/landing/templates/guides/guide.html.twig @@ -21,8 +21,6 @@ {%- block hero -%}{%- endblock -%} -{%- block contributors -%}{%- endblock -%} - {% block main %}
    diff --git a/web/landing/templates/main/_contributors.html.twig b/web/landing/templates/main/_contributors.html.twig deleted file mode 100644 index f738e826d4..0000000000 --- a/web/landing/templates/main/_contributors.html.twig +++ /dev/null @@ -1,25 +0,0 @@ -
    - - -
    - {% for contributor in contributors %} - - {{ contributor.login }} - - {% endfor %} -
    -
    diff --git a/web/landing/templates/main/_hero.html.twig b/web/landing/templates/main/_hero.html.twig index 397ae76ef5..cd2644f090 100644 --- a/web/landing/templates/main/_hero.html.twig +++ b/web/landing/templates/main/_hero.html.twig @@ -6,7 +6,7 @@
    - PHP {{ '8.3 · 8.4 · 8.5 · 8.6' }} + PHP {{ '8.5 · 8.6' }}

    diff --git a/web/landing/templates/main/not_found.html.twig b/web/landing/templates/main/not_found.html.twig index 92b4e58404..b0975b087a 100644 --- a/web/landing/templates/main/not_found.html.twig +++ b/web/landing/templates/main/not_found.html.twig @@ -15,8 +15,6 @@ {%- block hero -%}{%- endblock -%} -{%- block contributors -%}{%- endblock -%} - {% block main %}
    diff --git a/web/landing/templates/work-shop/_listing.html.twig b/web/landing/templates/work-shop/_listing.html.twig index 1bd2707faa..efaf94de13 100644 --- a/web/landing/templates/work-shop/_listing.html.twig +++ b/web/landing/templates/work-shop/_listing.html.twig @@ -36,9 +36,6 @@ {%- block hero -%}{%- endblock -%} -{# The Work-Shop is a commercial offer by the maintainer, not a community effort. #} -{%- block contributors -%}{%- endblock -%} - {% block main %} {# `??` (not the `default` filter) so an explicit `false` is respected - `false|default(true)` returns true #} {% set listing_available = listing_available ?? true %} diff --git a/web/landing/templates/work-shop/ai/how-it-works/index.html.twig b/web/landing/templates/work-shop/ai/how-it-works/index.html.twig index 2f0a42ea85..a8585b8ae6 100644 --- a/web/landing/templates/work-shop/ai/how-it-works/index.html.twig +++ b/web/landing/templates/work-shop/ai/how-it-works/index.html.twig @@ -10,9 +10,6 @@ {%- block hero -%}{%- endblock -%} -{# The Work-Shop is a commercial offer by the maintainer, not a community effort. #} -{%- block contributors -%}{%- endblock -%} - {% block main %} {% set surprises = [ { diff --git a/web/landing/templates/work-shop/blueprints/how-it-works/index.html.twig b/web/landing/templates/work-shop/blueprints/how-it-works/index.html.twig index 161dc6cd32..835ebceff3 100644 --- a/web/landing/templates/work-shop/blueprints/how-it-works/index.html.twig +++ b/web/landing/templates/work-shop/blueprints/how-it-works/index.html.twig @@ -10,9 +10,6 @@ {%- block hero -%}{%- endblock -%} -{# The Work-Shop is a commercial offer by the maintainer, not a community effort. #} -{%- block contributors -%}{%- endblock -%} - {% block main %} {% set surprises = [ { diff --git a/web/landing/templates/work-shop/index.html.twig b/web/landing/templates/work-shop/index.html.twig index 58ceab7fe6..5d5fd8b0a6 100644 --- a/web/landing/templates/work-shop/index.html.twig +++ b/web/landing/templates/work-shop/index.html.twig @@ -10,9 +10,6 @@ {%- block hero -%}{%- endblock -%} -{# The Work-Shop is a commercial offer by the maintainer, not a community effort. #} -{%- block contributors -%}{%- endblock -%} - {% block main %}