From 6f8cb03a5cb76e95b95a05103cd14cf782b8060f Mon Sep 17 00:00:00 2001 From: "Luke B. Silver" <22452787+loks0n@users.noreply.github.com> Date: Tue, 4 Aug 2026 01:06:02 +0100 Subject: [PATCH] Merge pull request #103 from utopia-php/feat/absorb-cache feat: absorb utopia-php/cache --- .DS_Store | Bin 6148 -> 0 bytes .github/ISSUE_TEMPLATE/bug.yaml | 93 - .github/ISSUE_TEMPLATE/documentation.yaml | 32 - .github/ISSUE_TEMPLATE/feature.yaml | 40 - .github/workflows/codeql-analysis.yml | 20 - .github/workflows/linter.yml | 20 - .github/workflows/mirror.yml | 17 + .github/workflows/test.yml | 117 - .gitignore | 5 +- CODE_OF_CONDUCT.md | 76 - CONTRIBUTING.md | 101 - Dockerfile.php-8.4 | 44 - Dockerfile.php-8.5 | 44 - README.md | 44 +- composer.json | 53 +- composer.lock | 3683 +---------------- docker-compose.yml | 143 +- phpstan.neon | 8 +- phpunit.xml | 60 +- psalm.xml | 15 - src/Cache/Adapter.php | 23 +- src/Cache/Adapter/CircuitBreaker.php | 9 +- src/Cache/Adapter/Filesystem.php | 84 +- src/Cache/Adapter/Hazelcast.php | 64 +- src/Cache/Adapter/Memcached.php | 66 +- src/Cache/Adapter/Memory.php | 40 +- src/Cache/Adapter/None.php | 31 +- src/Cache/Adapter/Pool.php | 31 +- src/Cache/Adapter/Redis.php | 109 +- src/Cache/Adapter/Redis/Client.php | 20 +- src/Cache/Adapter/Redis/ConnectionContext.php | 5 +- src/Cache/Adapter/Redis/ConnectionError.php | 5 +- .../Adapter/Redis/ConnectionException.php | 6 +- src/Cache/Adapter/Redis/Envelope.php | 6 +- src/Cache/Adapter/Redis/Leasable.php | 10 +- src/Cache/Adapter/Redis/Multiplexing.php | 61 +- src/Cache/Adapter/Redis/NoScript.php | 4 +- src/Cache/Adapter/Redis/RedisError.php | 5 +- src/Cache/Adapter/RedisCluster.php | 148 +- src/Cache/Adapter/Sharding.php | 40 +- src/Cache/Cache.php | 54 +- src/Cache/Feature/Leasable.php | 2 + src/Cache/Feature/Retryable.php | 14 +- src/Cache/Feature/Telemetry.php | 2 + tests/Cache/{E2E => }/Base.php | 63 +- tests/Cache/E2E/FilesystemTest.php | 88 - tests/Cache/E2E/HazelcastTest.php | 33 +- tests/Cache/E2E/MemcachedTest.php | 32 +- ...gTest.php => MultiplexingLeasableTest.php} | 73 +- .../E2E/{Redis => }/MultiplexingTest.php | 73 +- tests/Cache/E2E/Redis/RedisClusterTest.php | 83 - tests/Cache/E2E/Redis/RedisTest.php | 91 - tests/Cache/E2E/RedisClusterTest.php | 60 + ...LeasableTest.php => RedisLeasableTest.php} | 33 +- tests/Cache/E2E/RedisTest.php | 74 + tests/Cache/E2E/ShardingTest.php | 27 +- tests/Cache/Services.php | 71 + .../{E2E => Unit}/CircuitBreakerTest.php | 9 +- tests/Cache/Unit/FilesystemTest.php | 69 + tests/Cache/Unit/LoadResultsTelemetryTest.php | 41 +- tests/Cache/{E2E => Unit}/MemoryTest.php | 9 +- tests/Cache/{E2E => Unit}/NoneTest.php | 32 +- tests/Cache/{E2E => Unit}/PoolTest.php | 31 +- .../ClientTest.php => RedisClientTest.php} | 26 +- ...EnvelopeTest.php => RedisEnvelopeTest.php} | 6 +- ...NoScriptTest.php => RedisNoScriptTest.php} | 8 +- tests/Cache/{E2E => Unit}/TelemetryTest.php | 13 +- 67 files changed, 1079 insertions(+), 5420 deletions(-) delete mode 100644 .DS_Store delete mode 100644 .github/ISSUE_TEMPLATE/bug.yaml delete mode 100644 .github/ISSUE_TEMPLATE/documentation.yaml delete mode 100644 .github/ISSUE_TEMPLATE/feature.yaml delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/linter.yml create mode 100644 .github/workflows/mirror.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Dockerfile.php-8.4 delete mode 100644 Dockerfile.php-8.5 delete mode 100644 psalm.xml rename tests/Cache/{E2E => }/Base.php (73%) delete mode 100644 tests/Cache/E2E/FilesystemTest.php rename tests/Cache/E2E/{Redis/LeasableMultiplexingTest.php => MultiplexingLeasableTest.php} (89%) rename tests/Cache/E2E/{Redis => }/MultiplexingTest.php (81%) delete mode 100644 tests/Cache/E2E/Redis/RedisClusterTest.php delete mode 100644 tests/Cache/E2E/Redis/RedisTest.php create mode 100644 tests/Cache/E2E/RedisClusterTest.php rename tests/Cache/E2E/{Redis/LeasableTest.php => RedisLeasableTest.php} (94%) create mode 100644 tests/Cache/E2E/RedisTest.php create mode 100644 tests/Cache/Services.php rename tests/Cache/{E2E => Unit}/CircuitBreakerTest.php (97%) create mode 100644 tests/Cache/Unit/FilesystemTest.php rename tests/Cache/{E2E => Unit}/MemoryTest.php (72%) rename tests/Cache/{E2E => Unit}/NoneTest.php (68%) rename tests/Cache/{E2E => Unit}/PoolTest.php (61%) rename tests/Cache/Unit/{Redis/ClientTest.php => RedisClientTest.php} (91%) rename tests/Cache/Unit/{Redis/EnvelopeTest.php => RedisEnvelopeTest.php} (97%) rename tests/Cache/Unit/{Redis/NoScriptTest.php => RedisNoScriptTest.php} (88%) rename tests/Cache/{E2E => Unit}/TelemetryTest.php (80%) diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 991fd44d5eb4acb8a3c0863be335dab361fb38cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHLJxc>Y5S=v_b0|m<1QF4z1(krM#TjC!Rj`$qM3O+_g?wmxU}Gy*HX?#uI{$;V zmKI`b<6lsm*{q4H3H_XZ{BJ;%yb?8IcVuytnoP8w1tl@I$>ipKdry62W!%D_SS@l2(r-3xq z(|{@*!hu~&ZN~PRbzI!^pD$iz9Y%gD7}k&+Ve>x{e+s(Lfr`z2N-NYJlee`Otv~V( zIpf|0zBKf3tzGQ9Hs{KQTyNwxdDl-OUL)UJZ*qjqe~kn%3CGBPgo+2yF)K*zuMS52 zW(|Y)-MgJ9skt?WS;e>*vkqrY)2Re%Be+6mi^XLK5*BC0q5j6fGAZ6f=75GsFJ^|0+zYzcc diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml deleted file mode 100644 index b4d1e6a507..0000000000 --- a/.github/ISSUE_TEMPLATE/bug.yaml +++ /dev/null @@ -1,93 +0,0 @@ -name: "πŸ› Bug Report" -description: "Submit a bug report to help us improve" -title: "πŸ› Bug Report: " -labels: [bug] -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to fill out our bug report form πŸ™ - - type: textarea - id: steps-to-reproduce - validations: - required: true - attributes: - label: "πŸ‘Ÿ Reproduction steps" - description: "How do you trigger this bug? Please walk us through it step by step." - placeholder: "When I ..." - - type: textarea - id: expected-behavior - validations: - required: true - attributes: - label: "πŸ‘ Expected behavior" - description: "What did you think would happen?" - placeholder: "It should ..." - - type: textarea - id: actual-behavior - validations: - required: true - attributes: - label: "πŸ‘Ž Actual Behavior" - description: "What did actually happen? Add screenshots, if applicable." - placeholder: "It actually ..." - - type: dropdown - id: utopia-version - attributes: - label: "🎲 Utopia Cache version" - description: "What version of Utopia are you running?" - options: - - Version 0.18.x - - Version 0.17.x - - Version 0.16.x - - Version 0.15.x - - Version 0.14.x - - Different version (specify in environment) - validations: - required: true - - type: dropdown - id: php-version - attributes: - label: "🐘 PHP Version" - description: "What version of PHP are you running?" - options: - - PHP 8.0.x - - PHP 8.1.x - - Different version (specify in environment) - validations: - required: true - - type: dropdown - id: operating-system - attributes: - label: "πŸ’» Operating system" - description: "What OS is your server / device running on?" - options: - - Linux - - MacOS - - Windows - - Something else - validations: - required: true - - type: textarea - id: environment - validations: - required: false - attributes: - label: "🧱 Your Environment" - description: "Is your environment customized in any way?" - placeholder: "I use Cloudflare for ..." - - type: checkboxes - id: no-duplicate-issues - attributes: - label: "πŸ‘€ Have you spent some time to check if this issue has been raised before?" - description: "Have you Googled for a similar issue or checked our older issues for a similar bug?" - options: - - label: "I checked and didn't find similar issue" - required: true - - type: checkboxes - id: read-code-of-conduct - attributes: - label: "🏒 Have you read the Code of Conduct?" - options: - - label: "I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)" - required: true diff --git a/.github/ISSUE_TEMPLATE/documentation.yaml b/.github/ISSUE_TEMPLATE/documentation.yaml deleted file mode 100644 index cc3ef5eb12..0000000000 --- a/.github/ISSUE_TEMPLATE/documentation.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: "πŸ“š Documentation" -description: "Report an issue related to documentation" -title: "πŸ“š Documentation: " -labels: [documentation] -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to make our documentation better πŸ™ - - type: textarea - id: issue-description - validations: - required: true - attributes: - label: "πŸ’­ Description" - description: "A clear and concise description of what the issue is." - placeholder: "Documentation should not ..." - - type: checkboxes - id: no-duplicate-issues - attributes: - label: "πŸ‘€ Have you spent some time to check if this issue has been raised before?" - description: "Have you Googled for a similar issue or checked our older issues for a similar documentation issues?" - options: - - label: "I checked and didn't find similar issue" - required: true - - type: checkboxes - id: read-code-of-conduct - attributes: - label: "🏒 Have you read the Code of Conduct?" - options: - - label: "I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)" - required: true diff --git a/.github/ISSUE_TEMPLATE/feature.yaml b/.github/ISSUE_TEMPLATE/feature.yaml deleted file mode 100644 index 9c046248f2..0000000000 --- a/.github/ISSUE_TEMPLATE/feature.yaml +++ /dev/null @@ -1,40 +0,0 @@ -name: "πŸš€ Feature" -description: "Submit a proposal for a new feature" -title: "πŸš€ Feature: " -labels: [feature] -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to fill out our feature request form πŸ™ - - type: textarea - id: feature-description - validations: - required: true - attributes: - label: "πŸ”– Feature description" - description: "A clear and concise description of what the feature is." - placeholder: "You should add ..." - - type: textarea - id: pitch - validations: - required: true - attributes: - label: "🎀 Pitch" - description: "Please explain why this feature should be implemented and how it would be used. Add examples, if applicable." - placeholder: "In my use-case, ..." - - type: checkboxes - id: no-duplicate-issues - attributes: - label: "πŸ‘€ Have you spent some time to check if this issue has been raised before?" - description: "Have you Googled for a similar issue or checked our older issues for a similar feature request?" - options: - - label: "I checked and didn't find similar issue" - required: true - - type: checkboxes - id: read-code-of-conduct - attributes: - label: "🏒 Have you read the Code of Conduct?" - options: - - label: "I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)" - required: true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index f02bcd692e..0000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: "CodeQL" - -on: [pull_request] -jobs: - lint: - name: CodeQL - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - run: git checkout HEAD^2 - - - name: Run CodeQL - run: | - docker run --rm -v $PWD:/app composer sh -c \ - "composer install --profile --ignore-platform-reqs && composer check" diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index ffb8a097d3..0000000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: "Linter" - -on: [pull_request] -jobs: - lint: - name: Linter - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - run: git checkout HEAD^2 - - - name: Run Linter - run: | - docker run --rm -v $PWD:/app composer sh -c \ - "composer install --profile --ignore-platform-reqs && composer lint" diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml new file mode 100644 index 0000000000..dddde39b8a --- /dev/null +++ b/.github/workflows/mirror.yml @@ -0,0 +1,17 @@ +name: Mirror + +on: + pull_request_target: + types: [opened] + issues: + types: [opened] + +permissions: + issues: write + pull-requests: write + +jobs: + redirect: + uses: utopia-php/monorepo/.github/workflows/mirror-redirect.yml@main + with: + package: cache diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 24849845b8..0000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,117 +0,0 @@ -name: "Tests" - -on: [pull_request] - -env: - COMPOSE_PROJECT_NAME: cache - -jobs: - build: - name: Build (PHP ${{ matrix.php }}) - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - php: ['8.4', '8.5'] - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - run: git checkout HEAD^2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build tests image - uses: docker/build-push-action@v6 - with: - context: . - file: Dockerfile.php-${{ matrix.php }} - tags: cache-tests:${{ matrix.php }} - cache-from: type=gha,scope=php-${{ matrix.php }} - cache-to: type=gha,mode=max,scope=php-${{ matrix.php }} - outputs: type=docker,dest=/tmp/cache-tests-${{ matrix.php }}.tar - - - name: Cache tests image - uses: actions/cache@v4 - with: - key: cache-tests-${{ matrix.php }}-${{ github.event.pull_request.head.sha }} - path: /tmp/cache-tests-${{ matrix.php }}.tar - - unit: - name: Unit (PHP ${{ matrix.php }}) - runs-on: ubuntu-latest - needs: build - strategy: - fail-fast: false - matrix: - php: ['8.4', '8.5'] - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - run: git checkout HEAD^2 - - - name: Restore tests image - uses: actions/cache@v4 - with: - key: cache-tests-${{ matrix.php }}-${{ github.event.pull_request.head.sha }} - path: /tmp/cache-tests-${{ matrix.php }}.tar - fail-on-cache-miss: true - - - name: Start container - run: | - docker load --input /tmp/cache-tests-${{ matrix.php }}.tar - PHP_VERSION=${{ matrix.php }} docker compose up -d --no-deps --wait --wait-timeout 180 tests - - - name: Run unit tests - run: docker compose exec -T tests vendor/bin/phpunit --configuration phpunit.xml --testsuite unit - - adapter: - name: ${{ matrix.adapter.name }} (PHP ${{ matrix.php }}) - runs-on: ubuntu-latest - needs: build - strategy: - fail-fast: false - matrix: - php: ['8.4', '8.5'] - adapter: - - { name: Memory, suite: memory, services: '', wait: 0 } - - { name: None, suite: none, services: '', wait: 0 } - - { name: Filesystem, suite: filesystem, services: '', wait: 0 } - - { name: Pool, suite: pool, services: '', wait: 0 } - - { name: CircuitBreaker, suite: circuitbreaker, services: '', wait: 0 } - - { name: Telemetry, suite: telemetry, services: '', wait: 0 } - - { name: Memcached, suite: memcached, services: 'memcached', wait: 3 } - - { name: Hazelcast, suite: hazelcast, services: 'hazelcast', wait: 30 } - - { name: Sharding, suite: sharding, services: 'shardA shardB shardC', wait: 0 } - - { name: Redis, suite: redis, services: 'redis', wait: 0 } - - { name: RedisMultiplexing, suite: redis-multiplexing, services: 'redis', wait: 0 } - - { name: RedisCluster, suite: redis-cluster, services: 'redis-cluster', wait: 0 } - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - run: git checkout HEAD^2 - - - name: Restore tests image - uses: actions/cache@v4 - with: - key: cache-tests-${{ matrix.php }}-${{ github.event.pull_request.head.sha }} - path: /tmp/cache-tests-${{ matrix.php }}.tar - fail-on-cache-miss: true - - - name: Start services - run: | - docker load --input /tmp/cache-tests-${{ matrix.php }}.tar - PHP_VERSION=${{ matrix.php }} docker compose up -d --no-deps --wait --wait-timeout 180 tests ${{ matrix.adapter.services }} - if [ "${{ matrix.adapter.wait }}" -gt 0 ]; then sleep ${{ matrix.adapter.wait }}; fi - - - name: Run ${{ matrix.adapter.name }} tests - run: docker compose exec -T tests vendor/bin/phpunit --configuration phpunit.xml --testsuite ${{ matrix.adapter.suite }} diff --git a/.gitignore b/.gitignore index 56506c35eb..95a2c44c48 100755 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /vendor/ /.idea/ -.phpunit.result.cache -tests/data -tests/Cache/E2E/tests/pool/ +.phpunit.cache +.DS_Store diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 2dec654fbb..0000000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,76 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to make participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, sex characteristics, gender identity, expression, -level of experience, education, socio-economic status, nationality, personal -appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -- The use of sexualized language or imagery and unwelcome sexual attention or - advances -- Trolling, insulting/derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or electronic - address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at team@appwrite.io. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see -https://www.contributor-covenant.org/faq diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index f0afbdf872..0000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,101 +0,0 @@ -# Contributing - -We would ❀️ for you to contribute to Utopia-php and help make it better! We want contributing to Utopia-php to be fun, enjoyable, and educational for anyone and everyone. All contributions are welcome, including issues, new docs as well as updates and tweaks, blog posts, workshops, and more. - -## How to Start? - -If you are worried or don’t know where to start, check out our next section explaining what kind of help we could use and where can you get involved. You can reach out with questions to [Eldad Fux (@eldadfux)](https://twitter.com/eldadfux) or anyone from the [Appwrite team on Discord](https://discord.gg/GSeTUeA). You can also submit an issue, and a maintainer can guide you! - -## Code of Conduct - -Help us keep Utopia-php open and inclusive. Please read and follow our [Code of Conduct](/CODE_OF_CONDUCT.md). - -## Submit a Pull Request πŸš€ - -Branch naming convention is as following - -`TYPE-ISSUE_ID-DESCRIPTION` - -example: - -``` -doc-548-submit-a-pull-request-section-to-contribution-guide -``` - -When `TYPE` can be: - -- **feat** - is a new feature -- **doc** - documentation only changes -- **cicd** - changes related to CI/CD system -- **fix** - a bug fix -- **refactor** - code change that neither fixes a bug nor adds a feature - -**All PRs must include a commit message with the changes description!** - -For the initial start, fork the project and use git clone command to download the repository to your computer. A standard procedure for working on an issue would be to: - -1. `git pull`, before creating a new branch, pull the changes from upstream. Your master needs to be up to date. - -``` -$ git pull -``` - -2. Create new branch from `master` like: `doc-548-submit-a-pull-request-section-to-contribution-guide`
- -``` -$ git checkout -b [name_of_your_new_branch] -``` - -3. Work - commit - repeat ( be sure to be in your branch ) - -4. Push changes to GitHub - -``` -$ git push origin [name_of_your_new_branch] -``` - -5. Submit your changes for review - If you go to your repository on GitHub, you'll see a `Compare & pull request` button. Click on that button. -6. Start a Pull Request - Now submit the pull request and click on `Create pull request`. -7. Get a code review approval/reject -8. After approval, merge your PR -9. GitHub will automatically delete the branch after the merge is done. (they can still be restored). - -## Introducing New Features - -We would πŸ’– you to contribute to Utopia-php, but we would also like to make sure Utopia-php is as great as possible and loyal to its vision and mission statement πŸ™. - -For us to find the right balance, please open an issue explaining your ideas before introducing a new pull request. - -This will allow the Utopia-php community to have sufficient discussion about the new feature value and how it fits in the product roadmap and vision. - -This is also important for the Utopia-php lead developers to be able to give technical input and different emphasis regarding the feature design and architecture. Some bigger features might need to go through our [RFC process](https://github.com/appwrite/rfc). - -## Other Ways to Help - -Pull requests are great, but there are many other areas where you can help Utopia-php. - -### Blogging & Speaking - -Blogging, speaking about, or creating tutorials about one of Utopia-php’s many features is great way to contribute and help our project grow. - -### Presenting at Meetups - -Presenting at meetups and conferences about your Utopia-php projects. Your unique challenges and successes in building things with Utopia-php can provide great speaking material. We’d love to review your talk abstract/CFP, so get in touch with us if you’d like some help! - -### Sending Feedbacks & Reporting Bugs - -Sending feedback is a great way for us to understand your different use cases of Utopia-php better. If you had any issues, bugs, or want to share about your experience, feel free to do so on our GitHub issues page or at our [Discord channel](https://discord.gg/GSeTUeA). - -### Submitting New Ideas - -If you think Utopia-php could use a new feature, please open an issue on our GitHub repository, stating as much information as you can think about your new idea and it's implications. We would also use this issue to gather more information, get more feedback from the community, and have a proper discussion about the new feature. - -### Improving Documentation - -Submitting documentation updates, enhancements, designs, or bug fixes. Spelling or grammar fixes will be very much appreciated. - -### Helping Someone - -Searching for Utopia-php, GitHub or StackOverflow and helping someone else who needs help. You can also help by teaching others how to contribute to Utopia-php's repo! \ No newline at end of file diff --git a/Dockerfile.php-8.4 b/Dockerfile.php-8.4 deleted file mode 100644 index 386f1efdac..0000000000 --- a/Dockerfile.php-8.4 +++ /dev/null @@ -1,44 +0,0 @@ -FROM composer:2.7 as step0 - -ARG TESTING=false -ENV TESTING=$TESTING - -WORKDIR /usr/local/src/ - -COPY composer.lock /usr/local/src/ -COPY composer.json /usr/local/src/ - -RUN composer update --ignore-platform-reqs --optimize-autoloader \ - --no-plugins --no-scripts --prefer-dist - -FROM appwrite/utopia-base:php-8.4-2.0.0 as final - -ENV PHP_MEMCACHED_VERSION=v3.4.0 - -LABEL maintainer="team@appwrite.io" - -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -RUN \ - apk update \ - && apk add --no-cache make automake autoconf g++ gcc zlib-dev libmemcached-dev docker-cli \ - && rm -rf /var/cache/apk/* - -RUN \ - # Memcached Extension - git clone --branch $PHP_MEMCACHED_VERSION https://github.com/php-memcached-dev/php-memcached.git && \ - cd php-memcached && \ - phpize && \ - ./configure && \ - make && make install && \ - cd .. - -RUN echo extension=memcached.so >> /usr/local/etc/php/conf.d/memcached.ini - -WORKDIR /usr/src/code - -COPY ./ /usr/src/code - -COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor - -CMD [ "tail", "-f", "/dev/null" ] diff --git a/Dockerfile.php-8.5 b/Dockerfile.php-8.5 deleted file mode 100644 index afcf3e6fa9..0000000000 --- a/Dockerfile.php-8.5 +++ /dev/null @@ -1,44 +0,0 @@ -FROM composer:2.7 as step0 - -ARG TESTING=false -ENV TESTING=$TESTING - -WORKDIR /usr/local/src/ - -COPY composer.lock /usr/local/src/ -COPY composer.json /usr/local/src/ - -RUN composer update --ignore-platform-reqs --optimize-autoloader \ - --no-plugins --no-scripts --prefer-dist - -FROM appwrite/utopia-base:php-8.5-2.0.0 as final - -ENV PHP_MEMCACHED_VERSION=v3.4.0 - -LABEL maintainer="team@appwrite.io" - -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -RUN \ - apk update \ - && apk add --no-cache make automake autoconf g++ gcc zlib-dev libmemcached-dev docker-cli \ - && rm -rf /var/cache/apk/* - -RUN \ - # Memcached Extension - git clone --branch $PHP_MEMCACHED_VERSION https://github.com/php-memcached-dev/php-memcached.git && \ - cd php-memcached && \ - phpize && \ - ./configure && \ - make && make install && \ - cd .. - -RUN echo extension=memcached.so >> /usr/local/etc/php/conf.d/memcached.ini - -WORKDIR /usr/src/code - -COPY ./ /usr/src/code - -COPY --from=step0 /usr/local/src/vendor /usr/src/code/vendor - -CMD [ "tail", "-f", "/dev/null" ] diff --git a/README.md b/README.md index 51e179a4e2..af196af5e4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Utopia Cache -[![Build Status](https://travis-ci.org/utopia-php/cache.svg?branch=master)](https://travis-ci.com/utopia-php/cache) +> [!IMPORTANT] +> This repository is a read-only mirror of the [utopia-php monorepo](https://github.com/utopia-php/monorepo). Development happens in [`packages/cache`](https://github.com/utopia-php/monorepo/tree/main/packages/cache) β€” please open issues and pull requests there. + ![Total Downloads](https://img.shields.io/packagist/dt/utopia-php/cache.svg) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord)](https://appwrite.io/discord) @@ -8,9 +10,10 @@ Utopia framework cache library is simple and lite library for managing applicati Although this library is part of the [Utopia Framework](https://github.com/utopia-php/framework) project it is dependency free and can be used as standalone with any other PHP project or framework. -## Getting Started +## Getting started + +Install using Composer: -Install using composer: ```bash composer require utopia-php/cache ``` @@ -39,24 +42,41 @@ if(!$data) { echo $data; ``` -## Contribute +## Adapters -Currently we support only a Filesystem adapter for usage as a cache storage, send a pull request to add redis, memcached or any other storage adapter you might need to use with this library. +| Adapter | Notes | +| --- | --- | +| `Filesystem` | Files on disk, with optional streaming reads. | +| `Memory` | In-process array, useful in tests. | +| `None` | Stores nothing, for turning caching off. | +| `Redis` | phpredis, with reconnect and leases. | +| `Redis\Multiplexing` | Many Swoole coroutines over one Redis connection β€” see [the multiplexing guide](docs/multiplexing.md). | +| `RedisCluster` | phpredis against a Redis cluster. | +| `Memcached` | Memcached over the binary protocol. | +| `Hazelcast` | Hazelcast over its Memcached protocol. | +| `Sharding` | Spreads keys across several adapters. | +| `Pool` | Checks an adapter out of a `utopia-php/pools` pool per call. | +| `CircuitBreaker` | Wraps an adapter so a failing cache stops being called. | -## System Requirements +## System requirements -Utopia Framework requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible. +The library requires PHP 8.4 or later. The Redis, Memcached and Hazelcast adapters need the matching extension β€” see the `suggest` block in `composer.json`. ## Tests -To run all unit tests, use the following Docker command: +The unit tier needs nothing running: -`docker compose exec tests vendor/bin/phpunit --configuration phpunit.xml tests` +```bash +composer test +``` -To run static code analysis, use the following Psalm command: - -`docker-compose exec php8 vendor/bin/psalm --show-info=true` +The end-to-end tier runs on the host against this package's services: +```bash +docker compose up -d --wait +composer test:e2e +docker compose down -v +``` ## Copyright and license diff --git a/composer.json b/composer.json index 7218e4e229..ed0cd291e3 100644 --- a/composer.json +++ b/composer.json @@ -2,36 +2,51 @@ "name": "utopia-php/cache", "description": "A simple cache library to manage application cache storing, loading and purging", "type": "library", - "keywords": ["php","framework", "upf", "utopia", "cache"], + "keywords": [ + "php", + "framework", + "upf", + "utopia", + "cache" + ], "license": "MIT", - "minimum-stability": "stable", - "scripts": { - "check": "./vendor/bin/phpstan analyse --level max src tests", - "lint": "./vendor/bin/pint --test", - "format": "./vendor/bin/pint" - }, + "authors": [ + { + "name": "Team Appwrite", + "email": "team@appwrite.io" + } + ], "autoload": { - "psr-4": {"Utopia\\Cache\\": "src/Cache"} + "psr-4": { + "Utopia\\Cache\\": "src/Cache" + } }, "autoload-dev": { - "psr-4": {"Utopia\\Tests\\": "tests/Cache"} + "psr-4": { + "Utopia\\Tests\\": "tests/Cache" + } }, "require": { "php": ">=8.4", "ext-json": "*", - "ext-memcached": "*", - "ext-redis": "*", - "utopia-php/circuit-breaker": "0.3.*", - "utopia-php/pools": "2.*", - "utopia-php/telemetry": "*" + "utopia-php/circuit-breaker": "^0.3", + "utopia-php/pools": "^2.0", + "utopia-php/telemetry": "^0.4" }, "require-dev": { - "laravel/pint": "1.2.*", - "phpstan/phpstan": "^1.12", - "phpunit/phpunit": "^9.3", - "swoole/ide-helper": "^6.0", - "vimeo/psalm": "4.13.1" + "swoole/ide-helper": "^6.0" }, + "suggest": { + "ext-redis": "Required for the Redis, RedisCluster and Sharding adapters.", + "ext-memcached": "Required for the Memcached and Hazelcast adapters.", + "ext-swoole": "Required for the multiplexing Redis adapter (>=6.0)." + }, + "scripts": { + "test": "phpunit --testsuite unit", + "test:e2e": "phpunit --testsuite e2e" + }, + "minimum-stability": "stable", + "prefer-stable": true, "config": { "allow-plugins": { "php-http/discovery": true, diff --git a/composer.lock b/composer.lock index 2027fb54a2..72a929c9b8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,27 +4,26 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e61c8e22817afb02fe0f5586be47f36d", + "content-hash": "5c7803c4f7197b242f04e42c080c46cb", "packages": [ { "name": "brick/math", - "version": "0.14.1", + "version": "0.18.0", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "f05858549e5f9d7bb45875a75583240a38a281d0" + "reference": "82944324d1c1bdb2c2618e89978d4e2ad78d69ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/f05858549e5f9d7bb45875a75583240a38a281d0", - "reference": "f05858549e5f9d7bb45875a75583240a38a281d0", + "url": "https://api.github.com/repos/brick/math/zipball/82944324d1c1bdb2c2618e89978d4e2ad78d69ad", + "reference": "82944324d1c1bdb2c2618e89978d4e2ad78d69ad", "shasum": "" }, "require": { "php": "^8.2" }, "require-dev": { - "php-coveralls/php-coveralls": "^2.2", "phpstan/phpstan": "2.1.22", "phpunit/phpunit": "^11.5" }, @@ -56,7 +55,7 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.14.1" + "source": "https://github.com/brick/math/tree/0.18.0" }, "funding": [ { @@ -64,7 +63,7 @@ "type": "github" } ], - "time": "2025-11-24T14:40:29+00:00" + "time": "2026-06-14T18:21:03+00:00" }, { "name": "composer/semver", @@ -145,23 +144,23 @@ }, { "name": "google/protobuf", - "version": "v4.33.4", + "version": "v5.35.1", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "22d28025cda0d223a2e48c2e16c5284ecc9f5402" + "reference": "55bb4a7d6739b5af0927b96213c1371a3afb7cfb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/22d28025cda0d223a2e48c2e16c5284ecc9f5402", - "reference": "22d28025cda0d223a2e48c2e16c5284ecc9f5402", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/55bb4a7d6739b5af0927b96213c1371a3afb7cfb", + "reference": "55bb4a7d6739b5af0927b96213c1371a3afb7cfb", "shasum": "" }, "require": { - "php": ">=8.1.0" + "php": ">=8.2.0" }, "require-dev": { - "phpunit/phpunit": ">=5.0.0 <8.5.27" + "phpunit/phpunit": ">=11.5.0 <12.0.0" }, "suggest": { "ext-bcmath": "Need to support JSON deserialization" @@ -183,9 +182,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.4" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v5.35.1" }, - "time": "2026-01-12T17:58:43+00:00" + "time": "2026-06-11T21:19:23+00:00" }, { "name": "nyholm/psr7", @@ -333,16 +332,16 @@ }, { "name": "open-telemetry/api", - "version": "1.7.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/api.git", - "reference": "45bda7efa8fcdd9bdb0daa2f26c8e31f062f49d4" + "reference": "7c029c4a6fd457094a20569bf98f93d95e9a7559" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/45bda7efa8fcdd9bdb0daa2f26c8e31f062f49d4", - "reference": "45bda7efa8fcdd9bdb0daa2f26c8e31f062f49d4", + "url": "https://api.github.com/repos/opentelemetry-php/api/zipball/7c029c4a6fd457094a20569bf98f93d95e9a7559", + "reference": "7c029c4a6fd457094a20569bf98f93d95e9a7559", "shasum": "" }, "require": { @@ -352,7 +351,7 @@ "symfony/polyfill-php82": "^1.26" }, "conflict": { - "open-telemetry/sdk": "<=1.0.8" + "open-telemetry/sdk": "<=1.11" }, "type": "library", "extra": { @@ -399,20 +398,20 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-10-19T10:49:48+00:00" + "time": "2026-07-06T12:28:04+00:00" }, { "name": "open-telemetry/context", - "version": "1.4.0", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/context.git", - "reference": "d4c4470b541ce72000d18c339cfee633e4c8e0cf" + "reference": "3c414b246e0dabb7d6145404e6a5e4536ca18d07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/context/zipball/d4c4470b541ce72000d18c339cfee633e4c8e0cf", - "reference": "d4c4470b541ce72000d18c339cfee633e4c8e0cf", + "url": "https://api.github.com/repos/opentelemetry-php/context/zipball/3c414b246e0dabb7d6145404e6a5e4536ca18d07", + "reference": "3c414b246e0dabb7d6145404e6a5e4536ca18d07", "shasum": "" }, "require": { @@ -454,24 +453,24 @@ ], "support": { "chat": "https://app.slack.com/client/T08PSQ7BQ/C01NFPCV44V", - "docs": "https://opentelemetry.io/docs/php", + "docs": "https://opentelemetry.io/docs/languages/php", "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-09-19T00:05:49+00:00" + "time": "2025-10-19T06:44:33+00:00" }, { "name": "open-telemetry/exporter-otlp", - "version": "1.3.4", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/exporter-otlp.git", - "reference": "62e680d587beb42e5247aa6ecd89ad1ca406e8ca" + "reference": "283a0d66522f2adc6d8d7debfd7686be91c282be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/62e680d587beb42e5247aa6ecd89ad1ca406e8ca", - "reference": "62e680d587beb42e5247aa6ecd89ad1ca406e8ca", + "url": "https://api.github.com/repos/opentelemetry-php/exporter-otlp/zipball/283a0d66522f2adc6d8d7debfd7686be91c282be", + "reference": "283a0d66522f2adc6d8d7debfd7686be91c282be", "shasum": "" }, "require": { @@ -522,24 +521,24 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2026-01-15T09:31:34+00:00" + "time": "2026-02-05T09:44:52+00:00" }, { "name": "open-telemetry/gen-otlp-protobuf", - "version": "1.8.0", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/gen-otlp-protobuf.git", - "reference": "673af5b06545b513466081884b47ef15a536edde" + "reference": "66f04d0e448ad333033bfc7baae1aa56330be088" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/gen-otlp-protobuf/zipball/673af5b06545b513466081884b47ef15a536edde", - "reference": "673af5b06545b513466081884b47ef15a536edde", + "url": "https://api.github.com/repos/opentelemetry-php/gen-otlp-protobuf/zipball/66f04d0e448ad333033bfc7baae1aa56330be088", + "reference": "66f04d0e448ad333033bfc7baae1aa56330be088", "shasum": "" }, "require": { - "google/protobuf": "^3.22 || ^4.0", + "google/protobuf": "^3.22 || ^4.0 || ^5.0", "php": "^8.0" }, "suggest": { @@ -581,32 +580,32 @@ ], "support": { "chat": "https://app.slack.com/client/T08PSQ7BQ/C01NFPCV44V", - "docs": "https://opentelemetry.io/docs/php", + "docs": "https://opentelemetry.io/docs/languages/php", "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-09-17T23:10:12+00:00" + "time": "2026-06-17T12:06:32+00:00" }, { "name": "open-telemetry/sdk", - "version": "1.11.0", + "version": "1.15.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "d91f21addcdb42da9a451c002777f8318432461a" + "reference": "77e1aa73850154abb86937d52a70883edc3b4547" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/d91f21addcdb42da9a451c002777f8318432461a", - "reference": "d91f21addcdb42da9a451c002777f8318432461a", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/77e1aa73850154abb86937d52a70883edc3b4547", + "reference": "77e1aa73850154abb86937d52a70883edc3b4547", "shasum": "" }, "require": { "ext-json": "*", "nyholm/psr7-server": "^1.1", - "open-telemetry/api": "^1.7", + "open-telemetry/api": "^1.8", "open-telemetry/context": "^1.4", - "open-telemetry/sem-conv": "^1.0", + "open-telemetry/sem-conv": "^1.38.0", "php": "^8.1", "php-http/discovery": "^1.14", "psr/http-client": "^1.0", @@ -629,7 +628,10 @@ "spi": { "OpenTelemetry\\API\\Configuration\\ConfigEnv\\EnvComponentLoader": [ "OpenTelemetry\\API\\Instrumentation\\Configuration\\General\\ConfigEnv\\EnvComponentLoaderHttpConfig", - "OpenTelemetry\\API\\Instrumentation\\Configuration\\General\\ConfigEnv\\EnvComponentLoaderPeerConfig" + "OpenTelemetry\\API\\Instrumentation\\Configuration\\General\\ConfigEnv\\EnvComponentLoaderPeerConfig", + "OpenTelemetry\\SDK\\ConfigEnv\\Trace\\SpanSuppressionStrategySemConv", + "OpenTelemetry\\SDK\\ConfigEnv\\Trace\\SpanSuppressionStrategySpanKind", + "OpenTelemetry\\SDK\\ConfigEnv\\Distribution\\DistributionConfigurationSdk" ], "OpenTelemetry\\SDK\\Common\\Configuration\\Resolver\\ResolverInterface": [ "OpenTelemetry\\SDK\\Common\\Configuration\\Resolver\\SdkConfigurationResolver" @@ -639,7 +641,7 @@ ] }, "branch-alias": { - "dev-main": "1.9.x-dev" + "dev-main": "1.14.x-dev" } }, "autoload": { @@ -682,7 +684,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2026-01-15T11:21:03+00:00" + "time": "2026-07-14T13:09:54+00:00" }, { "name": "open-telemetry/sem-conv", @@ -1161,20 +1163,20 @@ }, { "name": "ramsey/uuid", - "version": "4.9.2", + "version": "4.9.3", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "8429c78ca35a09f27565311b98101e2826affde0" + "reference": "1df15849d00943a67d677dc9cfd80795f038c9f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/8429c78ca35a09f27565311b98101e2826affde0", - "reference": "8429c78ca35a09f27565311b98101e2826affde0", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/1df15849d00943a67d677dc9cfd80795f038c9f8", + "reference": "1df15849d00943a67d677dc9cfd80795f038c9f8", "shasum": "" }, "require": { - "brick/math": "^0.8.16 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14", + "brick/math": ">=0.8.16 <=0.18", "php": "^8.0", "ramsey/collection": "^1.2 || ^2.0" }, @@ -1233,22 +1235,22 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.9.2" + "source": "https://github.com/ramsey/uuid/tree/4.9.3" }, - "time": "2025-12-14T04:43:48+00:00" + "time": "2026-06-18T03:57:49+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.6.0", + "version": "v3.7.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" + "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", - "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/f3202fa1b5097b0af062dc978b32ecf63404e31d", + "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d", "shasum": "" }, "require": { @@ -1261,7 +1263,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.6-dev" + "dev-main": "3.7-dev" } }, "autoload": { @@ -1286,7 +1288,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.1" }, "funding": [ { @@ -1297,25 +1299,29 @@ "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": "2024-09-25T14:21:43+00:00" + "time": "2026-06-05T06:23:12+00:00" }, { "name": "symfony/http-client", - "version": "v7.4.3", + "version": "v7.4.15", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "d01dfac1e0dc99f18da48b18101c23ce57929616" + "reference": "817bb83ef06717f67ab72a3f03e3b63fbe138de1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/d01dfac1e0dc99f18da48b18101c23ce57929616", - "reference": "d01dfac1e0dc99f18da48b18101c23ce57929616", + "url": "https://api.github.com/repos/symfony/http-client/zipball/817bb83ef06717f67ab72a3f03e3b63fbe138de1", + "reference": "817bb83ef06717f67ab72a3f03e3b63fbe138de1", "shasum": "" }, "require": { @@ -1383,7 +1389,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.4.3" + "source": "https://github.com/symfony/http-client/tree/v7.4.15" }, "funding": [ { @@ -1403,20 +1409,20 @@ "type": "tidelift" } ], - "time": "2025-12-23T14:50:43+00:00" + "time": "2026-07-29T07:12:33+00:00" }, { "name": "symfony/http-client-contracts", - "version": "v3.6.0", + "version": "v3.7.1", "source": { "type": "git", "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "75d7043853a42837e68111812f4d964b01e5101c" + "reference": "41fc42d276aeff21192465331ebbab7d83a743c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/75d7043853a42837e68111812f4d964b01e5101c", - "reference": "75d7043853a42837e68111812f4d964b01e5101c", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/41fc42d276aeff21192465331ebbab7d83a743c0", + "reference": "41fc42d276aeff21192465331ebbab7d83a743c0", "shasum": "" }, "require": { @@ -1429,7 +1435,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.6-dev" + "dev-main": "3.7-dev" } }, "autoload": { @@ -1465,7 +1471,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v3.6.0" + "source": "https://github.com/symfony/http-client-contracts/tree/v3.7.1" }, "funding": [ { @@ -1476,25 +1482,29 @@ "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": "2025-04-29T11:18:49+00:00" + "time": "2026-06-05T06:23:12+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.33.0", + "version": "v1.38.2", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" + "reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", - "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6", + "reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6", "shasum": "" }, "require": { @@ -1546,7 +1556,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.38.2" }, "funding": [ { @@ -1566,20 +1576,20 @@ "type": "tidelift" } ], - "time": "2024-12-23T08:48:59+00:00" + "time": "2026-05-27T06:59:30+00:00" }, { "name": "symfony/polyfill-php82", - "version": "v1.33.0", + "version": "v1.38.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php82.git", - "reference": "5d2ed36f7734637dacc025f179698031951b1692" + "reference": "002dc0cfe5fd4ed6033d48f27d4f19a486c4b04b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php82/zipball/5d2ed36f7734637dacc025f179698031951b1692", - "reference": "5d2ed36f7734637dacc025f179698031951b1692", + "url": "https://api.github.com/repos/symfony/polyfill-php82/zipball/002dc0cfe5fd4ed6033d48f27d4f19a486c4b04b", + "reference": "002dc0cfe5fd4ed6033d48f27d4f19a486c4b04b", "shasum": "" }, "require": { @@ -1626,7 +1636,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php82/tree/v1.33.0" + "source": "https://github.com/symfony/polyfill-php82/tree/v1.38.1" }, "funding": [ { @@ -1646,20 +1656,20 @@ "type": "tidelift" } ], - "time": "2024-09-09T11:45:10+00:00" + "time": "2026-05-26T12:45:58+00:00" }, { "name": "symfony/polyfill-php83", - "version": "v1.33.0", + "version": "v1.41.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php83.git", - "reference": "17f6f9a6b1735c0f163024d959f700cfbc5155e5" + "reference": "5ea99087fb99c273a9b9236ed4c31e78b16103c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/17f6f9a6b1735c0f163024d959f700cfbc5155e5", - "reference": "17f6f9a6b1735c0f163024d959f700cfbc5155e5", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/5ea99087fb99c273a9b9236ed4c31e78b16103c6", + "reference": "5ea99087fb99c273a9b9236ed4c31e78b16103c6", "shasum": "" }, "require": { @@ -1706,7 +1716,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php83/tree/v1.33.0" + "source": "https://github.com/symfony/polyfill-php83/tree/v1.41.0" }, "funding": [ { @@ -1726,20 +1736,20 @@ "type": "tidelift" } ], - "time": "2025-07-08T02:45:35+00:00" + "time": "2026-07-01T12:47:55+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.6.1", + "version": "v3.7.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43" + "reference": "c0a284bab1ed8aa0417e3d69250ab437739563a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/45112560a3ba2d715666a509a0bc9521d10b6c43", - "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/c0a284bab1ed8aa0417e3d69250ab437739563a0", + "reference": "c0a284bab1ed8aa0417e3d69250ab437739563a0", "shasum": "" }, "require": { @@ -1757,7 +1767,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.6-dev" + "dev-main": "3.7-dev" } }, "autoload": { @@ -1793,7 +1803,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.6.1" + "source": "https://github.com/symfony/service-contracts/tree/v3.7.1" }, "funding": [ { @@ -1813,7 +1823,7 @@ "type": "tidelift" } ], - "time": "2025-07-15T11:30:57+00:00" + "time": "2026-06-16T09:55:08+00:00" }, { "name": "tbachert/spi", @@ -1869,16 +1879,16 @@ }, { "name": "utopia-php/circuit-breaker", - "version": "0.3.0", + "version": "0.3.1", "source": { "type": "git", "url": "https://github.com/utopia-php/circuit-breaker.git", - "reference": "064243c1667778c00abf027ff53a735a228776de" + "reference": "db5d77f6c99ebce2ee81bd8ed4ae8f41bd2b0828" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/circuit-breaker/zipball/064243c1667778c00abf027ff53a735a228776de", - "reference": "064243c1667778c00abf027ff53a735a228776de", + "url": "https://api.github.com/repos/utopia-php/circuit-breaker/zipball/db5d77f6c99ebce2ee81bd8ed4ae8f41bd2b0828", + "reference": "db5d77f6c99ebce2ee81bd8ed4ae8f41bd2b0828", "shasum": "" }, "require": { @@ -1888,7 +1898,7 @@ "laravel/pint": "^1.29", "phpstan/phpstan": "^2.1", "phpunit/phpunit": "^10.0", - "utopia-php/telemetry": "0.2.*" + "utopia-php/telemetry": "^0.4" }, "suggest": { "ext-opentelemetry": "Required by utopia-php/telemetry when using OpenTelemetry metrics.", @@ -1925,9 +1935,9 @@ ], "support": { "issues": "https://github.com/utopia-php/circuit-breaker/issues", - "source": "https://github.com/utopia-php/circuit-breaker/tree/0.3.0" + "source": "https://github.com/utopia-php/circuit-breaker/tree/0.3.1" }, - "time": "2026-05-12T04:27:08+00:00" + "time": "2026-05-29T12:12:23+00:00" }, { "name": "utopia-php/pools", @@ -2038,2753 +2048,18 @@ } ], "packages-dev": [ - { - "name": "amphp/amp", - "version": "v2.6.5", - "source": { - "type": "git", - "url": "https://github.com/amphp/amp.git", - "reference": "d7dda98dae26e56f3f6fcfbf1c1f819c9a993207" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/d7dda98dae26e56f3f6fcfbf1c1f819c9a993207", - "reference": "d7dda98dae26e56f3f6fcfbf1c1f819c9a993207", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1", - "ext-json": "*", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^7 | ^8 | ^9", - "react/promise": "^2", - "vimeo/psalm": "^3.12" - }, - "type": "library", - "autoload": { - "files": [ - "lib/functions.php", - "lib/Internal/functions.php" - ], - "psr-4": { - "Amp\\": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Daniel Lowrey", - "email": "rdlowrey@php.net" - }, - { - "name": "Aaron Piotrowski", - "email": "aaron@trowski.com" - }, - { - "name": "Bob Weinand", - "email": "bobwei9@hotmail.com" - }, - { - "name": "Niklas Keller", - "email": "me@kelunik.com" - } - ], - "description": "A non-blocking concurrency framework for PHP applications.", - "homepage": "https://amphp.org/amp", - "keywords": [ - "async", - "asynchronous", - "awaitable", - "concurrency", - "event", - "event-loop", - "future", - "non-blocking", - "promise" - ], - "support": { - "irc": "irc://irc.freenode.org/amphp", - "issues": "https://github.com/amphp/amp/issues", - "source": "https://github.com/amphp/amp/tree/v2.6.5" - }, - "funding": [ - { - "url": "https://github.com/amphp", - "type": "github" - } - ], - "time": "2025-09-03T19:41:28+00:00" - }, - { - "name": "amphp/byte-stream", - "version": "v1.8.2", - "source": { - "type": "git", - "url": "https://github.com/amphp/byte-stream.git", - "reference": "4f0e968ba3798a423730f567b1b50d3441c16ddc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/amphp/byte-stream/zipball/4f0e968ba3798a423730f567b1b50d3441c16ddc", - "reference": "4f0e968ba3798a423730f567b1b50d3441c16ddc", - "shasum": "" - }, - "require": { - "amphp/amp": "^2", - "php": ">=7.1" - }, - "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1.4", - "friendsofphp/php-cs-fixer": "^2.3", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^6 || ^7 || ^8", - "psalm/phar": "^3.11.4" - }, - "type": "library", - "autoload": { - "files": [ - "lib/functions.php" - ], - "psr-4": { - "Amp\\ByteStream\\": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Aaron Piotrowski", - "email": "aaron@trowski.com" - }, - { - "name": "Niklas Keller", - "email": "me@kelunik.com" - } - ], - "description": "A stream abstraction to make working with non-blocking I/O simple.", - "homepage": "https://amphp.org/byte-stream", - "keywords": [ - "amp", - "amphp", - "async", - "io", - "non-blocking", - "stream" - ], - "support": { - "issues": "https://github.com/amphp/byte-stream/issues", - "source": "https://github.com/amphp/byte-stream/tree/v1.8.2" - }, - "funding": [ - { - "url": "https://github.com/amphp", - "type": "github" - } - ], - "time": "2024-04-13T18:00:56+00:00" - }, - { - "name": "composer/package-versions-deprecated", - "version": "1.11.99.5", - "source": { - "type": "git", - "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d", - "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.1.0 || ^2.0", - "php": "^7 || ^8" - }, - "replace": { - "ocramius/package-versions": "1.11.99" - }, - "require-dev": { - "composer/composer": "^1.9.3 || ^2.0@dev", - "ext-zip": "^1.13", - "phpunit/phpunit": "^6.5 || ^7" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "support": { - "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.5" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2022-01-17T14:14:24+00:00" - }, - { - "name": "composer/pcre", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/composer/pcre.git", - "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/67a32d7d6f9f560b726ab25a061b38ff3a80c560", - "reference": "67a32d7d6f9f560b726ab25a061b38ff3a80c560", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" - }, - "require-dev": { - "phpstan/phpstan": "^1.3", - "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Pcre\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - } - ], - "description": "PCRE wrapping library that offers type-safe preg_* replacements.", - "keywords": [ - "PCRE", - "preg", - "regex", - "regular expression" - ], - "support": { - "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/1.0.1" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2022-01-21T20:24:37+00:00" - }, - { - "name": "composer/xdebug-handler", - "version": "2.0.5", - "source": { - "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "9e36aeed4616366d2b690bdce11f71e9178c579a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/9e36aeed4616366d2b690bdce11f71e9178c579a", - "reference": "9e36aeed4616366d2b690bdce11f71e9178c579a", - "shasum": "" - }, - "require": { - "composer/pcre": "^1", - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1 || ^2 || ^3" - }, - "require-dev": { - "phpstan/phpstan": "^1.0", - "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^4.2 || ^5.0 || ^6.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Composer\\XdebugHandler\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" - } - ], - "description": "Restarts a process without Xdebug.", - "keywords": [ - "Xdebug", - "performance" - ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/2.0.5" - }, - "funding": [ - { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" - } - ], - "time": "2022-02-24T20:20:32+00:00" - }, - { - "name": "dnoegel/php-xdg-base-dir", - "version": "v0.1.1", - "source": { - "type": "git", - "url": "https://github.com/dnoegel/php-xdg-base-dir.git", - "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", - "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~7.0|~6.0|~5.0|~4.8.35" - }, - "type": "library", - "autoload": { - "psr-4": { - "XdgBaseDir\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "implementation of xdg base directory specification for php", - "support": { - "issues": "https://github.com/dnoegel/php-xdg-base-dir/issues", - "source": "https://github.com/dnoegel/php-xdg-base-dir/tree/v0.1.1" - }, - "time": "2019-12-04T15:06:13+00:00" - }, - { - "name": "doctrine/deprecations", - "version": "1.1.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/deprecations.git", - "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", - "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "phpunit/phpunit": "<=7.5 || >=13" - }, - "require-dev": { - "doctrine/coding-standard": "^9 || ^12 || ^13", - "phpstan/phpstan": "1.4.10 || 2.1.11", - "phpstan/phpstan-phpunit": "^1.0 || ^2", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12", - "psr/log": "^1 || ^2 || ^3" - }, - "suggest": { - "psr/log": "Allows logging deprecations via PSR-3 logger implementation" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Deprecations\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", - "homepage": "https://www.doctrine-project.org/", - "support": { - "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.5" - }, - "time": "2025-04-07T20:06:18+00:00" - }, - { - "name": "doctrine/instantiator", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "23da848e1a2308728fe5fdddabf4be17ff9720c7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/23da848e1a2308728fe5fdddabf4be17ff9720c7", - "reference": "23da848e1a2308728fe5fdddabf4be17ff9720c7", - "shasum": "" - }, - "require": { - "php": "^8.4" - }, - "require-dev": { - "doctrine/coding-standard": "^14", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^1.2", - "phpstan/phpstan": "^2.1", - "phpstan/phpstan-phpunit": "^2.0", - "phpunit/phpunit": "^10.5.58" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/2.1.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2026-01-05T06:47:08+00:00" - }, - { - "name": "felixfbecker/advanced-json-rpc", - "version": "v3.2.1", - "source": { - "type": "git", - "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", - "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/b5f37dbff9a8ad360ca341f3240dc1c168b45447", - "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447", - "shasum": "" - }, - "require": { - "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "php": "^7.1 || ^8.0", - "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0" - }, - "require-dev": { - "phpunit/phpunit": "^7.0 || ^8.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "AdvancedJsonRpc\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Felix Becker", - "email": "felix.b@outlook.com" - } - ], - "description": "A more advanced JSONRPC implementation", - "support": { - "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", - "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1" - }, - "time": "2021-06-11T22:34:44+00:00" - }, - { - "name": "felixfbecker/language-server-protocol", - "version": "v1.5.3", - "source": { - "type": "git", - "url": "https://github.com/felixfbecker/php-language-server-protocol.git", - "reference": "a9e113dbc7d849e35b8776da39edaf4313b7b6c9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/a9e113dbc7d849e35b8776da39edaf4313b7b6c9", - "reference": "a9e113dbc7d849e35b8776da39edaf4313b7b6c9", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "require-dev": { - "phpstan/phpstan": "*", - "squizlabs/php_codesniffer": "^3.1", - "vimeo/psalm": "^4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "LanguageServerProtocol\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "ISC" - ], - "authors": [ - { - "name": "Felix Becker", - "email": "felix.b@outlook.com" - } - ], - "description": "PHP classes for the Language Server Protocol", - "keywords": [ - "language", - "microsoft", - "php", - "server" - ], - "support": { - "issues": "https://github.com/felixfbecker/php-language-server-protocol/issues", - "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/v1.5.3" - }, - "time": "2024-04-30T00:40:11+00:00" - }, - { - "name": "laravel/pint", - "version": "v1.2.1", - "source": { - "type": "git", - "url": "https://github.com/laravel/pint.git", - "reference": "e60e2112ee779ce60f253695b273d1646a17d6f1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/laravel/pint/zipball/e60e2112ee779ce60f253695b273d1646a17d6f1", - "reference": "e60e2112ee779ce60f253695b273d1646a17d6f1", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-mbstring": "*", - "ext-tokenizer": "*", - "ext-xml": "*", - "php": "^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.11.0", - "illuminate/view": "^9.32.0", - "laravel-zero/framework": "^9.2.0", - "mockery/mockery": "^1.5.1", - "nunomaduro/larastan": "^2.2.0", - "nunomaduro/termwind": "^1.14.0", - "pestphp/pest": "^1.22.1" - }, - "bin": [ - "builds/pint" - ], - "type": "project", - "autoload": { - "psr-4": { - "App\\": "app/", - "Database\\Seeders\\": "database/seeders/", - "Database\\Factories\\": "database/factories/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nuno Maduro", - "email": "enunomaduro@gmail.com" - } - ], - "description": "An opinionated code formatter for PHP.", - "homepage": "https://laravel.com", - "keywords": [ - "format", - "formatter", - "lint", - "linter", - "php" - ], - "support": { - "issues": "https://github.com/laravel/pint/issues", - "source": "https://github.com/laravel/pint" - }, - "time": "2022-11-29T16:25:20+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.13.4", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a", - "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3 <3.2.2" - }, - "require-dev": { - "doctrine/collections": "^1.6.8", - "doctrine/common": "^2.13.3 || ^3.2.2", - "phpspec/prophecy": "^1.10", - "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" - }, - "type": "library", - "autoload": { - "files": [ - "src/DeepCopy/deep_copy.php" - ], - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "support": { - "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4" - }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], - "time": "2025-08-01T08:46:24+00:00" - }, - { - "name": "netresearch/jsonmapper", - "version": "v4.5.0", - "source": { - "type": "git", - "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "8e76efb98ee8b6afc54687045e1b8dba55ac76e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8e76efb98ee8b6afc54687045e1b8dba55ac76e5", - "reference": "8e76efb98ee8b6afc54687045e1b8dba55ac76e5", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0 || ~10.0", - "squizlabs/php_codesniffer": "~3.5" - }, - "type": "library", - "autoload": { - "psr-0": { - "JsonMapper": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "OSL-3.0" - ], - "authors": [ - { - "name": "Christian Weiske", - "email": "cweiske@cweiske.de", - "homepage": "http://github.com/cweiske/jsonmapper/", - "role": "Developer" - } - ], - "description": "Map nested JSON structures onto PHP classes", - "support": { - "email": "cweiske@cweiske.de", - "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/v4.5.0" - }, - "time": "2024-09-08T10:13:13+00:00" - }, - { - "name": "nikic/php-parser", - "version": "v4.19.5", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "51bd93cc741b7fc3d63d20b6bdcd99fdaa359837" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/51bd93cc741b7fc3d63d20b6bdcd99fdaa359837", - "reference": "51bd93cc741b7fc3d63d20b6bdcd99fdaa359837", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.1" - }, - "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "support": { - "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.19.5" - }, - "time": "2025-12-06T11:45:25+00:00" - }, - { - "name": "openlss/lib-array2xml", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/nullivex/lib-array2xml.git", - "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nullivex/lib-array2xml/zipball/a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", - "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "LSS": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Bryan Tong", - "email": "bryan@nullivex.com", - "homepage": "https://www.nullivex.com" - }, - { - "name": "Tony Butler", - "email": "spudz76@gmail.com", - "homepage": "https://www.nullivex.com" - } - ], - "description": "Array2XML conversion library credit to lalit.org", - "homepage": "https://www.nullivex.com", - "keywords": [ - "array", - "array conversion", - "xml", - "xml conversion" - ], - "support": { - "issues": "https://github.com/nullivex/lib-array2xml/issues", - "source": "https://github.com/nullivex/lib-array2xml/tree/master" - }, - "time": "2019-03-29T20:06:56+00:00" - }, - { - "name": "phar-io/manifest", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "54750ef60c58e43759730615a392c31c80e23176" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", - "reference": "54750ef60c58e43759730615a392c31c80e23176", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-phar": "*", - "ext-xmlwriter": "*", - "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "support": { - "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2024-03-03T12:33:53+00:00" - }, - { - "name": "phar-io/version", - "version": "3.2.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "support": { - "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.2.1" - }, - "time": "2022-02-21T01:04:05+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.6.6", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "5cee1d3dfc2d2aa6599834520911d246f656bcb8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/5cee1d3dfc2d2aa6599834520911d246f656bcb8", - "reference": "5cee1d3dfc2d2aa6599834520911d246f656bcb8", - "shasum": "" - }, - "require": { - "doctrine/deprecations": "^1.1", - "ext-filter": "*", - "php": "^7.4 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.7", - "phpstan/phpdoc-parser": "^1.7|^2.0", - "webmozart/assert": "^1.9.1 || ^2" - }, - "require-dev": { - "mockery/mockery": "~1.3.5 || ~1.6.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-webmozart-assert": "^1.2", - "phpunit/phpunit": "^9.5", - "psalm/phar": "^5.26" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.6" - }, - "time": "2025-12-22T21:13:58+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.12.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "92a98ada2b93d9b201a613cb5a33584dde25f195" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/92a98ada2b93d9b201a613cb5a33584dde25f195", - "reference": "92a98ada2b93d9b201a613cb5a33584dde25f195", - "shasum": "" - }, - "require": { - "doctrine/deprecations": "^1.0", - "php": "^7.3 || ^8.0", - "phpdocumentor/reflection-common": "^2.0", - "phpstan/phpdoc-parser": "^1.18|^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "phpbench/phpbench": "^1.2", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.8", - "phpstan/phpstan-phpunit": "^1.1", - "phpunit/phpunit": "^9.5", - "rector/rector": "^0.13.9", - "vimeo/psalm": "^4.25" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.12.0" - }, - "time": "2025-11-21T15:09:14+00:00" - }, - { - "name": "phpstan/phpdoc-parser", - "version": "2.3.1", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "16dbf9937da8d4528ceb2145c9c7c0bd29e26374" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/16dbf9937da8d4528ceb2145c9c7c0bd29e26374", - "reference": "16dbf9937da8d4528ceb2145c9c7c0bd29e26374", - "shasum": "" - }, - "require": { - "php": "^7.4 || ^8.0" - }, - "require-dev": { - "doctrine/annotations": "^2.0", - "nikic/php-parser": "^5.3.0", - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/extension-installer": "^1.0", - "phpstan/phpstan": "^2.0", - "phpstan/phpstan-phpunit": "^2.0", - "phpstan/phpstan-strict-rules": "^2.0", - "phpunit/phpunit": "^9.6", - "symfony/process": "^5.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "PHPStan\\PhpDocParser\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPDoc parser with support for nullable, intersection and generic types", - "support": { - "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.1" - }, - "time": "2026-01-12T11:33:04+00:00" - }, - { - "name": "phpstan/phpstan", - "version": "1.12.32", - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2770dcdf5078d0b0d53f94317e06affe88419aa8", - "reference": "2770dcdf5078d0b0d53f94317e06affe88419aa8", - "shasum": "" - }, - "require": { - "php": "^7.2|^8.0" - }, - "conflict": { - "phpstan/phpstan-shim": "*" - }, - "bin": [ - "phpstan", - "phpstan.phar" - ], - "type": "library", - "autoload": { - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan - PHP Static Analysis Tool", - "keywords": [ - "dev", - "static analysis" - ], - "support": { - "docs": "https://phpstan.org/user-guide/getting-started", - "forum": "https://github.com/phpstan/phpstan/discussions", - "issues": "https://github.com/phpstan/phpstan/issues", - "security": "https://github.com/phpstan/phpstan/security/policy", - "source": "https://github.com/phpstan/phpstan-src" - }, - "funding": [ - { - "url": "https://github.com/ondrejmirtes", - "type": "github" - }, - { - "url": "https://github.com/phpstan", - "type": "github" - } - ], - "time": "2025-09-30T10:16:31+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "9.2.32", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/85402a822d1ecf1db1096959413d35e1c37cf1a5", - "reference": "85402a822d1ecf1db1096959413d35e1c37cf1a5", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-xmlwriter": "*", - "nikic/php-parser": "^4.19.1 || ^5.1.0", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-text-template": "^2.0.4", - "sebastian/code-unit-reverse-lookup": "^2.0.3", - "sebastian/complexity": "^2.0.3", - "sebastian/environment": "^5.1.5", - "sebastian/lines-of-code": "^1.0.4", - "sebastian/version": "^3.0.2", - "theseer/tokenizer": "^1.2.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.6" - }, - "suggest": { - "ext-pcov": "PHP extension that provides line coverage", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "9.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.32" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-08-22T04:23:01+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "3.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-12-02T12:48:52+00:00" - }, - { - "name": "phpunit/php-invoker", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-pcntl": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Invoke callables with a timeout", - "homepage": "https://github.com/sebastianbergmann/php-invoker/", - "keywords": [ - "process" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:58:55+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T05:33:50+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "5.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:16:10+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "9.6.31", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "945d0b7f346a084ce5549e95289962972c4272e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/945d0b7f346a084ce5549e95289962972c4272e5", - "reference": "945d0b7f346a084ce5549e95289962972c4272e5", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.5.0 || ^2", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.13.4", - "phar-io/manifest": "^2.0.4", - "phar-io/version": "^3.2.1", - "php": ">=7.3", - "phpunit/php-code-coverage": "^9.2.32", - "phpunit/php-file-iterator": "^3.0.6", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.4", - "phpunit/php-timer": "^5.0.3", - "sebastian/cli-parser": "^1.0.2", - "sebastian/code-unit": "^1.0.8", - "sebastian/comparator": "^4.0.9", - "sebastian/diff": "^4.0.6", - "sebastian/environment": "^5.1.5", - "sebastian/exporter": "^4.0.8", - "sebastian/global-state": "^5.0.8", - "sebastian/object-enumerator": "^4.0.4", - "sebastian/resource-operations": "^3.0.4", - "sebastian/type": "^3.2.1", - "sebastian/version": "^3.0.2" - }, - "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.6-dev" - } - }, - "autoload": { - "files": [ - "src/Framework/Assert/Functions.php" - ], - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.31" - }, - "funding": [ - { - "url": "https://phpunit.de/sponsors.html", - "type": "custom" - }, - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - }, - { - "url": "https://liberapay.com/sebastianbergmann", - "type": "liberapay" - }, - { - "url": "https://thanks.dev/u/gh/sebastianbergmann", - "type": "thanks_dev" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", - "type": "tidelift" - } - ], - "time": "2025-12-06T07:45:52+00:00" - }, - { - "name": "sebastian/cli-parser", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", - "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for parsing CLI options", - "homepage": "https://github.com/sebastianbergmann/cli-parser", - "support": { - "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-02T06:27:43+00:00" - }, - { - "name": "sebastian/code-unit", - "version": "1.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:08:54+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:30:19+00:00" - }, - { - "name": "sebastian/comparator", - "version": "4.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/67a2df3a62639eab2cc5906065e9805d4fd5dfc5", - "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.9" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - }, - { - "url": "https://liberapay.com/sebastianbergmann", - "type": "liberapay" - }, - { - "url": "https://thanks.dev/u/gh/sebastianbergmann", - "type": "thanks_dev" - }, - { - "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", - "type": "tidelift" - } - ], - "time": "2025-08-10T06:51:50+00:00" - }, - { - "name": "sebastian/complexity", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", - "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for calculating the complexity of PHP code units", - "homepage": "https://github.com/sebastianbergmann/complexity", - "support": { - "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-12-22T06:19:30+00:00" - }, - { - "name": "sebastian/diff", - "version": "4.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", - "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-02T06:30:58+00:00" - }, - { - "name": "sebastian/environment", - "version": "5.1.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "reference": "830c43a844f1f8d5b7a1f6d6076b784454d8b7ed", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.5" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:03:51+00:00" - }, - { - "name": "sebastian/exporter", - "version": "4.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "14c6ba52f95a36c3d27c835d65efc7123c446e8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/14c6ba52f95a36c3d27c835d65efc7123c446e8c", - "reference": "14c6ba52f95a36c3d27c835d65efc7123c446e8c", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "https://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.8" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - }, - { - "url": "https://liberapay.com/sebastianbergmann", - "type": "liberapay" - }, - { - "url": "https://thanks.dev/u/gh/sebastianbergmann", - "type": "thanks_dev" - }, - { - "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter", - "type": "tidelift" - } - ], - "time": "2025-09-24T06:03:27+00:00" - }, - { - "name": "sebastian/global-state", - "version": "5.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/b6781316bdcd28260904e7cc18ec983d0d2ef4f6", - "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.8" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - }, - { - "url": "https://liberapay.com/sebastianbergmann", - "type": "liberapay" - }, - { - "url": "https://thanks.dev/u/gh/sebastianbergmann", - "type": "thanks_dev" - }, - { - "url": "https://tidelift.com/funding/github/packagist/sebastian/global-state", - "type": "tidelift" - } - ], - "time": "2025-08-10T07:10:35+00:00" - }, - { - "name": "sebastian/lines-of-code", - "version": "1.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", - "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.18 || ^5.0", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for counting the lines of code in PHP source code", - "homepage": "https://github.com/sebastianbergmann/lines-of-code", - "support": { - "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-12-22T06:20:34+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:12:34+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:14:26+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "4.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "539c6691e0623af6dc6f9c20384c120f963465a0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/539c6691e0623af6dc6f9c20384c120f963465a0", - "reference": "539c6691e0623af6dc6f9c20384c120f963465a0", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "https://github.com/sebastianbergmann/recursion-context", - "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.6" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - }, - { - "url": "https://liberapay.com/sebastianbergmann", - "type": "liberapay" - }, - { - "url": "https://thanks.dev/u/gh/sebastianbergmann", - "type": "thanks_dev" - }, - { - "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", - "type": "tidelift" - } - ], - "time": "2025-08-10T06:57:39+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-03-14T16:00:52+00:00" - }, - { - "name": "sebastian/type", - "version": "3.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "reference": "75e2c2a32f5e0b3aef905b9ed0b179b953b3d7c7", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", - "support": { - "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.2.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2023-02-03T06:13:03+00:00" - }, - { - "name": "sebastian/version", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:39:44+00:00" - }, { "name": "swoole/ide-helper", - "version": "6.0.2", + "version": "6.2.2", "source": { "type": "git", "url": "https://github.com/swoole/ide-helper.git", - "reference": "6f12243dce071714c5febe059578d909698f9a52" + "reference": "ad91a281e135f498426fb2e5297376581a4e2dca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swoole/ide-helper/zipball/6f12243dce071714c5febe059578d909698f9a52", - "reference": "6f12243dce071714c5febe059578d909698f9a52", + "url": "https://api.github.com/repos/swoole/ide-helper/zipball/ad91a281e135f498426fb2e5297376581a4e2dca", + "reference": "ad91a281e135f498426fb2e5297376581a4e2dca", "shasum": "" }, "type": "library", @@ -4801,725 +2076,19 @@ "description": "IDE help files for Swoole.", "support": { "issues": "https://github.com/swoole/ide-helper/issues", - "source": "https://github.com/swoole/ide-helper/tree/6.0.2" + "source": "https://github.com/swoole/ide-helper/tree/6.2.2" }, - "time": "2025-03-23T07:31:41+00:00" - }, - { - "name": "symfony/console", - "version": "v6.4.31", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "f9f8a889f54c264f9abac3fc0f7a371ffca51997" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f9f8a889f54c264f9abac3fc0f7a371ffca51997", - "reference": "f9f8a889f54c264f9abac3fc0f7a371ffca51997", - "shasum": "" - }, - "require": { - "php": ">=8.1", - "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^2.5|^3", - "symfony/string": "^5.4|^6.0|^7.0" - }, - "conflict": { - "symfony/dependency-injection": "<5.4", - "symfony/dotenv": "<5.4", - "symfony/event-dispatcher": "<5.4", - "symfony/lock": "<5.4", - "symfony/process": "<5.4" - }, - "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" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Eases the creation of beautiful and testable command line interfaces", - "homepage": "https://symfony.com", - "keywords": [ - "cli", - "command-line", - "console", - "terminal" - ], - "support": { - "source": "https://github.com/symfony/console/tree/v6.4.31" - }, - "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": "2025-12-22T08:30:34+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.33.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", - "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-ctype": "*" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.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": "2024-09-09T11:45:10+00:00" - }, - { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.33.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70", - "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - } - }, - "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 intl's grapheme_* functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "grapheme", - "intl", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.33.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": "2025-06-27T09:58:17+00:00" - }, - { - "name": "symfony/polyfill-intl-normalizer", - "version": "v1.33.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "3833d7255cc303546435cb650316bff708a1c75c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", - "reference": "3833d7255cc303546435cb650316bff708a1c75c", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "suggest": { - "ext-intl": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, - "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 intl's Normalizer class and related functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "intl", - "normalizer", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.33.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": "2024-09-09T11:45:10+00:00" - }, - { - "name": "symfony/string", - "version": "v7.4.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/string.git", - "reference": "d50e862cb0a0e0886f73ca1f31b865efbb795003" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/d50e862cb0a0e0886f73ca1f31b865efbb795003", - "reference": "d50e862cb0a0e0886f73ca1f31b865efbb795003", - "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" - }, - "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/translation-contracts": "^2.5|^3.0", - "symfony/var-exporter": "^6.4|^7.0|^8.0" - }, - "type": "library", - "autoload": { - "files": [ - "Resources/functions.php" - ], - "psr-4": { - "Symfony\\Component\\String\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "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": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", - "homepage": "https://symfony.com", - "keywords": [ - "grapheme", - "i18n", - "string", - "unicode", - "utf-8", - "utf8" - ], - "support": { - "source": "https://github.com/symfony/string/tree/v7.4.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": "2025-11-27T13:27:24+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.3.1", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "b7489ce515e168639d17feec34b8847c326b0b3c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c", - "reference": "b7489ce515e168639d17feec34b8847c326b0b3c", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "support": { - "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.3.1" - }, - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2025-11-17T20:03:58+00:00" - }, - { - "name": "vimeo/psalm", - "version": "4.13.1", - "source": { - "type": "git", - "url": "https://github.com/vimeo/psalm.git", - "reference": "5cf660f63b548ccd4a56f62d916ee4d6028e01a3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/5cf660f63b548ccd4a56f62d916ee4d6028e01a3", - "reference": "5cf660f63b548ccd4a56f62d916ee4d6028e01a3", - "shasum": "" - }, - "require": { - "amphp/amp": "^2.4.2", - "amphp/byte-stream": "^1.5", - "composer/package-versions-deprecated": "^1.8.0", - "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.1 || ^2.0", - "dnoegel/php-xdg-base-dir": "^0.1.1", - "ext-ctype": "*", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-simplexml": "*", - "ext-tokenizer": "*", - "felixfbecker/advanced-json-rpc": "^3.0.3", - "felixfbecker/language-server-protocol": "^1.5", - "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "nikic/php-parser": "^4.13", - "openlss/lib-array2xml": "^1.0", - "php": "^7.1|^8", - "sebastian/diff": "^3.0 || ^4.0", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0 || ^6.0", - "webmozart/path-util": "^2.3" - }, - "provide": { - "psalm/psalm": "self.version" - }, - "require-dev": { - "bamarni/composer-bin-plugin": "^1.2", - "brianium/paratest": "^4.0||^6.0", - "ext-curl": "*", - "php-parallel-lint/php-parallel-lint": "^1.2", - "phpdocumentor/reflection-docblock": "^5", - "phpmyadmin/sql-parser": "5.1.0||dev-master", - "phpspec/prophecy": ">=1.9.0", - "phpunit/phpunit": "^9.0", - "psalm/plugin-phpunit": "^0.16", - "slevomat/coding-standard": "^7.0", - "squizlabs/php_codesniffer": "^3.5", - "symfony/process": "^4.3 || ^5.0 || ^6.0", - "weirdan/prophecy-shim": "^1.0 || ^2.0" - }, - "suggest": { - "ext-curl": "In order to send data to shepherd", - "ext-igbinary": "^2.0.5 is required, used to serialize caching data" - }, - "bin": [ - "psalm", - "psalm-language-server", - "psalm-plugin", - "psalm-refactor", - "psalter" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev", - "dev-2.x": "2.x-dev", - "dev-3.x": "3.x-dev", - "dev-master": "4.x-dev" - } - }, - "autoload": { - "files": [ - "src/functions.php", - "src/spl_object_id.php" - ], - "psr-4": { - "Psalm\\": "src/Psalm/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Matthew Brown" - } - ], - "description": "A static analysis tool for finding errors in PHP applications", - "keywords": [ - "code", - "inspection", - "php" - ], - "support": { - "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.13.1" - }, - "time": "2021-11-23T23:52:49+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.12.1", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "9be6926d8b485f55b9229203f962b51ed377ba68" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/9be6926d8b485f55b9229203f962b51ed377ba68", - "reference": "9be6926d8b485f55b9229203f962b51ed377ba68", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "ext-date": "*", - "ext-filter": "*", - "php": "^7.2 || ^8.0" - }, - "suggest": { - "ext-intl": "", - "ext-simplexml": "", - "ext-spl": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.12.1" - }, - "time": "2025-10-29T15:56:20+00:00" - }, - { - "name": "webmozart/path-util", - "version": "2.3.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/path-util.git", - "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725", - "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "webmozart/assert": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\PathUtil\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", - "support": { - "issues": "https://github.com/webmozart/path-util/issues", - "source": "https://github.com/webmozart/path-util/tree/2.3.0" - }, - "abandoned": "symfony/filesystem", - "time": "2015-12-17T08:42:14+00:00" + "time": "2026-07-25T08:15:29+00:00" } ], "aliases": [], "minimum-stability": "stable", "stability-flags": {}, - "prefer-stable": false, + "prefer-stable": true, "prefer-lowest": false, "platform": { "php": ">=8.4", - "ext-json": "*", - "ext-memcached": "*", - "ext-redis": "*" + "ext-json": "*" }, "platform-dev": {}, "plugin-api-version": "2.9.0" diff --git a/docker-compose.yml b/docker-compose.yml index 571b74bbd8..ac30f8514b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,100 +1,73 @@ -name: cache +x-redis: &redis + image: redis:7-alpine + command: ["redis-server", "--save", "", "--appendonly", "no"] + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 1s + timeout: 1s + retries: 30 services: - tests: - container_name: tests - image: cache-tests:${PHP_VERSION:-8.4} - build: - context: . - dockerfile: Dockerfile.php-${PHP_VERSION:-8.4} - networks: - - database - volumes: - - ./phpunit.xml:/usr/src/code/phpunit.xml - - ./src:/usr/src/code/src - - ./tests:/usr/src/code/tests - - /var/run/docker.sock:/var/run/docker.sock - depends_on: - - redis - - redis-cluster - - hazelcast - - memcached - - shardA - - shardB - - shardC - redis: - image: redis:6.0-alpine + <<: *redis container_name: cache-redis - healthcheck: - test: ["CMD", "redis-cli", "ping"] - interval: 2s - timeout: 3s - retries: 20 - networks: - - database + ports: + - "16381:6379" + shard-a: + <<: *redis + container_name: cache-shard-a + ports: + - "16382:6379" + + shard-b: + <<: *redis + container_name: cache-shard-b + ports: + - "16383:6379" + + shard-c: + <<: *redis + container_name: cache-shard-c + ports: + - "16384:6379" + + # The cluster advertises the addresses clients must dial, so its published + # ports have to match the ones inside the container. redis-cluster: image: grokzen/redis-cluster:7.0.10 - container_name: redis-cluster - hostname: redis-cluster + container_name: cache-redis-cluster environment: - - IP=redis-cluster + IP: 127.0.0.1 + INITIAL_PORT: 17000 + ports: + - "17000-17005:17000-17005" healthcheck: - test: ["CMD-SHELL", "redis-cli -p 7000 cluster info | grep -q cluster_state:ok"] - interval: 3s - timeout: 5s - retries: 30 - start_period: 10s - networks: - - database - - hazelcast: - image: hazelcast/hazelcast:5.3.7 - environment: - HZ_NETWORK_MEMCACHEPROTOCOL_ENABLED: "true" - container_name: hazelcast - networks: - - database + test: ["CMD-SHELL", "redis-cli -p 17000 cluster info | grep -q cluster_state:ok"] + interval: 2s + timeout: 3s + retries: 60 memcached: image: memcached:1.6.17-alpine - container_name: memcached - networks: - - database - - shardA: - image: redis:6.0-alpine - container_name: shardA + container_name: cache-memcached + ports: + - "11212:11211" healthcheck: - test: ["CMD", "redis-cli", "ping"] + test: ["CMD-SHELL", "echo version | nc -w 1 127.0.0.1 11211 | grep -q VERSION"] + interval: 1s + timeout: 2s + retries: 30 + + hazelcast: + image: hazelcast/hazelcast:5.3.7 + container_name: cache-hazelcast + environment: + HZ_NETWORK_MEMCACHEPROTOCOL_ENABLED: "true" + ports: + - "15701:5701" + healthcheck: + test: ["CMD-SHELL", "curl -sf http://127.0.0.1:5701/hazelcast/health/node-state | grep -q ACTIVE"] interval: 2s timeout: 3s - retries: 20 - networks: - - database - - shardB: - image: redis:6.0-alpine - container_name: shardB - healthcheck: - test: ["CMD", "redis-cli", "ping"] - interval: 2s - timeout: 3s - retries: 20 - networks: - - database - - shardC: - image: redis:6.0-alpine - container_name: shardC - healthcheck: - test: ["CMD", "redis-cli", "ping"] - interval: 2s - timeout: 3s - retries: 20 - networks: - - database - -networks: - database: + retries: 60 diff --git a/phpstan.neon b/phpstan.neon index 1213936da6..ee11b331f1 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,7 +1,7 @@ +includes: + - ../../phpstan.neon + parameters: - level: max - paths: - - src - - tests + treatPhpDocTypesAsCertain: false scanDirectories: - vendor/swoole/ide-helper diff --git a/phpunit.xml b/phpunit.xml index c1e27d05b2..99787f5cff 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,56 +1,20 @@ - + + cacheDirectory=".phpunit.cache"> - ./tests/Cache/Unit + tests/Cache/Unit - - ./tests/Cache/E2E/MemoryTest.php - - - ./tests/Cache/E2E/NoneTest.php - - - ./tests/Cache/E2E/FilesystemTest.php - - - ./tests/Cache/E2E/PoolTest.php - - - ./tests/Cache/E2E/CircuitBreakerTest.php - - - ./tests/Cache/E2E/TelemetryTest.php - - - ./tests/Cache/E2E/MemcachedTest.php - - - ./tests/Cache/E2E/HazelcastTest.php - - - ./tests/Cache/E2E/ShardingTest.php - - - ./tests/Cache/E2E/Redis - ./tests/Cache/E2E/Redis/RedisClusterTest.php - ./tests/Cache/E2E/Redis/MultiplexingTest.php - ./tests/Cache/E2E/Redis/LeasableMultiplexingTest.php - - - ./tests/Cache/E2E/Redis/RedisClusterTest.php - - - ./tests/Cache/E2E/Redis/MultiplexingTest.php - ./tests/Cache/E2E/Redis/LeasableMultiplexingTest.php + + tests/Cache/E2E + + + src + + diff --git a/psalm.xml b/psalm.xml deleted file mode 100644 index 8dc065a2ee..0000000000 --- a/psalm.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/src/Cache/Adapter.php b/src/Cache/Adapter.php index 2963d006d0..c7ae355a45 100644 --- a/src/Cache/Adapter.php +++ b/src/Cache/Adapter.php @@ -1,19 +1,18 @@ $data * @param string $hash optional * @return bool|string|array @@ -21,43 +20,25 @@ interface Adapter public function save(string $key, array|string $data, string $hash = ''): bool|string|array; /** - * @param string $key * @param string $hash optional - * @return bool */ public function touch(string $key, string $hash = ''): bool; /** - * @param string $key * @return string[] */ public function list(string $key): array; /** - * @param string $key * @param string $hash optional - * @return bool */ public function purge(string $key, string $hash = ''): bool; - /** - * @return bool - */ public function flush(): bool; - /** - * @return bool - */ public function ping(): bool; - /** - * @return int - */ public function getSize(): int; - /** - * @param string|null $key - * @return string - */ public function getName(?string $key = null): string; } diff --git a/src/Cache/Adapter/CircuitBreaker.php b/src/Cache/Adapter/CircuitBreaker.php index fa9275936e..050d907518 100644 --- a/src/Cache/Adapter/CircuitBreaker.php +++ b/src/Cache/Adapter/CircuitBreaker.php @@ -12,23 +12,20 @@ class CircuitBreaker implements Adapter, Feature\Leasable, Feature\Telemetry public function __construct( private readonly Adapter $adapter, private readonly UtopiaCircuitBreaker $breaker, - ) { - } + ) {} /** * Forward method calls to the internal adapter through the circuit breaker. * * Required because __call() can't be used to implement abstract methods. * - * @param string $method * @param array $args - * @return mixed */ public function delegate(string $method, array $args, mixed $fallback): mixed { return $this->breaker->call( - open: fn (): mixed => $fallback, - close: fn (): mixed => $this->adapter->{$method}(...$args), + open: fn(): mixed => $fallback, + close: fn(): mixed => $this->adapter->{$method}(...$args), ); } diff --git a/src/Cache/Adapter/Filesystem.php b/src/Cache/Adapter/Filesystem.php index c84ea2699e..565dcf89d1 100644 --- a/src/Cache/Adapter/Filesystem.php +++ b/src/Cache/Adapter/Filesystem.php @@ -1,5 +1,7 @@ path = $path; - $this->streaming = $streaming; - } + public function __construct(protected string $path, protected bool $streaming = false) {} /** - * @param string $key * @param int $ttl time in seconds * @param string $hash optional - * @return mixed */ public function load(string $key, int $ttl, string $hash = ''): mixed { $file = $this->getPath($key); - if (\file_exists($file) && (\filemtime($file) + $ttl > \time())) { // Cache is valid + if (file_exists($file) && (filemtime($file) + $ttl > time())) { // Cache is valid if ($this->streaming) { - return \fopen($file, 'rb'); + return fopen($file, 'rb'); } - return \file_get_contents($file); + return file_get_contents($file); } return false; } /** - * @param string $key * @param array|string $data * @param string $hash optional * @return bool|string|array - * * @throws Exception */ public function save(string $key, array|string $data, string $hash = ''): bool|string|array @@ -65,24 +46,20 @@ class Filesystem implements Adapter } $file = $this->getPath($key); - $dir = dirname($file); + $dir = \dirname($file); try { - if (! file_exists($dir)) { - if (! mkdir($dir, 0755, true) && ! file_exists($dir)) { - throw new Exception("Can't create directory {$dir}"); - } + if (!file_exists($dir) && (!mkdir($dir, 0755, true) && ! file_exists($dir))) { + throw new Exception("Can't create directory {$dir}"); } - return (\file_put_contents($file, $data, LOCK_EX)) ? $data : false; + return (file_put_contents($file, $data, LOCK_EX)) ? $data : false; } catch (Exception $e) { - throw new Exception($e->getMessage()); + throw new Exception($e->getMessage(), $e->getCode(), $e); } } /** - * @param string $key * @param string $hash optional - * @return bool */ public function touch(string $key, string $hash = ''): bool { @@ -98,7 +75,6 @@ class Filesystem implements Adapter } /** - * @param string $key * @return string[] */ public function list(string $key): array @@ -107,32 +83,24 @@ class Filesystem implements Adapter } /** - * @param string $key * @param string $hash optional - * @return bool */ public function purge(string $key, string $hash = ''): bool { $file = $this->getPath($key); - if (\file_exists($file)) { - return \unlink($file); + if (file_exists($file)) { + return unlink($file); } return false; } - /** - * @return bool - */ public function flush(): bool { return $this->deleteDirectory($this->path); } - /** - * @return bool - */ public function ping(): bool { return file_exists($this->path) && is_writable($this->path) && is_readable($this->path); @@ -140,26 +108,20 @@ class Filesystem implements Adapter /** * Returning root directory size in bytes - * - * @return int */ public function getSize(): int { try { - return $this->getDirectorySize(dirname($this->path)); + return $this->getDirectorySize($this->path); } catch (Exception) { return 0; } } - /** - * @param string $dir - * @return int - */ private function getDirectorySize(string $dir): int { $size = 0; - $normalizedPath = rtrim($dir, '/').'/*'; + $normalizedPath = rtrim($dir, '/') . '/*'; $paths = glob($normalizedPath, GLOB_NOSORT); if ($paths === false) { @@ -178,18 +140,12 @@ class Filesystem implements Adapter return $size; } - /** - * @param string $filename - * @return string - */ public function getPath(string $filename): string { - return $this->path.DIRECTORY_SEPARATOR.$filename; + return $this->path . DIRECTORY_SEPARATOR . $filename; } /** - * @param string $path - * @return bool * * @throws Exception */ @@ -199,11 +155,11 @@ class Filesystem implements Adapter throw new Exception("$path must be a directory"); } - if (substr($path, strlen($path) - 1, 1) != '/') { + if (substr($path, \strlen($path) - 1, 1) !== '/') { $path .= '/'; } - $files = glob($path.'*', GLOB_MARK); + $files = glob($path . '*', GLOB_MARK); if (! $files) { throw new Exception('Error happened during glob'); @@ -220,10 +176,6 @@ class Filesystem implements Adapter return rmdir($path); } - /** - * @param string|null $key - * @return string - */ public function getName(?string $key = null): string { return 'filesystem'; diff --git a/src/Cache/Adapter/Hazelcast.php b/src/Cache/Adapter/Hazelcast.php index 8192b74817..5349b1cf72 100644 --- a/src/Cache/Adapter/Hazelcast.php +++ b/src/Cache/Adapter/Hazelcast.php @@ -8,23 +8,14 @@ use Utopia\Cache\Feature\Retryable; class Hazelcast implements Adapter, Retryable { - /** - * @var Client - */ - protected Client $memcached; - private int $maxRetries = 0; private int $retryDelay = 1000; // milliseconds - public function __construct(Client $memcached) - { - $this->memcached = $memcached; - } + public function __construct(protected Client $memcached) {} /** * @param int $maxRetries (0-10) - * @return self */ public function setMaxRetries(int $maxRetries): self { @@ -35,7 +26,6 @@ class Hazelcast implements Adapter, Retryable /** * @param int $retryDelay time in milliseconds - * @return self */ public function setRetryDelay(int $retryDelay): self { @@ -45,19 +35,17 @@ class Hazelcast implements Adapter, Retryable } /** - * @param string $key * @param int $ttl time in seconds * @param string $hash optional - * @return mixed */ public function load(string $key, int $ttl, string $hash = ''): mixed { - $cache = $this->execute(fn () => $this->memcached->get($key)); - if (is_string($cache)) { + $cache = $this->execute(fn(): mixed => $this->memcached->get($key)); + if (\is_string($cache)) { $cache = json_decode($cache, true); } - if (! is_array($cache)) { + if (! \is_array($cache)) { return false; } @@ -69,14 +57,13 @@ class Hazelcast implements Adapter, Retryable } /** - * @param string $key * @param array|string $data * @param string $hash optional * @return bool|string|array */ public function save(string $key, array|string $data, string $hash = ''): bool|string|array { - if (empty($key) || empty($data)) { + if ($key === '' || $key === '0' || empty($data)) { return false; } @@ -85,32 +72,29 @@ class Hazelcast implements Adapter, Retryable 'data' => $data, ]; - return ($this->execute(fn () => $this->memcached->set($key, json_encode($cache)))) ? $data : false; + return ($this->execute(fn(): bool => $this->memcached->set($key, json_encode($cache)))) ? $data : false; } /** - * @param string $key * @param string $hash optional - * @return bool */ public function touch(string $key, string $hash = ''): bool { - $cache = $this->execute(fn () => $this->memcached->get($key)); - if (is_string($cache)) { + $cache = $this->execute(fn(): mixed => $this->memcached->get($key)); + if (\is_string($cache)) { $cache = json_decode($cache, true); } - if (! is_array($cache)) { + if (! \is_array($cache)) { return false; } $cache['time'] = time(); - return (bool) $this->execute(fn () => $this->memcached->set($key, json_encode($cache))); + return (bool) $this->execute(fn(): bool => $this->memcached->set($key, json_encode($cache))); } /** - * @param string $key * @return string[] */ public function list(string $key): array @@ -119,13 +103,11 @@ class Hazelcast implements Adapter, Retryable } /** - * @param string $key * @param string $hash optional - * @return bool */ public function purge(string $key, string $hash = ''): bool { - return (bool) $this->execute(fn () => $this->memcached->delete($key)); + return (bool) $this->execute(fn(): bool => $this->memcached->delete($key)); } /** @@ -137,24 +119,19 @@ class Hazelcast implements Adapter, Retryable return false; } - /** - * @return bool - */ public function ping(): bool { try { - $statuses = $this->execute(fn () => $this->memcached->getServerList()); + $statuses = $this->execute(fn(): array => $this->memcached->getServerList()); return ! empty($statuses); - } catch (\MemcachedException $e) { + } catch (\MemcachedException) { return false; } } /** * Returning total number of keys - * - * @return int */ public function getSize(): int { @@ -162,7 +139,7 @@ class Hazelcast implements Adapter, Retryable $servers = $this->memcached->getServerList(); if (! empty($servers)) { $stats = $this->memcached->getStats(); - $key = $servers[0]['host'].':'.$servers[0]['port']; + $key = $servers[0]['host'] . ':' . $servers[0]['port']; if (isset($stats[$key])) { $size = $stats[$key]['total_items'] ?? 0; } @@ -171,25 +148,16 @@ class Hazelcast implements Adapter, Retryable return $size; } - /** - * @return string - */ public function getName(?string $key = null): string { return 'hazelcast'; } - /** - * @return int - */ public function getMaxRetries(): int { return $this->maxRetries; } - /** - * @return int - */ public function getRetryDelay(): int { return $this->retryDelay; @@ -211,7 +179,7 @@ class Hazelcast implements Adapter, Retryable while ($attempts < $maxAttempts) { $result = $callback(); - if ($result === false && in_array($this->memcached->getResultCode(), [ + if ($result === false && \in_array($this->memcached->getResultCode(), [ \Memcached::RES_HOST_LOOKUP_FAILURE, \Memcached::RES_UNKNOWN_READ_FAILURE, \Memcached::RES_WRITE_FAILURE, @@ -226,7 +194,7 @@ class Hazelcast implements Adapter, Retryable $attempts++; if ($attempts >= $maxAttempts) { - throw new \MemcachedException('Hazelcast connection failed after '.$attempts.' attempts. Error: '.$this->memcached->getResultMessage()); + throw new \MemcachedException('Hazelcast connection failed after ' . $attempts . ' attempts. Error: ' . $this->memcached->getResultMessage()); } usleep($this->retryDelay * 1000); diff --git a/src/Cache/Adapter/Memcached.php b/src/Cache/Adapter/Memcached.php index 50001674c3..0fbbff91ff 100644 --- a/src/Cache/Adapter/Memcached.php +++ b/src/Cache/Adapter/Memcached.php @@ -8,28 +8,16 @@ use Utopia\Cache\Feature\Retryable; class Memcached implements Adapter, Retryable { - /** - * @var Client - */ - protected Client $memcached; - private int $maxRetries = 0; private int $retryDelay = 1000; // milliseconds - /** * Memcached constructor. - * - * @param Client $memcached */ - public function __construct(Client $memcached) - { - $this->memcached = $memcached; - } + public function __construct(protected Client $memcached) {} /** * @param int $maxRetries (0-10) - * @return self */ public function setMaxRetries(int $maxRetries): self { @@ -40,7 +28,6 @@ class Memcached implements Adapter, Retryable /** * @param int $retryDelay time in milliseconds - * @return self */ public function setRetryDelay(int $retryDelay): self { @@ -50,15 +37,12 @@ class Memcached implements Adapter, Retryable } /** - * @param string $key - * @param int $ttl * @param string $hash optional - * @return mixed */ public function load(string $key, int $ttl, string $hash = ''): mixed { /** @var array{time: int, data: string}|false */ - $cache = $this->execute(fn () => $this->memcached->get($key)); + $cache = $this->execute(fn(): mixed => $this->memcached->get($key)); if ($cache === false) { return false; } @@ -71,45 +55,41 @@ class Memcached implements Adapter, Retryable } /** - * @param string $key * @param array|string $data * @param string $hash optional * @return bool|string|array */ public function save(string $key, array|string $data, string $hash = ''): bool|string|array { - if (empty($key) || empty($data)) { + if ($key === '' || $key === '0' || empty($data)) { return false; } $cache = [ - 'time' => \time(), + 'time' => time(), 'data' => $data, ]; - return $this->execute(fn () => $this->memcached->set($key, $cache)) ? $data : false; + return $this->execute(fn(): bool => $this->memcached->set($key, $cache)) ? $data : false; } /** - * @param string $key * @param string $hash optional - * @return bool */ public function touch(string $key, string $hash = ''): bool { /** @var array{time: int, data: string|array}|false */ - $cache = $this->execute(fn () => $this->memcached->get($key)); + $cache = $this->execute(fn(): mixed => $this->memcached->get($key)); if ($cache === false) { return false; } $cache['time'] = time(); - return (bool) $this->execute(fn () => $this->memcached->set($key, $cache)); + return (bool) $this->execute(fn(): bool => $this->memcached->set($key, $cache)); } /** - * @param string $key * @return string[] */ public function list(string $key): array @@ -118,41 +98,31 @@ class Memcached implements Adapter, Retryable } /** - * @param string $key * @param string $hash optional - * @return bool */ public function purge(string $key, string $hash = ''): bool { - return (bool) $this->execute(fn () => $this->memcached->delete($key)); + return (bool) $this->execute(fn(): bool => $this->memcached->delete($key)); } - /** - * @return bool - */ public function flush(): bool { - return (bool) $this->execute(fn () => $this->memcached->flush()); + return (bool) $this->execute(fn(): bool => $this->memcached->flush()); } - /** - * @return bool - */ public function ping(): bool { try { $statuses = $this->memcached->getStats(); return ! empty($statuses); - } catch (\MemcachedException $e) { + } catch (\MemcachedException) { return false; } } /** * Returning total number of keys - * - * @return int */ public function getSize(): int { @@ -160,7 +130,7 @@ class Memcached implements Adapter, Retryable $servers = $this->memcached->getServerList(); if (! empty($servers)) { $stats = $this->memcached->getStats(); - $key = $servers[0]['host'].':'.$servers[0]['port']; + $key = $servers[0]['host'] . ':' . $servers[0]['port']; if (isset($stats[$key])) { $size = $stats[$key]['curr_items'] ?? 0; } @@ -169,26 +139,16 @@ class Memcached implements Adapter, Retryable return $size; } - /** - * @param string|null $key - * @return string - */ public function getName(?string $key = null): string { return 'memcached'; } - /** - * @return int - */ public function getMaxRetries(): int { return $this->maxRetries; } - /** - * @return int - */ public function getRetryDelay(): int { return $this->retryDelay; @@ -210,7 +170,7 @@ class Memcached implements Adapter, Retryable while ($attempts < $maxAttempts) { $result = $callback(); - if ($result === false && in_array($this->memcached->getResultCode(), [ + if ($result === false && \in_array($this->memcached->getResultCode(), [ \Memcached::RES_HOST_LOOKUP_FAILURE, \Memcached::RES_UNKNOWN_READ_FAILURE, \Memcached::RES_WRITE_FAILURE, @@ -225,7 +185,7 @@ class Memcached implements Adapter, Retryable $attempts++; if ($attempts >= $maxAttempts) { - throw new \MemcachedException('Memcached connection failed after '.$attempts.' attempts. Error: '.$this->memcached->getResultMessage()); + throw new \MemcachedException('Memcached connection failed after ' . $attempts . ' attempts. Error: ' . $this->memcached->getResultMessage()); } usleep($this->retryDelay * 1000); diff --git a/src/Cache/Adapter/Memory.php b/src/Cache/Adapter/Memory.php index 2c224b2deb..65a5100853 100644 --- a/src/Cache/Adapter/Memory.php +++ b/src/Cache/Adapter/Memory.php @@ -12,21 +12,11 @@ class Memory implements Adapter public $store = []; /** - * Memory constructor. - */ - public function __construct() - { - } - - /** - * @param string $key - * @param int $ttl * @param string $hash optional - * @return mixed */ public function load(string $key, int $ttl, string $hash = ''): mixed { - if (! empty($key) && isset($this->store[$key])) { + if ($key !== '' && $key !== '0' && isset($this->store[$key])) { /** @var array{time: int, data: string} */ $saved = $this->store[$key]; @@ -37,19 +27,18 @@ class Memory implements Adapter } /** - * @param string $key * @param array|string $data * @param string $hash optional * @return bool|string|array */ public function save(string $key, array|string $data, string $hash = ''): bool|string|array { - if (empty($key) || empty($data)) { + if ($key === '' || $key === '0' || empty($data)) { return false; } $saved = [ - 'time' => \time(), + 'time' => time(), 'data' => $data, ]; @@ -59,13 +48,11 @@ class Memory implements Adapter } /** - * @param string $key * @param string $hash optional - * @return bool */ public function touch(string $key, string $hash = ''): bool { - if (empty($key) || ! isset($this->store[$key])) { + if ($key === '' || $key === '0' || ! isset($this->store[$key])) { return false; } @@ -78,7 +65,6 @@ class Memory implements Adapter } /** - * @param string $key * @return string[] */ public function list(string $key): array @@ -87,13 +73,11 @@ class Memory implements Adapter } /** - * @param string $key * @param string $hash optional - * @return bool */ public function purge(string $key, string $hash = ''): bool { - if (! empty($key) && isset($this->store[$key])) { // if a key is passed and it exists in cache + if ($key !== '' && $key !== '0' && isset($this->store[$key])) { // if a key is passed and it exists in cache unset($this->store[$key]); return true; @@ -102,9 +86,6 @@ class Memory implements Adapter return false; } - /** - * @return bool - */ public function flush(): bool { $this->store = []; @@ -112,9 +93,6 @@ class Memory implements Adapter return true; } - /** - * @return bool - */ public function ping(): bool { return true; @@ -122,18 +100,12 @@ class Memory implements Adapter /** * Returning total number of keys - * - * @return int */ public function getSize(): int { - return count($this->store); + return \count($this->store); } - /** - * @param string|null $key - * @return string - */ public function getName(?string $key = null): string { return 'memory'; diff --git a/src/Cache/Adapter/None.php b/src/Cache/Adapter/None.php index d584fa0e3d..a6a5730cc3 100644 --- a/src/Cache/Adapter/None.php +++ b/src/Cache/Adapter/None.php @@ -1,5 +1,7 @@ |string $data * @param string $hash optional * @return bool|string|array @@ -36,9 +27,7 @@ class None implements Adapter } /** - * @param string $key * @param string $hash optional - * @return bool */ public function touch(string $key, string $hash = ''): bool { @@ -46,7 +35,6 @@ class None implements Adapter } /** - * @param string $key * @return string[] */ public function list(string $key): array @@ -55,43 +43,28 @@ class None implements Adapter } /** - * @param string $key * @param string $hash optional - * @return bool */ public function purge(string $key, string $hash = ''): bool { return true; } - /** - * @return bool - */ public function flush(): bool { return true; } - /** - * @return bool - */ public function ping(): bool { return true; } - /** - * @return int - */ public function getSize(): int { return 0; } - /** - * @param string|null $key - * @return string - */ public function getName(?string $key = null): string { return 'none'; diff --git a/src/Cache/Adapter/Pool.php b/src/Cache/Adapter/Pool.php index a2f8b3c367..c1b3028739 100644 --- a/src/Cache/Adapter/Pool.php +++ b/src/Cache/Adapter/Pool.php @@ -8,23 +8,16 @@ use Utopia\Pools\Pool as UtopiaPool; class Pool implements Adapter, Leasable { - /** - * @var UtopiaPool - */ - protected UtopiaPool $pool; - /** * @param UtopiaPool $pool The pool to use for connections. Must contain instances of Adapter. * * @throws \Exception */ - public function __construct(UtopiaPool $pool) + public function __construct(protected UtopiaPool $pool) { - $this->pool = $pool; - - $this->pool->use(function (mixed $resource) { + $this->pool->use(function (mixed $resource): void { if (! ($resource instanceof Adapter)) { - throw new \Exception('Pool must contain instances of '.Adapter::class); + throw new \Exception('Pool must contain instances of ' . Adapter::class); } }); } @@ -34,15 +27,11 @@ class Pool implements Adapter, Leasable * * Required because __call() can't be used to implement abstract methods. * - * @param string $method * @param array $args - * @return mixed */ public function delegate(string $method, array $args): mixed { - return $this->pool->use(function (Adapter $adapter) use ($method, $args) { - return $adapter->{$method}(...$args); - }); + return $this->pool->use(fn(Adapter $adapter) => $adapter->{$method}(...$args)); } public function load(string $key, int $ttl, string $hash = ''): mixed @@ -62,9 +51,7 @@ class Pool implements Adapter, Leasable public function getGeneration(string $key): string { - return $this->pool->use(function (Adapter $adapter) use ($key): string { - return $adapter instanceof Leasable ? $adapter->getGeneration($key) : '0'; - }); + return $this->pool->use(fn(Adapter $adapter): string => $adapter instanceof Leasable ? $adapter->getGeneration($key) : '0'); } public function saveWithLease(string $key, array|string $data, string $hash, string $generation): bool|string|array @@ -72,11 +59,9 @@ class Pool implements Adapter, Leasable /** * @var bool|string|array $result */ - $result = $this->pool->use(function (Adapter $adapter) use ($key, $data, $hash, $generation) { - return $adapter instanceof Leasable - ? $adapter->saveWithLease($key, $data, $hash, $generation) - : $adapter->save($key, $data, $hash); - }); + $result = $this->pool->use(fn(Adapter $adapter): bool|string|array => $adapter instanceof Leasable + ? $adapter->saveWithLease($key, $data, $hash, $generation) + : $adapter->save($key, $data, $hash)); return $result; } diff --git a/src/Cache/Adapter/Redis.php b/src/Cache/Adapter/Redis.php index e67c544dcf..dd8b8332df 100644 --- a/src/Cache/Adapter/Redis.php +++ b/src/Cache/Adapter/Redis.php @@ -13,29 +13,29 @@ use Utopia\Cache\Feature\Retryable; class Redis extends Leasable implements Adapter, Retryable { - /** - * @var Client - */ protected Client $redis; private int $maxRetries = 0; private int $retryDelay = 1000; // milliseconds - private string $host; + private readonly string $host; - private int $port; + private readonly int $port; - private float $timeout; + private readonly float $timeout; - private ?string $persistentId; + private readonly ?string $persistentId; - private float $readTimeout; + private readonly float $readTimeout; /** - * @var string|array|null + * Credentials replayed on reconnect, as the argument list AUTH takes: + * [password] for a legacy password, [username, password] for an ACL user. + * + * @var array */ - private string|array|null $auth = null; + private array $auth = []; /** * Whether the original connection was persistent (pconnect) @@ -46,15 +46,13 @@ class Redis extends Leasable implements Adapter, Retryable /** * Redis constructor. - * - * @param Client $redis */ public function __construct(Client $redis) { $this->host = $redis->getHost(); $this->port = $redis->getPort(); $timeout = $redis->getTimeout(); - $this->timeout = ($timeout !== false) ? (float) $timeout : 0.0; + $this->timeout = ($timeout !== false) ? $timeout : 0.0; $this->persistentId = $redis->getPersistentId(); $this->readTimeout = $redis->getReadTimeout(); @@ -62,16 +60,17 @@ class Redis extends Leasable implements Adapter, Retryable $this->dbIndex = $redis->getDbNum(); $auth = $redis->getAuth(); - if ($auth !== null && $auth !== false) { - $this->auth = $auth; - } + $this->auth = match (true) { + \is_array($auth) => $auth, + \is_string($auth) => [$auth], + default => [], + }; $this->redis = $redis; } /** * @param int $maxRetries (0-10) - * @return self */ public function setMaxRetries(int $maxRetries): self { @@ -82,7 +81,6 @@ class Redis extends Leasable implements Adapter, Retryable /** * @param int $retryDelay time in milliseconds - * @return self */ public function setRetryDelay(int $retryDelay): self { @@ -92,14 +90,12 @@ class Redis extends Leasable implements Adapter, Retryable } /** - * @param string $key * @param int $ttl time in seconds * @param string $hash optional - * @return mixed */ public function load(string $key, int $ttl, string $hash = ''): mixed { - if (empty($hash)) { + if ($hash === '' || $hash === '0') { $hash = $key; } @@ -107,9 +103,9 @@ class Redis extends Leasable implements Adapter, Retryable return false; } - $redis_string = $this->execute(fn () => $this->redis->hGet($key, $hash)); + $redis_string = $this->execute(fn(): \Redis|string|false => $this->redis->hGet($key, $hash)); - if (! is_string($redis_string)) { + if (! \is_string($redis_string)) { return false; } @@ -117,18 +113,17 @@ class Redis extends Leasable implements Adapter, Retryable } /** - * @param string $key * @param array|string $data * @param string $hash optional * @return bool|string|array */ public function save(string $key, array|string $data, string $hash = ''): bool|string|array { - if (empty($key) || empty($data)) { + if ($key === '' || $key === '0' || empty($data)) { return false; } - if (empty($hash)) { + if ($hash === '' || $hash === '0') { $hash = $key; } @@ -138,22 +133,20 @@ class Redis extends Leasable implements Adapter, Retryable try { $value = Envelope::encode($data, time()); - $this->execute(fn () => $this->redis->hSet($key, $hash, $value)); + $this->execute(fn(): \Redis|int|false => $this->redis->hSet($key, $hash, $value)); return $data; - } catch (Throwable $th) { + } catch (Throwable) { return false; } } /** - * @param string $key * @param string $hash optional - * @return bool */ public function touch(string $key, string $hash = ''): bool { - if (empty($hash)) { + if ($hash === '' || $hash === '0') { $hash = $key; } @@ -161,9 +154,9 @@ class Redis extends Leasable implements Adapter, Retryable return false; } - $redis_string = $this->execute(fn () => $this->redis->hGet($key, $hash)); + $redis_string = $this->execute(fn(): \Redis|string|false => $this->redis->hGet($key, $hash)); - if (! is_string($redis_string)) { + if (! \is_string($redis_string)) { return false; } @@ -172,24 +165,23 @@ class Redis extends Leasable implements Adapter, Retryable return false; } - return $this->execute(fn () => $this->redis->hSet($key, $hash, $value)) !== false; + return $this->execute(fn(): \Redis|int|false => $this->redis->hSet($key, $hash, $value)) !== false; } /** - * @param string $key * @return string[] */ public function list(string $key): array { /** @var array */ - $keys = $this->execute(fn () => $this->redis->hKeys($key)); + $keys = $this->execute(fn(): \Redis|array|false => $this->redis->hKeys($key)); if (empty($keys)) { return []; } // Don't expose reserved internal fields (generation, tombstone) as listable cache fields. - return \array_values(\array_filter($keys, fn (string $field): bool => ! $this->isReserved($field))); + return array_values(array_filter($keys, fn(string $field): bool => ! $this->isReserved($field))); } protected function leaseEvalSha(string $sha, string $key, array $args): mixed @@ -224,62 +216,48 @@ class Redis extends Leasable implements Adapter, Retryable protected function leaseEval(string $script, string $key, array $args): mixed { - return $this->execute(fn () => $this->redis->eval($script, [$key, ...$args], 1)); + return $this->execute(fn(): mixed => $this->redis->eval($script, [$key, ...$args], 1)); } protected function leaseHget(string $key, string $field): mixed { - return $this->execute(fn () => $this->redis->hGet($key, $field)); + return $this->execute(fn(): \Redis|string|false => $this->redis->hGet($key, $field)); } - /** - * @return bool - */ public function flush(): bool { - return (bool) $this->execute(fn () => $this->redis->flushDB()); + return (bool) $this->execute(fn(): \Redis|bool => $this->redis->flushDB()); } - /** - * @return bool - */ public function ping(): bool { try { $this->redis->ping(); return true; - } catch (Exception $e) { + } catch (Exception) { return false; } } /** * Returning total number of keys - * - * @return int */ public function getSize(): int { // A purged key keeps its reserved field(s) until re-cached, so DBSIZE can // slightly over-count purged-but-not-yet-recached keys. /** @var int $size */ - $size = $this->execute(fn () => $this->redis->dbSize()); + $size = $this->execute(fn(): \Redis|int|false => $this->redis->dbSize()); return $size; } - /** - * @return int - */ public function getMaxRetries(): int { return $this->maxRetries; } - /** - * @return int - */ public function getRetryDelay(): int { return $this->retryDelay; @@ -288,8 +266,6 @@ class Redis extends Leasable implements Adapter, Retryable /** * Execute a Redis command with retry logic * - * @param callable $callback - * @return mixed * * @throws \RedisException */ @@ -316,7 +292,7 @@ class Redis extends Leasable implements Adapter, Retryable try { $this->reconnect(); - } catch (\RedisException $e) { + } catch (\RedisException) { // Reconnect failed, will retry on next iteration } } @@ -331,9 +307,6 @@ class Redis extends Leasable implements Adapter, Retryable * * RedisException always returns error code 0 with no subclasses for different error types. * The only way to differentiate connection errors from command errors is by message matching. - * - * @param Exception $e - * @return bool */ private function isConnectionError(Exception $e): bool { @@ -350,13 +323,7 @@ class Redis extends Leasable implements Adapter, Retryable ]; $message = strtolower($e->getMessage()); - foreach ($connectionErrors as $needle) { - if (str_contains($message, $needle)) { - return true; - } - } - - return false; + return array_any($connectionErrors, fn(string $needle): bool => str_contains($message, $needle)); } private function reconnect(): void @@ -383,8 +350,8 @@ class Redis extends Leasable implements Adapter, Retryable ); } - if ($this->auth !== null) { - $newRedis->auth($this->auth); + if ($this->auth !== []) { + $newRedis->auth(\count($this->auth) === 1 ? $this->auth[0] : $this->auth); } if ($this->dbIndex !== 0) { diff --git a/src/Cache/Adapter/Redis/Client.php b/src/Cache/Adapter/Redis/Client.php index 1f718ff3d2..878f3a53f0 100644 --- a/src/Cache/Adapter/Redis/Client.php +++ b/src/Cache/Adapter/Redis/Client.php @@ -19,7 +19,7 @@ class Client */ public const INCOMPLETE = "\0__INCOMPLETE__\0"; - private SwooleClient $client; + private readonly SwooleClient $client; private string $buffer = ''; @@ -36,7 +36,7 @@ class Client $errMsg = $this->client->errMsg; $this->close(); - throw new ConnectionException('Failed to connect to Redis: '.$errMsg); + throw new ConnectionException('Failed to connect to Redis: ' . $errMsg); } } @@ -76,7 +76,7 @@ class Client public function send(string $payload): void { $written = $this->client->send($payload); - if ($written === strlen($payload)) { + if ($written === \strlen($payload)) { return; } @@ -84,7 +84,7 @@ class Client ? ($this->client->errMsg ?: 'send failed') : 'partial send'; - throw new ConnectionException('Redis send failed: '.$message); + throw new ConnectionException('Redis send failed: ' . $message); } public function recv(float $timeout): string|false @@ -109,7 +109,7 @@ class Client { try { $this->client->close(); - } catch (Throwable $th) { + } catch (Throwable) { // ignore } } @@ -129,7 +129,7 @@ class Client throw $value->exception; } - if (! is_array($value)) { + if (! \is_array($value)) { return $value; } @@ -147,10 +147,10 @@ class Client */ public static function encode(array $args): string { - $out = '*'.count($args)."\r\n"; + $out = '*' . \count($args) . "\r\n"; foreach ($args as $arg) { $arg = (string) $arg; - $out .= '$'.strlen($arg)."\r\n".$arg."\r\n"; + $out .= '$' . \strlen($arg) . "\r\n" . $arg . "\r\n"; } return $out; @@ -188,7 +188,7 @@ class Client if ($len === -1) { return null; } - if (strlen($buffer) < $offset + $len + 2) { + if (\strlen($buffer) < $offset + $len + 2) { return self::INCOMPLETE; } $value = substr($buffer, $offset, $len); @@ -211,7 +211,7 @@ class Client return $items; default: - throw new \RedisException('Unknown RESP type: '.$type); + throw new \RedisException('Unknown RESP type: ' . $type); } } } diff --git a/src/Cache/Adapter/Redis/ConnectionContext.php b/src/Cache/Adapter/Redis/ConnectionContext.php index 8118681eb4..124f9799dd 100644 --- a/src/Cache/Adapter/Redis/ConnectionContext.php +++ b/src/Cache/Adapter/Redis/ConnectionContext.php @@ -1,5 +1,7 @@ isReserved($hash)) { return false; } @@ -211,7 +211,7 @@ abstract class Leasable implements \Utopia\Cache\Feature\Leasable /** SHA1 digest Redis identifies a cached script by β€” the digest of its body. */ private function shaFor(string $script): string { - return self::$scriptSha[$script] ??= \sha1($script); + return self::$scriptSha[$script] ??= sha1($script); } /** diff --git a/src/Cache/Adapter/Redis/Multiplexing.php b/src/Cache/Adapter/Redis/Multiplexing.php index 3f4ac90d2e..4bef174e8a 100644 --- a/src/Cache/Adapter/Redis/Multiplexing.php +++ b/src/Cache/Adapter/Redis/Multiplexing.php @@ -31,28 +31,25 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature * Serializes pending enqueue + send so the FIFO invariant holds even when * many coroutines issue commands concurrently. */ - private Lock $sendLock; + private readonly Lock $sendLock; private Telemetry $telemetry; private ?UpDownCounter $pendingDepth = null; /** - * @param string $host - * @param int $port * @param float $timeout connect timeout in seconds * @param float $readTimeout read timeout in seconds β€” caches should * fail fast, default 0.25s * @param string|array|null $auth password or [username, password] - * @param int $dbIndex */ public function __construct( - private string $host, - private int $port = 6379, - private float $timeout = 1.0, - private float $readTimeout = 0.25, - private string|array|null $auth = null, - private int $dbIndex = 0, + private readonly string $host, + private readonly int $port = 6379, + private readonly float $timeout = 1.0, + private readonly float $readTimeout = 0.25, + private readonly string|array|null $auth = null, + private readonly int $dbIndex = 0, ) { if ($this->timeout <= 0) { throw new \InvalidArgumentException('timeout must be greater than 0'); @@ -102,7 +99,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature public function load(string $key, int $ttl, string $hash = ''): mixed { - if (empty($hash)) { + if ($hash === '' || $hash === '0') { $hash = $key; } @@ -112,7 +109,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature $value = $this->command(['HGET', $key, $hash]); - if (! is_string($value)) { + if (! \is_string($value)) { return false; } @@ -121,11 +118,11 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature public function save(string $key, array|string $data, string $hash = ''): bool|string|array { - if (empty($key) || empty($data)) { + if ($key === '' || $key === '0' || empty($data)) { return false; } - if (empty($hash)) { + if ($hash === '' || $hash === '0') { $hash = $key; } @@ -141,7 +138,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature public function touch(string $key, string $hash = ''): bool { - if (empty($hash)) { + if ($hash === '' || $hash === '0') { $hash = $key; } @@ -150,7 +147,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature } $value = $this->command(['HGET', $key, $hash]); - if (! is_string($value)) { + if (! \is_string($value)) { return false; } @@ -168,12 +165,12 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature public function list(string $key): array { $keys = $this->command(['HKEYS', $key]); - if (! is_array($keys)) { + if (! \is_array($keys)) { return []; } /** @var string[] $keys */ - return \array_values(\array_filter($keys, fn (string $field): bool => ! $this->isReserved($field))); + return array_values(array_filter($keys, fn(string $field): bool => ! $this->isReserved($field))); } protected function leaseEvalSha(string $sha, string $key, array $args): mixed @@ -211,7 +208,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature { try { return $this->command(['PING']) === 'PONG'; - } catch (Throwable $th) { + } catch (Throwable) { return false; } } @@ -220,7 +217,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature { $size = $this->command(['DBSIZE']); - return is_int($size) ? $size : 0; + return \is_int($size) ? $size : 0; } public function getName(?string $key = null): string @@ -240,7 +237,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature { try { return $this->dispatch($args); - } catch (ConnectionException $th) { + } catch (ConnectionException) { $this->ensureConnected(); return $this->dispatch($args); @@ -258,7 +255,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature $locked = $this->lockSend(); try { $context = $this->connection; - if ($context === null) { + if (!$context instanceof \Utopia\Cache\Adapter\Redis\ConnectionContext) { throw new ConnectionException('Redis connection is not open'); } $response = new Channel(1); @@ -275,7 +272,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature $this->unlockSend($locked); } - if ($error !== null) { + if ($error instanceof \Utopia\Cache\Adapter\Redis\ConnectionException) { $this->teardownIfCurrent($context, $error); throw $error; @@ -288,7 +285,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature { $locked = $this->lockSend(); try { - if ($this->connection === null) { + if (!$this->connection instanceof \Utopia\Cache\Adapter\Redis\ConnectionContext) { $this->connect(); } } finally { @@ -321,7 +318,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature try { if ($this->auth !== null) { - $authArgs = is_array($this->auth) + $authArgs = \is_array($this->auth) ? array_merge(['AUTH'], array_values($this->auth)) : ['AUTH', $this->auth]; @@ -330,10 +327,8 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature } } - if ($this->dbIndex !== 0) { - if ($client->command(['SELECT', (string) $this->dbIndex], $this->readTimeout) !== 'OK') { - throw new \RedisException('Redis SELECT failed'); - } + if ($this->dbIndex !== 0 && $client->command(['SELECT', (string) $this->dbIndex], $this->readTimeout) !== 'OK') { + throw new \RedisException('Redis SELECT failed'); } } catch (Throwable $th) { $client->close(); @@ -346,7 +341,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature $context = new ConnectionContext($client, $pending); $this->connection = $context; - Coroutine::create(function () use ($context) { + Coroutine::create(function () use ($context): void { $this->readerLoop($context); }); } @@ -356,7 +351,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature $context = null; $locked = $this->lockSend(); try { - if ($this->connection !== null) { + if ($this->connection instanceof \Utopia\Cache\Adapter\Redis\ConnectionContext) { $context = $this->connection; $this->connection = null; } @@ -364,7 +359,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature $this->unlockSend($locked); } - if ($context !== null) { + if ($context instanceof \Utopia\Cache\Adapter\Redis\ConnectionContext) { $this->finishTeardown($context, new ConnectionException('Connection closed')); } } @@ -431,7 +426,7 @@ class Multiplexing extends Leasable implements Adapter, TelemetryFeature try { $value = Client::parse($readBuffer, $offset); } catch (Throwable $th) { - $this->teardownIfCurrent($context, new ConnectionException('Redis protocol parse failed: '.$th->getMessage())); + $this->teardownIfCurrent($context, new ConnectionException('Redis protocol parse failed: ' . $th->getMessage())); return; } diff --git a/src/Cache/Adapter/Redis/NoScript.php b/src/Cache/Adapter/Redis/NoScript.php index 90d395e561..b8060482c9 100644 --- a/src/Cache/Adapter/Redis/NoScript.php +++ b/src/Cache/Adapter/Redis/NoScript.php @@ -16,7 +16,7 @@ final class NoScript extends \RuntimeException * code is the reply's leading token β€” "NOSCRIPT No matching script." β€” the * same across the raw RESP frame and php-redis getLastError(). */ - private const CODE = 'NOSCRIPT'; + private const string CODE = 'NOSCRIPT'; /** * True when a Redis error string's code (its leading token) is NOSCRIPT. @@ -25,7 +25,7 @@ final class NoScript extends \RuntimeException */ public static function matches(string $error): bool { - return \explode(' ', $error, 2)[0] === self::CODE; + return explode(' ', $error, 2)[0] === self::CODE; } /** Build the signal from the underlying Redis error (exception or message). */ diff --git a/src/Cache/Adapter/Redis/RedisError.php b/src/Cache/Adapter/Redis/RedisError.php index 93680dbeb3..444f8267cb 100644 --- a/src/Cache/Adapter/Redis/RedisError.php +++ b/src/Cache/Adapter/Redis/RedisError.php @@ -1,11 +1,12 @@ - */ - protected array $seeds; - - /** - * @var ?string - */ - protected ?string $name; - private int $maxRetries = 0; - private int $retryDelay = 1000; // milliseconds - - private float $timeout; - - private float $readTimeout; - - private bool $persistent; + private int $retryDelay = 1000; /** - * @var string|array|null - */ - private string|array|null $auth; - - /** - * @param Client $redis * @param array $seeds - * @param string|null $name - * @param float $timeout - * @param float $readTimeout - * @param bool $persistent * @param string|array|null $auth Password string or ['username', 'password'] array for ACL */ - public function __construct( - Client $redis, - array $seeds, - ?string $name = null, - float $timeout = 1.5, - float $readTimeout = 1.5, - bool $persistent = false, - string|array|null $auth = null - ) { - $this->redis = $redis; - $this->seeds = $seeds; - $this->name = $name; - $this->timeout = $timeout; - $this->readTimeout = $readTimeout; - $this->persistent = $persistent; - $this->auth = $auth; - } + public function __construct(protected Client $redis, protected array $seeds, protected ?string $name = null, private readonly float $timeout = 1.5, private readonly float $readTimeout = 1.5, private readonly bool $persistent = false, private readonly string|array|null $auth = null) {} /** * @param int $maxRetries (0-10) - * @return self */ public function setMaxRetries(int $maxRetries): self { @@ -80,7 +32,6 @@ class RedisCluster implements Adapter, Retryable /** * @param int $retryDelay time in milliseconds - * @return self */ public function setRetryDelay(int $retryDelay): self { @@ -90,27 +41,30 @@ class RedisCluster implements Adapter, Retryable } /** - * @param string $key * @param int $ttl time in seconds * @param string $hash optional - * @return mixed */ public function load(string $key, int $ttl, string $hash = ''): mixed { - if (empty($hash)) { + if ($hash === '' || $hash === '0') { $hash = $key; } /** @var string|false */ - $redis_string = $this->execute(fn () => $this->redis->hGet($key, $hash)); + $redis_string = $this->execute(fn(): string => $this->redis->hGet($key, $hash)); - if ($redis_string === false || ! is_string($redis_string)) { + if ($redis_string === false || ! \is_string($redis_string)) { return false; } - /** @var array{time: int, data: string} $cache */ $cache = json_decode($redis_string, true); + // A purged key keeps its field until re-cached, holding a value that + // is not an envelope. + if (! \is_array($cache) || ! isset($cache['time'], $cache['data'])) { + return false; + } + if ($cache['time'] + $ttl > time()) { // Cache is valid return $cache['data']; } @@ -119,54 +73,51 @@ class RedisCluster implements Adapter, Retryable } /** - * @param string $key * @param array|string $data * @param string $hash optional * @return bool|string|array */ public function save(string $key, array|string $data, string $hash = ''): bool|string|array { - if (empty($key) || empty($data)) { + if ($key === '' || $key === '0' || empty($data)) { return false; } - if (empty($hash)) { + if ($hash === '' || $hash === '0') { $hash = $key; } try { $value = json_encode([ - 'time' => \time(), + 'time' => time(), 'data' => $data, ], flags: JSON_THROW_ON_ERROR); - } catch (Throwable $th) { + } catch (Throwable) { return false; } try { - $this->execute(fn () => $this->redis->hSet($key, $hash, $value)); + $this->execute(fn(): int => $this->redis->hSet($key, $hash, $value)); return $data; - } catch (Throwable $th) { + } catch (Throwable) { return false; } } /** - * @param string $key * @param string $hash optional - * @return bool */ public function touch(string $key, string $hash = ''): bool { - if (empty($hash)) { + if ($hash === '' || $hash === '0') { $hash = $key; } /** @var string|false */ - $redis_string = $this->execute(fn () => $this->redis->hGet($key, $hash)); + $redis_string = $this->execute(fn(): string => $this->redis->hGet($key, $hash)); - if ($redis_string === false || ! is_string($redis_string)) { + if ($redis_string === false || ! \is_string($redis_string)) { return false; } @@ -175,21 +126,20 @@ class RedisCluster implements Adapter, Retryable $cache = json_decode($redis_string, true, flags: JSON_THROW_ON_ERROR); $cache['time'] = time(); $value = json_encode($cache, flags: JSON_THROW_ON_ERROR); - } catch (Throwable $th) { + } catch (Throwable) { return false; } - return $this->execute(fn () => $this->redis->hSet($key, $hash, $value)) !== false; + return $this->execute(fn(): int => $this->redis->hSet($key, $hash, $value)) !== false; } /** - * @param string $key * @return string[] */ public function list(string $key): array { /** @var array */ - $keys = (array) $this->execute(fn () => $this->redis->hKeys($key)); + $keys = (array) $this->execute(fn(): array => $this->redis->hKeys($key)); if (empty($keys)) { return []; @@ -199,25 +149,20 @@ class RedisCluster implements Adapter, Retryable } /** - * @param string $key * @param string $hash optional - * @return bool */ public function purge(string $key, string $hash = ''): bool { - if (! empty($hash)) { - return (bool) $this->execute(fn () => $this->redis->hdel($key, $hash)); + if ($hash !== '' && $hash !== '0') { + return (bool) $this->execute(fn(): int => $this->redis->hdel($key, $hash)); } - return (bool) $this->execute(fn () => $this->redis->del($key)); + return (bool) $this->execute(fn(): int => $this->redis->del($key)); } - /** - * @return bool - */ public function flush(): bool { - return (bool) $this->execute(function () { + return (bool) $this->execute(function (): true { /** @var array $masters */ $masters = $this->redis->_masters(); foreach ($masters as $master) { @@ -228,28 +173,23 @@ class RedisCluster implements Adapter, Retryable }); } - /** - * @return bool - */ public function ping(): bool { try { - return (bool) $this->execute(function () { + return (bool) $this->execute(function (): true { foreach ($this->redis->_masters() as $master) { $this->redis->ping($master); } return true; }); - } catch (Exception $e) { + } catch (Exception) { return false; } } /** * Returning total number of keys - * - * @return int */ public function getSize(): int { @@ -269,25 +209,16 @@ class RedisCluster implements Adapter, Retryable return (int) $size; } - /** - * @return int - */ public function getMaxRetries(): int { return $this->maxRetries; } - /** - * @return int - */ public function getRetryDelay(): int { return $this->retryDelay; } - /** - * @return ?string - */ public function getClusterName(): ?string { return $this->name; @@ -304,8 +235,6 @@ class RedisCluster implements Adapter, Retryable /** * Execute a Redis command with retry logic * - * @param callable $callback - * @return mixed * * @throws \RedisClusterException */ @@ -332,7 +261,7 @@ class RedisCluster implements Adapter, Retryable try { $this->reconnect(); - } catch (\RedisClusterException $e) { + } catch (\RedisClusterException) { // Reconnect failed, will retry on next iteration } } @@ -347,9 +276,6 @@ class RedisCluster implements Adapter, Retryable * * RedisClusterException always returns error code 0 with no subclasses for different error types. * The only way to differentiate connection errors from command errors is by message matching. - * - * @param Exception $e - * @return bool */ private function isConnectionError(Exception $e): bool { @@ -371,13 +297,7 @@ class RedisCluster implements Adapter, Retryable ]; $message = strtolower($e->getMessage()); - foreach ($connectionErrors as $needle) { - if (str_contains($message, $needle)) { - return true; - } - } - - return false; + return array_any($connectionErrors, fn(string $needle): bool => str_contains($message, $needle)); } private function reconnect(): void @@ -388,16 +308,12 @@ class RedisCluster implements Adapter, Retryable $this->timeout, $this->readTimeout, $this->persistent, - $this->auth + $this->auth, ); $this->redis = $newRedis; } - /** - * @param string|null $key - * @return string - */ public function getName(?string $key = null): string { return 'redis-cluster'; diff --git a/src/Cache/Adapter/Sharding.php b/src/Cache/Adapter/Sharding.php index e267362d2a..733d544d52 100644 --- a/src/Cache/Adapter/Sharding.php +++ b/src/Cache/Adapter/Sharding.php @@ -12,9 +12,6 @@ class Sharding implements Adapter, Leasable */ protected array $adapters; - /** - * @var int - */ protected int $count = 0; /** @@ -37,7 +34,7 @@ class Sharding implements Adapter, Leasable */ public function __construct(array $adapters) { - if (empty($adapters)) { + if ($adapters === []) { throw new \Exception('No adapters provided'); } @@ -46,10 +43,8 @@ class Sharding implements Adapter, Leasable } /** - * @param string $key * @param int $ttl time in seconds * @param string $hash optional - * @return mixed */ public function load(string $key, int $ttl, string $hash = ''): mixed { @@ -57,7 +52,6 @@ class Sharding implements Adapter, Leasable } /** - * @param string $key * @param array|string $data * @param string $hash optional * @return bool|string|array @@ -84,9 +78,7 @@ class Sharding implements Adapter, Leasable } /** - * @param string $key * @param string $hash optional - * @return bool */ public function touch(string $key, string $hash = ''): bool { @@ -94,7 +86,6 @@ class Sharding implements Adapter, Leasable } /** - * @param string $key * @return string[] */ public function list(string $key): array @@ -103,46 +94,30 @@ class Sharding implements Adapter, Leasable } /** - * @param string $key * @param string $hash optional - * @return bool */ public function purge(string $key, string $hash = ''): bool { return $this->getAdapter($key)->purge($key, $hash); } - /** - * @return bool - */ public function flush(): bool { $result = true; foreach ($this->adapters as $value) { - $result = ($value->flush()) ? $result : false; + $result = $value->flush() && $result; } return $result; } - /** - * @return bool - */ public function ping(): bool { - foreach ($this->adapters as $value) { - if (! ($value->ping())) { - return false; - } - } - - return true; + return array_all($this->adapters, fn(\Utopia\Cache\Adapter $value): bool => $value->ping()); } /** * Returning total number of keys of all adapters - * - * @return int */ public function getSize(): int { @@ -154,9 +129,6 @@ class Sharding implements Adapter, Leasable return $size; } - /** - * @return string - */ public function getName(?string $key = null): string { if ($key === null) { @@ -166,13 +138,9 @@ class Sharding implements Adapter, Leasable return $this->getAdapter($key)->getName(); } - /** - * @param string $key - * @return Adapter - */ protected function getAdapter(string $key): Adapter { - $hash = \crc32($key); + $hash = crc32($key); $index = $hash % $this->count; return $this->adapters[$index]; diff --git a/src/Cache/Cache.php b/src/Cache/Cache.php index 4da205deac..6fad1bd78e 100644 --- a/src/Cache/Cache.php +++ b/src/Cache/Cache.php @@ -10,8 +10,6 @@ use Utopia\Telemetry\Histogram; class Cache { - private Adapter $adapter; - /** * @var bool If cache keys are case-sensitive */ @@ -19,21 +17,13 @@ class Cache protected Telemetry $telemetry; - /** - * @var Histogram|null - */ protected ?Histogram $operationDuration = null; - /** - * @var Counter|null - */ protected ?Counter $loadResults = null; /** * Set telemetry adapter. Instruments are created lazily on first use to * avoid emitting empty data point streams on every export interval. - * - * @param Telemetry $telemetry */ public function setTelemetry(Telemetry $telemetry): void { @@ -52,7 +42,7 @@ class Cache 'cache.operation.duration', 's', null, - ['ExplicitBucketBoundaries' => [0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1]] + ['ExplicitBucketBoundaries' => [0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1]], ); } @@ -67,12 +57,9 @@ class Cache /** * Initialize with a no-op telemetry adapter by default. - * - * @param Adapter $adapter */ - public function __construct(Adapter $adapter) + public function __construct(private readonly Adapter $adapter) { - $this->adapter = $adapter; $this->telemetry = new NoTelemetry(); } @@ -80,7 +67,6 @@ class Cache * Toggle case sensitivity of keys inside cache * * @param bool $value if true, cache keys will be case-sensitive - * @return bool */ public function setCaseSensitivity(bool $value): bool { @@ -90,15 +76,13 @@ class Cache /** * Load cached data. return false in no valid cache. * - * @param string $key * @param int $ttl time in seconds * @param string $hash optional - * @return mixed */ public function load(string $key, int $ttl, string $hash = ''): mixed { - $key = $this->caseSensitive ? $key : \strtolower($key); - $hash = $this->caseSensitive ? $hash : \strtolower($hash); + $key = $this->caseSensitive ? $key : strtolower($key); + $hash = $this->caseSensitive ? $hash : strtolower($hash); $start = microtime(true); $result = $this->adapter->load($key, $ttl, $hash); @@ -119,7 +103,6 @@ class Cache /** * Save data to cache. Returns data on success of false on failure. * - * @param string $key * @param string|array $data * @param string $hash optional * @return bool|string|array @@ -144,9 +127,6 @@ class Cache /** * Current generation token for $key (advances on each purge). Returns '0' * when the underlying adapter does not support leasing. - * - * @param string $key - * @return string */ public function getGeneration(string $key): string { @@ -154,7 +134,7 @@ class Cache return '0'; } - $key = $this->caseSensitive ? $key : \strtolower($key); + $key = $this->caseSensitive ? $key : strtolower($key); return $this->adapter->getGeneration($key); } @@ -165,16 +145,13 @@ class Cache * cache-aside read-after-write race. Falls back to an unconditional save when * the adapter does not support leasing. * - * @param string $key * @param string|array $data - * @param string $hash - * @param string $generation * @return bool|string|array */ public function saveWithLease(string $key, mixed $data, string $hash, string $generation): bool|string|array { - $key = $this->caseSensitive ? $key : \strtolower($key); - $hash = $this->caseSensitive ? $hash : \strtolower($hash); + $key = $this->caseSensitive ? $key : strtolower($key); + $hash = $this->caseSensitive ? $hash : strtolower($hash); $start = microtime(true); try { @@ -195,9 +172,7 @@ class Cache /** * Refresh a cache entry timestamp without replacing its data. * - * @param string $key * @param string $hash optional - * @return bool */ public function touch(string $key, string $hash = ''): bool { @@ -218,12 +193,11 @@ class Cache /** * Returns a list of keys. * - * @param string $key * @return string[] */ public function list(string $key): array { - $key = $this->caseSensitive ? $key : \strtolower($key); + $key = $this->caseSensitive ? $key : strtolower($key); $start = microtime(true); $result = $this->adapter->list($key); @@ -239,14 +213,12 @@ class Cache /** * Removes data from cache. Returns true on success of false on failure. * - * @param string $key * @param string $hash optional - * @return bool */ public function purge(string $key, string $hash = ''): bool { - $key = $this->caseSensitive ? $key : \strtolower($key); - $hash = $this->caseSensitive ? $hash : \strtolower($hash); + $key = $this->caseSensitive ? $key : strtolower($key); + $hash = $this->caseSensitive ? $hash : strtolower($hash); $start = microtime(true); $result = $this->adapter->purge($key, $hash); @@ -261,8 +233,6 @@ class Cache /** * Removes all data from cache. Returns true on success of false on failure. - * - * @return bool */ public function flush(): bool { @@ -279,8 +249,6 @@ class Cache /** * Check Cache Connecitivity - * - * @return bool */ public function ping(): bool { @@ -289,8 +257,6 @@ class Cache /** * Get db size. - * - * @return int */ public function getSize(): int { diff --git a/src/Cache/Feature/Leasable.php b/src/Cache/Feature/Leasable.php index c838e8f6a7..216fc33503 100644 --- a/src/Cache/Feature/Leasable.php +++ b/src/Cache/Feature/Leasable.php @@ -1,5 +1,7 @@ save($this->key, $this->data, $this->key); - $this->assertEquals($this->data, $result); + $this->assertSame($this->data, $result); } public function testNotEmptyCacheKey(): void @@ -60,7 +107,7 @@ abstract class Base extends TestCase public function testCacheTouch(): void { $result = self::$cache->save('touch-key', 'touch data', 'touch-key'); - $this->assertEquals('touch data', $result); + $this->assertSame('touch data', $result); sleep(3); @@ -76,7 +123,7 @@ abstract class Base extends TestCase { // Ensure case in-sensitivity first (configured in adapter's setUp) $data = self::$cache->save('planet', 'Earth', 'planet'); - $this->assertEquals('Earth', $data); + $this->assertSame('Earth', $data); $data = self::$cache->load('planet', 60 * 60 * 24 * 30 * 3 /* 3 months */, 'planet'); $this->assertEquals('Earth', $data); @@ -92,12 +139,14 @@ abstract class Base extends TestCase $this->assertEquals(false, $data); $data = self::$cache->load('PLANET', 60 * 60 * 24 * 30 * 3 /* 3 months */, 'PLANET'); $this->assertEquals(false, $data); + } - // Test case sensitivity + public function testCaseSensitivity(): void + { self::$cache->setCaseSensitivity(true); $data = self::$cache->save('color', 'pink', 'color'); - $this->assertEquals('pink', $data); + $this->assertSame('pink', $data); $data = self::$cache->load('color', 60 * 60 * 24 * 30 * 3 /* 3 months */, 'color'); $this->assertEquals('pink', $data); $data = self::$cache->load('COLOR', 60 * 60 * 24 * 30 * 3 /* 3 months */, 'COLOR'); @@ -105,6 +154,8 @@ abstract class Base extends TestCase $result = self::$cache->purge('color'); $this->assertEquals(true, $result); + + self::$cache->setCaseSensitivity(false); } public function testPing(): void diff --git a/tests/Cache/E2E/FilesystemTest.php b/tests/Cache/E2E/FilesystemTest.php deleted file mode 100644 index dd21fd0a61..0000000000 --- a/tests/Cache/E2E/FilesystemTest.php +++ /dev/null @@ -1,88 +0,0 @@ -save('test', 'test'); - $this->assertEquals(4, self::$cache->getSize()); - } - - public function testStreamingLoad(): void - { - $path = __DIR__.'/tests/stream-data'; - - try { - if (! file_exists($path)) { - mkdir($path, 0777, true); - } - - $cache = new Cache(new Filesystem($path, true)); - $cache->save('stream-test', 'stream data'); - - $stream = $cache->load('stream-test', 60); - - $this->assertTrue(is_resource($stream)); - $this->assertEquals('stream data', stream_get_contents($stream)); - - fclose($stream); - } finally { - $this->deletePath($path); - } - } - - public function testStreamingLoadMissingKey(): void - { - $path = __DIR__.'/tests/stream-missing-data'; - - try { - if (! file_exists($path)) { - mkdir($path, 0777, true); - } - - $cache = new Cache(new Filesystem($path, true)); - - $this->assertEquals(false, $cache->load('missing-stream-test', 60)); - } finally { - $this->deletePath($path); - } - } - - private function deletePath(string $path): void - { - if (! file_exists($path)) { - return; - } - - if (is_file($path)) { - unlink($path); - - return; - } - - $files = glob($path.'/*'); - - if ($files !== false) { - foreach ($files as $file) { - $this->deletePath($file); - } - } - - rmdir($path); - } -} diff --git a/tests/Cache/E2E/HazelcastTest.php b/tests/Cache/E2E/HazelcastTest.php index ab26ff2cd1..de19982979 100644 --- a/tests/Cache/E2E/HazelcastTest.php +++ b/tests/Cache/E2E/HazelcastTest.php @@ -1,53 +1,56 @@ addServer('hazelcast', 5701); + $memcached->addServer(Services::HOST, Services::HAZELCAST_PORT); self::$cache = new Cache(new HazelcastAdapter($memcached)); } public function testGetSize(): void { - $this->assertEquals(0, self::$cache->getSize()); + $this->assertSame(0, self::$cache->getSize()); } public function testCacheReconnect(): void { $memcached = new Memcached(); - $memcached->addServer('hazelcast', 5701); - self::$cache = new Cache((new HazelcastAdapter($memcached))->setMaxRetries(3)); + $memcached->addServer(Services::HOST, Services::HAZELCAST_PORT); + self::$cache = new Cache(new HazelcastAdapter($memcached)->setMaxRetries(3)); self::$cache->save('test:reconnect', 'reconnect', 'test:reconnect'); - $stopCmd = 'docker ps -a --filter "name=hazelcast" --format "{{.Names}}" | xargs -r docker stop'; - exec($stopCmd.' 2>&1', $output, $exitCode); - $this->assertEquals(0, $exitCode, "Docker stop failed: $stopCmd\nOutput: ".implode("\n", $output)); + Services::compose('stop', 'hazelcast'); sleep(3); try { self::$cache->load('test:reconnect', 5); $this->fail('Hazelcast connection should have failed'); - } catch (\MemcachedException $e) { + } catch (MemcachedException) { } - $output = []; - $startCmd = 'docker ps -a --filter "name=hazelcast" --format "{{.Names}}" | xargs -r docker start'; - exec($startCmd.' 2>&1', $output, $exitCode); - $this->assertEquals(0, $exitCode, "Docker start failed: $startCmd\nOutput: ".implode("\n", $output)); - sleep(6); + Services::compose('up', '-d', '--wait', 'hazelcast'); + // Reconnecting is what the adapter is on the hook for; serving the + // first write afterwards is Hazelcast's own start-up. + Services::waitUntil(fn(): bool => self::$cache->save('test:ready', 'ready') !== false); - $this->assertEquals('reconnect', self::$cache->save('test:reconnect', 'reconnect', 'test:reconnect')); + $this->assertSame('reconnect', self::$cache->save('test:reconnect', 'reconnect', 'test:reconnect')); $this->assertEquals('reconnect', self::$cache->load('test:reconnect', 5)); } + #[\Override] public function testFlush(): void { //not implemented as Hazelcast doesn't support flush functionality diff --git a/tests/Cache/E2E/MemcachedTest.php b/tests/Cache/E2E/MemcachedTest.php index 03c78bd29c..d0ae6bf017 100644 --- a/tests/Cache/E2E/MemcachedTest.php +++ b/tests/Cache/E2E/MemcachedTest.php @@ -1,52 +1,54 @@ addServer('memcached', 11211); + $mc->addServer(Services::HOST, Services::MEMCACHED_PORT); self::$cache = new Cache(new MemcachedAdapter($mc)); } public function testGetSize(): void { + // Memcached expires flushed items lazily, so they can still be counted + // β€” measure the delta rather than the absolute item count. + $before = self::$cache->getSize(); self::$cache->save('test:file33', 'file33'); - $this->assertEquals(1, self::$cache->getSize()); + $this->assertSame($before + 1, self::$cache->getSize()); } public function testCacheReconnect(): void { $mc = new Memcached(); - $mc->addServer('memcached', 11211); - self::$cache = new Cache((new MemcachedAdapter($mc))->setMaxRetries(3)); + $mc->addServer(Services::HOST, Services::MEMCACHED_PORT); + self::$cache = new Cache(new MemcachedAdapter($mc)->setMaxRetries(3)); self::$cache->save('test:reconnect', 'reconnect'); - $stopCmd = 'docker ps -a --filter "name=memcached" --format "{{.Names}}" | xargs -r docker stop'; - exec($stopCmd.' 2>&1', $output, $exitCode); - $this->assertEquals(0, $exitCode, "Docker stop failed: $stopCmd\nOutput: ".implode("\n", $output)); + Services::compose('stop', 'memcached'); sleep(3); try { self::$cache->load('test:reconnect', 5); $this->fail('Memcached connection should have failed'); - } catch (\MemcachedException $e) { + } catch (MemcachedException) { } - $output = []; - $startCmd = 'docker ps -a --filter "name=memcached" --format "{{.Names}}" | xargs -r docker start'; - exec($startCmd.' 2>&1', $output, $exitCode); - $this->assertEquals(0, $exitCode, "Docker start failed: $startCmd\nOutput: ".implode("\n", $output)); - sleep(3); + Services::compose('up', '-d', '--wait', 'memcached'); - $this->assertEquals('reconnect', self::$cache->save('test:reconnect', 'reconnect', 'test:reconnect')); + $this->assertSame('reconnect', self::$cache->save('test:reconnect', 'reconnect', 'test:reconnect')); $this->assertEquals('reconnect', self::$cache->load('test:reconnect', 5)); } } diff --git a/tests/Cache/E2E/Redis/LeasableMultiplexingTest.php b/tests/Cache/E2E/MultiplexingLeasableTest.php similarity index 89% rename from tests/Cache/E2E/Redis/LeasableMultiplexingTest.php rename to tests/Cache/E2E/MultiplexingLeasableTest.php index fb6c41078d..0e06953161 100644 --- a/tests/Cache/E2E/Redis/LeasableMultiplexingTest.php +++ b/tests/Cache/E2E/MultiplexingLeasableTest.php @@ -1,14 +1,19 @@ close(); } }); - if ($error !== null) { + if ($error instanceof \Throwable) { throw $error; } } private function makeCache(): Cache { - $this->adapter = new RedisMultiplexing('redis', 6379); + $this->adapter = new RedisMultiplexing(Services::HOST, Services::REDIS_PORT); return new Cache($this->adapter); } private function graceCache(int $milliseconds): Cache { - $this->adapter = new RedisMultiplexing('redis', 6379); + $this->adapter = new RedisMultiplexing(Services::HOST, Services::REDIS_PORT); $this->adapter->setLeaseGraceWindow($milliseconds); return new Cache($this->adapter); @@ -58,7 +63,7 @@ class LeasableMultiplexingTest extends TestCase public function testFreshKeyHasZeroGeneration(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -68,7 +73,7 @@ class LeasableMultiplexingTest extends TestCase public function testSaveWithLeaseStoresWhenGenerationUnchanged(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -81,7 +86,7 @@ class LeasableMultiplexingTest extends TestCase public function testPurgeAdvancesGeneration(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -95,7 +100,7 @@ class LeasableMultiplexingTest extends TestCase public function testHashPurgeAdvancesGeneration(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -121,7 +126,7 @@ class LeasableMultiplexingTest extends TestCase */ public function testStaleSaveAfterPurgeIsRejected(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -140,7 +145,7 @@ class LeasableMultiplexingTest extends TestCase public function testFreshSaveAfterPurgeSucceeds(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -160,7 +165,7 @@ class LeasableMultiplexingTest extends TestCase */ public function testLeaseSurvivesScriptCacheFlush(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -169,7 +174,7 @@ class LeasableMultiplexingTest extends TestCase // Evict every cached script server-side; the next EVALSHA now misses. $raw = new Redis(); - $raw->connect('redis', 6379); + $raw->connect(Services::HOST, Services::REDIS_PORT); $raw->script('flush'); $raw->close(); @@ -179,7 +184,7 @@ class LeasableMultiplexingTest extends TestCase $fresh = $cache->getGeneration('doc:1'); $this->assertNotFalse( $cache->saveWithLease('doc:1', ['v' => 2], 'doc:1', $fresh), - 'saveWithLease must fall back to EVAL after NOSCRIPT' + 'saveWithLease must fall back to EVAL after NOSCRIPT', ); $this->assertSame(['v' => 2], $cache->load('doc:1', 60, 'doc:1')); }); @@ -187,7 +192,7 @@ class LeasableMultiplexingTest extends TestCase public function testPurgePreservesDeletionResult(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -200,7 +205,7 @@ class LeasableMultiplexingTest extends TestCase public function testPurgeDropsValueButKeepsGenerationField(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -221,7 +226,7 @@ class LeasableMultiplexingTest extends TestCase public function testReservedGenerationFieldIsProtected(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -245,7 +250,7 @@ class LeasableMultiplexingTest extends TestCase public function testListHidesGenerationField(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -261,8 +266,8 @@ class LeasableMultiplexingTest extends TestCase public function testLeaseGraceWindowDefaultsToZero(): void { - $this->runCo(function () { - $this->adapter = new RedisMultiplexing('redis', 6379); + $this->runCo(function (): void { + $this->adapter = new RedisMultiplexing(Services::HOST, Services::REDIS_PORT); $this->assertSame(0, $this->adapter->getLeaseGraceWindow()); }); } @@ -273,7 +278,7 @@ class LeasableMultiplexingTest extends TestCase */ public function testTombstoneRejectsTokenValidSaveWithinGraceWindow(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->graceCache(500); $cache->flush(); @@ -282,7 +287,7 @@ class LeasableMultiplexingTest extends TestCase $generation = $cache->getGeneration('doc:1'); $this->assertFalse( $cache->saveWithLease('doc:1', ['stale' => true], 'doc:1', $generation), - 'A token-valid save inside the grace window must be refused by the tombstone' + 'A token-valid save inside the grace window must be refused by the tombstone', ); $this->assertFalse($cache->load('doc:1', 60, 'doc:1'), 'Cache must not hold the stale value'); @@ -290,7 +295,7 @@ class LeasableMultiplexingTest extends TestCase // multiplexing adapter exposes no raw write, so use a temporary // synchronous php-redis client for this out-of-band poke. $raw = new Redis(); - $raw->connect('redis', 6379); + $raw->connect(Services::HOST, Services::REDIS_PORT); // Derive from the Redis server clock (what the tombstone Lua uses via // TIME), not the PHP wall clock, so a client/server skew can't flake it. $past = ((int) $raw->time()[0] - 60) * 1000000; @@ -299,17 +304,17 @@ class LeasableMultiplexingTest extends TestCase $this->assertNotFalse( $cache->saveWithLease('doc:1', ['fresh' => true], 'doc:1', $generation), - 'After the grace window a token-valid save must succeed' + 'After the grace window a token-valid save must succeed', ); $this->assertSame(['fresh' => true], $cache->load('doc:1', 60, 'doc:1')); $raw = new Redis(); - $raw->connect('redis', 6379); + $raw->connect(Services::HOST, Services::REDIS_PORT); $lingering = (bool) $raw->hExists('doc:1', '__utopia_tomb__'); $raw->close(); $this->assertFalse( $lingering, - 'The spent tombstone must be dropped on the next save, not linger in the hash' + 'The spent tombstone must be dropped on the next save, not linger in the hash', ); }); } @@ -317,7 +322,7 @@ class LeasableMultiplexingTest extends TestCase /** A field-level purge must open the tombstone too. */ public function testFieldPurgeAlsoOpensTombstone(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->graceCache(500); $cache->flush(); @@ -327,7 +332,7 @@ class LeasableMultiplexingTest extends TestCase $generation = $cache->getGeneration('doc:1'); $this->assertFalse( $cache->saveWithLease('doc:1', ['stale' => true], 'field-a', $generation), - 'A token-valid field save inside the grace window must be refused' + 'A token-valid field save inside the grace window must be refused', ); $this->assertFalse($cache->load('doc:1', 60, 'field-a')); }); @@ -335,7 +340,7 @@ class LeasableMultiplexingTest extends TestCase public function testListHidesTombstoneField(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->graceCache(500); $cache->flush(); @@ -348,7 +353,7 @@ class LeasableMultiplexingTest extends TestCase public function testReservedTombstoneFieldIsProtected(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->graceCache(500); $cache->flush(); @@ -365,7 +370,7 @@ class LeasableMultiplexingTest extends TestCase */ public function testTombstoneIgnoresImplausibleFutureDeadline(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->graceCache(500); $cache->flush(); @@ -376,14 +381,14 @@ class LeasableMultiplexingTest extends TestCase // The multiplexing adapter exposes no raw write, so stamp it via a // temporary synchronous php-redis client. $raw = new Redis(); - $raw->connect('redis', 6379); + $raw->connect(Services::HOST, Services::REDIS_PORT); $farFutureMicros = ((int) $raw->time()[0] + 3600) * 1000000; $raw->hSet('doc:1', '__utopia_tomb__', (string) $farFutureMicros); $raw->close(); $this->assertNotFalse( $cache->saveWithLease('doc:1', ['v' => 1], 'doc:1', $generation), - 'An implausibly far-future deadline (backward clock step) must be ignored, not wedge saves' + 'An implausibly far-future deadline (backward clock step) must be ignored, not wedge saves', ); $this->assertSame(['v' => 1], $cache->load('doc:1', 60, 'doc:1')); }); diff --git a/tests/Cache/E2E/Redis/MultiplexingTest.php b/tests/Cache/E2E/MultiplexingTest.php similarity index 81% rename from tests/Cache/E2E/Redis/MultiplexingTest.php rename to tests/Cache/E2E/MultiplexingTest.php index f2cf27b531..3188b2ac0a 100644 --- a/tests/Cache/E2E/Redis/MultiplexingTest.php +++ b/tests/Cache/E2E/MultiplexingTest.php @@ -1,15 +1,20 @@ close(); } }); - if ($error !== null) { + if ($error instanceof \Throwable) { throw $error; } } @@ -42,7 +47,7 @@ class MultiplexingTest extends TestCase private function makeCache(): Cache { - $this->adapter = new RedisMultiplexing('redis', 6379); + $this->adapter = new RedisMultiplexing(Services::HOST, Services::REDIS_PORT); return new Cache($this->adapter); } @@ -56,7 +61,7 @@ class MultiplexingTest extends TestCase public function testCacheSave(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -64,7 +69,7 @@ class MultiplexingTest extends TestCase $this->assertEquals($this->dataArray, $result); $result = $cache->save($this->key, $this->data, $this->key); - $this->assertEquals($this->data, $result); + $this->assertSame($this->data, $result); $loaded = $cache->load($this->key, 60, $this->key); $this->assertEquals($this->data, $loaded); @@ -73,7 +78,7 @@ class MultiplexingTest extends TestCase public function testCachePurge(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->save($this->key, $this->data, $this->key); @@ -87,7 +92,7 @@ class MultiplexingTest extends TestCase public function testCacheTouch(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->save('touch-key', 'touch data', 'touch-key'); @@ -95,7 +100,7 @@ class MultiplexingTest extends TestCase $this->assertFalse($cache->load('touch-key', 2, 'touch-key')); $this->assertTrue($cache->touch('touch-key', 'touch-key')); - $this->assertEquals('touch data', $cache->load('touch-key', 2, 'touch-key')); + $this->assertSame('touch data', $cache->load('touch-key', 2, 'touch-key')); $this->assertFalse($cache->touch('missing-touch-key', 'missing-touch-key')); $cache->purge('touch-key'); @@ -104,7 +109,7 @@ class MultiplexingTest extends TestCase public function testPing(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $this->assertTrue($cache->ping()); }); @@ -112,7 +117,7 @@ class MultiplexingTest extends TestCase public function testFlush(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->save('x', 'x', 'x'); $cache->save('y', 'y', 'y'); @@ -128,7 +133,7 @@ class MultiplexingTest extends TestCase public function testGetSize(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -136,13 +141,13 @@ class MultiplexingTest extends TestCase $cache->save('test:file34', 'file34', 'test:file34'); $cache->save('test:file35', 'file35', 'test:file35'); - $this->assertEquals(3, $cache->getSize()); + $this->assertSame(3, $cache->getSize()); }); } public function testJsonData(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -171,14 +176,14 @@ class MultiplexingTest extends TestCase $jsonString = json_encode($payload, JSON_THROW_ON_ERROR); $this->assertNotFalse($jsonString); - $this->assertEquals($jsonString, $cache->save('json:string', $jsonString, 'json:string')); + $this->assertSame($jsonString, $cache->save('json:string', $jsonString, 'json:string')); $this->assertEquals($jsonString, $cache->load('json:string', 60, 'json:string')); }); } public function testLargeJsonPayload(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -186,7 +191,7 @@ class MultiplexingTest extends TestCase for ($i = 0; $i < 1000; $i++) { $rows[] = [ 'i' => $i, - 'name' => 'row-'.$i, + 'name' => 'row-' . $i, 'value' => str_repeat('x', 64), ]; } @@ -202,7 +207,7 @@ class MultiplexingTest extends TestCase public function testConcurrentJsonMultiplexing(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -212,14 +217,14 @@ class MultiplexingTest extends TestCase for ($i = 0; $i < $count; $i++) { $wg->add(); - Coroutine::create(function () use ($cache, $i, $wg, &$errors) { + Coroutine::create(function () use ($cache, $i, $wg, &$errors): void { try { - $key = 'json-mux:'.$i; + $key = 'json-mux:' . $i; $value = [ 'i' => $i, - 'tags' => ['a', 'b', 'c-'.$i], + 'tags' => ['a', 'b', 'c-' . $i], 'meta' => ['nested' => ['count' => $i * 2]], - 'text' => 'cafΓ© πŸš€ row '.$i, + 'text' => 'cafΓ© πŸš€ row ' . $i, ]; $saved = $cache->save($key, $value, $key); if ($saved !== $value) { @@ -227,7 +232,7 @@ class MultiplexingTest extends TestCase } $loaded = $cache->load($key, 60, $key); if ($loaded != $value) { - $errors[] = "load mismatch for $i: ".var_export($loaded, true); + $errors[] = "load mismatch for $i: " . var_export($loaded, true); } } catch (\Throwable $th) { $errors[] = $th->getMessage(); @@ -239,8 +244,8 @@ class MultiplexingTest extends TestCase $wg->wait(); - $this->assertEmpty($errors, 'Concurrent errors: '.implode('; ', $errors)); - $this->assertEquals($count, $cache->getSize()); + $this->assertEmpty($errors, 'Concurrent errors: ' . implode('; ', $errors)); + $this->assertSame($count, $cache->getSize()); }); } @@ -249,7 +254,7 @@ class MultiplexingTest extends TestCase */ public function testConcurrentMultiplexing(): void { - $this->runCo(function () { + $this->runCo(function (): void { $cache = $this->makeCache(); $cache->flush(); @@ -259,17 +264,17 @@ class MultiplexingTest extends TestCase for ($i = 0; $i < $count; $i++) { $wg->add(); - Coroutine::create(function () use ($cache, $i, $wg, &$errors) { + Coroutine::create(function () use ($cache, $i, $wg, &$errors): void { try { - $key = 'mux:'.$i; - $value = 'value-'.$i; + $key = 'mux:' . $i; + $value = 'value-' . $i; $saved = $cache->save($key, $value, $key); if ($saved !== $value) { - $errors[] = "save mismatch for $i: ".var_export($saved, true); + $errors[] = "save mismatch for $i: " . var_export($saved, true); } $loaded = $cache->load($key, 60, $key); if ($loaded !== $value) { - $errors[] = "load mismatch for $i: ".var_export($loaded, true); + $errors[] = "load mismatch for $i: " . var_export($loaded, true); } } catch (\Throwable $th) { $errors[] = $th->getMessage(); @@ -281,8 +286,8 @@ class MultiplexingTest extends TestCase $wg->wait(); - $this->assertEmpty($errors, 'Concurrent errors: '.implode('; ', $errors)); - $this->assertEquals($count, $cache->getSize()); + $this->assertEmpty($errors, 'Concurrent errors: ' . implode('; ', $errors)); + $this->assertSame($count, $cache->getSize()); }); } } diff --git a/tests/Cache/E2E/Redis/RedisClusterTest.php b/tests/Cache/E2E/Redis/RedisClusterTest.php deleted file mode 100644 index fc0f5dd565..0000000000 --- a/tests/Cache/E2E/Redis/RedisClusterTest.php +++ /dev/null @@ -1,83 +0,0 @@ -save("test:file$i", "file$i", "test:file$i"); - } - - $this->assertEquals(20, self::$cache->getSize()); - } - - /** - * @depends testGetSize - */ - public function testCacheReconnect(): void - { - self::$redis = new RedisCluster(null, SEEDS, TIMEOUT, TIMEOUT); - self::$cache = new Cache((new RedisAdapter(self::$redis, SEEDS))->setMaxRetries(3)); - - self::$cache->save('test:reconnect', 'reconnect', 'test:reconnect'); - - // Must recreate container because grokzen/redis-cluster doesn't persist cluster state across stop/start - $rmCmd = 'docker rm -f redis-cluster'; - exec($rmCmd.' 2>&1', $output, $exitCode); - $this->assertEquals(0, $exitCode, "Docker rm failed: $rmCmd\nOutput: ".implode("\n", $output)); - sleep(1); - - try { - self::$cache->load('test:reconnect', 5); - $this->fail('Redis connection should have failed'); - } catch (\RedisClusterException $e) { - } - - $output = []; - $runCmd = 'docker run -d --name redis-cluster --hostname redis-cluster --network cache_database -e IP=redis-cluster grokzen/redis-cluster:7.0.10'; - exec($runCmd.' 2>&1', $output, $exitCode); - $this->assertEquals(0, $exitCode, "Docker run failed: $runCmd\nOutput: ".implode("\n", $output)); - - // Wait for cluster to be ready with retry logic (max 60 seconds) to reduce flaky tests - $maxWait = 60; - $waited = 0; - $saveResult = false; - while ($waited < $maxWait && $saveResult === false) { - try { - $saveResult = self::$cache->save('test:reconnect', 'reconnect', 'test:reconnect'); - if ($saveResult !== false) { - break; - } - } catch (\RedisClusterException $e) { - // Exception thrown, will retry - } - sleep(5); - $waited += 5; - } - $this->assertEquals('reconnect', self::$cache->save('test:reconnect', 'reconnect', 'test:reconnect')); - $this->assertEquals('reconnect', self::$cache->load('test:reconnect', 5)); - } -} diff --git a/tests/Cache/E2E/Redis/RedisTest.php b/tests/Cache/E2E/Redis/RedisTest.php deleted file mode 100644 index 1d1e7bb5d9..0000000000 --- a/tests/Cache/E2E/Redis/RedisTest.php +++ /dev/null @@ -1,91 +0,0 @@ -connect('redis', 6379); - self::$cache = new Cache(new RedisAdapter($redis)); - } - - public function testGetSize(): void - { - self::$cache->flush(); - self::$cache->save('test:file33', 'file33', 'test:file33'); - self::$cache->save('test:file34', 'file34', 'test:file34'); - self::$cache->save('test:file35', 'file35', 'test:file35'); - $this->assertEquals(3, self::$cache->getSize()); - } - - /** - * @depends testGetSize - */ - public function testCacheReconnect(): void - { - $redis = new Redis(); - $redis->connect('redis', 6379); - self::$cache = new Cache((new RedisAdapter($redis))->setMaxRetries(3)); - - self::$cache->save('test:reconnect', 'reconnect', 'test:reconnect'); - - $stopCmd = 'docker ps -a --filter "name=cache-redis" --format "{{.Names}}" | xargs -r docker stop'; - exec($stopCmd.' 2>&1', $output, $exitCode); - $this->assertEquals(0, $exitCode, "Docker stop failed: $stopCmd\nOutput: ".implode("\n", $output)); - sleep(1); - - try { - self::$cache->load('test:reconnect', 5); - $this->fail('Redis connection should have failed'); - } catch (\RedisException $e) { - } - - $output = []; - $startCmd = 'docker ps -a --filter "name=cache-redis" --format "{{.Names}}" | xargs -r docker start'; - exec($startCmd.' 2>&1', $output, $exitCode); - $this->assertEquals(0, $exitCode, "Docker start failed: $startCmd\nOutput: ".implode("\n", $output)); - sleep(3); - - $this->assertEquals('reconnect', self::$cache->save('test:reconnect', 'reconnect', 'test:reconnect')); - $this->assertEquals('reconnect', self::$cache->load('test:reconnect', 5)); - } - - /** - * @depends testCacheReconnect - */ - public function testCacheReconnectPersistent(): void - { - $redis = new Redis(); - $redis->pconnect('redis', 6379); - self::$cache = new Cache((new RedisAdapter($redis))->setMaxRetries(3)); - - self::$cache->save('test:reconnect_persistent', 'reconnect_persistent', 'test:reconnect_persistent'); - - $stopCmd = 'docker ps -a --filter "name=cache-redis" --format "{{.Names}}" | xargs -r docker stop'; - exec($stopCmd.' 2>&1', $output, $exitCode); - $this->assertEquals(0, $exitCode, "Docker stop failed: $stopCmd\nOutput: ".implode("\n", $output)); - sleep(1); - - try { - self::$cache->load('test:reconnect_persistent', 5); - $this->fail('Redis connection should have failed'); - } catch (\RedisException $e) { - } - - $output = []; - $startCmd = 'docker ps -a --filter "name=cache-redis" --format "{{.Names}}" | xargs -r docker start'; - exec($startCmd.' 2>&1', $output, $exitCode); - $this->assertEquals(0, $exitCode, "Docker start failed: $startCmd\nOutput: ".implode("\n", $output)); - sleep(3); - - $this->assertEquals('reconnect_persistent', self::$cache->save('test:reconnect_persistent', 'reconnect_persistent', 'test:reconnect_persistent')); - $this->assertEquals('reconnect_persistent', self::$cache->load('test:reconnect_persistent', 5)); - } -} diff --git a/tests/Cache/E2E/RedisClusterTest.php b/tests/Cache/E2E/RedisClusterTest.php new file mode 100644 index 0000000000..a9aa289b4d --- /dev/null +++ b/tests/Cache/E2E/RedisClusterTest.php @@ -0,0 +1,60 @@ +save("test:file$i", "file$i", "test:file$i"); + } + + $this->assertSame(20, self::$cache->getSize()); + } + + #[Depends('testGetSize')] + public function testCacheReconnect(): void + { + self::$redis = new RedisCluster(null, Services::CLUSTER_SEEDS, self::TIMEOUT, self::TIMEOUT); + self::$cache = new Cache(new RedisAdapter(self::$redis, Services::CLUSTER_SEEDS)->setMaxRetries(3)); + + self::$cache->save('test:reconnect', 'reconnect', 'test:reconnect'); + + // The container must be recreated: grokzen/redis-cluster does not + // persist cluster state across a stop and start. + Services::compose('rm', '-sf', 'redis-cluster'); + sleep(1); + + try { + self::$cache->load('test:reconnect', 5); + $this->fail('Redis connection should have failed'); + } catch (RedisClusterException) { + } + + Services::compose('up', '-d', '--force-recreate', '--wait', 'redis-cluster'); + + $this->assertSame('reconnect', self::$cache->save('test:reconnect', 'reconnect', 'test:reconnect')); + $this->assertEquals('reconnect', self::$cache->load('test:reconnect', 5)); + } +} diff --git a/tests/Cache/E2E/Redis/LeasableTest.php b/tests/Cache/E2E/RedisLeasableTest.php similarity index 94% rename from tests/Cache/E2E/Redis/LeasableTest.php rename to tests/Cache/E2E/RedisLeasableTest.php index 4633d69ee6..090ced28fe 100644 --- a/tests/Cache/E2E/Redis/LeasableTest.php +++ b/tests/Cache/E2E/RedisLeasableTest.php @@ -1,20 +1,23 @@ connect('redis', 6379); + $redis->connect(Services::HOST, Services::REDIS_PORT); $this->cache = new Cache(new RedisAdapter($redis)); $this->cache->flush(); } @@ -100,7 +103,7 @@ class LeasableTest extends TestCase // Evict every cached script server-side; the next EVALSHA now misses. $raw = new Redis(); - $raw->connect('redis', 6379); + $raw->connect(Services::HOST, Services::REDIS_PORT); $raw->script('flush'); $raw->close(); @@ -110,7 +113,7 @@ class LeasableTest extends TestCase $fresh = $this->cache->getGeneration('doc:1'); $this->assertNotFalse( $this->cache->saveWithLease('doc:1', ['v' => 2], 'doc:1', $fresh), - 'saveWithLease must fall back to EVAL after NOSCRIPT' + 'saveWithLease must fall back to EVAL after NOSCRIPT', ); $this->assertSame(['v' => 2], $this->cache->load('doc:1', 60, 'doc:1')); } @@ -175,7 +178,7 @@ class LeasableTest extends TestCase private function graceCache(int $milliseconds): Cache { $redis = new Redis(); - $redis->connect('redis', 6379); + $redis->connect(Services::HOST, Services::REDIS_PORT); $adapter = new RedisAdapter($redis); $adapter->setLeaseGraceWindow($milliseconds); @@ -185,8 +188,8 @@ class LeasableTest extends TestCase public function testLeaseGraceWindowDefaultsToZero(): void { $redis = new Redis(); - $redis->connect('redis', 6379); - $this->assertSame(0, (new RedisAdapter($redis))->getLeaseGraceWindow()); + $redis->connect(Services::HOST, Services::REDIS_PORT); + $this->assertSame(0, new RedisAdapter($redis)->getLeaseGraceWindow()); } /** @@ -196,7 +199,7 @@ class LeasableTest extends TestCase public function testTombstoneRejectsTokenValidSaveWithinGraceWindow(): void { $redis = new Redis(); - $redis->connect('redis', 6379); + $redis->connect(Services::HOST, Services::REDIS_PORT); $adapter = new RedisAdapter($redis); $adapter->setLeaseGraceWindow(500); $cache = new Cache($adapter); @@ -207,7 +210,7 @@ class LeasableTest extends TestCase $generation = $cache->getGeneration('doc:1'); $this->assertFalse( $cache->saveWithLease('doc:1', ['stale' => true], 'doc:1', $generation), - 'A token-valid save inside the grace window must be refused by the tombstone' + 'A token-valid save inside the grace window must be refused by the tombstone', ); $this->assertFalse($cache->load('doc:1', 60, 'doc:1'), 'Cache must not hold the stale value'); @@ -219,12 +222,12 @@ class LeasableTest extends TestCase $this->assertNotFalse( $cache->saveWithLease('doc:1', ['fresh' => true], 'doc:1', $generation), - 'After the grace window a token-valid save must succeed' + 'After the grace window a token-valid save must succeed', ); $this->assertSame(['fresh' => true], $cache->load('doc:1', 60, 'doc:1')); $this->assertFalse( (bool) $redis->hExists('doc:1', '__utopia_tomb__'), - 'The spent tombstone must be dropped on the next save, not linger in the hash' + 'The spent tombstone must be dropped on the next save, not linger in the hash', ); } @@ -240,7 +243,7 @@ class LeasableTest extends TestCase $generation = $cache->getGeneration('doc:1'); $this->assertFalse( $cache->saveWithLease('doc:1', ['stale' => true], 'field-a', $generation), - 'A token-valid field save inside the grace window must be refused' + 'A token-valid field save inside the grace window must be refused', ); $this->assertFalse($cache->load('doc:1', 60, 'field-a')); } @@ -274,7 +277,7 @@ class LeasableTest extends TestCase public function testTombstoneIgnoresImplausibleFutureDeadline(): void { $redis = new Redis(); - $redis->connect('redis', 6379); + $redis->connect(Services::HOST, Services::REDIS_PORT); $adapter = new RedisAdapter($redis); $adapter->setLeaseGraceWindow(500); $cache = new Cache($adapter); @@ -289,7 +292,7 @@ class LeasableTest extends TestCase $this->assertNotFalse( $cache->saveWithLease('doc:1', ['v' => 1], 'doc:1', $generation), - 'An implausibly far-future deadline (backward clock step) must be ignored, not wedge saves' + 'An implausibly far-future deadline (backward clock step) must be ignored, not wedge saves', ); $this->assertSame(['v' => 1], $cache->load('doc:1', 60, 'doc:1')); } diff --git a/tests/Cache/E2E/RedisTest.php b/tests/Cache/E2E/RedisTest.php new file mode 100644 index 0000000000..f2d4644526 --- /dev/null +++ b/tests/Cache/E2E/RedisTest.php @@ -0,0 +1,74 @@ +connect(Services::HOST, Services::REDIS_PORT); + self::$cache = new Cache(new RedisAdapter($redis)); + } + + public function testGetSize(): void + { + self::$cache->flush(); + self::$cache->save('test:file33', 'file33', 'test:file33'); + self::$cache->save('test:file34', 'file34', 'test:file34'); + self::$cache->save('test:file35', 'file35', 'test:file35'); + $this->assertSame(3, self::$cache->getSize()); + } + + #[Depends('testGetSize')] + public function testCacheReconnect(): void + { + $this->assertReconnects(persistent: false); + } + + #[Depends('testCacheReconnect')] + public function testCacheReconnectPersistent(): void + { + $this->assertReconnects(persistent: true); + } + + /** + * Restarts Redis underneath a live adapter and asserts it recovers. + */ + private function assertReconnects(bool $persistent): void + { + $key = $persistent ? 'test:reconnect_persistent' : 'test:reconnect'; + + $redis = new Redis(); + $persistent + ? $redis->pconnect(Services::HOST, Services::REDIS_PORT) + : $redis->connect(Services::HOST, Services::REDIS_PORT); + self::$cache = new Cache(new RedisAdapter($redis)->setMaxRetries(3)); + + self::$cache->save($key, 'reconnect', $key); + + Services::compose('stop', 'redis'); + sleep(1); + + try { + self::$cache->load($key, 5); + $this->fail('Redis connection should have failed'); + } catch (RedisException) { + } + + Services::compose('up', '-d', '--wait', 'redis'); + + $this->assertSame('reconnect', self::$cache->save($key, 'reconnect', $key)); + $this->assertEquals('reconnect', self::$cache->load($key, 5)); + } +} diff --git a/tests/Cache/E2E/ShardingTest.php b/tests/Cache/E2E/ShardingTest.php index 766d18dc11..a8e0a773d3 100644 --- a/tests/Cache/E2E/ShardingTest.php +++ b/tests/Cache/E2E/ShardingTest.php @@ -1,5 +1,7 @@ connect('shardA', 6379); + $shards = []; - $shardB = new Redis(); - $shardB->connect('shardB', 6379); + foreach (Services::SHARD_PORTS as $port) { + $redis = new Redis(); + $redis->connect(Services::HOST, $port); + $shards[] = new RedisAdapter($redis); + } - $shardC = new Redis(); - $shardC->connect('shardC', 6379); - - self::$cache = new Cache(new Sharding([ - new RedisAdapter($shardA), - new RedisAdapter($shardB), - new RedisAdapter($shardC), - ])); + self::$cache = new Cache(new Sharding($shards)); } public function testGetSize(): void { self::$cache->save('test:file33', 'file33', 'test:file33'); self::$cache->save('test:file34', 'file34', 'test:file33'); - $this->assertEquals(2, self::$cache->getSize()); + $this->assertSame(2, self::$cache->getSize()); } public function testEmptyAdapters(): void diff --git a/tests/Cache/Services.php b/tests/Cache/Services.php new file mode 100644 index 0000000000..7ca14c950e --- /dev/null +++ b/tests/Cache/Services.php @@ -0,0 +1,71 @@ +&1', $output, $code); + + if ($code !== 0) { + throw new RuntimeException("`{$command}` failed: " . implode("\n", $output)); + } + } +} diff --git a/tests/Cache/E2E/CircuitBreakerTest.php b/tests/Cache/Unit/CircuitBreakerTest.php similarity index 97% rename from tests/Cache/E2E/CircuitBreakerTest.php rename to tests/Cache/Unit/CircuitBreakerTest.php index 7ec6e387da..2b057e67c7 100644 --- a/tests/Cache/E2E/CircuitBreakerTest.php +++ b/tests/Cache/Unit/CircuitBreakerTest.php @@ -1,6 +1,8 @@ save('test', 'test'); + $this->assertSame(4, self::$cache->getSize()); + } + + #[Override] + public function testCaseSensitivity(): void + { + if (self::foldsFilenameCase(self::$path)) { + $this->markTestSkipped('The host filesystem folds filename case.'); + } + + parent::testCaseSensitivity(); + } + + public function testStreamingLoad(): void + { + $path = self::scratch('stream-data'); + + try { + $cache = new Cache(new Filesystem($path, true)); + $cache->save('stream-test', 'stream data'); + + $stream = $cache->load('stream-test', 60); + + $this->assertTrue(\is_resource($stream)); + $this->assertSame('stream data', stream_get_contents($stream)); + + fclose($stream); + } finally { + self::deletePath($path); + } + } + + public function testStreamingLoadMissingKey(): void + { + $path = self::scratch('stream-missing-data'); + + try { + $cache = new Cache(new Filesystem($path, true)); + + $this->assertEquals(false, $cache->load('missing-stream-test', 60)); + } finally { + self::deletePath($path); + } + } +} diff --git a/tests/Cache/Unit/LoadResultsTelemetryTest.php b/tests/Cache/Unit/LoadResultsTelemetryTest.php index 42995e088c..3dc9ace961 100644 --- a/tests/Cache/Unit/LoadResultsTelemetryTest.php +++ b/tests/Cache/Unit/LoadResultsTelemetryTest.php @@ -1,5 +1,7 @@ > $captured */ - public function __construct(public array &$captured) - { - } + public function __construct(public array &$captured) {} public function createCounter(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): \Utopia\Telemetry\Counter { @@ -46,18 +45,15 @@ class LoadResultsTelemetryTest extends TestCase } $captured = &$this->captured; - return $this->counters[$name] = new class($captured) extends \Utopia\Telemetry\Counter - { + return $this->counters[$name] = new class ($captured) extends \Utopia\Telemetry\Counter { /** * @param array> $captured */ - public function __construct(public array &$captured) - { - } + public function __construct(public array &$captured) {} public function add(float|int $amount, iterable $attributes = []): void { - $this->captured[] = \is_array($attributes) ? $attributes : \iterator_to_array($attributes); + $this->captured[] = \is_array($attributes) ? $attributes : iterator_to_array($attributes); } }; } @@ -68,7 +64,7 @@ class LoadResultsTelemetryTest extends TestCase $cache->save('here', 'value'); $cache->load('here', 60); - $results = \array_column($captured, 'result'); + $results = array_column($captured, 'result'); $this->assertSame(['miss', 'hit'], $results); } @@ -76,8 +72,7 @@ class LoadResultsTelemetryTest extends TestCase { $captured = []; - $adapter = new class extends Memory - { + $adapter = new class extends Memory { public function load(string $key, int $ttl, string $hash = ''): mixed { return null; @@ -85,14 +80,11 @@ class LoadResultsTelemetryTest extends TestCase }; $cache = new Cache($adapter); - $telemetry = new class($captured) extends TestTelemetry - { + $telemetry = new class ($captured) extends TestTelemetry { /** * @param array> $captured */ - public function __construct(public array &$captured) - { - } + public function __construct(public array &$captured) {} public function createCounter(string $name, ?string $unit = null, ?string $description = null, array $advisory = []): \Utopia\Telemetry\Counter { @@ -101,18 +93,15 @@ class LoadResultsTelemetryTest extends TestCase } $captured = &$this->captured; - return $this->counters[$name] = new class($captured) extends \Utopia\Telemetry\Counter - { + return $this->counters[$name] = new class ($captured) extends \Utopia\Telemetry\Counter { /** * @param array> $captured */ - public function __construct(public array &$captured) - { - } + public function __construct(public array &$captured) {} public function add(float|int $amount, iterable $attributes = []): void { - $this->captured[] = \is_array($attributes) ? $attributes : \iterator_to_array($attributes); + $this->captured[] = \is_array($attributes) ? $attributes : iterator_to_array($attributes); } }; } diff --git a/tests/Cache/E2E/MemoryTest.php b/tests/Cache/Unit/MemoryTest.php similarity index 72% rename from tests/Cache/E2E/MemoryTest.php rename to tests/Cache/Unit/MemoryTest.php index 1240a2e54c..43af0cbef1 100644 --- a/tests/Cache/E2E/MemoryTest.php +++ b/tests/Cache/Unit/MemoryTest.php @@ -1,11 +1,14 @@ save('test:file34', 'file34'); self::$cache->save('test:file35', 'file35'); self::$cache->save('test:file36', 'file36'); - $this->assertEquals(4, self::$cache->getSize()); + $this->assertSame(4, self::$cache->getSize()); } } diff --git a/tests/Cache/E2E/NoneTest.php b/tests/Cache/Unit/NoneTest.php similarity index 68% rename from tests/Cache/E2E/NoneTest.php rename to tests/Cache/Unit/NoneTest.php index e0029bf8ad..ac53226808 100644 --- a/tests/Cache/E2E/NoneTest.php +++ b/tests/Cache/Unit/NoneTest.php @@ -1,11 +1,15 @@ assertEquals(0, self::$cache->getSize()); + $this->assertSame(0, self::$cache->getSize()); } public function testEmptyCacheKey(): void @@ -26,6 +30,7 @@ class NoneTest extends Base $this->assertEquals(false, $data); } + #[\Override] public function testCacheSave(): void { $result = self::$cache->save($this->key, $this->data); @@ -33,9 +38,7 @@ class NoneTest extends Base $this->assertEquals(false, $result); } - /** - * @depends testCacheSave - */ + #[Depends('testCacheSave')] public function testCacheLoad(): void { $data = self::$cache->load($this->key, 60 * 60 * 24 * 30 * 3 /* 3 months */); @@ -43,9 +46,8 @@ class NoneTest extends Base $this->assertEquals(false, $data); } - /** - * @depends testCacheLoad - */ + #[Depends('testCacheLoad')] + #[\Override] public function testNotEmptyCacheKey(): void { $data = self::$cache->load($this->key, 60 * 60 * 24 * 30 * 3 /* 3 months */); @@ -53,6 +55,7 @@ class NoneTest extends Base $this->assertEquals(false, $data); } + #[\Override] public function testCachePurge(): void { $result = self::$cache->purge($this->key); @@ -60,14 +63,21 @@ class NoneTest extends Base $this->assertEquals(true, $result); } + #[\Override] public function testCacheTouch(): void { $this->assertEquals(false, self::$cache->touch($this->key)); } + #[\Override] public function testCaseInsensitivity(): void { - // None adapter does not expect case sensitivity/insensitivy - $this->assertEquals(true, true); + $this->markTestSkipped('The None adapter stores nothing, so key casing cannot matter.'); + } + + #[\Override] + public function testCaseSensitivity(): void + { + $this->markTestSkipped('The None adapter stores nothing, so key casing cannot matter.'); } } diff --git a/tests/Cache/E2E/PoolTest.php b/tests/Cache/Unit/PoolTest.php similarity index 61% rename from tests/Cache/E2E/PoolTest.php rename to tests/Cache/Unit/PoolTest.php index e9081a9819..b0db09f7b2 100644 --- a/tests/Cache/E2E/PoolTest.php +++ b/tests/Cache/Unit/PoolTest.php @@ -1,25 +1,26 @@ new Filesystem(self::$path), timeout: 0.0); self::$cache = new Cache(new Pool($pool)); } @@ -27,7 +28,17 @@ class PoolTest extends Base public function testGetSize(): void { self::$cache->save('test', 'test'); - $this->assertEquals(4, self::$cache->getSize()); + $this->assertSame(4, self::$cache->getSize()); + } + + #[Override] + public function testCaseSensitivity(): void + { + if (self::foldsFilenameCase(self::$path)) { + $this->markTestSkipped('The host filesystem folds filename case.'); + } + + parent::testCaseSensitivity(); } public function testLeaseFallbackForNonLeasableAdapter(): void diff --git a/tests/Cache/Unit/Redis/ClientTest.php b/tests/Cache/Unit/RedisClientTest.php similarity index 91% rename from tests/Cache/Unit/Redis/ClientTest.php rename to tests/Cache/Unit/RedisClientTest.php index 0f94562038..0e5f2ff629 100644 --- a/tests/Cache/Unit/Redis/ClientTest.php +++ b/tests/Cache/Unit/RedisClientTest.php @@ -1,6 +1,8 @@ assertSame( "*1\r\n\$4\r\nPING\r\n", - Client::encode(['PING']) + Client::encode(['PING']), ); $this->assertSame( "*3\r\n\$3\r\nSET\r\n\$3\r\nfoo\r\n\$3\r\nbar\r\n", - Client::encode(['SET', 'foo', 'bar']) + Client::encode(['SET', 'foo', 'bar']), ); } @@ -27,7 +29,7 @@ class ClientTest extends TestCase { $this->assertSame( "*2\r\n\$6\r\nSELECT\r\n\$1\r\n3\r\n", - Client::encode(['SELECT', 3]) + Client::encode(['SELECT', 3]), ); } @@ -37,8 +39,8 @@ class ClientTest extends TestCase $encoded = Client::encode(['SET', 'k', $payload]); $this->assertSame( - "*3\r\n\$3\r\nSET\r\n\$1\r\nk\r\n\$".strlen($payload)."\r\n".$payload."\r\n", - $encoded + "*3\r\n\$3\r\nSET\r\n\$1\r\nk\r\n\$" . \strlen($payload) . "\r\n" . $payload . "\r\n", + $encoded, ); } @@ -75,7 +77,7 @@ class ClientTest extends TestCase $payload = "line1\r\nline2"; $this->assertSame( $payload, - Client::parse('$'.strlen($payload)."\r\n".$payload."\r\n", $offset) + Client::parse('$' . \strlen($payload) . "\r\n" . $payload . "\r\n", $offset), ); } @@ -98,7 +100,7 @@ class ClientTest extends TestCase $offset = 0; $buffer = "*3\r\n\$3\r\nfoo\r\n:42\r\n+OK\r\n"; $this->assertSame(['foo', 42, 'OK'], Client::parse($buffer, $offset)); - $this->assertSame(strlen($buffer), $offset); + $this->assertSame(\strlen($buffer), $offset); } public function testParseEmptyArray(): void @@ -118,7 +120,7 @@ class ClientTest extends TestCase $offset = 0; $buffer = "*2\r\n*2\r\n:1\r\n:2\r\n*1\r\n\$1\r\nx\r\n"; $this->assertSame([[1, 2], ['x']], Client::parse($buffer, $offset)); - $this->assertSame(strlen($buffer), $offset); + $this->assertSame(\strlen($buffer), $offset); } public function testParseRedisErrorIsWrappedNotThrown(): void @@ -168,7 +170,7 @@ class ClientTest extends TestCase $this->assertSame('OK', Client::parse($buffer, $offset)); $this->assertSame(5, $offset); $this->assertSame('SECOND', Client::parse($buffer, $offset)); - $this->assertSame(strlen($buffer), $offset); + $this->assertSame(\strlen($buffer), $offset); } public function testParseUnknownTypeThrows(): void @@ -188,7 +190,7 @@ class ClientTest extends TestCase // And that encode produces what a real Redis would expect. $this->assertSame( "*4\r\n\$4\r\nHSET\r\n\$1\r\nk\r\n\$1\r\nf\r\n\$1\r\nv\r\n", - Client::encode(['HSET', 'k', 'f', 'v']) + Client::encode(['HSET', 'k', 'f', 'v']), ); } diff --git a/tests/Cache/Unit/Redis/EnvelopeTest.php b/tests/Cache/Unit/RedisEnvelopeTest.php similarity index 97% rename from tests/Cache/Unit/Redis/EnvelopeTest.php rename to tests/Cache/Unit/RedisEnvelopeTest.php index 9a6c3ffb1b..1445512d18 100644 --- a/tests/Cache/Unit/Redis/EnvelopeTest.php +++ b/tests/Cache/Unit/RedisEnvelopeTest.php @@ -1,11 +1,13 @@ assertSame('NOSCRIPT No matching script. Please use EVAL.', $signal->getMessage()); - $this->assertNull($signal->getPrevious()); + $this->assertNotInstanceOf(\Throwable::class, $signal->getPrevious()); } } diff --git a/tests/Cache/E2E/TelemetryTest.php b/tests/Cache/Unit/TelemetryTest.php similarity index 80% rename from tests/Cache/E2E/TelemetryTest.php rename to tests/Cache/Unit/TelemetryTest.php index 386738bc32..5347895b2a 100644 --- a/tests/Cache/E2E/TelemetryTest.php +++ b/tests/Cache/Unit/TelemetryTest.php @@ -1,6 +1,8 @@ setTelemetry($telemetry); $this->assertSame($telemetry, $adapter->telemetry); - $this->assertEquals(1, $adapter->calls); + $this->assertSame(1, $adapter->calls); } }